forked from leftypol/leftypol
ffmpeg.php: add h265 support
This commit is contained in:
parent
a86d88ebfc
commit
7b3442b7c2
1 changed files with 7 additions and 6 deletions
|
|
@ -111,11 +111,12 @@ function is_valid_webm(array $ffprobe_out) {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} elseif ($extension === 'mp4' || stristr($ffprobe_out['format']['format_name'], 'mp4')) {
|
} elseif ($extension === 'mp4' || stristr($ffprobe_out['format']['format_name'], 'mp4')) {
|
||||||
$any_h264 = false;
|
$any_h26x = false;
|
||||||
for ($i = 0; $i < count($trackmap['videoat']); $i++) {
|
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;
|
$video_idx = $i;
|
||||||
$any_h264 = true;
|
$any_h26x = true;
|
||||||
break;
|
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 the video is not h264, h265 or there is audio but it's not aac.
|
||||||
if (!$any_h264 || ($audio_idx !== null && !$any_aac)) {
|
if (!$any_h26x || ($audio_idx !== null && !$any_aac)) {
|
||||||
return [
|
return [
|
||||||
'error' => [
|
'error' => [
|
||||||
'code' => 2,
|
'code' => 2,
|
||||||
'msg' => $config['error']['invalidwebm'] . ' [h264/aac check]'
|
'msg' => $config['error']['invalidwebm'] . ' [h264/h265/aac check]'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue