I'm using AVAssetExportSession in combination with AVAssetExportPresetPassthrough to stitch multiple videos together. Everything works quite fine, except after my first sub-clip should have finished, it's picture "freezes" on the last frame but the second is not going to play. I made sure to set the layer opacity to 0.0f once each clip has finished, if I use another Preset-Type everything works... Any hints?
问题:
回答1:
I got in touch with Apple, they told me this is a bug, please find the the bugreport here : https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/3/wo/zpx0I9jVzf8090ZICwg1GM/5.83.28.0.9
回答2:
While you can use AVAssetExportPresetPassthrough
to concatenate videos, the resulting video is not the most compatible as each segment ends up in its own track. It should play back in on iOS/OSX but it's unlikely to play nicely with YouTube or Facebook.
So there's something wrong with your implementation, but you should probably consider using a different preset (that will flatten your videos into one track) or use an AVAssetWriter
.
回答3:
I guess it is because you are using a AVMutableComposition
to insert 2 of your video clips by insertTimeRange:ofAsset:atTime:error:
. This will result 2 video track on the composition, and when there're 2 video track and no composition layer instruction, only the first video track will be displayed.
Try to alloc a video track yourself and insert the assets' video track to these video track using insertTimeRange:ofTrack:atTime:kCMTimeZero error:&error
will probably fix these issue.