Compare commits

..

No commits in common. "2ac10e635010f7c96385b2c684d9ecc5af244583" and "4d6d4fc6da8f7ffc340e7282b5e1d6521a90389e" have entirely different histories.

2 changed files with 6 additions and 16 deletions

View file

@ -1,5 +0,0 @@
#!/bin/sh
COMMON="--quality=0.67"
pack-vid $COMMON --size=4m "$1" "${1%.mp4}-small.mp4" &
pack-vid $COMMON --size=25m "$1" "${1%.mp4}-large.mp4" &
wait

View file

@ -18,9 +18,9 @@ $maxBytes = $maxBytes * 15 / 16; // leave some headroom
$options = [
'crop' => false,
'no-audio' => false,
'exposure' => '-1', // stops
'exposure' => '-0.5', // half stop down
'peak' => '1000', // '10000' is max
'fps' => '60000/1001',
'fps' => '60',
'size' => $maxBytes,
'quality' => 1.0,
];
@ -168,8 +168,7 @@ function convert( $src, $dest, $options ) {
} else {
$frameWidth = 1920;
$frameHeight = 1080;
// Cap the bitrate rather than making larger encodings.
$bitrate = min( $bitrate, $base * 8 );
$bitrate = $base * 4;
}
$aspect = $width / $height;
@ -200,13 +199,12 @@ function convert( $src, $dest, $options ) {
$filters = [ "scale=w=$scaleWidth:h=$scaleHeight" ];
if ( $hdr ) {
$filters[] = "zscale=t=linear";
$filters[] = "zscale=t=linear:p=bt2020";
if ( $exposure ) {
$filters[] = "exposure=$exposure";
}
$filters[] = "tonemap=hable:peak=$peak";
$filters[] = "zscale=t=bt709:p=bt709:m=bt709:r=full";
$filters[] = "vibrance=0.20";
}
$filters[] = "format=yuv420p";
if ( $crop ) {
@ -222,7 +220,6 @@ function convert( $src, $dest, $options ) {
// $preset = 'veryslow'; // annoying at higher resolutions
$preset = 'slow';
//$preset = 'fast';
$tempPrefix = 'pack-vid-passlog' . rand(0,1 << 31);
$passlog = tempnam( '.', $tempPrefix );
@ -230,8 +227,7 @@ function convert( $src, $dest, $options ) {
array_merge( [
'-i', $src,
'-f', 'mp4',
//'-fpsmax', $fps,
'-r', $fps,
'-fpsmax', $fps,
'-vf', $vf,
'-c:v', 'libx264',
'-b:v', $bitrate,
@ -247,8 +243,7 @@ function convert( $src, $dest, $options ) {
array_merge( [
'-i', $src,
'-vf', $vf,
//'-fpsmax', $fps,
'-r', $fps,
'-fpsmax', $fps,
'-c:v', 'libx264',
'-b:v', $bitrate,
'-preset', $preset,