]> git.seodisparate.com - EN605.617.81.FA21_StephenSeo_DitheringProject/commitdiff
More tweaking of encoding params for video
authorStephen Seo <seo.disparate@gmail.com>
Sun, 5 Dec 2021 11:15:10 +0000 (20:15 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Sun, 5 Dec 2021 11:16:55 +0000 (20:16 +0900)
Also tweaked the notes/docs about resulting encoded video output.

README.md
src/video.cc
src/video.h

index 3f7755495eb9cfaed66764e07e126b689b859e6e..1624484d6254f7c73c4ae4c5f0279b11b01df56a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
 directory.~~
 
-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
-output each frame to individual PNGs, then combining them later just like as
-mentioned here: https://trac.ffmpeg.org/wiki/Slideshow .
+Video decoding and encoding is finished, ~~but there is some noticable drops in
+quality when encoding to colored dithered video~~ but the resulting video may
+end up being too large. It may be better to just output each frame to individual
+PNGs, then combining them later just like as mentioned here with the params you
+want set: https://trac.ffmpeg.org/wiki/Slideshow .
 
 # Other Notes
 
index c3784712ae7a722cf39f06ccd57d52e151283abc..afcf0cc4c1faca00d2470a2aeb356b261fa63009 100644 (file)
@@ -212,8 +212,10 @@ bool Video::DitherVideo(const std::string &output_filename, Image *blue_noise,
     enc_codec_context->height = height;
     enc_stream->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->qmax = 35;
+    enc_codec_context->qmin = 20;
     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;
index 3d060bbc71f6deade06cc0faf4fbf83a46af8b35..2b3f053c5473f85769a42624f63bacb1e88de82a 100644 (file)
@@ -47,8 +47,8 @@ class Video {
    * \brief Dithers the frames in the input video.
    *
    * 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
-   * video struggles to maintain video quality.
+   * frame instead of a video file. This may be desireable for more control over
+   * the params set when encoding the resulting video.
    *
    * \return True on success.
    */