Opened 13 years ago
Closed 13 years ago
#601 closed defect (invalid)
ffmpeg / libx264 produces invalid MP4 file
Reported by: | carl | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
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.
Change History (7)
follow-up: 4 comment:1 by , 13 years ago
Keywords: | ffmpeg libx264 removed |
---|
comment:2 by , 13 years ago
Description: | modified (diff) |
---|
comment:3 by , 13 years ago
And please upload preview.mp4 to http://www.datafilehost.com/ and post the download link here.
follow-up: 5 comment:4 by , 13 years ago
Replying to cehoyos:
Does the crash also happen if you add -vn or -an to the second encode?
Is two-pass really necessary or can you produce a file that crashes with one pass only?
Does only ffprobe crash or also ffmpeg -i preview.mp4 (or ffmpeg -i preview.mp4 -f null -)?
Yes, it does crash with that command. I have uploaded a single pass version which crashes here: http://www.datafilehost.com/download-d595b7f9.html
follow-up: 6 comment:5 by , 13 years ago
Replying to shifter1:
I have uploaded a single pass version which crashes here: http://www.datafilehost.com/download-d595b7f9.html
Works fine for me (ffplay and mplayer play preview.mp4 as expected), please update to latest git head.
(Note that you are encoding to H264 RGB which is unusual and it is likely that most applications except MPlayer and FFmpeg do not support it. You may of course argue that -pix_fmt yuv420p should be made standard in this case.)
$ md5sum preview.mp4 0ef0a6aee29e893d0928c7ffb3ea3e11 preview.mp4 $ ffmpeg -i preview.mp4 -f null - ffmpeg version N-34304-gc0dbab9, Copyright (c) 2000-2011 the FFmpeg developers built on Oct 31 2011 10:34:46 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc libavutil 51. 22. 0 / 51. 22. 0 libavcodec 53. 26. 0 / 53. 26. 0 libavformat 53. 18. 0 / 53. 18. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 45. 2 / 2. 45. 2 libswscale 2. 1. 0 / 2. 1. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'preview.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.16.1 Duration: 00:00:10.00, start: 0.000000, bitrate: 706 kb/s Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbr24p, 1440x900, 702 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : [buffer @ 0x138b5e0] w:1440 h:900 pixfmt:gbr24p tb:1/1000000 sar:0/1 sws_param: Output #0, null, to 'pipe:': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.18.0 Stream #0:0(und): Video: rawvideo, gbr24p, 1440x900, q=2-31, 200 kb/s, 90k tbn, 30 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : Stream mapping: Stream #0.0 -> #0.0 (h264 -> rawvideo) Press [q] to stop, [?] for help frame= 300 fps=125 q=0.0 Lsize= -0kB time=00:00:10.00 bitrate= -0.0kbits/s video:0kB audio:0kB global headers:0kB muxing overhead -inf%
follow-up: 7 comment:6 by , 13 years ago
Replying to cehoyos:
Replying to shifter1:
I have uploaded a single pass version which crashes here: http://www.datafilehost.com/download-d595b7f9.html
Works fine for me (ffplay and mplayer play preview.mp4 as expected), please update to latest git head.
(Note that you are encoding to H264 RGB which is unusual and it is likely that most applications except MPlayer and FFmpeg do not support it. You may of course argue that -pix_fmt yuv420p should be made standard in this case.)
$ md5sum preview.mp4 0ef0a6aee29e893d0928c7ffb3ea3e11 preview.mp4 $ ffmpeg -i preview.mp4 -f null - ffmpeg version N-34304-gc0dbab9, Copyright (c) 2000-2011 the FFmpeg developers built on Oct 31 2011 10:34:46 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc libavutil 51. 22. 0 / 51. 22. 0 libavcodec 53. 26. 0 / 53. 26. 0 libavformat 53. 18. 0 / 53. 18. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 45. 2 / 2. 45. 2 libswscale 2. 1. 0 / 2. 1. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'preview.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.16.1 Duration: 00:00:10.00, start: 0.000000, bitrate: 706 kb/s Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbr24p, 1440x900, 702 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : [buffer @ 0x138b5e0] w:1440 h:900 pixfmt:gbr24p tb:1/1000000 sar:0/1 sws_param: Output #0, null, to 'pipe:': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.18.0 Stream #0:0(und): Video: rawvideo, gbr24p, 1440x900, q=2-31, 200 kb/s, 90k tbn, 30 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : Stream mapping: Stream #0.0 -> #0.0 (h264 -> rawvideo) Press [q] to stop, [?] for help frame= 300 fps=125 q=0.0 Lsize= -0kB time=00:00:10.00 bitrate= -0.0kbits/s video:0kB audio:0kB global headers:0kB muxing overhead -inf%
Just pulled and recompiled. The error goes away in ff*, but persists in VLC. Oh well, I guess you can't have everything. Thanks for the help.
comment:7 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Replying to shifter1:
Replying to cehoyos:
Replying to shifter1:
Works fine for me (ffplay and mplayer play preview.mp4 as expected), please update to latest git head.
(Note that you are encoding to H264 RGB which is unusual and it is likely that most applications except MPlayer and FFmpeg do not support it. You may of course argue that -pix_fmt yuv420p should be made standard in this case.)
Just pulled and recompiled. The error goes away in ff*, but persists in VLC. Oh well, I guess you can't have everything.
I suspect you want to add -pix_fmt yuv420p to your command line to get a file every application can play.
Does the crash also happen if you add -vn or -an to the second encode?
Is two-pass really necessary or can you produce a file that crashes with one pass only?
Does only ffprobe crash or also ffmpeg -i preview.mp4 (or ffmpeg -i preview.mp4 -f null -)?