Skip to content

Commit 0c3c227

Browse files
author
Daniel Neto
committed
https://github.com/WWBN/AVideo/issues/9817#issuecomment-2599133126
1 parent 5833c2d commit 0c3c227

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

objects/MP4Processor.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ public static function createMP4MaxResolutionFromQueueId($pathFileName, $encoder
1010
if($inputResolution> $maxResolution){
1111
$inputResolution = $maxResolution;
1212
}
13-
$destinationFile = Encoder::getTmpFileName($encoder_queue_id, 'mp4', $inputResolution);
14-
return self::createMP4($pathFileName, $destinationFile, $encoder_queue_id, $inputResolution);
13+
// Get allowed resolutions from Format::ENCODING_SETTINGS
14+
$allowedResolutions = array_keys(Format::ENCODING_SETTINGS);
15+
// Determine the target resolution
16+
$targetResolution = self::getClosestResolution($inputResolution, $allowedResolutions);
17+
18+
$destinationFile = Encoder::getTmpFileName($encoder_queue_id, 'mp4', $targetResolution);
19+
_error_log("MP4Processor::createMP4MaxResolutionFromQueueId [$pathFileName, $encoder_queue_id, $maxResolution ] [{$inputResolution}p] => [{$targetResolution}p] $destinationFile");
20+
return self::createMP4($pathFileName, $destinationFile, $encoder_queue_id, $targetResolution);
1521
}
1622

1723
public static function createMP4MaxResolution($pathFileName, $destinationFile, $maxResolution = 1080){

0 commit comments

Comments
 (0)