Skip to content

Commit

Permalink
pass input_typings in vfilter / afilter (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemia authored Feb 16, 2024
1 parent c1aaa82 commit b6671c1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/ffmpeg/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Any

from ffmpeg.schema import StreamType

from .dag.nodes import FilterableStream, FilterNode, InputNode, MergeOutputsNode, OutputNode, OutputStream
from .streams.audio import AudioStream
from .streams.av import AVStream
Expand Down Expand Up @@ -54,7 +56,9 @@ def merge_outputs(*streams: OutputStream) -> OutputStream:
return MergeOutputsNode(inputs=streams).stream()


def vfilter(*streams: FilterableStream, name: str, **kwargs: Any) -> VideoStream:
def vfilter(
*streams: FilterableStream, name: str, input_typings: tuple[StreamType, ...] = (StreamType.video,), **kwargs: Any
) -> VideoStream:
"""
Apply a custom video filter which has only one output to this stream
Expand All @@ -69,10 +73,12 @@ def vfilter(*streams: FilterableStream, name: str, **kwargs: Any) -> VideoStream
Note:
This function is for custom filter which is not implemented in typed-ffmpeg
"""
return FilterNode(name=name, inputs=streams, kwargs=tuple(kwargs.items())).video(0)
return FilterNode(name=name, inputs=streams, input_typings=input_typings, kwargs=tuple(kwargs.items())).video(0)


def afilter(*streams: FilterableStream, name: str, **kwargs: Any) -> AudioStream:
def afilter(
*streams: FilterableStream, name: str, input_typings: tuple[StreamType, ...] = (StreamType.audio,), **kwargs: Any
) -> AudioStream:
"""
Apply a custom audio filter which has only one output to this stream
Expand All @@ -87,7 +93,7 @@ def afilter(*streams: FilterableStream, name: str, **kwargs: Any) -> AudioStream
Note:
This function is for custom filter which is not implemented in typed-ffmpeg
"""
return FilterNode(name=name, inputs=streams, kwargs=tuple(kwargs.items())).audio(0)
return FilterNode(name=name, inputs=streams, input_typings=input_typings, kwargs=tuple(kwargs.items())).audio(0)


def filter_multi_output(*streams: FilterableStream, name: str, **kwargs: Any) -> FilterNode:
Expand Down

0 comments on commit b6671c1

Please sign in to comment.