[Libav-user] how to set mjpeg encoding quality programmatically?
YIRAN LI
mrfun.china at gmail.com
Fri Jun 10 09:05:43 CEST 2016
2016-06-10 13:32 GMT+10:00 YIRAN LI <mrfun.china at gmail.com>:
>
>
> 2016-06-09 23:29 GMT+10:00 Carl Eugen Hoyos <cehoyos at ag.or.at>:
>
>> YIRAN LI <mrfun.china at ...> writes:
>>
>> > AVCodecContext.flags |= CODEC_FLAG_QSCALE
>> > and AVCodecContext.global_quality = qscale * FF_QP2LAMBDA,
>> > in my case qscale = 3
>>
>> This is correct, qscale 3 ensures (with mpeg-4 asp) a
>> near-lossless visual quality.
>>
>>
> Thansk Carl, I think I can use the same way to set quality for mpeg4
> video, right?
>
> What't the differenct between it and seting qmin qmax in codeccctx?
>
> Thanks
>
>
>
Hi Carl, I asked this because I found whatever qsacale value I set, the
size and quality of output mpeg4 videos are same.
I did a bit debug, and found the cause (I'm using an old version of ffmpeg)
In the encode2 function, it uses
MpegEncContext *s = avctx->priv_data;
s->qscale as the qsacle value.
So setting it into pVideoCodecCtx->global_quality doesn't pass the value
into priv_data
I tried av_opt_set_int(pVideoCodecCtx->priv_data, "qscale", 3, 0); but
failed.
Here is the mpeg4 encoder, there's a qscale member in MpegEncContext.
Could you give me a hint how to set it?
Thanks
Carl Eugen
> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160610/9b25cf28/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.PNG
Type: image/png
Size: 34829 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160610/9b25cf28/attachment.png>
More information about the Libav-user
mailing list