Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to take several subsections of a video and concatenate them using the concat ffmpeg filter. It's just like the the example in the FFmpeg documentation, except that all of the clips are from the same source video.

Here is what I am trying:

ffmpeg \
  -ss 1.0 -frames:v 20 -i myInput.mp4 \
  -ss 2.0 -frames:v 20 -i myInput.mp4 \
  -ss 3.0 -frames:v 20 -i myInput.mp4 \
  -filter_complex '[0:0][0:1][1:0][1:1][2:0][2:1]concat=n=3:v=1:a=2[v][a1][a2]' \
  -map '[v]' -map '[a1]' -map '[a2]' myOutput.mp4

When I try this, I get the following error (full output here):

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

A few things:

  • What's with the error? According to the stderr output, those streams do exist. What am I missing?
  • Shouldn't the -ss (and -frames:v) be reflected in the "Duration: ... start: ... " line of the stderr output when the inputs are listed?
  • Will the "-frames:v" option even work to specify the duration of an input? (apparently -t is only for output??) Is there a way to specify the duration of an input with seconds instead of frames?

Help me LordNeckbeard -- you're my only hope!

share|improve this question

migrated from stackoverflow.com Mar 31 '13 at 0:16

This question came from our site for professional and enthusiast programmers.

    
The error message isn't very informative for users, but I believe it is the result of all of your inputs having one audio stream each and you're telling the filter that you want two output audio streams. You probably want one audio stream. Try '[0:0][0:1][1:0][1:1][2:0][2:1]concat=n=3:v=1:a=1[v][a1]' and remove -map '[a2]'. However, I'm not sure if what you're trying to do is currently possible, and you may have to create the segments and then use the concat demuxer. –  LordNeckbeard Apr 1 '13 at 20:56
    
Actually maybe it would be possible with use of the aselect/select filters, but I haven't looked into it or tried. Someone else may have a better idea - there are other users who often provide better answers. You can also always try the ffmpeg-user mailing list. –  LordNeckbeard Apr 1 '13 at 21:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.