m_avCodecContext->gop_size = fps * 2;
- // TODO: Make bitrate depend on the framerate? More frames is more data.
- // maxFramerate can apparently be changed while recording, so keep that in mind.
- m_avCodecContext->bit_rate = std::round(area * 2);
- m_avCodecContext->rc_min_rate = std::round(area);
- m_avCodecContext->rc_max_rate = std::round(area * 3);
-
- m_avCodecContext->rc_buffer_size = m_avCodecContext->bit_rate;
-
- m_avCodecContext->thread_count = QThread::idealThreadCount();
-
if (int result = avcodec_open2(m_avCodecContext, codec, &options); result < 0) {
qCWarning(PIPEWIRERECORD_LOGGING) << "Could not open codec" << av_err2str(result);
return false;
if (m_quality) {
crf = percentageToAbsoluteQuality(m_quality);
}
- m_avCodecContext->qmin = std::clamp(crf / 2, 0, crf);
- m_avCodecContext->qmax = std::clamp(qRound(crf * 1.5), crf, 63);
+
+ av_dict_set_int(&options, "qmin", std::clamp(crf / 2, 0, crf), 0);
+ av_dict_set_int(&options, "qmax", std::clamp(int(crf * 1.5), crf, 63), 0);
av_dict_set_int(&options, "crf", crf, 0);
// 0-4 are for Video-On-Demand with the good or best deadline.
av_dict_set(&options, "tile-columns", "6", 0);
av_dict_set(&options, "tile-rows", "2", 0);
- // This should make things faster, but it only seems to consume 100MB more RAM.
- // av_dict_set(&options, "row-mt", "1", 0);
+ av_dict_set(&options, "row-mt", "1", 0);
av_dict_set(&options, "frame-parallel", "1", 0);
return options;