1

in the same PHP process I'm trying to open a file that was manipulated and saved, and then I'm trying to open it with as a new FFMpeg\Video. For example, in the same process:

Open -> original.MOV
  Manipulate & save to -> new.mp4
    Open -> new.mp4

However when I'm trying to open the manipulated file I get this InvalidArgumentException exception:

InvalidArgumentException: Unable to detect file format, only audio and video supported

It's thrown by the FFMpeg::open() after it could not detect that it's a either Video or Audio stream.

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');
}

The filters I applied to the video are audio mute and speedup (setpts).

So I wonder, why FFMpeg doesn't recognise it as video?

Rami
  • 381
  • 2
  • 4
  • 15
  • What ffmpeg command was applied to the MOV? – Gyan May 19 '16 at 05:44
  • Basically if I had to convert it to ffmpeg it would probably be: ffmpeg -i tests/clips/originals/clip1.MOV -vf 'setpts=(1/5)*PTS' -an tests/clips/video_1.mp4 – Rami May 19 '16 at 10:24
  • Looks good. You need to read in the actual error reported by FFmpeg, sent to stderr. – Gyan May 19 '16 at 10:45
  • Well, I use Monolog for logging and I see logs only of ffprobe commands and no ffmpeg :/ – Rami May 19 '16 at 12:49
  • Since you're using ffprobe to probe, what do those logs say? – Gyan May 19 '16 at 13:00
  • Never mind, I made a mistake inside my code where I tried to a load a corrupted video file. Thank you @Mulvya for helping my friend. – Rami May 19 '16 at 16:57

1 Answers1

0

Apparently I was trying to open a video file that was corrupted or incomplete. Anyway, the problem wasn't with the code or god forbid - php-ffmpeg.

Rami
  • 381
  • 2
  • 4
  • 15