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;