Quicktime:设置“elng”原子,或 AVAssetTrack 的 ExtendedLanguageTag 属性
我有一些视频,我需要为每个曲目设置扩展语言标签。我还没有找到任何可以执行此操作的应用程序,因此我尝试用代码来执行此操作。
elng
标签的文档为 此处。
我尝试读取该标签的位置是在 iOS 上,其中 extendedLanguageTag
是 AVAssetTrack 的只读属性。本质上,我想在 QuickTime 文件中的轨道上设置一些可以使用该属性检索的内容。
我不在乎使用哪个 QuickTime API — 在本次尝试中,我使用 QTKit 打开视频,然后使用旧的 C QuickTime API 尝试设置标签。但是,它不起作用。 (没有返回错误代码,只是没有设置标签。)
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]];
我之前实际上从未使用过 QuickTime C API,所以我可能完全误解了某些内容。有人可以帮忙吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论