tweak tweak and add vibrancy

This commit is contained in:
Brooke Vibber 2023-04-21 17:57:03 -07:00
parent 4d6d4fc6da
commit b4bf93af2d

View file

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