Skip to content

Concat for varying length #468

@Owez

Description

@Owez

I'd like to concatinate a non-fixed amount of audio-video streams together. I currently have a list like so of paths corrosponding to v1, a1, v2, a2, v3, a3 etc which may be varied in length:

x  = ["1.mp4", "1.mp3", "2.mp4", "2.mp3"]

And i'd like to concatinate these. I was thinking something like:

ffmpeg.concat(*x, v=1, a=1).output("output.mp4").run()

But it apparently only accepts a ffmpeg.nodes.FilterableStream as seen in this traceback:

Traceback (most recent call last):
  File "redata.py", line 180, in <module>
    ffmpeg.concat(*videostream, v=1, a=1).output("playlist.mp4").run()
  File "/home/owen/.local/share/virtualenvs/redata-c2MOZ56k/lib/python3.8/site-packages/ffmpeg/_filters.py", line 399, in concat
    return FilterNode(streams, concat.__name__, kwargs=kwargs, max_inputs=None).stream()
  File "/home/owen/.local/share/virtualenvs/redata-c2MOZ56k/lib/python3.8/site-packages/ffmpeg/nodes.py", line 266, in __init__
    super(FilterNode, self).__init__(
  File "/home/owen/.local/share/virtualenvs/redata-c2MOZ56k/lib/python3.8/site-packages/ffmpeg/nodes.py", line 202, in __init__
    self.__check_input_types(stream_map, incoming_stream_types)
  File "/home/owen/.local/share/virtualenvs/redata-c2MOZ56k/lib/python3.8/site-packages/ffmpeg/nodes.py", line 172, in __check_input_types
    raise TypeError(
TypeError: Expected incoming stream(s) to be of one of the following types: ffmpeg.nodes.FilterableStream; got <class 'str'>

Any help would be appreciated, I cant seem to get it to work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions