[Libav-user] How to convert "-q:v 1" to API form

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Jan 28 23:20:30 CET 2016

Arthur Muller <muller at ...> writes:

> Using the API version of ffmpeg I’ve managed to generate 
> the mp4 file by first converting the png files to yuv 
> format. That was not a problem. But I haven’t figured out 
> what I have to do in my code to mimic the behavior of 
> “-q:v 1” to get the better quality?

(Old MEncoder documentation suggested not to use a value 
smaller than "2".)

You have to set AVCodecContext->global_quality but you 
have to multiply the qscale:
global_quality = qscale * FF_QP2LAMBDA

Carl Eugen

More information about the Libav-user mailing list