Setting AVMutableComposition's frameDuration

我与影子孤独终老i 提交于 2019-11-30 09:54:45
MonsieurDart

It seems that the AVAssetExportSession preset takes precedence over the AVVideoComposition frameDuration. I've opened a bug report:

http://openradar.appspot.com/11127156

replying MonsieurDart's answer: I didn't try the AVEditDemo but I'm not having this issue on iOS 8, nor did I have it on iOS 7.

I'm using a AVMutableVideoComposition and setting it as the AVAssetExportSession's 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;

where the videoTrack is a AVMutableCompositionTrack created from the asset

yong wei

The client can set sourceTrackIDForFrameTiming to kCMPersistentTrackID_Invalid and frameDuration to an appropriate value in order to specify the maximum output frame rate independent of the source track timing.

videoComposition.sourceTrackIDForFrameTiming = kCMPersistentTrackID_Invalid;
videoComposition.frameDuration = CMTimeMake(1, 30);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!