More tweaking of encoding params for video

Also tweaked the notes/docs about resulting encoded video output.
This commit is contained in:
Stephen Seo 2021-12-05 20:15:10 +09:00
parent ddeac3201c
commit db2d75de06
3 changed files with 10 additions and 7 deletions

View file

@ -25,10 +25,11 @@ output video being encoded hasn't been implemented yet. The current
implementation writes each video frame to a PNG image in the current implementation writes each video frame to a PNG image in the current
directory.~~ directory.~~
Video decoding and encoding is finished, but there is some noticable drops in Video decoding and encoding is finished, ~~but there is some noticable drops in
quality when encoding to colored dithered video. It may be better to just quality when encoding to colored dithered video~~ but the resulting video may
output each frame to individual PNGs, then combining them later just like as end up being too large. It may be better to just output each frame to individual
mentioned here: https://trac.ffmpeg.org/wiki/Slideshow . PNGs, then combining them later just like as mentioned here with the params you
want set: https://trac.ffmpeg.org/wiki/Slideshow .
# Other Notes # Other Notes

View file

@ -212,8 +212,10 @@ bool Video::DitherVideo(const std::string &output_filename, Image *blue_noise,
enc_codec_context->height = height; enc_codec_context->height = height;
enc_stream->time_base = time_base; enc_stream->time_base = time_base;
enc_codec_context->time_base = time_base; enc_codec_context->time_base = time_base;
enc_codec_context->gop_size = 12; enc_codec_context->gop_size = 128;
enc_codec_context->global_quality = 23; enc_codec_context->global_quality = 23;
enc_codec_context->qmax = 35;
enc_codec_context->qmin = 20;
enc_codec_context->pix_fmt = AVPixelFormat::AV_PIX_FMT_YUV444P; enc_codec_context->pix_fmt = AVPixelFormat::AV_PIX_FMT_YUV444P;
if (avf_enc_context->oformat->flags & AVFMT_GLOBALHEADER) { if (avf_enc_context->oformat->flags & AVFMT_GLOBALHEADER) {
enc_codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; enc_codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

View file

@ -47,8 +47,8 @@ class Video {
* \brief Dithers the frames in the input video. * \brief Dithers the frames in the input video.
* *
* If output_as_pngs is true, then the output will be individaul PNGs of each * If output_as_pngs is true, then the output will be individaul PNGs of each
* frame instead of a video file. This may be desireable because the output * frame instead of a video file. This may be desireable for more control over
* video struggles to maintain video quality. * the params set when encoding the resulting video.
* *
* \return True on success. * \return True on success.
*/ */