Setting AVMutableComposition's frameDuration

前端 未结 3 1316
灰色年华
灰色年华 2020-12-30 15:19

I\'m playing with the AVEditDemo project, from Apple\'s WWDC 2010 sample pack, and I\'m trying to change the frame rate of the exported video. The

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 15:43

    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

提交回复
热议问题