ffmpeg.php: add h265 support

This commit is contained in:
Zankaria 2025-10-11 00:37:15 +02:00
parent a86d88ebfc
commit 7b3442b7c2

View file

@ -111,11 +111,12 @@ function is_valid_webm(array $ffprobe_out) {
];
}
} elseif ($extension === 'mp4' || stristr($ffprobe_out['format']['format_name'], 'mp4')) {
$any_h264 = false;
$any_h26x = false;
for ($i = 0; $i < count($trackmap['videoat']); $i++) {
if ($ffprobe_out['streams'][$i]['codec_name'] == 'h264') {
$video_codec = $ffprobe_out['streams'][$i]['codec_name'];
if ($video_codec == 'h264' || $video_codec == 'h265') {
$video_idx = $i;
$any_h264 = true;
$any_h26x = true;
break;
}
}
@ -131,12 +132,12 @@ function is_valid_webm(array $ffprobe_out) {
}
}
// If the video is not h264 or (there is audio but it's not aac).
if (!$any_h264 || ($audio_idx !== null && !$any_aac)) {
// If the video is not h264, h265 or there is audio but it's not aac.
if (!$any_h26x || ($audio_idx !== null && !$any_aac)) {
return [
'error' => [
'code' => 2,
'msg' => $config['error']['invalidwebm'] . ' [h264/aac check]'
'msg' => $config['error']['invalidwebm'] . ' [h264/h265/aac check]'
]
];
}