Compare commits
7 commits
96f4cf2f72
...
324a3fa064
| Author | SHA1 | Date | |
|---|---|---|---|
| 324a3fa064 | |||
| 2b86f64b14 | |||
| b58863cb1c | |||
| 6b5d7328a8 | |||
| 22eacccc26 | |||
| 5544d42cb4 | |||
| ca2ab23a97 |
3 changed files with 66 additions and 4 deletions
28
pack-set-hdr
Executable file
28
pack-set-hdr
Executable file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
OPTS=""
|
||||||
|
|
||||||
|
for INFILE in "$@"
|
||||||
|
do
|
||||||
|
if [[ "$1" =~ ^--.* ]]
|
||||||
|
then
|
||||||
|
echo "OPTION: $1"
|
||||||
|
OPTS="$OPTS $1"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo "FILE: $INFILE"
|
||||||
|
|
||||||
|
COMMON="--vcodec=libsvtav1 --hdr"
|
||||||
|
SPEED_SMALL="4"
|
||||||
|
SPEED_LARGE="4"
|
||||||
|
|
||||||
|
SMALL="$COMMON --size=4m --quality=0.5 --preset=$SPEED_SMALL"
|
||||||
|
MED="$COMMON --size=10m --quality=0.75 --preset=$SPEED_SMALL"
|
||||||
|
TEN80="$COMMON --bitrate=4000000 --width=1920 --height=1080 --preset=$SPEED_LARGE"
|
||||||
|
|
||||||
|
pack-vid $SMALL $OPTS "$INFILE" "${INFILE%.mp4}-hdr-av1-small.webm"
|
||||||
|
pack-vid $MED $OPTS "$INFILE" "${INFILE%.mp4}-hdr-av1-med.webm"
|
||||||
|
pack-vid $TEN80 $OPTS "$INFILE" "${INFILE%.mp4}-hdr-av1-1080p.webm"
|
||||||
|
fi
|
||||||
|
done
|
||||||
28
pack-set-vp9
Executable file
28
pack-set-vp9
Executable file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
OPTS=""
|
||||||
|
|
||||||
|
for INFILE in "$@"
|
||||||
|
do
|
||||||
|
if [[ "$1" =~ ^--.* ]]
|
||||||
|
then
|
||||||
|
echo "OPTION: $1"
|
||||||
|
OPTS="$OPTS $1"
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo "FILE: $INFILE"
|
||||||
|
|
||||||
|
COMMON="--vcodec=libvpx-vp9 --hdr"
|
||||||
|
SPEED_SMALL="2"
|
||||||
|
SPEED_LARGE="2"
|
||||||
|
|
||||||
|
SMALL="$COMMON --size=4m --quality=0.5 --speed=$SPEED_SMALL"
|
||||||
|
MED="$COMMON --size=10m --quality=0.75 --speed=$SPEED_SMALL"
|
||||||
|
TEN80="$COMMON --bitrate=4000000 --width=1920 --height=1080 --preset=$SPEED_LARGE"
|
||||||
|
|
||||||
|
pack-vid $SMALL $OPTS "$INFILE" "${INFILE%.mp4}-hdr-vp9-small.webm"
|
||||||
|
pack-vid $MED $OPTS "$INFILE" "${INFILE%.mp4}-hdr-vp9-med.webm"
|
||||||
|
pack-vid $TEN80 $OPTS "$INFILE" "${INFILE%.mp4}-hdr-vp9-1080p.webm"
|
||||||
|
fi
|
||||||
|
done
|
||||||
14
pack-vid
14
pack-vid
|
|
@ -30,6 +30,7 @@ $options = [
|
||||||
'size' => $maxBytes,
|
'size' => $maxBytes,
|
||||||
'quality' => 1.0,
|
'quality' => 1.0,
|
||||||
'bitrate' => 0,
|
'bitrate' => 0,
|
||||||
|
'hdr-input' => false,
|
||||||
'hdr' => false,
|
'hdr' => false,
|
||||||
'dither' => false,
|
'dither' => false,
|
||||||
'width' => false,
|
'width' => false,
|
||||||
|
|
@ -71,7 +72,8 @@ if ( count ( $args ) < 2 ) {
|
||||||
" --bitrate=n target bitrate (exclusive with --size)\n" .
|
" --bitrate=n target bitrate (exclusive with --size)\n" .
|
||||||
" --size=n target file size in bytes (exclusive with --bitrate)\n" .
|
" --size=n target file size in bytes (exclusive with --bitrate)\n" .
|
||||||
" --quality=n fraction of base bitrate to break on (deafult 1.0)\n" .
|
" --quality=n fraction of base bitrate to break on (deafult 1.0)\n" .
|
||||||
" --hdr force HDR input processing on\n" .
|
" --hdr-input force HDR input processing on\n" .
|
||||||
|
" --hdr force HDR output on (normally SDR output)\n" .
|
||||||
" --dither enable dithering in 8-bit downconversion\n" .
|
" --dither enable dithering in 8-bit downconversion\n" .
|
||||||
" --width=n override frame width in pixels\n" .
|
" --width=n override frame width in pixels\n" .
|
||||||
" --height=n override frame height in pixels\n" .
|
" --height=n override frame height in pixels\n" .
|
||||||
|
|
@ -190,9 +192,10 @@ function convert( $src, $dest, $options ) {
|
||||||
$cropLeft = intval( $options['crop-left'] );
|
$cropLeft = intval( $options['crop-left'] );
|
||||||
}
|
}
|
||||||
// @fixme some files are missing this? trims from qt?
|
// @fixme some files are missing this? trims from qt?
|
||||||
//$hdr = $track->color_primaries === 'bt2020' || $options['hdr'];
|
//$hdrInput = $track->color_primaries === 'bt2020' || $options['hdr-input'];
|
||||||
// pix_fmt: "yuv420p10le"
|
// pix_fmt: "yuv420p10le"
|
||||||
$hdr = substr( $track->pix_fmt, -5 ) === 'p10le' || $options['hdr'];
|
$hdrInput = substr( $track->pix_fmt, -5 ) === 'p10le' || $options['hdr-input'];
|
||||||
|
$hdr = $hdrInput && $options['hdr'];
|
||||||
if ( $options['keyframe-int'] ) {
|
if ( $options['keyframe-int'] ) {
|
||||||
$keyframeInt = intval( $options['keyframe-int'] );
|
$keyframeInt = intval( $options['keyframe-int'] );
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -317,6 +320,8 @@ function convert( $src, $dest, $options ) {
|
||||||
}
|
}
|
||||||
$filters[] = "scale=w=$scaleWidth:h=$scaleHeight";
|
$filters[] = "scale=w=$scaleWidth:h=$scaleHeight";
|
||||||
if ( $hdr ) {
|
if ( $hdr ) {
|
||||||
|
$filters[] = "format=yuv420p10le";
|
||||||
|
} elseif ( $hdrInput ) {
|
||||||
$filters[] = "zscale=t=linear:p=709:m=709";
|
$filters[] = "zscale=t=linear:p=709:m=709";
|
||||||
if ( $exposure ) {
|
if ( $exposure ) {
|
||||||
$filters[] = "exposure=$exposure";
|
$filters[] = "exposure=$exposure";
|
||||||
|
|
@ -335,8 +340,9 @@ function convert( $src, $dest, $options ) {
|
||||||
if ( $vibrance ) {
|
if ( $vibrance ) {
|
||||||
$filters[] = "vibrance=$vibrance";
|
$filters[] = "vibrance=$vibrance";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$filters[] = "format=yuv420p";
|
||||||
}
|
}
|
||||||
$filters[] = "format=yuv420p";
|
|
||||||
if ( $crop ) {
|
if ( $crop ) {
|
||||||
$filters[] = "crop=w=$frameWidth:h=$frameHeight";
|
$filters[] = "crop=w=$frameWidth:h=$frameHeight";
|
||||||
} elseif ( $letterbox ) {
|
} elseif ( $letterbox ) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue