[FFmpeg-user] Trouble encoding h.264

Langdon langdon at gmail.com
Thu Mar 22 15:41:50 CET 2012


> Your input is yuv422p, you do not specify another colourspace,
>
> libx264 was compiled with yuv422p support,
> so ffmpeg encodes to h264 4:2:2 which is not supported
> by most playback applications.
>
> Add -pix_fmt yuv420p.
>
> Carl Eugen

Impressive, that did the trick!  Thank you!

It's not a huge deal, but I switched from MP3 to AAC and again, WMP
choked on it (played just a portion of the audio, and sped up the
video 2-3x), while ffplay and YouTube were able to handle it just
fine.  I switched the container from AVI to MKV, and that played fine
in WMP-HC.  It seemed like the only sample_fmt that AAC supports is
flt...

Do most playback options not support aac/flt in the avi container as
well? Or is there something else I can tweak?

I have latest CCCP installed, if that makes a difference...

* Plays Well *

> ffmpeg -strict experimental -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 -strict experimental -acodec aac -vcodec libx264 -same_quant -sample_fmt s32 -pix_fmt yuv420p -ac 2 -ar 48000  -y c:\alka-video/output/06A.mkv

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-libope
ncore-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 @ 00000000002E0200] 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 @ 00000000002F05E0] 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 @ 0000000000302860] w:1280 h:720 pixfmt:yuv422p tb:1/1000000
sar:0/1 sws_param:
[buffersink @ 000000000030D830] auto-inserting filter 'auto-inserted
scale 0' between the filter 'src' and the filter 'out'
[scale @ 000000000030DA00] w:1280 h:720 fmt:yuv422p -> w:1280 h:720
fmt:yuv420p flags:0x4
Incompatible sample format 's32' for codec 'aac', auto-selecting format 'flt'
[libx264 @ 00000000003022F0] using cpu capabilities: MMX2 SSE2Fast
SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 00000000003022F0] profile High, level 3.1
[libx264 @ 00000000003022F0] 264 - core 120 r2146 bcd41db -
H.264/MPEG-4 AVC codec - Copyleft 2003-2011 -
http://www.videolan.org/x264.html - options: cabac=1 r
ef=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_pski
p=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 dir
ect=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 q
pstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'c:\alka-video/output/06A.mkv':
  Metadata:
    encoder         : Lavf54.2.100
    Stream #0:0: Video: h264, yuv420p, 1280x720, q=-1--1, 1k tbn, 23.98 tbc
    Stream #0:1: Audio: aac, 48000 Hz, 2 channels, flt, 128 kb/s
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo -> libx264)
  Stream #0:0 -> #0:1 (pcm_s16le -> aac)
Press [q] to stop, [?] for help
Truncating packet of size 4096 to 373777kB time=00:00:01.70
bitrate=2767.2kbits/s
Truncating packet of size 4096 to 1
frame=   91 fps= 10 q=28.0 Lsize=    1029kB time=00:00:03.71
bitrate=2271.5kbits/s
video:961kB audio:65kB global headers:0kB muxing overhead 0.244409%
[libx264 @ 00000000003022F0] frame I:2     Avg QP:22.31  size: 39945
[libx264 @ 00000000003022F0] frame P:51    Avg QP:24.38  size: 13822
[libx264 @ 00000000003022F0] frame B:38    Avg QP:27.25  size:  5233
[libx264 @ 00000000003022F0] consecutive B-frames: 22.0% 61.5% 16.5%  0.0%
[libx264 @ 00000000003022F0] mb I  I16..4: 11.0% 76.7% 12.3%
[libx264 @ 00000000003022F0] mb P  I16..4:  1.2%  7.0%  0.5%  P16..4:
45.7% 15.0%  6.8%  0.0%  0.0%    skip:23.8%
[libx264 @ 00000000003022F0] mb B  I16..4:  0.1%  1.0%  0.1%  B16..8:
43.0%  5.0%  0.9%  direct: 1.8%  skip:48.1%  L0:35.8% L1:57.4% BI:
6.8%
[libx264 @ 00000000003022F0] 8x8 transform intra:79.3% inter:84.1%
[libx264 @ 00000000003022F0] coded y,uvDC,uvAC intra: 65.5% 61.3%
10.5% inter: 17.8% 18.8% 0.1%
[libx264 @ 00000000003022F0] i16 v,h,dc,p: 20% 31%  3% 47%
[libx264 @ 00000000003022F0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 12%
10%  7% 11% 13% 10%  9%  8%
[libx264 @ 00000000003022F0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 23%
11%  5% 12% 10%  8%  6%  4%
[libx264 @ 00000000003022F0] i8c dc,h,v,p: 55% 22% 18%  5%
[libx264 @ 00000000003022F0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000000003022F0] ref P L0: 61.5% 14.4% 15.6%  8.4%
[libx264 @ 00000000003022F0] ref B L0: 87.5% 11.8%  0.8%
[libx264 @ 00000000003022F0] ref B L1: 98.0%  2.0%
[libx264 @ 00000000003022F0] kb/s:2073.35


* Only hear a portion of the audio, and video plays too fast in WMP-HC *

>ffmpeg -strict experimental -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 -strict experimental -acodec aac -vcodec libx264 -same_quant -sample_fmt s32 -pix_fmt yuv420p -ac 2 -ar 48000  -y c:\alka-video/output/06A.avi
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-libope
ncore-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 @ 00000000002E0200] 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 @ 00000000002F05E0] 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 @ 00000000003027B0] w:1280 h:720 pixfmt:yuv422p tb:1/1000000
sar:0/1 sws_param:
[buffersink @ 00000000003029B0] auto-inserting filter 'auto-inserted
scale 0' between the filter 'src' and the filter 'out'
[scale @ 000000000030D960] w:1280 h:720 fmt:yuv422p -> w:1280 h:720
fmt:yuv420p flags:0x4
Incompatible sample format 's32' for codec 'aac', auto-selecting format 'flt'
[libx264 @ 00000000003022F0] using cpu capabilities: MMX2 SSE2Fast
SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 00000000003022F0] profile High, level 3.1
Output #0, avi, to 'c:\alka-video/output/06A.avi':
  Metadata:
    ISFT            : Lavf54.2.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1280x720,
