Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/gpu-encoding' into featu…
Browse files Browse the repository at this point in the history
…re/gpu-encoding
  • Loading branch information
gael-connan-cybex committed Aug 22, 2024
2 parents 3180598 + c339c58 commit 2c7c0f7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/Enums/Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ enum Encoder: string

public function getAdditionalParameters(bool $forMp4Fallback = false): array
{
$enumParameters = match ($this) {
Encoder::NVIDIA_H264 => ['-c:v', 'h264_nvenc'],
Encoder::NVIDIA_HEVC => ['-c:v', 'hevc_nvenc'],
default => [],
};
$configuredParameters = config(sprintf('encoder.%s', $this->value), []);

if ($forMp4Fallback) {
$enumParameters = match ($this) {
Encoder::NVIDIA_H264, Encoder::NVIDIA_HEVC => ['-c:v', 'h264_nvenc', '-b:v', env('TRANSMORPHER_VIDEO_ENCODER_BITRATE', '6000k')],
default => ['-b:v', env('TRANSMORPHER_VIDEO_ENCODER_BITRATE', '6000k')],
};
} else {
$enumParameters = match ($this) {
Encoder::NVIDIA_H264 => ['-c:v', 'h264_nvenc'],
Encoder::NVIDIA_HEVC => ['-c:v', 'hevc_nvenc'],
default => [],
};
}

return array_merge($enumParameters, $configuredParameters);
Expand Down

0 comments on commit 2c7c0f7

Please sign in to comment.