From ddeac3201c3870e1a577a63ef4ab7625e833ed4c Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Sun, 5 Dec 2021 19:54:13 +0900 Subject: [PATCH] Tweak encoding params for better quality video --- src/video.cc | 1 + src/video.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video.cc b/src/video.cc index 7b4056d..c378471 100644 --- a/src/video.cc +++ b/src/video.cc @@ -213,6 +213,7 @@ bool Video::DitherVideo(const std::string &output_filename, Image *blue_noise, enc_stream->time_base = time_base; enc_codec_context->time_base = time_base; enc_codec_context->gop_size = 12; + enc_codec_context->global_quality = 23; enc_codec_context->pix_fmt = AVPixelFormat::AV_PIX_FMT_YUV444P; if (avf_enc_context->oformat->flags & AVFMT_GLOBALHEADER) { enc_codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; diff --git a/src/video.h b/src/video.h index ebfc7d0..3d060bb 100644 --- a/src/video.h +++ b/src/video.h @@ -16,7 +16,7 @@ constexpr unsigned int kReadBufPaddingSize = AV_INPUT_BUFFER_PADDING_SIZE; constexpr unsigned int kReadBufSizeWithPadding = kReadBufSize + kReadBufPaddingSize; -constexpr unsigned int kOutputBitrate = 40000000; +constexpr unsigned int kOutputBitrate = 80000000; /*! * \brief Helper class that uses Image and OpenCLHandle to dither video frames.