peak to 10k and allow setting exposure and peak
This commit is contained in:
parent
bb2af76233
commit
930518f046
1 changed files with 17 additions and 3 deletions
20
pack-vid
20
pack-vid
|
@ -14,11 +14,19 @@ $self = array_shift( $args );
|
||||||
$options = [
|
$options = [
|
||||||
'letterbox' => false,
|
'letterbox' => false,
|
||||||
'audio' => false,
|
'audio' => false,
|
||||||
|
'exposure' => '0',
|
||||||
|
'peak' => '10000'
|
||||||
];
|
];
|
||||||
|
|
||||||
while ( count( $args ) > 0 && substr( $args[0], 0, 2 ) == '--' ) {
|
while ( count( $args ) > 0 && substr( $args[0], 0, 2 ) == '--' ) {
|
||||||
$option = substr( array_shift( $args ), 2 );
|
$option = substr( array_shift( $args ), 2 );
|
||||||
$options[$option] = true;
|
$parts = explode( '=', $option, 2 );
|
||||||
|
if ( count( $parts ) == 2 ) {
|
||||||
|
[ $key, $val ] = $parts;
|
||||||
|
$options[$key] = $val;
|
||||||
|
} else {
|
||||||
|
$options[$option] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( count ( $args ) < 2 ) {
|
if ( count ( $args ) < 2 ) {
|
||||||
|
@ -26,7 +34,9 @@ if ( count ( $args ) < 2 ) {
|
||||||
"Usage: $self [options...] <srcfile.mp4> <destfile.mp4>\n" .
|
"Usage: $self [options...] <srcfile.mp4> <destfile.mp4>\n" .
|
||||||
"Options:\n" .
|
"Options:\n" .
|
||||||
" --letterbox pad instead of cropping\n" .
|
" --letterbox pad instead of cropping\n" .
|
||||||
" --audio include audio\n"
|
" --audio include audio\n" .
|
||||||
|
" --exposure=n adjust exposure\n" .
|
||||||
|
" --peak=n set HDR peak nits\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
[ $src, $dest ] = $args;
|
[ $src, $dest ] = $args;
|
||||||
|
@ -143,13 +153,17 @@ function convert( $src, $dest, $options ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$peakNits = 2000;
|
$exposure = floatval( $options['exposure'] );
|
||||||
|
$peakNits = floatval( $options['peakNits'] );
|
||||||
$sdrNits = 80;
|
$sdrNits = 80;
|
||||||
$peak = $peakNits / $sdrNits;
|
$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";
|
||||||
|
if ( $exposure ) {
|
||||||
|
$filters[] = "exposure=$exposure";
|
||||||
|
}
|
||||||
$filters[] = "tonemap=hable:peak=$peak";
|
$filters[] = "tonemap=hable:peak=$peak";
|
||||||
$filters[] = "zscale=t=bt709:m=bt709:r=full";
|
$filters[] = "zscale=t=bt709:m=bt709:r=full";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue