[MEncoder-users] Strange things when encoding with libx264: B frames, threads

Etienne Buira etienne.buira.lists at free.fr
Sun Oct 11 19:22:26 CEST 2009


On Sun, Oct 11, 2009 at 05:25:12PM +0200, Grozdan wrote:
> 2009/10/11 Etienne Buira <etienne.buira.lists at free.fr>:
> > On Sun, Oct 11, 2009 at 04:34:42PM +0200, Grozdan wrote:
> >> 2009/10/11 Etienne Buira <etienne.buira.lists at free.fr>:
> >> > Hello.
> >> >
> >> > I have troubles when encoding with libx264.
> >> >
> >> > I use mencoder SVN-r29766, and libx264 git
> >> > 39f6499e3abcf473bdcbade38aba9a7490470e6a (both updated at the same
> >> > time).
> >> >
> >> > When using a command line not specifying "bframes=0" in -x264encopts, B
> >> > frames are generated, despite the man page says that default bframes
> >> > value is 0.
> >> > However, if I specify "bframes=0", no bframes are generated. What's
> >> > wrong? My cmdline? man page? bug?
> >> >
> >> > Also, without specifying "threads=1" (like manpage says it is the
> >> > default), mencoder process uses more than 300% CPU (quad core). I have
> >> > the same questions about this issue.
> >> >
> >> > My typical command line is 'mencoder -o dest.avi -hr-edl-seek -edl
> >> > edl-file -oac faac -faacopts br=128 -ovc x264 -x264encopts
> >> > frameref=7:direct_pred=auto:partitions=all:8x8dct:me=umh:subq=7:mixed_refs:trellis=2:crf=21
> >> > source.ts'
> >>
> >> Man page is highly outdated. Bframes are on by default if you don't
> >> specify anything. Threads is set to auto which will use all available
> >> cores
> >
> > OK, so is there an accurate documentation somewhere? Or should we fall
> > back to the source (yeah, most accurate doc ever, but needs to be used
> > to mplayer source architecture, what I always failed to do).
> 
> MEncoder just picks up the defaults of libx264 if nothing is specified
> so you'll have to look at x264 default settings. You can find more
> info on the defaults here
> http://mewiki.project357.com/wiki/X264_Settings

Interesting, thank you.

I took the time to read x264:common/common.c, and update the mplayer man
page accordingly. Please find the patch attached.
-------------- next part --------------
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1	(revision 29770)
+++ DOCS/man/en/mplayer.1	(working copy)
@@ -10017,7 +10017,7 @@
 .
 .TP
 .B frameref=<1\-16>
-Number of previous frames used as predictors in B- and P-frames (default: 1).
+Number of previous frames used as predictors in B- and P-frames (default: 3).
 This is effective in anime, but in live-action material the improvements
 usually drop off very rapidly above 6 or so reference frames.
 This has no effect on decoding speed, but does increase the memory needed for
@@ -10026,7 +10026,7 @@
 .
 .TP
 .B bframes=<0\-16>
-maximum number of consecutive B-frames between I- and P-frames (default: 0)
+maximum number of consecutive B-frames between I- and P-frames (default: 3)
 .
 .TP
 .B (no)b_adapt
@@ -10195,7 +10195,7 @@
 .
 .TP
 .B (no)weight_b
-Use weighted prediction in B-frames.
+Use weighted prediction in B-frames (default: on).
 Without this option, bidirectionally predicted macroblocks give
 equal weight to each reference frame.
 With this option, the weights are determined by the temporal position
@@ -10238,7 +10238,7 @@
 .TP
 .B (no)8x8dct
 Adaptive spatial transform size: allows macroblocks to choose between
-4x4 and 8x8 DCT.
+4x4 and 8x8 DCT (default: on).
 Also allows the i8x8 macroblock type.
 Without this option, only 4x4 DCT is used.
 .
@@ -10297,9 +10297,9 @@
 searches.
 .IPs 6
 Enables rate-distortion optimization of macroblock types in
-I- and P-frames (default).
+I- and P-frames.
 .IPs 7
-Enables rate-distortion optimization of macroblock types in all frames.
+Enables rate-distortion optimization of macroblock types in all frames (default).
 .IPs 8
 Enables rate-distortion optimization of motion vectors and intra prediction modes in I- and P-frames.
 .IPs 9
@@ -10322,6 +10322,7 @@
 Allows each 8x8 or 16x8 motion partition to independently select a
 reference frame.
 Without this option, a whole macroblock must use the same reference.
+(default: enabled).
 Requires frameref>1.
 .
 .TP
@@ -10330,9 +10331,9 @@
 .PD 0
 .RSs
 .IPs 0
-disabled (default)
+disabled
 .IPs 1
-enabled only for the final encode
+enabled only for the final encode (default)
 .IPs 2
 enabled during all mode decisions (slow, requires subq>=6)
 .RE
@@ -10406,9 +10407,9 @@
 .IPs 0
 disabled
 .IPs 1
-Avoid moving bits between frames.
+Avoid moving bits between frames (default).
 .IPs 2
-Move bits between frames (by default).
+Move bits between frames.
 .RE
 .PD 1
 .
@@ -10475,14 +10476,14 @@
 .TP
 .B level_idc=<10\-51>
 Set the bitstream's level as defined by annex A of the H.264 standard
-(default: 51 \- level 5.1).
+(default: auto-guessed).
 This is used for telling the decoder what capabilities it needs to support.
 Use this parameter only if you know what it means,
 and you have a need to set it.
 .
 .TP
 .B threads=<0\-16>
-Spawn threads to encode in parallel on multiple CPUs (default: 1).
+Spawn threads to encode in parallel on multiple CPUs (default: 0).
 This has a slight penalty to compression quality.
 0 or 'auto' tells x264 to detect how many CPUs you have and pick an
 appropriate number of threads.


More information about the MEncoder-users mailing list