I have some videos for which I need to set an extended language tag for each of the tracks. I haven't found any app that does this, so I'm trying to do it in code.
The documentation for the elng
tag is here.
The place I'm trying to read that tag is on iOS, where extendedLanguageTag
is a read-only property of AVAssetTrack. Essentially I want to set something on the track in my QuickTime file that can be retrieved using that property.
I don't care which QuickTime API I use — in this attempt, I'm using QTKit to open the video and then using the old C QuickTime API to try and set the tag. However, it isn't working. (No error codes are being returned, the tag just isn't being set.)
NSError *error = nil;
QTMovie *mov = [QTMovie movieWithFile:filename error:&error];
NSArray *tracks = mov.tracks;
int i=0;
for (QTTrack *track in tracks)
{
OSErr err;
Track qtrack = track.quickTimeTrack;
Media media = GetTrackMedia(qtrack);
QTAtomContainer props;
err = GetMediaPropertyAtom(media, &props);
if (props == NULL)
{
err = QTNewAtomContainer(&props);
}
char nt[5]= "en-gb" ;
QTAtom newAtom;
err = QTInsertChild(props, kParentAtomIsContainer, 'elng', 1, 0, 5, &nt, &newAtom);
if (newAtom == NULL)
{
NSLog(@"Insert child failed");
}
SetMediaPropertyAtom(media, props);
}
[mov writeToFile:@"/Users/amy/Downloads/testfilmAgain43.mov" withAttributes:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:QTMovieFlatten]];
I haven't actually ever used the QuickTime C API before, so I may be completely misunderstanding something. Can anyone help?