pympeg (python + ffmpeg)
A simple to use ffmpeg binding in python. Simple filters command can be implemented using simple functions without worrying about the ffmpeg syntax.
Useful in situation when you know how to construct ffmpeg command but don't want it to look ugly with for loops.
Usage
Four functions to work with:
pympeg.input(name="example.mp4")pympeg.filter(intputs=any, filter_name="trim", params={"start": 3, "duration": 10})pympeg.arg(caller=any, args="concat=n=1", outputs=["audio", "video"]) # inputs= is availablepympeg.run() # default adds overwrite file option (ffmpeg -y )graph = pympeg.graph() # returns a list of nodes, use print to get representationExamples
- Adding filters
out = (
pympeg.input(name="example.mp4")
.filter(filter_name="trim", params={"start": 2, "duration": 10})
.output(name="output.mp4")
.run()
)
command generated :: ffmpeg -i example.mp4 -y -filter_complex \
"[0] trim=start=2:duration=10 [nyQ]" -map "[nyQ]" output.mp4 - Implementing simple file conversion
out = (
pympeg.input(name="example.mp4")
.output(name="example.wav")
.run()
)
command generated :: ffmpeg -i example.mp4 example.wav Note: Use pympeg.init() when using multiple run commands
Contribute
Yes! all/any contributions are welcome.
On this page
Languages
Python100.0%
Contributors
Latest Release
v0.0.1January 11, 2021The Unlicense
Created December 31, 2020
Updated February 13, 2023