From 8bc573bfad1891274bce04b24e75b2b69638a446 Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Thu, 23 Jun 2022 17:15:30 -0400 Subject: [PATCH] Tweak video compression params --- bin/compress-video | 4 ++-- bin/compress-video-with-crf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/compress-video b/bin/compress-video index d51db04..ba309b5 100644 --- a/bin/compress-video +++ b/bin/compress-video @@ -33,9 +33,9 @@ if [[ $use_gpu == "" || $2 == "" || $output_name == "" ]]; then fi # Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU. -use_crf=25 +use_crf=21 if [[ $use_gpu -eq 1 ]]; then - use_crf=27 + use_crf=25 fi compress-video-with-crf $use_gpu $use_crf "$filename" "$output_name" diff --git a/bin/compress-video-with-crf b/bin/compress-video-with-crf index a28e13b..7fe9490 100644 --- a/bin/compress-video-with-crf +++ b/bin/compress-video-with-crf @@ -54,7 +54,7 @@ function encode() { # File will be slightly larger than CPU encoding, but it's much faster to transcode and doesn't max out the CPU cores. ffmpeg -y -stats -loglevel level+error $timing_args -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output" else - ffmpeg $timing_args -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v baseline -level 3.0 -strict -2 "$output" + ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v high -level 3.0 -strict -2 "$output" fi printf "\n${GREEN}${BOLD}Finished encoding '$filename.$extension' (CRF $crf) | output name '$output'${NORMAL}\n\n" }