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

Luca Abeni lucabe72
Mon Feb 20 09:53:47 CET 2006

Hi Robert,

On Sun, 2006-02-19 at 17:33 +0000, Robert Swain wrote:
> > I suspect libavcodex/x264.c defaults set some strange value in the x264,
> > but I've not been able to track it down (I do not know anything about
> > x264 and its parameters).
> Yet again someone has noted that the x264 defaults in FFmpeg are lacking. This 
> is giving a bad impression of x264. :/
Do not worry... At least to me, it is pretty clear that the problem is
not in the x264 library, but is in the glue code contained in
libavcodec/x264.c. I apologize if I gave the impression that I was
complaining about x264.

But maybe the real problem (for me, at least) is that I am expecting
something wrong from libavcodec/x264.c.
In my opinion, such code should aim to "integrate" x264 with ffmpeg in a
"nice" way (meaning that it should try to "translate" the libavcodec
parameters I am used to into x264 parameters).

> My recommendation for anyone using x264 in FFmpeg would be to check the x264 
> command line defaults and explicitly specify all parameters to FFmpeg using 
> the defaults from the x264 CLI and whatever alterations one may want to make.
I tried to do that, but I got lost :(
I think the problem could be related to the rate control settings, but I
am not sure.

> 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.

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.
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?

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?

	Thanks (and sorry if what I wrote does not make sense),
Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 Cerchi l?amore? Allora iscriviti gratis a Meetic: troverai migliaia di single in linea e potrai chattare con loro.
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4049&d=20-2

More information about the ffmpeg-devel mailing list