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 = [
'crop' => false,
'no-audio' => false,
'exposure' => '-0.5', // half stop down
'exposure' => '-1', // stops
'peak' => '1000', // '10000' is max
'fps' => '60',
'fps' => '60000/1001',
'size' => $maxBytes,
'quality' => 1.0,
];
@ -168,7 +168,8 @@ function convert( $src, $dest, $options ) {
} else {
$frameWidth = 1920;
$frameHeight = 1080;
$bitrate = $base * 4;
// Cap the bitrate rather than making larger encodings.
$bitrate = min( $bitrate, $base * 8 );
}
$aspect = $width / $height;
@ -199,12 +200,13 @@ function convert( $src, $dest, $options ) {
$filters = [ "scale=w=$scaleWidth:h=$scaleHeight" ];
if ( $hdr ) {
$filters[] = "zscale=t=linear:p=bt2020";
$filters[] = "zscale=t=linear";
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 ) {
@ -220,6 +222,7 @@ 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 );
@ -227,7 +230,8 @@ function convert( $src, $dest, $options ) {
array_merge( [
'-i', $src,
'-f', 'mp4',
'-fpsmax', $fps,
//'-fpsmax', $fps,
'-r', $fps,
'-vf', $vf,
'-c:v', 'libx264',
'-b:v', $bitrate,
@ -243,7 +247,8 @@ function convert( $src, $dest, $options ) {
array_merge( [
'-i', $src,
'-vf', $vf,
'-fpsmax', $fps,
//'-fpsmax', $fps,
'-r', $fps,
'-c:v', 'libx264',
'-b:v', $bitrate,
'-preset', $preset,