Are frames returned in presentation or decode order with AVAssetReader

I read somewhere that the frames are returned in decode order instead of presentation order when using AVAssetReader. The documentation seems sparse on the subject. I have so far failed to find a video file where the frames are not returned in presentation order.

Can anyone confirm the frames are actually returned in decode order?

Answered by Engineer in 893058022

AVAssetReaderOutput returns frames in decode order when decoding is not requested (when output settings is nil) and in presentation order when decoding is performed.

When working with encoded sample data directly, it is important to maintain the decode order.  After decoding, decode order has no particular significance and presentation order is appropriate.

From my testing, when using nil in the output settings, we can indeed get frames that are out-of-order from a presentation PoV. (For the same video with non-nil output settings, I did not get out-of-order frames.)

Using nil output settings, we also do not get any image data (at least with the movie I tested), so it’s not very useful anyways…

I’d very much like to get more info if possible. Might even open a DTS if I do not get feedback after a while…

AVAssetReaderOutput returns frames in decode order when decoding is not requested (when output settings is nil) and in presentation order when decoding is performed.

When working with encoded sample data directly, it is important to maintain the decode order.  After decoding, decode order has no particular significance and presentation order is appropriate.

Are frames returned in presentation or decode order with AVAssetReader
 
 
Q