From 742238f6428b8479204424ee0babbab72365d2ca Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 30 Jul 2023 10:22:43 -0700 Subject: [PATCH] allow overriding frame size --- pack-vid | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pack-vid b/pack-vid index 88fb4b9..85161ee 100755 --- a/pack-vid +++ b/pack-vid @@ -28,6 +28,8 @@ $options = [ 'quality' => 1.0, 'hdr' => false, 'dither' => false, + 'width' => false, + 'height' => false, ]; while ( count( $args ) > 0 && substr( $args[0], 0, 2 ) == '--' ) { @@ -55,7 +57,9 @@ if ( count ( $args ) < 2 ) { " --size=n target file size in bytes (default 3.5M)\n" . " --quality=n fraction of base bitrate to break on (deafult 0.75)\n" . " --hdr force HDR input processing on\n" . - " --dither enable dithering in 8-bit downconversion\n" + " --dither enable dithering in 8-bit downconversion\n" . + " --width override frame width in pixels\n" . + " --height override frame height in pixels\n" ); } [ $src, $dest ] = $args; @@ -251,6 +255,13 @@ function convert( $src, $dest, $options ) { } */ + if ( $options['width'] ) { + $frameWidth = intval( $options['width'] ); + } + if ( $options['height'] ) { + $frameHeight = intval( $options['height'] ); + } + $wide = $aspect > ( $frameWidth / $frameHeight ); $crop = boolval( $options['crop'] ); $letterbox = boolval( $options['letterbox'] );