0

- Full Error:

Stream specifier 's1:v' in filtergraph description [0]split=2:outputs=2[s0][s1];[s1:v]reverse[s2];[s0][s2]concat=a=0:n=2:v=1[s3] matches no streams.

- Formatted Error

  • [0]split=2:outputs=2[s0][s1];
  • [s1:v]reverse[s2];
  • [s0][s2]concat=a=0:n=2:v=1[s3]

- Code:

instances = (
    ffmpeg
    .input(self.video_file)
    .filter_multi_output(filter_name="split", outputs=2)
)
ordered_edits = []
for i in range(2):
    if i%2 == 0:
        ordered_edits.append(
            instances[i]
        )
    else:
        ordered_edits.append(
            instances[i].video.filter(filter_name="reverse")
        )
(
    ffmpeg
    .concat(*ordered_edits, a=0, v=1)
    .output('done/output.mp4')
    .run(overwrite_output=True))

Looking at the error code, it seems like s1:v should be a valid reference. The only thing I can think of is that there is an issue saving an exclusive video input into a nonspecified output. The files don't actually have any audio, I just want the video.

I'm lost, please help ffmpeg experts of the world!

2 Answers2

0

Using .video is redundant here.

Per the ffmpeg documentation:

17.33 split, asplit

Split input into several identical outputs.

asplit works with audio input, split with video.

The filter accepts a single parameter which specifies the number of outputs. If unspecified, it defaults to 2.

In other words, by using a split filter, you are implicitly stripping audio off of the video. I am not totally sure why s1:v is an error, instead of just a no-op, but it does seem to be the cause of the error.

This works fine for me:

instances = (
    ffmpeg
    .input("input.mp4")
    .filter_multi_output(filter_name="split", outputs=2)
)
ordered_edits = []
for i in range(2):
    if i%2 == 0:
        ordered_edits.append(
            instances[i]
        )
    else:
        ordered_edits.append(
            instances[i].filter(filter_name="reverse")
        )
(
    ffmpeg
    .concat(*ordered_edits, a=0, v=1)
    .output('output.mp4')
    .run(overwrite_output=True))

This produces a video where the input video plays, then plays backwards, which I assume is what was intended.

Nick ODell
  • 15,465
  • 3
  • 32
  • 66
-1

The error message indicates that the s1:v stream specifier in the filtergraph description is not matching any streams. This is probably because the reverse filter is only being applied to the video stream, but not to the audio stream, which is causing the output streams to be mismatched.

jim bakov
  • 1
  • 1
  • Thanks for the answer. I generally understand your answer, but I am not sure how to actually fix it. – Will Beeson Apr 19 '23 at 00:53
  • you can use the split filter to split both the audio and video streams into separate outputs, and then apply the reverse filter to both outputs before concatenating them back together. – jim bakov Apr 19 '23 at 00:55
  • The videos don't actually have any audio, so I don't think that would work. How do you split video and audio into separate outputs? – Will Beeson Apr 19 '23 at 01:01
  • @WillBeeson If the videos don't have audio, then why are you saving as an mp3 file? – Nick ODell Apr 19 '23 at 01:04
  • Bug. Hadn't had a chance to catch that bug because the code hadn't gotten that far, just changed it and ran it again with the same problem. – Will Beeson Apr 19 '23 at 01:09
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 21 '23 at 04:47