编码一次后尝试用 PHP-FFMpeg 打开文件
Trying to open file with PHP-FFMpeg after it was encoded once
在同一个 PHP 过程中,我试图打开一个经过处理和保存的文件,然后我试图用新 FFMpeg\Video 打开它。比如在同一个进程中:
Open -> original.MOV
Manipulate & save to -> new.mp4
Open -> new.mp4
然而,当我试图打开被操纵的文件时,我得到了这个 InvalidArgumentException 异常:
InvalidArgumentException: Unable to detect file format, only audio and video supported
它是 FFMpeg::open() 在无法检测到它是视频流还是音频流后抛出的。
FFMpeg::open()
public function open($pathfile)
{
if (null === $streams = $this->ffprobe->streams($pathfile)) {
throw new RuntimeException(sprintf('Unable to probe "%s".', $pathfile));
}
if (0 < count($streams->videos())) {
return new Video($pathfile, $this->driver, $this->ffprobe);
} elseif (0 < count($streams->audios())) {
return new Audio($pathfile, $this->driver, $this->ffprobe);
}
throw new InvalidArgumentException('Unable to detect file format, only audio and video supported');
}
我对视频应用的过滤器是音频静音和加速(设置)。
所以我想知道,为什么 FFMpeg 不能将其识别为视频?
显然我试图打开一个损坏或不完整的视频文件。无论如何,问题不在于代码或上帝禁止 - php-ffmpeg。
在同一个 PHP 过程中,我试图打开一个经过处理和保存的文件,然后我试图用新 FFMpeg\Video 打开它。比如在同一个进程中:
Open -> original.MOV
Manipulate & save to -> new.mp4
Open -> new.mp4
然而,当我试图打开被操纵的文件时,我得到了这个 InvalidArgumentException 异常:
InvalidArgumentException: Unable to detect file format, only audio and video supported
它是 FFMpeg::open() 在无法检测到它是视频流还是音频流后抛出的。
FFMpeg::open()
public function open($pathfile) { if (null === $streams = $this->ffprobe->streams($pathfile)) { throw new RuntimeException(sprintf('Unable to probe "%s".', $pathfile)); } if (0 < count($streams->videos())) { return new Video($pathfile, $this->driver, $this->ffprobe); } elseif (0 < count($streams->audios())) { return new Audio($pathfile, $this->driver, $this->ffprobe); } throw new InvalidArgumentException('Unable to detect file format, only audio and video supported'); }
我对视频应用的过滤器是音频静音和加速(设置)。
所以我想知道,为什么 FFMpeg 不能将其识别为视频?
显然我试图打开一个损坏或不完整的视频文件。无论如何,问题不在于代码或上帝禁止 - php-ffmpeg。