[Libav-user] Fwd: How to set video quality when opening encoder

YIRAN LI mrfun.china at gmail.com
Wed May 15 06:53:00 CEST 2013


I've solved this problem by setting codecCtx->flags |= CODEC_FLAG_QSCALE;
and set codecCtx->global_quality = 1180 to get the best quality!

because in libtheoraenc.c line 215: t_info.quality =
av_clip(avc_context->global_quality /(float)FF_QP2LAMBDA, 0, 10) * 6.3
and #define FF_QP2LAMBDA 118

so av_clip( 1180/118, 0, 10 ) * 6.3 = 63 get the best quality.

Please correct me if I'm wrong, thanks!

---------- Forwarded message ----------
From: YIRAN LI <mrfun.china at gmail.com>
Date: 2013/5/15
Subject: How to set video quality when opening encoder
To: "This list is about using libavcodec, libavformat, libavutil,
libavdevice and libavfilter." <libav-user at ffmpeg.org>

Hi friends,

I'm trying to encode using libtheora, I'm able to using command line
argument -q:v 0-10 to set video quality. But I had problem when setting it
in my program.

My code looks like below:

AVDictionary* options = NULL;
av_dict_set(&options, "qscale", "0", 0); // also tried "q:v"

but seems encoder can't understand the keys.

Could anyone let me know how to set the video qscale in this case?

Great thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130515/ec22ea19/attachment.html>

More information about the Libav-user mailing list