Opened 3 years ago
Last modified 3 years ago
#9110 open defect
Remux TS to MP4 creates an invalid file, delay_moov flag not working as requested
Reported by: | Hunny Puppy | Owned by: | |
---|---|---|---|
Priority: | important | Component: | undetermined |
Version: | git-master | Keywords: | mov regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
Summary of the bug: When trying to remuxed a TS file to MP4 ffmpeg throws an error Cannot write moov atom before AC3 packets. Set the delay_moov flag to fix this.
and the resulting file is invalid.
Despite setting the delay_moov flags it still throws the same error and the resulting file is still missing the audio track or invalid
How to reproduce:
ffmpeg -y -i "Broken_MOOV.ts" -vcodec copy -acodec copy test.mp4 ffmpeg version 4.3.2-2021-02-02-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (Rev6, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mpegts, from 'Broken_MOOV.ts': Duration: 00:00:05.00, start: 1.400000, bitrate: 10066 kb/s Program 1 Metadata: service_name : CNN HD service_provider: CNNHD Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 448 kb/s Stream #0:1[0x101]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Side data: cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 9781248 vbv_delay: N/A [mp4 @ 0000022b73c6e800] track 1: codec frame size is not set Output #0, mp4, to 'test.mp4': Metadata: encoder : Lavf58.45.100 Stream #0:0: Video: mpeg2video (Main) (mp4v / 0x7634706D), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc Side data: cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 9781248 vbv_delay: N/A Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s Stream mapping: Stream #0:1 -> #0:0 (copy) Stream #0:0 -> #0:1 (copy) Press [q] to stop, [?] for help [mp4 @ 0000022b73c6e800] Cannot write moov atom before AC3 packets. Set the delay_moov flag to fix this. Error writing trailer of test.mp4: Invalid argument frame= 96 fps=0.0 q=-1.0 Lsize= 5979kB time=00:00:04.93 bitrate=9928.7kbits/s speed= 215x video:5707kB audio:270kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.033545%
With delay_moov flag:
ffmpeg -y -i "Broken_MOOV.ts" -vcodec copy -acodec copy -movflags +delay_moov test.mp4 ffmpeg version 4.3.2-2021-02-02-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (Rev6, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mpegts, from 'Broken_MOOV.ts': Duration: 00:00:05.00, start: 1.400000, bitrate: 10066 kb/s Program 1 Metadata: service_name : CNN HD service_provider: CNNHD Stream #0:0[0x100](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 448 kb/s Stream #0:1[0x101]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Side data: cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 9781248 vbv_delay: N/A [mp4 @ 0000020752f8ea80] track 1: codec frame size is not set Output #0, mp4, to 'test.mp4': Metadata: encoder : Lavf58.45.100 Stream #0:0: Video: mpeg2video (Main) (mp4v / 0x7634706D), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc Side data: cpb: bitrate max/min/avg: 15000000/0/0 buffer size: 9781248 vbv_delay: N/A Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s Stream mapping: Stream #0:1 -> #0:0 (copy) Stream #0:0 -> #0:1 (copy) Press [q] to stop, [?] for help [mp4 @ 0000020752f8ea80] Cannot write moov atom before AC3 packets. Set the delay_moov flag to fix this. Last message repeated 5 times [mp4 @ 0000020752f8ea80] Cannot write moov atom before AC3 packets. Set the delay_moov flag to fix this. Last message repeated 1 times frame= 96 fps=0.0 q=-1.0 Lsize= 5kB time=00:00:04.93 bitrate= 7.8kbits/s speed= 125x video:5707kB audio:270kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Attachments (1)
Change History (10)
by , 3 years ago
Attachment: | Broken_MOOV.ts added |
---|
follow-up: 6 comment:1 by , 3 years ago
Analyzed by developer: | set |
---|---|
Reproduced by developer: | set |
comment:2 by , 3 years ago
Keywords: | mov regression added |
---|---|
Priority: | normal → important |
Status: | new → open |
Regression since 2b8458fcc5d503d0587f14d1fe9107878691cbae
comment:5 by , 3 years ago
Checking in, any word on this? Is there some sort of a workaround possible?
comment:6 by , 3 years ago
Replying to mkver:
A quick fix would be to reject such invalid packets immediately, but unfortunately one can't really return the error to the caller as the caller will likely stop writing due to that (at least the ffmpeg cli does so).
Wouldn't it better to fail the conversion than complete it with invalid data?
comment:9 by , 3 years ago
"some reason the first audio packet the ts demuxer exports is only two bytes long (0x612A)"
Then it is not an audio packet.
For some reason the first audio packet the ts demuxer exports is only two bytes long (0x612A). The mp4 muxer puts this packet in its vos_data and errors out later because said data is invalid. But because of this data no attempt to get the data from a real packet is made.
A quick fix would be to reject such invalid packets immediately, but unfortunately one can't really return the error to the caller as the caller will likely stop writing due to that (at least the ffmpeg cli does so).