MCPcopy Create free account
hub / github.com/kkroening/ffmpeg-python / get_args

Function get_args

ffmpeg/_run.py:150–171  ·  view source on GitHub ↗

Build command-line arguments to be passed to ffmpeg.

(stream_spec, overwrite_output=False)

Source from the content-addressed store, hash-verified

148
149@output_operator()
150def get_args(stream_spec, overwrite_output=False):
151 """Build command-line arguments to be passed to ffmpeg."""
152 nodes = get_stream_spec_nodes(stream_spec)
153 args = []
154 # TODO: group nodes together, e.g. `-i somefile -r somerate`.
155 sorted_nodes, outgoing_edge_maps = topo_sort(nodes)
156 input_nodes = [node for node in sorted_nodes if isinstance(node, InputNode)]
157 output_nodes = [node for node in sorted_nodes if isinstance(node, OutputNode)]
158 global_nodes = [node for node in sorted_nodes if isinstance(node, GlobalNode)]
159 filter_nodes = [node for node in sorted_nodes if isinstance(node, FilterNode)]
160 stream_name_map = {(node, None): str(i) for i, node in enumerate(input_nodes)}
161 filter_arg = _get_filter_arg(filter_nodes, outgoing_edge_maps, stream_name_map)
162 args += reduce(operator.add, [_get_input_args(node) for node in input_nodes])
163 if filter_arg:
164 args += ['-filter_complex', filter_arg]
165 args += reduce(
166 operator.add, [_get_output_args(node, stream_name_map) for node in output_nodes]
167 )
168 args += reduce(operator.add, [_get_global_args(node) for node in global_nodes], [])
169 if overwrite_output:
170 args += ['-y']
171 return args
172
173
174@output_operator()

Callers 1

compileFunction · 0.85

Calls 6

get_stream_spec_nodesFunction · 0.85
topo_sortFunction · 0.85
_get_filter_argFunction · 0.85
_get_input_argsFunction · 0.85
_get_output_argsFunction · 0.85
_get_global_argsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…