allow overriding frame size

This commit is contained in:
Brooke Vibber 2023-07-30 10:22:43 -07:00
parent 3127862487
commit 742238f642

View file

@ -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'] );