lieff / minimp4

Minimalistic MP4 mux/demux single header library
Creative Commons Zero v1.0 Universal
342 stars 58 forks source link

all modes failed on certain bitstream #16

Closed rhwu closed 4 years ago

rhwu commented 4 years ago

Attached test2.264 (640x480) failed on all the 3 modes. But I'm able to do muxing with this bitstream using ffmpeg: $ ffmpeg -framerate 30 -i test2.264 -c copy test2.mp4

test2.264.zip

lieff commented 4 years ago

This stream is progressive high profile, needs to be supported in mp4_h26x_write_nal helper. Will do this at some point. Fragmentation mode + slices also currently not supported.

minimp4 still can be used in such cases, just other demuxer should be used instead of mp4_h26x_write_nal which correctly aggregates one h264 frame into sample and pass it directly to MP4E_put_sample.

lieff commented 4 years ago

Turns out it's trivial to fix. Problem was not in progressive encoding as I think at first, but in access unit delimiter NALu`s which was not handled. This https://github.com/lieff/minimp4/commit/8bbd1ca2bb24fdb8214ab585b2a83f6cda3cc6a0 fixes default and sequential modes, for fragmentation mode there same issue as https://github.com/lieff/minimp4/issues/15 .