[FFmpeg-user] Trouble encoding h.264

Langdon langdon at gmail.com
Thu Mar 22 13:02:59 CET 2012


I have some raw video (-f yuv4mpegpipe) and audio (-f u16le -acodec
pcm_s16le) that I extracted from another file.

When I try to re-encode the two parts as h.264, the sound plays OK, but the
video is mostly gray in Media Player Classic Home Cinema, as well as when
uploaded to YouTube.  ffplay.exe seems to play it OK, but I'm creating the
video for mass consumption.

Am I doing something wrong?  I had to tell ffmpeg about every attribute of
the audio before it would work right, but I'm not sure what to tell it
about the video.

ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 48000 -i
c:/alka-video/workspace/06A.cat.a -i c:/alka-video/workspace/06A.cat.v
-vcodec libx264 -same_quant -y c:\alka-video/output/06A.avi > _h264.txt

 ffmpeg version N-38622-g1eabd71 Copyright (c) 2000-2012 the FFmpeg
developers
  built on Mar  7 2012 00:21:47 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype
--enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp
--enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid
--enable-zlib
  libavutil      51. 42.100 / 51. 42.100
  libavcodec     54. 10.100 / 54. 10.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[u16le @ 000000000031F3C0] Estimating duration from bitrate, this may be
inaccurate
Input #0, u16le, from 'c:/alka-video/workspace/06A.cat.a':
  Duration: 00:00:03.79, start: 0.000000, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[yuv4mpegpipe @ 0000000001E4F8C0] Estimating duration from bitrate, this
may be inaccurate
Input #1, yuv4mpegpipe, from 'c:/alka-video/workspace/06A.cat.v':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: rawvideo (Y42B / 0x42323459), yuv422p, 1280x720,
23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
[buffer @ 0000000001E617D0] w:1280 h:720 pixfmt:yuv422p tb:1/1000000
sar:0/1 sws_param:
[libx264 @ 0000000001E61350] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.1 Cache64
[libx264 @ 0000000001E61350] profile High 4:2:2, level 3.1, 4:2:2 8-bit
Output #0, avi, to 'c:\alka-video/output/06A.avi':
  Metadata:
    ISFT            : Lavf54.2.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv422p, 1280x720,
q=-1--1, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, 2 channels, s16
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo -> libx264)
  Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
Truncating packet of size 4096 to 3737
Truncating packet of size 4096 to 1
frame=   91 fps=  7 q=28.0 Lsize=    1187kB time=00:00:03.71
bitrate=2619.9kbits/s
video:1099kB audio:72kB global headers:0kB muxing overhead 1.332733%
[libx264 @ 0000000001E61350] frame I:2     Avg QP:22.39  size: 44095
[libx264 @ 0000000001E61350] frame P:51    Avg QP:24.42  size: 16121
[libx264 @ 0000000001E61350] frame B:38    Avg QP:27.17  size:  5667
[libx264 @ 0000000001E61350] consecutive B-frames: 22.0% 61.5% 16.5%  0.0%
[libx264 @ 0000000001E61350] mb I  I16..4: 11.8% 76.5% 11.7%
[libx264 @ 0000000001E61350] mb P  I16..4:  1.4%  7.2%  0.5%  P16..4: 50.1%
16.1%  7.5%  0.0%  0.0%    skip:17.1%
[libx264 @ 0000000001E61350] mb B  I16..4:  0.1%  1.1%  0.1%  B16..8: 41.9%
 4.9%  0.9%  direct: 2.3%  skip:48.8%  L0:36.4% L1:56.4% BI: 7.2%
[libx264 @ 0000000001E61350] 8x8 transform intra:78.7% inter:84.4%
[libx264 @ 0000000001E61350] coded y,uvDC,uvAC intra: 64.4% 79.3% 10.1%
inter: 18.2% 37.1% 0.1%
[libx264 @ 0000000001E61350] i16 v,h,dc,p: 21% 28%  4% 47%
[libx264 @ 0000000001E61350] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 13% 10%  6%
11% 13% 10% 10%  8%
[libx264 @ 0000000001E61350] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 23% 10%  5%
11% 10%  8%  5%  4%
[libx264 @ 0000000001E61350] i8c dc,h,v,p: 52% 17% 23%  9%
[libx264 @ 0000000001E61350] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000001E61350] ref P L0: 59.5% 13.0% 17.9%  9.6%
[libx264 @ 0000000001E61350] ref B L0: 87.1% 12.1%  0.7%
[libx264 @ 0000000001E61350] ref B L1: 98.0%  2.0%
[libx264 @ 0000000001E61350] kb/s:2372.67

