A python binding for FFmpeg which provides sync and async APIs
Project description
python-ffmpeg
A python binding for FFmpeg which provides sync and async APIs
Help
See documentation for more details.
Install
To install python-ffmpeg, simply use pip:
$ pip install python-ffmpeg
Examples
You can find more examples in the documentation.
Transcoding
from ffmpeg import FFmpeg, Progress
def main():
ffmpeg = (
FFmpeg()
.option("y")
.input("input.mp4")
.output(
"ouptut.mp4",
{"codec:v": "libx264"},
vf="scale=1280:-1",
preset="veryslow",
crf=24,
)
)
ffmpeg.execute()
if __name__ == "__main__":
main()
Recording
from ffmpeg import FFmpeg, Progress
def main():
ffmpeg = (
FFmpeg()
.option("y")
.input(
"rtsp://username:password@127.0.0.1/cam",
rtsp_transport="tcp",
rtsp_flags="prefer_tcp",
)
.output("output.mp4", vcodec="copy")
)
@ffmpeg.on("progress")
def time_to_terminate(progress: Progress):
if progress.frame > 200:
ffmpeg.terminate()
ffmpeg.execute()
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-ffmpeg-2.0.0.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file python-ffmpeg-2.0.0.tar.gz
.
File metadata
- Download URL: python-ffmpeg-2.0.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc16c26f5b4af0881d7e34e1d86a03b8075153f32dd4f35909ef401086903700 |
|
MD5 | df1c812a2a3709568aec5723ea1bcc81 |
|
BLAKE2b-256 | c9525ef21cbcf3383dc13740a7e8f414898541b50bacccd242d2daf0dc8906f2 |
File details
Details for the file python_ffmpeg-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: python_ffmpeg-2.0.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 496e5ac8e78d39c4630dcc6922b90dba4059928d46b5419aff12249aa11cb115 |
|
MD5 | 01f224ef301604df19dd6805ae595d00 |
|
BLAKE2b-256 | 97f29fd3c84006188d9320c1ffd86c651530f832aa669e29a57ff418dcecdb3f |