3

This is my command (url1, url2, url3, url4 are placeholders):

ffmpeg -i url1 -i url2 -i url3 -i url4 -filter_complex "[1:v:0] [1:a:0] [2:v:0] [2:a:0] [3:v:0] [3:v:0] concat=n=4:v=1:a=1 [v] [a]" -map [v] -map [a] /Users/myname/Downloads/f1-2017-07-12.mp4 -y

I get this error

Stream specifier ':v:0' in filtergraph description [1:v:0] [1:a:0] [2:v:0] [2:a:0] [3:v:0] [3:v:0] concat=n=4:v=1:a=1 [v] [a] matches no streams.

Not sure what is going on. I tried all urls individually and they all work (video and audio). I'm just getting this error when I try to concatenate them.

I also tried this using another syntax for filter_complex:

ffmpeg -i url1 -i url2 -i url3 -i url4 -filter_complex [0:0] [0:1] [1:0] [1:1] [2:0] [2:1] [3:0] [3:1] concat=n=4:v=1:a=1 [v] [a] -map [v] [a] /Users/timurridjanovic/Downloads/f1-2017-07-12.mp4 -y

And I get this error:

[AVFilterGraph @ 0x7ffe91703a00] No such filter: '' Error initializing complex filters. Invalid argument

Can someone help me?

Timur Ridjanovic
  • 1,002
  • 1
  • 12
  • 18

3 Answers3

3

You specify 4 segments to concat but feed only 3.

Either use

ffmpeg -i url1 -i url2 -i url3 -i url4 -filter_complex "[1:v:0] [1:a:0] [2:v:0] [2:a:0] [3:v:0] [3:a:0] concat=n=3:v=1:a=1 [v] [a]" -map [v] -map [a] /Users/myname/Downloads/f1-2017-07-12.mp4 -y

or

ffmpeg -i url1 -i url2 -i url3 -i url4 -filter_complex "[0:v:0] [0:a:0] [1:v:0] [1:a:0] [2:v:0] [2:a:0] [3:v:0] [3:a:0] concat=n=4:v=1:a=1 [v] [a]" -map [v] -map [a] /Users/myname/Downloads/f1-2017-07-12.mp4 -y

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • Thx! I tried that but now I get ```Parsed_concat_0 @ 0x7ff650edc1a0] Input link in2:v0 parameters (size 1280x720, SAR 1:1) do not match the corresponding output link in0:v0 parameters (1920x1080, SAR 1:1) [Parsed_concat_0 @ 0x7ff650edc1a0] Failed to configure output pad on Parsed_concat_0 Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #3:0``` – Timur Ridjanovic Jul 13 '17 at 13:49
  • All video streams should have same resolution. Scale them beforehand if they don't. – Gyan Jul 14 '17 at 11:31
3

This solution seems to work:

ffmpeg -i url1 -i url2 -i url3 -i url4 -filter_complex "[0:v:0]scale=1920:1080[c1]; [1:v:0]scale=1920:1080[c2]; [2:v:0]scale=1920:1080[c3]; [3:v:0]scale=1920:1080[c4], [c1] [0:a:0] [c2] [1:a:0] [c3] [2:a:0] [c4] [3:a:0] concat=n=4:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" /Users/myname/Downloads/f1-2017-07-12.mp4 -y

I needed to resize all videos first and then concatenate them. The issue was that the videos were of different sizes.

Timur Ridjanovic
  • 1,002
  • 1
  • 12
  • 18
0

This error can also occur if one of the video inputs has a duration of 0s. So make sure all the video segments have a non-zero duration.

DecimalTurn
  • 3,243
  • 3
  • 16
  • 36