[Ffmpeg-devel] Differences between mencoder and ffmpegwhenencoding using x264

Loren Merritt lorenm
Tue Feb 21 02:57:14 CET 2006


On Mon, 20 Feb 2006, Luca Abeni wrote:
> On Sun, 2006-02-19 at 17:33 +0000, Robert Swain wrote:
>
>> Just setting the output codec to x264 and setting a bit rate or other
>> mechanism is insufficient
>
> I think this is the real problem. In my opinion (but remember: I do not
> know x264 internals at all, so I might be completely wrong) the same
> AVCodecContext settings that give decent results with MPEG4 should give
> equally decent results with H.264...
> So, I think this is the thing that should be improved.
>
>> People expect the
>> defaults to yield good quality such that they can specify a bit rate to
>> evaluate the capability of a codec and it's just not the case.
>
> Maybe I am being naive, but... Why? The same defaults that give decent
> quality with a codec should give decent quality with all the other
> codecs, no? At least, this is how it works for most of the ffmpeg codecs
> I tried.

The ffmpeg defaults aren't great for mpeg4 either (gop_size=12,
no B-frames). Additionally, some of the options that do exist already but 
weren't used in mpeg4, have defaults inappropriate for h264
(loopfilter, coder_type).

> Again, it seems that libavcodec/x264.c is doing things "his own way",
> and is not well integrated with the rest of libavcodec. AVCodecContext
> contains a lot of fields that are only used by x264, and x264.c does not
> use many fields of AVCodecContext.

Many of the fields don't have equivalents. The choice is: add a bunch of 
fields for new and/or similar options that are specific to x264, or not
support those options explicitely and allow only a few presets?

> For example, look at AVCodecContext.cqp (I already wrote an email about
> it some time ago, but as far as I can see noone replied). It took some
> time to me to understand how to encode h264 video at a constant
> quality... Why isn't x264.c using AVCodecContext.global_quality and
> CODEC_FLAG_QSCALE (with some eventual translation, if needed) like the
> other codecs?

This one you can argue. The reason is that whoever wrote that piece of 
code was used to x264, and wanted to specify quality using H.264's 
quantizer scale, rather than having to translate to the mpeg* scale. 
Of course, to someone is used to mpeg* the ease of use is reversed.

> Another thing: with MPEG* and H263 (I think) I can get a good quality
> improvement by setting "mb_decision = FF_MB_DECISION_RD". This has no
> effect on x264. Doesn't x264 implement something similar to "mb_decision
> = FF_MB_DECISION_RD"? If it does, maybe x264.c could "translate" this
> setting in the equivalent x264 one?

lavc has mbd,mbcmp,cmp,subcmp to specify the comparison functions used in 
motion estimation and mode decision. x264 has one parameter "subme" that 
combines all of those.
And the ffmpeg defaults currently enable the highest setting of subme... 
while disabling all of the MB modes it's supposed to choose between.

--Loren Merritt





More information about the ffmpeg-devel mailing list