adjust hdr peak, set pass log file
This commit is contained in:
parent
a80629c9ad
commit
bed9ce149b
1 changed files with 8 additions and 1 deletions
9
pack-vid
9
pack-vid
|
@ -130,10 +130,14 @@ function convert( $src, $dest, $options ) {
|
||||||
$scaleWidth = evenize( $width * $frameHeight / $height );
|
$scaleWidth = evenize( $width * $frameHeight / $height );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$peakNits = 2000;
|
||||||
|
$sdrNits = 80;
|
||||||
|
$peak = $peakNits / $sdrNits;
|
||||||
|
|
||||||
$filters = [ "scale=w=$scaleWidth:h=$scaleHeight" ];
|
$filters = [ "scale=w=$scaleWidth:h=$scaleHeight" ];
|
||||||
if ( $hdr ) {
|
if ( $hdr ) {
|
||||||
$filters[] = "zscale=t=linear:p=bt709";
|
$filters[] = "zscale=t=linear:p=bt709";
|
||||||
$filters[] = "tonemap=hable:peak=8";
|
$filters[] = "tonemap=hable:peak=$peak";
|
||||||
$filters[] = "zscale=t=bt709:m=bt709:r=full";
|
$filters[] = "zscale=t=bt709:m=bt709:r=full";
|
||||||
}
|
}
|
||||||
$filters[] = "format=yuv420p";
|
$filters[] = "format=yuv420p";
|
||||||
|
@ -147,6 +151,7 @@ function convert( $src, $dest, $options ) {
|
||||||
|
|
||||||
$fps = 30;
|
$fps = 30;
|
||||||
|
|
||||||
|
$passlog = tempnam( '.', 'pack-vid-passlog' );
|
||||||
run( 'ffmpeg',
|
run( 'ffmpeg',
|
||||||
array_merge( [
|
array_merge( [
|
||||||
'-i', $src,
|
'-i', $src,
|
||||||
|
@ -157,6 +162,7 @@ function convert( $src, $dest, $options ) {
|
||||||
'-b:v', $bitrate,
|
'-b:v', $bitrate,
|
||||||
'-preset', 'veryslow',
|
'-preset', 'veryslow',
|
||||||
'-pass', '1',
|
'-pass', '1',
|
||||||
|
'-passlogfile', $passlog,
|
||||||
'-g', $keyframeInt,
|
'-g', $keyframeInt,
|
||||||
], $audio, [
|
], $audio, [
|
||||||
'-y', '/dev/null'
|
'-y', '/dev/null'
|
||||||
|
@ -171,6 +177,7 @@ function convert( $src, $dest, $options ) {
|
||||||
'-b:v', $bitrate,
|
'-b:v', $bitrate,
|
||||||
'-preset', 'veryslow',
|
'-preset', 'veryslow',
|
||||||
'-pass', '2',
|
'-pass', '2',
|
||||||
|
'-passlogfile', $passlog,
|
||||||
'-g', $keyframeInt,
|
'-g', $keyframeInt,
|
||||||
], $audio, [
|
], $audio, [
|
||||||
'-movflags', '+faststart',
|
'-movflags', '+faststart',
|
||||||
|
|
Loading…
Reference in a new issue