Output is attached as well if that makes it easier to read. TIA!
-------------- next part --------------
C:\alka-video>ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 48000 -i c:/alka-video/workspace/06A.cat.a -i c:/alka-video/workspace/06A.cat.v -vcodec libx264 -same_quant -y c:\alka-video/output/06A.avi > _h264.txt
ffmpeg version N-38622-g1eabd71 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  7 2012 00:21:47 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 42.100 / 51. 42.100
  libavcodec     54. 10.100 / 54. 10.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[u16le @ 000000000031F3C0] Estimating duration from bitrate, this may be inaccurate
Input #0, u16le, from 'c:/alka-video/workspace/06A.cat.a':
  Duration: 00:00:03.79, start: 0.000000, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[yuv4mpegpipe @ 0000000001E4F8C0] Estimating duration from bitrate, this may be inaccurate
Input #1, yuv4mpegpipe, from 'c:/alka-video/workspace/06A.cat.v':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: rawvideo (Y42B / 0x42323459), yuv422p, 1280x720, 23.98 fps, 23.98 tbr, 23.98 tbn, 23.98 tbc
[buffer @ 0000000001E617D0] w:1280 h:720 pixfmt:yuv422p tb:1/1000000 sar:0/1 sws_param:
[libx264 @ 0000000001E61350] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0000000001E61350] profile High 4:2:2, level 3.1, 4:2:2 8-bit
Output #0, avi, to 'c:\alka-video/output/06A.avi':
  Metadata:
    ISFT            : Lavf54.2.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv422p, 1280x720, q=-1--1, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, 2 channels, s16
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo -> libx264)
  Stream #0:0 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
Truncating packet of size 4096 to 3737
Truncating packet of size 4096 to 1
frame=   91 fps=  7 q=28.0 Lsize=    1187kB time=00:00:03.71 bitrate=2619.9kbits/s
video:1099kB audio:72kB global headers:0kB muxing overhead 1.332733%
[libx264 @ 0000000001E61350] frame I:2     Avg QP:22.39  size: 44095
[libx264 @ 0000000001E61350] frame P:51    Avg QP:24.42  size: 16121
[libx264 @ 0000000001E61350] frame B:38    Avg QP:27.17  size:  5667
[libx264 @ 0000000001E61350] consecutive B-frames: 22.0% 61.5% 16.5%  0.0%
[libx264 @ 0000000001E61350] mb I  I16..4: 11.8% 76.5% 11.7%
[libx264 @ 0000000001E61350] mb P  I16..4:  1.4%  7.2%  0.5%  P16..4: 50.1% 16.1%  7.5%  0.0%  0.0%    skip:17.1%
[libx264 @ 0000000001E61350] mb B  I16..4:  0.1%  1.1%  0.1%  B16..8: 41.9%  4.9%  0.9%  direct: 2.3%  skip:48.8%  L0:36.4% L1:56.4% BI: 7.2%
[libx264 @ 0000000001E61350] 8x8 transform intra:78.7% inter:84.4%
[libx264 @ 0000000001E61350] coded y,uvDC,uvAC intra: 64.4% 79.3% 10.1% inter: 18.2% 37.1% 0.1%
[libx264 @ 0000000001E61350] i16 v,h,dc,p: 21% 28%  4% 47%
[libx264 @ 0000000001E61350] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 13% 10%  6% 11% 13% 10% 10%  8%
[libx264 @ 0000000001E61350] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 23% 10%  5% 11% 10%  8%  5%  4%
[libx264 @ 0000000001E61350] i8c dc,h,v,p: 52% 17% 23%  9%
[libx264 @ 0000000001E61350] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000001E61350] ref P L0: 59.5% 13.0% 17.9%  9.6%
[libx264 @ 0000000001E61350] ref B L0: 87.1% 12.1%  0.7%
[libx264 @ 0000000001E61350] ref B L1: 98.0%  2.0%
[libx264 @ 0000000001E61350] kb/s:2372.67


More information about the ffmpeg-user mailing list