leandromoreira / ffmpeg-libav-tutorial

FFmpeg libav tutorial - learn how media works from basic to transmuxing, transcoding and more. Translations: πŸ‡ΊπŸ‡Έ πŸ‡¨πŸ‡³ πŸ‡°πŸ‡· πŸ‡ͺπŸ‡Έ πŸ‡»πŸ‡³ πŸ‡§πŸ‡·
https://github.com/leandromoreira/ffmpeg-libav-tutorial
BSD 3-Clause "New" or "Revised" License
9.78k stars 937 forks source link

Transcoding: fmp4 delay_moov #94

Closed alexLopatin closed 3 years ago

alexLopatin commented 3 years ago

Hi Leandro! Thanks for this awesome tutorial, it really saved me a lot of time understanding ffmpeg. But there is a problem with the transcoding example. When transcoding to fragmented mp4, the encoder context doesn't supply full info to output stream, resulting in next error:

ffmpeg : [extract_extradata @ 00000243f19d6e00] No start code is found. broken_test.mp4: could not find codec parameters [h264 @ 00000243f19d67c0] No start code is found. [h264 @ 00000243f19d67c0] Error splitting the input into NAL units. [h264 @ 00000243f19ede80] No start code is found. [h264 @ 00000243f19ede80] Error splitting the input into NAL units. [h264 @ 00000243f1a742c0] sps_id 15 out of range [h264 @ 00000243f1a742c0] no frame! [h264 @ 00000243f19f28c0] No start code is found. [h264 @ 00000243f19f28c0] Error splitting the input into NAL units. [h264 @ 00000243f19f3180] no frame! [h264 @ 00000243f1a7d2c0] no frame! [h264 @ 00000243f19f3b00] slice type 15 too large at 1 [h264 @ 00000243f19f3b00] decode_slice_header error [h264 @ 00000243f19f3b00] no frame! [h264 @ 00000243f19f44c0] No start code is found. [h264 @ 00000243f19f44c0] Error splitting the input into NAL units.

So, with setting movflags=delay_moov everything works fine. I think it's because I'm using a newer version of x264. Anyway, should this flag set on in transcoding example?

leandromoreira commented 3 years ago

hi there @alexLopatin I'm glad this is useful for you.

I didn't find this option on the documentation but saw this on the movencoder and it's even the default usage for the hls encoder. Good catch :)

Do you want to make a PR for this?