touch up nvid crf

This commit is contained in:
Ali Furkan Yıldız 2023-01-11 20:40:02 +03:00
parent 672f7f3e92
commit eab4103865

View file

@ -30,12 +30,12 @@ rec_ar: set audio samplerate (default: 192000)
rec_normalize: immediately start nvid after recording ends [set to enable] rec_normalize: immediately start nvid after recording ends [set to enable]
$0 nvid / normalize $0 nvid / normalize
Normalize and compress video & audio Normalize video & audio for backwards compatibility and lower file size
Usage: $0 nvid <file> [outfile] Usage: $0 nvid <file> [outfile]
Environment variables: Environment variables:
nvid_preset: set preset (default: veryslow) nvid_preset: set preset (default: veryslow)
nvid_vrate: replace -crf options 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_rgb: use libx264rgb [set to enable]
nvid_pixfmt: set pixel format (default: yuv420p) nvid_pixfmt: set pixel format (default: yuv420p)
nvid_profile: set profile (default: high) nvid_profile: set profile (default: high)
@ -52,16 +52,16 @@ my $in = "";
while (<>) { $in .= $_; } while (<>) { $in .= $_; }
my @sinks = split("\n\n", $in); my @sinks = split("\n\n", $in);
foreach (@sinks) { foreach (@sinks) {
if (/State: RUNNING/) { if (/State: RUNNING/) {
/Monitor Source: ([^\n]*)/; /Monitor Source: ([^\n]*)/;
print $1 . "\n"; print $1 . "\n";
exit; exit;
} }
} }
')"}) ')"})
# shellcheck disable=SC2206 # shellcheck disable=SC2206
# remove empty elements from array # remove empty elements from array
devices=(${devices[@]}); devices=(${devices[@]})
pulse_inputs="" pulse_inputs=""
audio_maps="" audio_maps=""
audio_filter="" audio_filter=""
@ -100,10 +100,11 @@ normalize() {
OUTPUTFILE="${2:-n_$(grep -oP '^.+(?=\..+)' <<<"$1").mp4}" OUTPUTFILE="${2:-n_$(grep -oP '^.+(?=\..+)' <<<"$1").mp4}"
echo "Saving to $OUTPUTFILE" echo "Saving to $OUTPUTFILE"
# shellcheck disable=SC2086
ffmpeg -y \ ffmpeg -y \
${nvid_cl+-hwaccel opencl} -i "$1" \ ${nvid_cl+-hwaccel opencl} -i "$1" \
${nvid_cl+-init_hw_device opencl=ocl -filter_hw_device ocl} \ ${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}" \ -pix_fmt "${nvid_pixfmt:-yuv420p}" -profile:v "${nvid_profile:-high}" \
-c:a "${nvid_ac:-aac}" -b:a "${nvid_ba:-160k}" -ar "${nvid_ar:-48000}" \ -c:a "${nvid_ac:-aac}" -b:a "${nvid_ba:-160k}" -ar "${nvid_ar:-48000}" \
-map 0 \ -map 0 \