ffmpeg.php: Use first available video if more than on is present

This commit is contained in:
Zankaria 2025-10-09 22:45:11 +02:00
parent 8bb7daefae
commit 477485458e

View file

@ -62,7 +62,7 @@ function is_valid_webm($ffprobe_out) {
$trackmap = locate_webm_tracks($ffprobe_out); $trackmap = locate_webm_tracks($ffprobe_out);
// one video track // one video track
if (count($trackmap['videoat']) != 1) { if (count($trackmap['videoat']) < 1) {
return [ return [
'error' => [ 'error' => [
'code' => 2, 'code' => 2,
@ -70,6 +70,7 @@ function is_valid_webm($ffprobe_out) {
] ]
]; ];
} }
// If there's more than one video, yolo it
$videoidx = $trackmap['videoat'][0]; $videoidx = $trackmap['videoat'][0];
$extension = pathinfo($ffprobe_out['format']['filename'], PATHINFO_EXTENSION); $extension = pathinfo($ffprobe_out['format']['filename'], PATHINFO_EXTENSION);