diff --git a/pack-vid b/pack-vid index 96ff723..c81e0f9 100755 --- a/pack-vid +++ b/pack-vid @@ -14,11 +14,19 @@ $self = array_shift( $args ); $options = [ 'letterbox' => false, 'audio' => false, + 'exposure' => '0', + 'peak' => '10000' ]; while ( count( $args ) > 0 && substr( $args[0], 0, 2 ) == '--' ) { $option = substr( array_shift( $args ), 2 ); - $options[$option] = true; + $parts = explode( '=', $option, 2 ); + if ( count( $parts ) == 2 ) { + [ $key, $val ] = $parts; + $options[$key] = $val; + } else { + $options[$option] = true; + } } if ( count ( $args ) < 2 ) { @@ -26,7 +34,9 @@ if ( count ( $args ) < 2 ) { "Usage: $self [options...] \n" . "Options:\n" . " --letterbox pad instead of cropping\n" . - " --audio include audio\n" + " --audio include audio\n" . + " --exposure=n adjust exposure\n" . + " --peak=n set HDR peak nits\n" ); } [ $src, $dest ] = $args; @@ -143,13 +153,17 @@ function convert( $src, $dest, $options ) { } } - $peakNits = 2000; + $exposure = floatval( $options['exposure'] ); + $peakNits = floatval( $options['peakNits'] ); $sdrNits = 80; $peak = $peakNits / $sdrNits; $filters = [ "scale=w=$scaleWidth:h=$scaleHeight" ]; if ( $hdr ) { $filters[] = "zscale=t=linear:p=bt709"; + if ( $exposure ) { + $filters[] = "exposure=$exposure"; + } $filters[] = "tonemap=hable:peak=$peak"; $filters[] = "zscale=t=bt709:m=bt709:r=full"; }