From 5ba048b8c86166265e31a2769bcb187a0cf1dc99 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 26 Oct 2023 11:10:59 -0700 Subject: [PATCH] fixes for options --- pack-set | 12 ++++++------ pack-vid | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pack-set b/pack-set index 9d22560..9bbafce 100755 --- a/pack-set +++ b/pack-set @@ -12,17 +12,17 @@ do else echo "FILE: $INFILE" - #COMMON="$OPTS" - #COMMON="$OPTS --exposure=-2.5 --peak=141" - #COMMON="$OPTS --exposure=-1 --peak=500" - COMMON="$OPTS --peak=1000" + #COMMON="" + #COMMON="--exposure=-2.5 --peak=141" + #COMMON="--exposure=-1 --peak=500" + COMMON="--peak=1000" SPEED_SMALL="veryslow" SPEED_LARGE="slow" SMALL="$COMMON --size=4m --quality=0.75 --preset=$SPEED_SMALL" LARGE="$COMMON --size=25m --preset=$SPEED_LARGE" - pack-vid $SMALL "$INFILE" "${INFILE%.mp4}-small.mp4" - pack-vid $LARGE "$INFILE" "${INFILE%.mp4}-large.mp4" + pack-vid $SMALL $OPTS "$INFILE" "${INFILE%.mp4}-small.mp4" + pack-vid $LARGE $OPTS "$INFILE" "${INFILE%.mp4}-large.mp4" fi done diff --git a/pack-vid b/pack-vid index 3c83dcc..b3803a0 100755 --- a/pack-vid +++ b/pack-vid @@ -31,6 +31,7 @@ $options = [ 'width' => false, 'height' => false, 'keyframe-int' => 0, + 'vibrance' => 0, ]; while ( count( $args ) > 0 && substr( $args[0], 0, 2 ) == '--' ) { @@ -300,6 +301,7 @@ function convert( $src, $dest, $options ) { $peakNits = floatval( $options['peak'] ); $sdrNits = 80; $peak = $peakNits / $sdrNits; + $vibrance = floatval( $options['vibrance'] ); $filters = [ "scale=w=$scaleWidth:h=$scaleHeight" ]; if ( $hdr ) { @@ -313,8 +315,10 @@ function convert( $src, $dest, $options ) { } else { $dither = ""; } - $filters[] = "zscale=t=bt709:p=bt709:m=bt709:r=full$dither"; - $filters[] = "vibrance=0.2"; + $filters[] = "zscale=tin=linear:t=709:p=709:m=709:r=full$dither"; + if ( $vibrance ) { + $filters[] = "vibrance=$vibrance"; + } } $filters[] = "format=yuv420p"; if ( $crop ) { @@ -337,7 +341,6 @@ function convert( $src, $dest, $options ) { '-i', $src, '-f', 'mp4', '-fpsmax', $fps, - //'-r', $fps, '-vf', $vf, '-c:v', 'libx264', '-b:v', $bitrate, @@ -354,7 +357,6 @@ function convert( $src, $dest, $options ) { '-i', $src, '-vf', $vf, '-fpsmax', $fps, - //'-r', $fps, '-c:v', 'libx264', '-b:v', $bitrate, '-preset', $preset,