AVMutableComposition plays empty with AVPlayer, but exports with AVAssetExportSession

I am creating AVMutableCompositioncontaining videos imported from the library. I pass AVMutableVideoCompositioncontaining an array AVMutableVideoCompositionInstructionto convert (scale, rotate) and fade (opacity) between the video tracks.

Most videos have no problems. I can play the song using AVPlayeror export it using AVAssetExportSessionwithout any problems. But for some videos, when the composition is transferred to AVPlayer, I get a black screen, for example, when the time settings are AVMutableVideoCompositionInstructionnot set correctly. However, when I export the same composition containing the same instruction and time (actually the same composition) to AVAssetExportSession, the movie is perfectly exported. If I only play the imported video as a simple AVAsset using AVPlayer, the video playback will be great.

I tried to raise the timeline of my movie to 60,000 instead of 600 jumps, as it was the duration of the imported video, which was a problem (floating point is lost), but it is not.

This happens under iOS8, but can also happen under iOS7. I dont know.

PS: I did not send the code because there are too many lines.

+4
source share

All Articles