ffmpeg.php: fix track selection

This commit is contained in:
Zankaria 2026-03-03 00:15:31 +01:00
parent c4f8619b5c
commit 3b79619643

View file

@ -17,10 +17,9 @@ function get_webm_info($filename) {
$validcheck = is_valid_webm($ffprobe_out);
$webminfo['error'] = $validcheck['error'];
if (empty($webminfo['error'])) {
$trackmap = $validcheck['trackmap'];
$videoidx = $trackmap['videoat'][$validcheck['video_idx']];
$webminfo['width'] = $ffprobe_out['streams'][$videoidx]['width'];
$webminfo['height'] = $ffprobe_out['streams'][$videoidx]['height'];
$video_idx = $validcheck['video_idx'];
$webminfo['width'] = $ffprobe_out['streams'][$video_idx]['width'];
$webminfo['height'] = $ffprobe_out['streams'][$video_idx]['height'];
$webminfo['duration'] = $ffprobe_out['format']['duration'];
}
return $webminfo;
@ -53,7 +52,6 @@ function locate_webm_tracks($ffprobe_out) {
* @param string $ffprobe_out
* @return array<array> An array with the following values:
* error: array with error code and message
* trackmap: decoded ffprobe output
* video_idx: int, index of the video track
* audio_idx: ?int, index of the audio track, if present
*/
@ -156,7 +154,6 @@ function is_valid_webm(array $ffprobe_out) {
return [
'error' => [],
'trackmap' => $trackmap,
'video_idx' => $video_idx,
'audio_idx' => $audio_idx
];