whee
This commit is contained in:
parent
688827cbb8
commit
19223d8288
2 changed files with 8 additions and 10 deletions
11
pack-set
11
pack-set
|
@ -4,18 +4,13 @@ for INFILE in "$@"
|
||||||
do
|
do
|
||||||
echo "$INFILE"
|
echo "$INFILE"
|
||||||
|
|
||||||
COMMON="--exposure=-2.5 --peak=141"
|
COMMON="--quality=0.75 --exposure=-2.5 --peak=141"
|
||||||
SPEED="slow"
|
SPEED="slow"
|
||||||
#SPEED="veryfast"
|
#SPEED="veryfast"
|
||||||
|
|
||||||
SMALL="$COMMON --size=4m --preset=$SPEED"
|
SMALL="$COMMON --size=4m --preset=$SPEED"
|
||||||
LARGE="$COMMON --size=25m --preset=$SPEED"
|
LARGE="$COMMON --size=25m --preset=$SPEED"
|
||||||
LETTERBOX="--quality=0.75"
|
|
||||||
CROP="--crop"
|
|
||||||
|
|
||||||
pack-vid $SMALL $CROP "$INFILE" "${INFILE%.mp4}-crop-small.mp4"
|
pack-vid $SMALL "$INFILE" "${INFILE%.mp4}-small.mp4"
|
||||||
pack-vid $SMALL $LETTERBOX "$INFILE" "${INFILE%.mp4}-letterbox-small.mp4"
|
pack-vid $LARGE "$INFILE" "${INFILE%.mp4}-large.mp4"
|
||||||
|
|
||||||
pack-vid $LARGE $CROP "$INFILE" "${INFILE%.mp4}-crop-large.mp4"
|
|
||||||
pack-vid $LARGE $LETTERBOX "$INFILE" "${INFILE%.mp4}-letterbox-large.mp4"
|
|
||||||
done
|
done
|
||||||
|
|
7
pack-vid
7
pack-vid
|
@ -17,6 +17,7 @@ $maxBytes = $maxBytes * 15 / 16; // leave some headroom
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'crop' => false,
|
'crop' => false,
|
||||||
|
'letterbox' => false,
|
||||||
'no-audio' => false,
|
'no-audio' => false,
|
||||||
'exposure' => '0', // stops
|
'exposure' => '0', // stops
|
||||||
'peak' => '1000', // '10000' is max
|
'peak' => '1000', // '10000' is max
|
||||||
|
@ -41,7 +42,8 @@ if ( count ( $args ) < 2 ) {
|
||||||
die(
|
die(
|
||||||
"Usage: $self [options...] <srcfile.mp4> <destfile.mp4>\n" .
|
"Usage: $self [options...] <srcfile.mp4> <destfile.mp4>\n" .
|
||||||
"Options:\n" .
|
"Options:\n" .
|
||||||
" --crop crop instead of padding\n" .
|
" --crop crop to 16:9\n" .
|
||||||
|
" --letterbox pad to 16:9\n" .
|
||||||
" --no-audio strip audio\n" .
|
" --no-audio strip audio\n" .
|
||||||
" --exposure=n adjust exposure\n" .
|
" --exposure=n adjust exposure\n" .
|
||||||
" --peak=n set HDR peak nits\n" .
|
" --peak=n set HDR peak nits\n" .
|
||||||
|
@ -177,6 +179,7 @@ function convert( $src, $dest, $options ) {
|
||||||
$aspect = $width / $height;
|
$aspect = $width / $height;
|
||||||
$wide = $aspect > ( $frameWidth / $frameHeight );
|
$wide = $aspect > ( $frameWidth / $frameHeight );
|
||||||
$crop = boolval( $options['crop'] );
|
$crop = boolval( $options['crop'] );
|
||||||
|
$letterbox = boolval( $options['letterbox'] );
|
||||||
if ( $crop ) {
|
if ( $crop ) {
|
||||||
if ( $wide ) {
|
if ( $wide ) {
|
||||||
$scaleHeight = $frameHeight;
|
$scaleHeight = $frameHeight;
|
||||||
|
@ -213,7 +216,7 @@ function convert( $src, $dest, $options ) {
|
||||||
$filters[] = "format=yuv420p";
|
$filters[] = "format=yuv420p";
|
||||||
if ( $crop ) {
|
if ( $crop ) {
|
||||||
$filters[] = "crop=w=$frameWidth:h=$frameHeight";
|
$filters[] = "crop=w=$frameWidth:h=$frameHeight";
|
||||||
} else {
|
} elseif ( $letterbox ) {
|
||||||
$offsetX = round( ( $frameWidth - $scaleWidth) / 2 );
|
$offsetX = round( ( $frameWidth - $scaleWidth) / 2 );
|
||||||
$offsetY = round( ( $frameHeight - $scaleHeight) / 2 );
|
$offsetY = round( ( $frameHeight - $scaleHeight) / 2 );
|
||||||
$filters[] = "pad=w=$frameWidth:h=$frameHeight:x=$offsetX:y=$offsetY";
|
$filters[] = "pad=w=$frameWidth:h=$frameHeight:x=$offsetX:y=$offsetY";
|
||||||
|
|
Loading…
Reference in a new issue