[FFmpeg-user] Image sequence to h264 anything but grayscale is black

Dave P lists.davep at gmail.com
Wed Oct 31 02:57:32 CET 2012


On Oct 30, 2012 9:42 PM, "Damon Edwards" <dzedward at gmail.com> wrote:
>
> When compiling an image sequence of pngs to h264, if the image has any
> color the resulting video is all black frames. If the images don't have
> color (grayscale) the video plays perfect. Am I missing some dependency or
> something? Any help is greatly appreciated!
>
> Below are the two outputs of ffmpeg. It's the same mp3, and the same image
> sequence for both of these except one batch is color and one is grayscale.
>
> ffmpeg -i audio.mp3 -f image2 -r 24 -i %6d.png -vcodec libx264 -acodec
> libfaac -ab "96k" -ac 2 -b:v "780K" -y output.mp4
>
> Color Images Output (results in black image for the duration of the video,
> audio plays)
> _____________________________________________________________
>
> ffmpeg version N-46203-g1730dcf Copyright (c) 2000-2012 the FFmpeg
> developers
>   built on Oct 30 2012 23:48:35 with gcc 4.4.6 (GCC) 20120305 (Red Hat
> 4.4.6-4)
>   configuration: --enable-gpl --enable-libmp3lame --enable-libtheora
> --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264
> --enable-version3 --enable-libfaac --enable-nonfree --enable-libfreetype
> --enable-libass
>   libavutil      52.  1.100 / 52.  1.100
>   libavcodec     54. 70.100 / 54. 70.100
>   libavformat    54. 35.100 / 54. 35.100
>   libavdevice    54.  3.100 / 54.  3.100
>   libavfilter     3. 20.113 /  3. 20.113
>   libswscale      2.  1.101 /  2.  1.101
>   libswresample   0. 16.100 /  0. 16.100
>   libpostproc    52.  1.100 / 52.  1.100
> [mp3 @ 0x2e0f240] Estimating duration from bitrate, this may be inaccurate
> Input #0, mp3, from 'audio.mp3':
>   Metadata:
>     major_brand     : qt
>     minor_version   : 0
>     compatible_brands: qt
>     date-eng        : 2012-10-30T17:57:02-0700
>     date            : 2012-10-30T17:57:02-0700
>     encoder-eng     : 6.0
>     encoder         : Lavf54.35.100
>   Duration: 00:00:00.75, start: 0.000000, bitrate: 128 kb/s
>     Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
> Input #1, image2, from '%6d.png':
>   Duration: 00:00:05.28, start: 0.000000, bitrate: N/A
>     Stream #1:0: Video: png, rgb24, 480x360, 24 fps, 24.02 tbr, 24.02 tbn,
> 24.02 tbc
> [libx264 @ 0x2e26720] using cpu capabilities: MMX2 SSE2Fast SSSE3
> FastShuffle SSE4.2
> [libx264 @ 0x2e26720] profile High 4:4:4 Predictive, level 2.1, 4:4:4
8-bit
> [libx264 @ 0x2e26720] 264 - core 128 r2216 198a7ea - H.264/MPEG-4 AVC
codec
> - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options:
cabac=0
> ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0
> me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11
> fast_pskip=0 chroma_qp_offset=0 threads=3 lookahead_threads=1
> sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
> constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=24
scenecut=0
> intra_refresh=0 rc=cqp mbtree=0 qp=0
> Output #0, mp4, to 'output.mp4':
>   Metadata:
>     major_brand     : qt
>     minor_version   : 0
>     compatible_brands: qt
>     date-eng        : 2012-10-30T17:57:02-0700
>     date            : 2012-10-30T17:57:02-0700
>     encoder-eng     : 6.0
>     encoder         : Lavf54.35.100
>     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv444p, 480x360,
> q=-1--1, 19216 tbn, 24.02 tbc
>     Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo,
> s16, 96 kb/s
> Stream mapping:
>   Stream #1:0 -> #0:0 (png -> libx264)
>   Stream #0:0 -> #0:1 (mp3 -> libfaac)
> Press [q] to stop, [?] for help
>

[Snip]

>
> Grayscale Images Output (works, both video and audio)
> _____________________________________________________________
>
> ffmpeg version N-46203-g1730dcf Copyright (c) 2000-2012 the FFmpeg
> developers
>   built on Oct 30 2012 23:48:35 with gcc 4.4.6 (GCC) 20120305 (Red Hat
> 4.4.6-4)
>   configuration: --enable-gpl --enable-libmp3lame --enable-libtheora
> --enable-libvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264
> --enable-version3 --enable-libfaac --enable-nonfree --enable-libfreetype
> --enable-libass
>   libavutil      52.  1.100 / 52.  1.100
>   libavcodec     54. 70.100 / 54. 70.100
>   libavformat    54. 35.100 / 54. 35.100
>   libavdevice    54.  3.100 / 54.  3.100
>   libavfilter     3. 20.113 /  3. 20.113
>   libswscale      2.  1.101 /  2.  1.101
>   libswresample   0. 16.100 /  0. 16.100
>   libpostproc    52.  1.100 / 52.  1.100
> [mp3 @ 0x2263240] max_analyze_duration 5000000 reached at 5015510
> Input #0, mp3, from 'audio.mp3':
>   Metadata:
>     major_brand     : qt
>     minor_version   : 0
>     compatible_brands: qt
>     date-eng        : 2012-10-30T17:57:02-0700
>     date            : 2012-10-30T17:57:02-0700
>     encoder-eng     : 6.0
>     encoder         : Lavf54.35.100
>   Duration: 00:00:05.32, start: 0.000000, bitrate: 128 kb/s
>     Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
> Input #1, image2, from '%6d.png':
>   Duration: 00:00:05.28, start: 0.000000, bitrate: N/A
>     Stream #1:0: Video: png, gray, 480x360, 24 fps, 24.02 tbr, 24.02 tbn,
> 24.02 tbc
> [libx264 @ 0x227b7e0] using cpu capabilities: MMX2 SSE2Fast SSSE3
> FastShuffle SSE4.2
> [libx264 @ 0x227b7e0] profile High, level 2.1
> [libx264 @ 0x227b7e0] 264 - core 128 r2216 198a7ea - H.264/MPEG-4 AVC
codec
> - Copyleft 2003-2012 - 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 lookahead_threads=1
> 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=24 scenecut=40
> intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=829 ratetol=1.0
> qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> Output #0, mp4, to 'output.mp4':
>   Metadata:
>     major_brand     : qt
>     minor_version   : 0
>     compatible_brands: qt
>     date-eng        : 2012-10-30T17:57:02-0700
>     date            : 2012-10-30T17:57:02-0700
>     encoder-eng     : 6.0
>     encoder         : Lavf54.35.100
>     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 480x360,

The color batch of images is 4:4:4 while the grayscale batch is 4:2:0.  I
don't think x264 can handle 4:4:4.  See option -pix_fmt.


More information about the ffmpeg-user mailing list