mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-06 04:15:44 +08:00
#17: auto-generate split output count
This commit is contained in:
parent
5d78a2595d
commit
cf1b7bfd4b
@ -59,7 +59,7 @@ def _get_filter_spec(node, outgoing_edge_map, stream_name_map):
|
|||||||
outgoing_edges = get_outgoing_edges(node, outgoing_edge_map)
|
outgoing_edges = get_outgoing_edges(node, outgoing_edge_map)
|
||||||
inputs = [stream_name_map[edge.upstream_node, edge.upstream_label] for edge in incoming_edges]
|
inputs = [stream_name_map[edge.upstream_node, edge.upstream_label] for edge in incoming_edges]
|
||||||
outputs = [stream_name_map[edge.upstream_node, edge.upstream_label] for edge in outgoing_edges]
|
outputs = [stream_name_map[edge.upstream_node, edge.upstream_label] for edge in outgoing_edges]
|
||||||
filter_spec = '{}{}{}'.format(''.join(inputs), node._get_filter(), ''.join(outputs))
|
filter_spec = '{}{}{}'.format(''.join(inputs), node._get_filter(outgoing_edges), ''.join(outputs))
|
||||||
return filter_spec
|
return filter_spec
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,11 +148,17 @@ class FilterNode(Node):
|
|||||||
kwargs=kwargs
|
kwargs=kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_filter(self):
|
def _get_filter(self, outgoing_edges):
|
||||||
params_text = self.name
|
args = self.args
|
||||||
arg_params = ['{}'.format(arg) for arg in self.args]
|
kwargs = self.kwargs
|
||||||
kwarg_params = ['{}={}'.format(k, self.kwargs[k]) for k in sorted(self.kwargs)]
|
if self.name == 'split':
|
||||||
|
args = [len(outgoing_edges)]
|
||||||
|
|
||||||
|
arg_params = ['{}'.format(arg) for arg in args]
|
||||||
|
kwarg_params = ['{}={}'.format(k, kwargs[k]) for k in sorted(kwargs)]
|
||||||
params = arg_params + kwarg_params
|
params = arg_params + kwarg_params
|
||||||
|
|
||||||
|
params_text = self.name
|
||||||
if params:
|
if params:
|
||||||
params_text += '={}'.format(':'.join(params))
|
params_text += '={}'.format(':'.join(params))
|
||||||
return params_text
|
return params_text
|
||||||
|
@ -122,7 +122,7 @@ def test_get_args_complex_filter():
|
|||||||
'-i', TEST_OVERLAY_FILE,
|
'-i', TEST_OVERLAY_FILE,
|
||||||
'-filter_complex',
|
'-filter_complex',
|
||||||
'[0]vflip[s0];' \
|
'[0]vflip[s0];' \
|
||||||
'[s0]split[s1][s2];' \
|
'[s0]split=2[s1][s2];' \
|
||||||
'[s1]trim=end_frame=20:start_frame=10[s3];' \
|
'[s1]trim=end_frame=20:start_frame=10[s3];' \
|
||||||
'[s2]trim=end_frame=40:start_frame=30[s4];' \
|
'[s2]trim=end_frame=40:start_frame=30[s4];' \
|
||||||
'[s3][s4]concat=n=2[s5];' \
|
'[s3][s4]concat=n=2[s5];' \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user