I am using AVAssetExportSession for encoding video. For some source files(not all files), there is out of sync between video and audio after exporting by AVAssetExportSession without editing.
This issue causes when I put AVMutableComposition to asset parameter in initialization of AVAssetExportSession.(There is no out of sync when I put source asset directly to asset parameter.) I just created new AVMutableComposition. And I inserted video track and audio track of source asset to AVMutableComposition. But, the result of export session has out of sync. The audio of exported video is faster by about 0.05 seconds than the original one.
Through some searches I doubt this problem is related to Encoder delay(Encoder delay). Because 0.05 seconds with 44100Hz is about 2112 samples. But I am not sure. Can it resolve with AVAssetExportSession? Or Should I use AVAssetReader/AVAssetWriter or others which is more controllable than AVAssetExportSession? Are there any solutions?
This issue causes when I put AVMutableComposition to asset parameter in initialization of AVAssetExportSession.(There is no out of sync when I put source asset directly to asset parameter.) I just created new AVMutableComposition. And I inserted video track and audio track of source asset to AVMutableComposition. But, the result of export session has out of sync. The audio of exported video is faster by about 0.05 seconds than the original one.
Through some searches I doubt this problem is related to Encoder delay(Encoder delay). Because 0.05 seconds with 44100Hz is about 2112 samples. But I am not sure. Can it resolve with AVAssetExportSession? Or Should I use AVAssetReader/AVAssetWriter or others which is more controllable than AVAssetExportSession? Are there any solutions?