3

I'm incorporating PHP-FFMpeg to my symfony3 project which is working perfectly. However recently I've been needing to concatenate two videos into one, and it would appear it's not supported. So I created a ConcatVideoFilter class that I'm using based off of this

    public function apply(Video $video, VideoInterface $format)
    {
        $params = [];
        $count = count($this->files) + 1;
        foreach ($this->files as $i => $file) {
            $params[] = '-i';
            $params[] = $file;
        }
        $params[] = '-filter_complex';
        $params[] = 'concat=n='.$count.':v=1:a=1 [v]';
        $params[] = '-map';
        $params[] = '[v]';
        return $params;
    }

I'm getting an encoding failed error in my symfony profiler

RuntimeException: Encoding failed, ExecutionFailureException: ffmpeg failed to execute command

I then copy pasted the actual ffmpeg command line to see what error it would give:

Filter concat:out:v0 has a unconnected output

Which is giving me this error

Filter concat:out:v0 has a unconnected output

What does this error mean, and what can I do to get rid of it?

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
kemicofa ghost
  • 16,349
  • 8
  • 82
  • 131
  • Why did you make a screenshot instead of simply copying and pasting the text? Screenshots are harder to read, they can't be searched, text can't be copied form it, they take longer to download, and seem to rely on a 3rd party host. – llogan Feb 08 '16 at 20:12
  • @LordNeckbeard It was more on giving a general idea of what I did, since I believed that the error was coming from my PHP class (which I added as text) rather than ffmpeg itself. In the end, it was like Mulvya pointed out. – kemicofa ghost Feb 09 '16 at 08:26

1 Answers1

2

You need

    $params[] = '-filter_complex';
    $params[] = 'concat=n='.$count.':v=1:a=1 [v][a]';
    $params[] = '-map';
    $params[] = '[v]';
    $params[] = '-map';
    $params[] = '[a]';

Your concat filter exports an audio output but you didn't assign it an output pad and then map it.

Gyan
  • 85,394
  • 9
  • 169
  • 201