From eab41038659e05358d7ea48091d6124e83120f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Furkan=20Y=C4=B1ld=C4=B1z?= Date: Wed, 11 Jan 2023 20:40:02 +0300 Subject: [PATCH] touch up nvid crf --- shell/bash/avt/avt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/shell/bash/avt/avt b/shell/bash/avt/avt index 87f92ae..1b7b514 100755 --- a/shell/bash/avt/avt +++ b/shell/bash/avt/avt @@ -30,12 +30,12 @@ rec_ar: set audio samplerate (default: 192000) rec_normalize: immediately start nvid after recording ends [set to enable] $0 nvid / normalize -Normalize and compress video & audio +Normalize video & audio for backwards compatibility and lower file size Usage: $0 nvid [outfile] Environment variables: nvid_preset: set preset (default: veryslow) nvid_vrate: replace -crf options -nvid_crf: set crf value (default: 21) +nvid_crf: set crf value (default: 19) nvid_rgb: use libx264rgb [set to enable] nvid_pixfmt: set pixel format (default: yuv420p) nvid_profile: set profile (default: high) @@ -52,16 +52,16 @@ my $in = ""; while (<>) { $in .= $_; } my @sinks = split("\n\n", $in); foreach (@sinks) { - if (/State: RUNNING/) { - /Monitor Source: ([^\n]*)/; - print $1 . "\n"; - exit; - } + if (/State: RUNNING/) { + /Monitor Source: ([^\n]*)/; + print $1 . "\n"; + exit; + } } ')"}) # shellcheck disable=SC2206 # remove empty elements from array - devices=(${devices[@]}); + devices=(${devices[@]}) pulse_inputs="" audio_maps="" audio_filter="" @@ -100,10 +100,11 @@ normalize() { OUTPUTFILE="${2:-n_$(grep -oP '^.+(?=\..+)' <<<"$1").mp4}" echo "Saving to $OUTPUTFILE" + # shellcheck disable=SC2086 ffmpeg -y \ ${nvid_cl+-hwaccel opencl} -i "$1" \ ${nvid_cl+-init_hw_device opencl=ocl -filter_hw_device ocl} \ - -c:v libx264${nvid_rgb+rgb} ${avt_cl+-x264opts opencl} -preset "${nvid_preset:-veryslow}" ${nvid_vrate:--crf "${nvid_crf:-21}"} \ + -c:v libx264${nvid_rgb+rgb} ${avt_cl+-x264opts opencl} -preset "${nvid_preset:-veryslow}" ${nvid_vrate:--crf "${nvid_crf:-19}"} \ -pix_fmt "${nvid_pixfmt:-yuv420p}" -profile:v "${nvid_profile:-high}" \ -c:a "${nvid_ac:-aac}" -b:a "${nvid_ba:-160k}" -ar "${nvid_ar:-48000}" \ -map 0 \