K Ф February 2016

Filter concat:out:v0 has a unconnected output | Concatenating with php-ffmpeg

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?

Answers


Mulvya February 2016

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.

Post Status

Asked in February 2016
Viewed 3,405 times
Voted 13
Answered 1 times

Search




Leave an answer