This commit is contained in:
Brooke Vibber 2023-04-09 14:52:06 -07:00
parent b4832db888
commit 4757720ac4

View file

@ -187,7 +187,7 @@ function convert( $src, $dest, $options ) {
} }
$exposure = floatval( $options['exposure'] ); $exposure = floatval( $options['exposure'] );
$peakNits = floatval( $options['peakNits'] ); $peakNits = floatval( $options['peak'] );
$sdrNits = 80; $sdrNits = 80;
$peak = $peakNits / $sdrNits; $peak = $peakNits / $sdrNits;
@ -215,7 +215,8 @@ function convert( $src, $dest, $options ) {
// $preset = 'veryslow'; // annoying at higher resolutions // $preset = 'veryslow'; // annoying at higher resolutions
$preset = 'slow'; $preset = 'slow';
$passlog = tempnam( '.', 'pack-vid-passlog' ); $tempPrefix = 'pack-vid-passlog' . rand(0,1 << 31);
$passlog = tempnam( '.', $tempPrefix );
run( 'ffmpeg', run( 'ffmpeg',
array_merge( [ array_merge( [
'-i', $src, '-i', $src,
@ -248,4 +249,16 @@ function convert( $src, $dest, $options ) {
'-y', $dest '-y', $dest
] ) ] )
); );
$len = strlen( $tempPrefix );
if ( $len > 0 ) {
$dir = dir( './' );
for ( $entry = $dir->read(); $entry !== false; $entry = $dir->read() ) {
if ( substr( $entry, 0, $len ) === $tempPrefix ) {
print "...deleting temp file: $entry\n";
unlink( $entry );
}
}
$dir->close();
}
} }