From dffe1a0402fba2300d1b19351c25f3cd757e83f7 Mon Sep 17 00:00:00 2001 From: Brooke Vibber Date: Wed, 23 Oct 2024 19:10:40 -0700 Subject: [PATCH] tweaks * 600 -> 800 on pack-preset * audio-channels and audio-bitrate options on pack-video --- pack-preset | 3 ++- pack-vid | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pack-preset b/pack-preset index 08db3a5..ed290ea 100755 --- a/pack-preset +++ b/pack-preset @@ -1 +1,2 @@ -pack-set --color-temperature=6800 --peak=600 --vibrance=0.2 "$@" +#pack-set --color-temperature=6800 --peak=600 --vibrance=0.2 "$@" +pack-set --color-temperature=6800 --peak=800 --vibrance=0.2 "$@" diff --git a/pack-vid b/pack-vid index edfcc5d..47e7515 100755 --- a/pack-vid +++ b/pack-vid @@ -20,12 +20,15 @@ $options = [ 'crop' => false, 'letterbox' => false, 'no-audio' => false, + 'audio-bitrate' => 96000, + 'audio-channels' => 2, 'exposure' => '0', // stops 'peak' => '1000', // '10000' is max 'preset' => 'medium', 'fps' => '60000/1001', 'size' => $maxBytes, 'quality' => 1.0, + 'bitrate' => 0, 'hdr' => false, 'dither' => false, 'width' => false, @@ -62,8 +65,9 @@ if ( count ( $args ) < 2 ) { " --peak=n set HDR peak nits\n" . " --preset=key set h.264 encoding preset\n" . " --fps=n frame rate limit\n" . - " --size=n target file size in bytes (default 3.5M)\n" . - " --quality=n fraction of base bitrate to break on (deafult 0.75)\n" . + " --bitrate=n target bitrate (exclusive with --size)\n" . + " --size=n target file size in bytes (exclusive with --bitrate)\n" . + " --quality=n fraction of base bitrate to break on (deafult 1.0)\n" . " --hdr force HDR input processing on\n" . " --dither enable dithering in 8-bit downconversion\n" . " --width=n override frame width in pixels\n" . @@ -195,14 +199,18 @@ function convert( $src, $dest, $options ) { } $bitrate = floor( $maxBits / $duration ); + if ( $options['bitrate'] ) { + $bitrate = sizify( $options['bitrate'] ); + } if ( $options[ 'no-audio' ] || count( $audioTracks ) == 0 ) { $audio = [ '-an' ]; } else { - $audioBitrate = 96 * 1000; + $audioBitrate = $options[ 'audio-bitrate' ]; + $audioChannels = $options[ 'audio-channels' ]; $audio = [ - '-ac', 2, + '-ac', $audioChannels, '-b:a', $audioBitrate, ]; $bitrate -= $audioBitrate;