iphone - 设置 AVMutableComposition 的 frameDuration

标签 iphone ios avfoundation avassetexportsession avmutablecomposition

我正在玩来自 Apple 的 WWDC 2010 示例包的 AVEditDemo 项目,我正在尝试更改导出视频的帧速率。视频使用 AVMutableComposition 导出,frameDuration 设置如下:

videoComposition.frameDuration = CMTimeMake(1, 30); // 30 fps

出于某种原因,将 30 更改为 25 不会更改使用 AVAssetExportSession 导出的视频的 framerate。有谁知道为什么?

最佳答案

回复MonsieurDart的回答: 我没有尝试 AVEditDemo 但我在 iOS 8 上没有遇到这个问题,在 iOS 7 上也没有。

我正在使用 AVMutableVideoComposition 并将其设置为 AVAssetExportSession 的 videoComposition。

.
.
AVMutableVideoCompositionInstruction * instruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
AVMutableVideoCompositionLayerInstruction *layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:videoTrack];
AVMutableVideoComposition *compositionInstruction = [AVMutableVideoComposition videoComposition];
compositionInstruction.instructions = @[instruction];
compositionInstruction.frameDuration = CMTimeMake(1, 30);
.
.    
AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:composition AVAssetExportPresetHighestQuality];
exporter.videoComposition = compositionInstruction;

其中 videoTrack 是从 Assets 创建的 AVMutableCompositionTrack

关于iphone - 设置 AVMutableComposition 的 frameDuration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9725193/

相关文章:

iphone - 如何在iphone中缓存图像

ios - AVPlayerViewController 点击 "done"关闭到错误的 View Controller

iphone - 如何获取html文件的一部分?

iphone - iOS中如何修改录好的语音播放和发声 "funny"?

iphone - 在 Facebook 墙上添加照片

iphone - 检查 NSFetchedResultsController/Core Data 中的现有值

ios - 如何避免小时数被标记为日历链接?

objective-c - 创建数据库文件(如果不存在)

ios - CMSampleBufferRef 池写入 H.264 AVCC 流

ios - 无延迟播放音效