MP4 with edit list and multiple stsds not decoding correctly
|Reported by:||Jiejun||Owned by:|
|Version:||git-master||Keywords:||mov h264 edts|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
When a MP4 has both edit list and multiple stsds, it does not decode correctly with ffmpeg. An example is https://www.dropbox.com/s/qz0ort4znqq9jdy/attachment_video.mov?dl=0. Such videos can be easily generated by iOS, when using AVMutableComposition and AVAssetExportSession to replace a part of a video with another totally different video.
To reproduce, run:
ffmpeg -i attachment_video.mov frames/frame%03d.jpg
Take a look at frame327.jpg, frame328.jpg, frame329.jpg frame330.jpg. They are pure-green, which is wrong. They should be exactly the same as frame331.jpg.
FFmpeg also prints error messages:
[h264 @ 0x7fbfc9040a00] reference count overflow [h264 @ 0x7fbfc9040a00] decode_slice_header error [h264 @ 0x7fbfc9040a00] no frame! Past duration 0.999992 too large Last message repeated 7 times Error while decoding stream #0:0: Invalid data found when processing input Past duration 0.999992 too large [h264 @ 0x7fbfc9004800] reference count overflow [h264 @ 0x7fbfc9004800] decode_slice_header error [h264 @ 0x7fbfc9004800] no frame! [h264 @ 0x7fbfc9001000] reference count overflow [h264 @ 0x7fbfc9001000] decode_slice_header error [h264 @ 0x7fbfc9001000] no frame! ...
The root cause is that FFmpeg used a wrong stsd to decode several frames.