ffmpy3
ffmpy3 is a fork of ffmpy, a simplistic FFmpeg command line wrapper. ffmpy implements a Pythonic interface for executing FFmpeg via command line and uses Python's subprocess module for synchronous execution. Asynchronous execution using yield from or await is also supported using Python's asyncio.subprocess module.
Installation
You guessed it:
pip install ffmpy3
Quick example
The following code snippet executes FFmpeg synchronously, taking input.mp4
from the current directory as the input. It remuxes the contents of input.mp4
into a new file called output.avi
which is saved in the current directory.
>>> import ffmpy3
>>> ff = ffmpy3.FFmpeg(
... inputs={'input.mp4': None},
... outputs={'output.avi': None}
... )
>>> ff.run()
The following code snippet does the same thing as above, but executes FFmpeg asynchronously.
>>> ff = ffmpy3.FFmpeg(
... inputs={'input.mp4': None},
... outputs={'output.avi': None}
... )
>>> ff.run_async()
>>> await ff.wait()
Documentation
See Examples section for usage examples.
License
ffmpy3 is licensed under the terms of the MIT license.