Commit b5492b37 authored by Philippe Gorley's avatar Philippe Gorley

encoder: clamp vp8 crf to specified values

Fixes recording.

Change-Id: I56042a37d86dcdc2a514a9319a71e12f4ee148ed
parent 26b35255
...@@ -785,6 +785,7 @@ MediaEncoder::initVP8(AVCodecContext* encoderCtx, uint64_t br) ...@@ -785,6 +785,7 @@ MediaEncoder::initVP8(AVCodecContext* encoderCtx, uint64_t br)
encoderCtx->slices = 2; // VP8E_SET_TOKEN_PARTITIONS encoderCtx->slices = 2; // VP8E_SET_TOKEN_PARTITIONS
encoderCtx->qmin = 4; encoderCtx->qmin = 4;
encoderCtx->qmax = 56; encoderCtx->qmax = 56;
crf = std::min(encoderCtx->qmax, std::max((int)crf, encoderCtx->qmin));
libav_utils::setDictValue(&options_, "crf", std::to_string(crf)); libav_utils::setDictValue(&options_, "crf", std::to_string(crf));
av_opt_set_int(encoderCtx, "crf", crf, AV_OPT_SEARCH_CHILDREN); av_opt_set_int(encoderCtx, "crf", crf, AV_OPT_SEARCH_CHILDREN);
encoderCtx->rc_buffer_size = bufSize; encoderCtx->rc_buffer_size = bufSize;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment