Asynchronously invoke ffmpeg for the supplied node graph. Args: pipe_stdin: if True, connect pipe to subprocess stdin (to be used with ``pipe:`` ffmpeg inputs). pipe_stdout: if True, connect pipe to subprocess stdout (to be used with ``pipe:`` ffmpeg outp
(
stream_spec,
cmd='ffmpeg',
pipe_stdin=False,
pipe_stdout=False,
pipe_stderr=False,
quiet=False,
overwrite_output=False,
)
| 192 | |
| 193 | @output_operator() |
| 194 | def run_async( |
| 195 | stream_spec, |
| 196 | cmd='ffmpeg', |
| 197 | pipe_stdin=False, |
| 198 | pipe_stdout=False, |
| 199 | pipe_stderr=False, |
| 200 | quiet=False, |
| 201 | overwrite_output=False, |
| 202 | ): |
| 203 | """Asynchronously invoke ffmpeg for the supplied node graph. |
| 204 | |
| 205 | Args: |
| 206 | pipe_stdin: if True, connect pipe to subprocess stdin (to be |
| 207 | used with ``pipe:`` ffmpeg inputs). |
| 208 | pipe_stdout: if True, connect pipe to subprocess stdout (to be |
| 209 | used with ``pipe:`` ffmpeg outputs). |
| 210 | pipe_stderr: if True, connect pipe to subprocess stderr. |
| 211 | quiet: shorthand for setting ``capture_stdout`` and |
| 212 | ``capture_stderr``. |
| 213 | **kwargs: keyword-arguments passed to ``get_args()`` (e.g. |
| 214 | ``overwrite_output=True``). |
| 215 | |
| 216 | Returns: |
| 217 | A `subprocess Popen`_ object representing the child process. |
| 218 | |
| 219 | Examples: |
| 220 | Run and stream input:: |
| 221 | |
| 222 | process = ( |
| 223 | ffmpeg |
| 224 | .input('pipe:', format='rawvideo', pix_fmt='rgb24', s='{}x{}'.format(width, height)) |
| 225 | .output(out_filename, pix_fmt='yuv420p') |
| 226 | .overwrite_output() |
| 227 | .run_async(pipe_stdin=True) |
| 228 | ) |
| 229 | process.communicate(input=input_data) |
| 230 | |
| 231 | Run and capture output:: |
| 232 | |
| 233 | process = ( |
| 234 | ffmpeg |
| 235 | .input(in_filename) |
| 236 | .output('pipe':, format='rawvideo', pix_fmt='rgb24') |
| 237 | .run_async(pipe_stdout=True, pipe_stderr=True) |
| 238 | ) |
| 239 | out, err = process.communicate() |
| 240 | |
| 241 | Process video frame-by-frame using numpy:: |
| 242 | |
| 243 | process1 = ( |
| 244 | ffmpeg |
| 245 | .input(in_filename) |
| 246 | .output('pipe:', format='rawvideo', pix_fmt='rgb24') |
| 247 | .run_async(pipe_stdout=True) |
| 248 | ) |
| 249 | |
| 250 | process2 = ( |
| 251 | ffmpeg |