[Libav-user] how to set mjpeg encoding quality programmatically?

Don Moir donmoir at comcast.net
Thu Jun 9 11:16:05 CEST 2016

 >​Hi, searching the mail list and seems I found the answer.

 >Just need to set

 >AVCodecContext.flags |= CODEC_FLAG_QSCALE
 >and AVCodecContext.global_quality  = qscale * FF_QP2LAMBDA, in my case 
qscale = 3

 >Please correct me if anything wrong, thanks

I had a question regarding setting the bit_rate to adjust quality. This 
works but fuzzy on how best to set the bit_rate.

I tried what you did and that works but it produces an excessively large 
file with a large bit_rate using QSCALE. I mean way to large bit_rate. 
So there is more to the story. I am testing with 1920x1080 live 
recording. Using the bit_rate only I am able to control quality and file 
size better than I can currently using QSCALE but again sort of fuzzy 
logic on how best to set the bit_rate.

I am still experimenting with it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160609/fa06b83d/attachment.html>

More information about the Libav-user mailing list