[Libav-user] How to pass quality scale to mjpeg encoder
Tobias Rapp
t.rapp at noa-archive.com
Thu Jan 25 10:25:49 EET 2018
Hi,
trying to do the equivalent of FFmpeg command-line output option "-q:v
3" on library level I came up with the following code (error checking
stripped off):
AVCodecContext *enc_ctx = NULL;
const AVCodec *codec = avcodec_find_encoder_by_name("mjpeg");
int ret;
enc_ctx = avcodec_alloc_context3(codec);
enc_ctx->flags |= AV_CODEC_FLAG_QSCALE;
enc_ctx->global_quality = FF_QP2LAMBDA * 3.0;
ret = avcodec_open2(enc_ctx, enc_ctx->codec, NULL);
Unfortunately it doesn't seem to have any effect on the output image
size. Is there something obvious that I'm missing?
Regards,
Tobias
More information about the Libav-user
mailing list