q=-1--1, 23.98 tbn, 23.98 tbc
    Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 48000 Hz, 2
channels, flt, 128 kb/s
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo -> libx264)
  Stream #0:0 -> #0:1 (pcm_s16le -> aac)
Press [q] to stop, [?] for help
Truncating packet of size 4096 to 373708kB time=00:00:01.70
bitrate=2918.1kbits/s
Truncating packet of size 4096 to 1
frame=   91 fps=  9 q=28.0 Lsize=    1043kB time=00:00:03.71
bitrate=2301.0kbits/s
video:961kB audio:65kB global headers:0kB muxing overhead 1.572291%
[libx264 @ 00000000003022F0] frame I:2     Avg QP:22.31  size: 40316
[libx264 @ 00000000003022F0] frame P:51    Avg QP:24.38  size: 13822
[libx264 @ 00000000003022F0] frame B:38    Avg QP:27.25  size:  5233
[libx264 @ 00000000003022F0] consecutive B-frames: 22.0% 61.5% 16.5%  0.0%
[libx264 @ 00000000003022F0] mb I  I16..4: 11.0% 76.7% 12.3%
[libx264 @ 00000000003022F0] mb P  I16..4:  1.2%  7.0%  0.5%  P16..4:
45.7% 15.0%  6.8%  0.0%  0.0%    skip:23.8%
[libx264 @ 00000000003022F0] mb B  I16..4:  0.1%  1.0%  0.1%  B16..8:
43.0%  5.0%  0.9%  direct: 1.8%  skip:48.1%  L0:35.8% L1:57.4% BI:
6.8%
[libx264 @ 00000000003022F0] 8x8 transform intra:79.3% inter:84.1%
[libx264 @ 00000000003022F0] coded y,uvDC,uvAC intra: 65.5% 61.3%
10.5% inter: 17.8% 18.8% 0.1%
[libx264 @ 00000000003022F0] i16 v,h,dc,p: 20% 31%  3% 47%
[libx264 @ 00000000003022F0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 12%
10%  7% 11% 13% 10%  9%  8%
[libx264 @ 00000000003022F0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 23%
11%  5% 12% 10%  8%  6%  4%
[libx264 @ 00000000003022F0] i8c dc,h,v,p: 55% 22% 18%  5%
[libx264 @ 00000000003022F0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000000003022F0] ref P L0: 61.5% 14.4% 15.6%  8.4%
[libx264 @ 00000000003022F0] ref B L0: 87.5% 11.8%  0.8%
[libx264 @ 00000000003022F0] ref B L1: 98.0%  2.0%
[libx264 @ 00000000003022F0] kb/s:2074.91


More information about the ffmpeg-user mailing list