diff --git a/ffmpeg/_run.py b/ffmpeg/_run.py index 83117e4..8e4af83 100644 --- a/ffmpeg/_run.py +++ b/ffmpeg/_run.py @@ -59,7 +59,7 @@ def _get_filter_spec(node, outgoing_edge_map, stream_name_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] 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 diff --git a/ffmpeg/nodes.py b/ffmpeg/nodes.py index 11b8f85..ca060be 100644 --- a/ffmpeg/nodes.py +++ b/ffmpeg/nodes.py @@ -148,11 +148,17 @@ class FilterNode(Node): kwargs=kwargs ) - def _get_filter(self): - params_text = self.name - arg_params = ['{}'.format(arg) for arg in self.args] - kwarg_params = ['{}={}'.format(k, self.kwargs[k]) for k in sorted(self.kwargs)] + def _get_filter(self, outgoing_edges): + args = self.args + kwargs = 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_text = self.name if params: params_text += '={}'.format(':'.join(params)) return params_text diff --git a/ffmpeg/tests/test_ffmpeg.py b/ffmpeg/tests/test_ffmpeg.py index 47f8f72..a0d1396 100644 --- a/ffmpeg/tests/test_ffmpeg.py +++ b/ffmpeg/tests/test_ffmpeg.py @@ -122,7 +122,7 @@ def test_get_args_complex_filter(): '-i', TEST_OVERLAY_FILE, '-filter_complex', '[0]vflip[s0];' \ - '[s0]split[s1][s2];' \ + '[s0]split=2[s1][s2];' \ '[s1]trim=end_frame=20:start_frame=10[s3];' \ '[s2]trim=end_frame=40:start_frame=30[s4];' \ '[s3][s4]concat=n=2[s5];' \