#601: ffmpeg / libx264 produces invalid MP4 file -------------------------------------+------------------------------------- Reporter: shifter1 | Owner: Type: defect | Status: new Priority: normal | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Description changed by cehoyos:
Old description: > FFmpeg or libx264 or some combination of the two produces an invalid mp4 > that will crash ffprobe / probably others (VLC crashes on the file as > well). > > The source is a number of PNG images and the output is a 2 pass encoded > libx264 coded video. > > Here is the command line I used: > carl@af:~/fractal$ ffmpeg -r 30 -i fracs/fractal%05d.png -vcodec libx264 > -b:v 4096k -t 60 -threads 0 -pass 1 preview.mp4 > ffmpeg version N-33758-gc4e02d3, Copyright (c) 2000-2011 the FFmpeg > developers > built on Oct 18 2011 03:55:48 with gcc 4.4.3 > configuration: --enable-librtmp --enable-gpl --enable-shared --enable- > nonfree --enable-pthreads --enable-libx264 --enable-libmp3lame --enable- > libvorbis -- > enable-libfaac --enable-libtheora --enable-libvpx > libavutil 51. 21. 0 / 51. 21. 0 > libavcodec 53. 21. 0 / 53. 21. 0 > libavformat 53. 16. 1 / 53. 16. 1 > libavdevice 53. 4. 0 / 53. 4. 0 > libavfilter 2. 43. 7 / 2. 43. 7 > libswscale 2. 1. 0 / 2. 1. 0 > libpostproc 51. 2. 0 / 51. 2. 0 > Input #0, image2, from 'fracs/fractal%05d.png': > Duration: 00:05:19.00, start: 0.000000, bitrate: N/A > Stream #0:0: Video: png, rgb24, 1440x900, 30 fps, 30 tbr, 30 tbn, 30 > tbc > File 'preview.mp4' already exists. Overwrite ? [y/N] y > w:1440 h:900 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: > [libx264 @ 0x9121a80] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 > [libx264 @ 0x9121a80] profile High 4:4:4 Predictive, level 4.0, 4:4:4 > 8-bit > [libx264 @ 0x9121a80] 264 - core 118 r2085 8a62835 - H.264/MPEG-4 AVC > codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: > cabac=1 ref= > 1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 > mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 > deadzone=21,11 fast_pskip=1 > chroma_qp_offset=0 threads=3 sliced_threads=0 nr=0 decimate=1 > interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 > b_adapt=1 b_bias=0 dir > ect=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 > intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=4096 ratetol=1.0 > qcomp=0.6 > 0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 > Output #0, mp4, to 'preview.mp4': > Metadata: > encoder : Lavf53.16.1 > Stream #0:0: Video: h264 (![0][0][0] / 0x0021), rgb24, 1440x900, q=-1 > --1, pass 1, 4096 kb/s, 30 tbn, 30 tbc > Stream mapping: > Stream #0.0 -> #0.0 (png -> libx264) > Press [q] to stop, [?] for help > frame= 1800 fps= 15 q=-1.0 Lsize= 35021kB time=00:00:59.93 > bitrate=4786.9kbits/s > video:34994kB audio:0kB global headers:0kB muxing overhead 0.076605% > > ====================================================== > For the second pass: > > carl@af:~/fractal$ ffmpeg -r 30 -i fracs/fractal%05d.png -i Midnight.mp3 > -vcodec libx264 -b:v 4096k -acodec libfaac -ab 160k -t 60 -threads 0 > -pass 2 preview.mp4 > ffmpeg version N-33758-gc4e02d3, Copyright (c) 2000-2011 the FFmpeg > developers > built on Oct 18 2011 03:55:48 with gcc 4.4.3 > configuration: --enable-librtmp --enable-gpl --enable-shared --enable- > nonfree --enable-pthreads --enable-libx264 --enable-libmp3lame --enable- > libvorbis --enable-libfaac --enable-libtheora --enable-libvpx > libavutil 51. 21. 0 / 51. 21. 0 > libavcodec 53. 21. 0 / 53. 21. 0 > libavformat 53. 16. 1 / 53. 16. 1 > libavdevice 53. 4. 0 / 53. 4. 0 > libavfilter 2. 43. 7 / 2. 43. 7 > libswscale 2. 1. 0 / 2. 1. 0 > libpostproc 51. 2. 0 / 51. 2. 0 > Input #0, image2, from 'fracs/fractal%05d.png': > Duration: 00:05:19.00, start: 0.000000, bitrate: N/A > Stream #0:0: Video: png, rgb24, 1440x900, 30 fps, 30 tbr, 30 tbn, 30 > tbc > [mp3 @ 0x9dd0780] max_analyze_duration 5000000 reached at 5015510 > [mp3 @ 0x9dd0780] Estimating duration from bitrate, this may be > inaccurate > Input #1, mp3, from 'Midnight.mp3': > Metadata: > title : {Midnight} (ID: 60919) > album : Newgrounds Audio Portal > track : 01/01 > artist : cornandbeans > Duration: 00:05:18.88, start: 0.000000, bitrate: 95 kb/s > Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16, 96 kb/s > File 'preview.mp4' already exists. Overwrite ? [y/N] y > w:1440 h:900 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: > [libx264 @ 0x9de7060] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 > [libx264 @ 0x9de7060] profile High 4:4:4 Predictive, level 4.0, 4:4:4 > 8-bit > [libx264 @ 0x9de7060] 264 - core 118 r2085 8a62835 - H.264/MPEG-4 AVC > codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: > cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 > psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 > cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 > sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 > constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 > weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 > intra_refresh=0 rc_lookahead=40 rc=2pass mbtree=1 bitrate=4096 > ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 > ip_ratio=1.40 aq=1:1.00 > Output #0, mp4, to 'preview.mp4': > Metadata: > encoder : Lavf53.16.1 > Stream #0:0: Video: h264 (![0][0][0] / 0x0021), rgb24, 1440x900, q=-1 > --1, pass 2, 4096 kb/s, 30 tbn, 30 tbc > Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 44100 Hz, stereo, s16, > 160 kb/s > Stream mapping: > Stream #0.0 -> #0.0 (png -> libx264) > Stream #1.0 -> #0.1 (mp3 -> libfaac) > Press [q] to stop, [?] for help > frame= 1800 fps= 9 q=-1.0 Lsize= 30945kB time=00:00:59.93 > bitrate=4229.7kbits/s > video:29784kB audio:1114kB global headers:0kB muxing overhead 0.153548% > > > =================================================== > Finally, trying to probe: > > carl@af:~/fractal$ ffprobe preview.mp4 > ffprobe version N-33758-gc4e02d3, Copyright (c) 2007-2011 the FFmpeg > developers > built on Oct 18 2011 03:55:48 with gcc 4.4.3 > configuration: --enable-librtmp --enable-gpl --enable-shared --enable- > nonfree --enable-pthreads --enable-libx264 --enable-libmp3lame --enable- > libvorbis --enable-libfaac --enable-libtheora --enable-libvpx > libavutil 51. 21. 0 / 51. 21. 0 > libavcodec 53. 21. 0 / 53. 21. 0 > libavformat 53. 16. 1 / 53. 16. 1 > libavdevice 53. 4. 0 / 53. 4. 0 > libavfilter 2. 43. 7 / 2. 43. 7 > libswscale 2. 1. 0 / 2. 1. 0 > libpostproc 51. 2. 0 / 51. 2. 0 > *** glibc detected *** ffprobe: free(): invalid pointer: 0xb605f020 *** > ======= Backtrace: ========= > /lib/tls/i686/cmov/libc.so.6(+0x6b591)[0xb6855591] > /lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0xb6856de8] > /lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0xb6859ecd] > /usr/local/lib/libavutil.so.51(av_freep+0x12)[0xb6992ef2] > ======= Memory map: ======== > 08048000-08051000 r-xp 00000000 08:02 2496305 /usr/local/bin/ffprobe > 08051000-08052000 r--p 00009000 08:02 2496305 /usr/local/bin/ffprobe > 08052000-08053000 rw-p 0000a000 08:02 2496305 /usr/local/bin/ffprobe > 08976000-08a62000 rw-p 00000000 00:00 0 [heap] > > ... > > There is lots more, and I can include the video source and output files. > They are fairly large though. New description: FFmpeg or libx264 or some combination of the two produces an invalid mp4 that will crash ffprobe / probably others (VLC crashes on the file as well). The source is a number of PNG images and the output is a 2 pass encoded libx264 coded video. Here is the command line I used: {{{ carl@af:~/fractal$ ffmpeg -r 30 -i fracs/fractal%05d.png -vcodec libx264 -b:v 4096k -t 60 -threads 0 -pass 1 preview.mp4 ffmpeg version N-33758-gc4e02d3, Copyright (c) 2000-2011 the FFmpeg developers built on Oct 18 2011 03:55:48 with gcc 4.4.3 configuration: --enable-librtmp --enable-gpl --enable-shared --enable- nonfree --enable-pthreads --enable-libx264 --enable-libmp3lame --enable- libvorbis -- enable-libfaac --enable-libtheora --enable-libvpx libavutil 51. 21. 0 / 51. 21. 0 libavcodec 53. 21. 0 / 53. 21. 0 libavformat 53. 16. 1 / 53. 16. 1 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 43. 7 / 2. 43. 7 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, image2, from 'fracs/fractal%05d.png': Duration: 00:05:19.00, start: 0.000000, bitrate: N/A Stream #0:0: Video: png, rgb24, 1440x900, 30 fps, 30 tbr, 30 tbn, 30 tbc File 'preview.mp4' already exists. Overwrite ? [y/N] y w:1440 h:900 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: [libx264 @ 0x9121a80] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 [libx264 @ 0x9121a80] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit [libx264 @ 0x9121a80] 264 - core 118 r2085 8a62835 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref= 1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 dir ect=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=4096 ratetol=1.0 qcomp=0.6 0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'preview.mp4': Metadata: encoder : Lavf53.16.1 Stream #0:0: Video: h264 (![0][0][0] / 0x0021), rgb24, 1440x900, q=-1 --1, pass 1, 4096 kb/s, 30 tbn, 30 tbc Stream mapping: Stream #0.0 -> #0.0 (png -> libx264) Press [q] to stop, [?] for help frame= 1800 fps= 15 q=-1.0 Lsize= 35021kB time=00:00:59.93 bitrate=4786.9kbits/s video:34994kB audio:0kB global headers:0kB muxing overhead 0.076605% }}} ====================================================== For the second pass: {{{ carl@af:~/fractal$ ffmpeg -r 30 -i fracs/fractal%05d.png -i Midnight.mp3 -vcodec libx264 -b:v 4096k -acodec libfaac -ab 160k -t 60 -threads 0 -pass 2 preview.mp4 ffmpeg version N-33758-gc4e02d3, Copyright (c) 2000-2011 the FFmpeg developers built on Oct 18 2011 03:55:48 with gcc 4.4.3 configuration: --enable-librtmp --enable-gpl --enable-shared --enable- nonfree --enable-pthreads --enable-libx264 --enable-libmp3lame --enable- libvorbis --enable-libfaac --enable-libtheora --enable-libvpx libavutil 51. 21. 0 / 51. 21. 0 libavcodec 53. 21. 0 / 53. 21. 0 libavformat 53. 16. 1 / 53. 16. 1 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 43. 7 / 2. 43. 7 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 Input #0, image2, from 'fracs/fractal%05d.png': Duration: 00:05:19.00, start: 0.000000, bitrate: N/A Stream #0:0: Video: png, rgb24, 1440x900, 30 fps, 30 tbr, 30 tbn, 30 tbc [mp3 @ 0x9dd0780] max_analyze_duration 5000000 reached at 5015510 [mp3 @ 0x9dd0780] Estimating duration from bitrate, this may be inaccurate Input #1, mp3, from 'Midnight.mp3': Metadata: title : {Midnight} (ID: 60919) album : Newgrounds Audio Portal track : 01/01 artist : cornandbeans Duration: 00:05:18.88, start: 0.000000, bitrate: 95 kb/s Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16, 96 kb/s File 'preview.mp4' already exists. Overwrite ? [y/N] y w:1440 h:900 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: [libx264 @ 0x9de7060] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 [libx264 @ 0x9de7060] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit [libx264 @ 0x9de7060] 264 - core 118 r2085 8a62835 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=2pass mbtree=1 bitrate=4096 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'preview.mp4': Metadata: encoder : Lavf53.16.1 Stream #0:0: Video: h264 (![0][0][0] / 0x0021), rgb24, 1440x900, q=-1 --1, pass 2, 4096 kb/s, 30 tbn, 30 tbc Stream #0:1: Audio: aac (@[0][0][0] / 0x0040), 44100 Hz, stereo, s16, 160 kb/s Stream mapping: Stream #0.0 -> #0.0 (png -> libx264) Stream #1.0 -> #0.1 (mp3 -> libfaac) Press [q] to stop, [?] for help frame= 1800 fps= 9 q=-1.0 Lsize= 30945kB time=00:00:59.93 bitrate=4229.7kbits/s video:29784kB audio:1114kB global headers:0kB muxing overhead 0.153548% }}} =================================================== Finally, trying to probe: {{{ carl@af:~/fractal$ ffprobe preview.mp4 ffprobe version N-33758-gc4e02d3, Copyright (c) 2007-2011 the FFmpeg developers built on Oct 18 2011 03:55:48 with gcc 4.4.3 configuration: --enable-librtmp --enable-gpl --enable-shared --enable- nonfree --enable-pthreads --enable-libx264 --enable-libmp3lame --enable- libvorbis --enable-libfaac --enable-libtheora --enable-libvpx libavutil 51. 21. 0 / 51. 21. 0 libavcodec 53. 21. 0 / 53. 21. 0 libavformat 53. 16. 1 / 53. 16. 1 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 43. 7 / 2. 43. 7 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 *** glibc detected *** ffprobe: free(): invalid pointer: 0xb605f020 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6(+0x6b591)[0xb6855591] /lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0xb6856de8] /lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0xb6859ecd] /usr/local/lib/libavutil.so.51(av_freep+0x12)[0xb6992ef2] ======= Memory map: ======== 08048000-08051000 r-xp 00000000 08:02 2496305 /usr/local/bin/ffprobe 08051000-08052000 r--p 00009000 08:02 2496305 /usr/local/bin/ffprobe 08052000-08053000 rw-p 0000a000 08:02 2496305 /usr/local/bin/ffprobe 08976000-08a62000 rw-p 00000000 00:00 0 [heap] ... }}} There is lots more, and I can include the video source and output files. They are fairly large though. -- -- Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/601#comment:2> FFmpeg <http://ffmpeg.org> FFmpeg issue tracker _______________________________________________ FFmpeg-trac mailing list FFmpeg-trac@avcodec.org http://avcodec.org/mailman/listinfo/ffmpeg-trac