Modern Python FFmpeg wrappers offer comprehensive support for complex filters, complete with detailed typing and documentation.
Reason this release was yanked:
it is prerelease, use 1.0.0 instead
Project description
typed-ffmpeg
Modern Python FFmpeg wrappers provide extensive support for complex filters, accompanied by detailed typing and documentation.
This API design draws inspiration from the user-friendly ffmpeg-python
package, which offers an easy-to-use Pythonic interface for accessing FFmpeg functionality. However, the ffmpeg-python
package lacks certain features that I require, including:
- IDE friendly
- Built-in documentation for FFmpeg filters
- Comprehensive typing and type checking
- Support for JSON serialization and deserialization of filter graphs
- FFmpeg validation and automatic correction
- Support for partial evaluation of filter graphs
Features - Installation - Quick Usage
Features
-
Built-in Documentation: Checking the FFmpeg documentation every time you want to use a filter can be cumbersome. typed-ffmpeg utilizes docstrings to provide comprehensive documentation for all filters. IDEs and text editors can display this documentation as a tooltip when you hover over a filter.
-
Typed: This package offers comprehensive typing for all filters, including both input and output types. For non-dynamic inputs/outputs, typing is checked by static type checkers such as mypy; for dynamic inputs/outputs, typing is checked at runtime. This can help catch errors early and make your code more robust.
-
No Dependency: typed-ffmpeg is a pure Python package only build on python std library. Relying solely on the Python standard library for a package ensures portability, as it doesn't require additional dependencies for installation. It also minimizes maintenance overhead and security risks while providing stable functionality.
-
Serialization: typed-ffmpeg offers the capability to serialize and deserialize filter graphs to JSON format, enabling you to save the filter graph to a file and reload it for future use.
-
Validate and Auto Fix: The FFMpeg filter graph can be intricate and challenging to construct accurately. typed-ffmpeg provides a functionality to validate and even automatically correct these filter graphs, aiding in rectifying any inconsistencies or errors present within the graph.
[!Note] This feature can be turned off by setting relate flags during
compile
orrun
.
- Partial Evaluation (Coming Soon): typed-ffmpeg provides a way to partially evaluate the filter graph. This can help evaluate the filter graph step by step.
Installation
[!Note] FFmpeg installation is required on your system.
With pip
:
pip install typed-ffmpeg
You can also install support for visualizing filter graphs with graphviz
:
[!Note] Graphviz must be installed on your system.
pip install 'typed-ffmpeg[graph]'
Quick Usage
import ffmpeg
f = (
ffmpeg
.input(filename='input.mp4')
.hflip()
.output(filename='output.mp4')
)
f.run()
[!NOTE] Obtaining the graph is simple; just utilize
f.view()
.
See the Usage section of the docs for more examples!
Acknowledgements
This project was initially conceived upon the release of GPT-3. I embarked on this endeavor to test GPT-3's capability to generate a functional SDK for FFmpeg by providing it with FFmpeg documentation. However, I soon realized that it remained a challenging task for GPT to create a truly usable SDK for FFmpeg. Therefore, I opted to develop an SDK for FFmpeg using traditional code generation methods. Nevertheless, without the assistance of Copilot and GPT, I would not have had the time to complete this project.
I have decided to release this open-source project on February 24, 2024, to commemorate the seventh birthday of my son, Austin. His curiosity and enthusiasm for exploring the world have been a constant source of inspiration throughout this journey.
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
Built Distribution
Hashes for typed_ffmpeg-0.1.32-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46c82c20747e946b667dd5dcb1f266bc254c68783b5ec13e38fe1569b249c6fe |
|
MD5 | bb2f0d5908f2e80430719aeabfc78240 |
|
BLAKE2b-256 | ea704f2aa07dc249883156214e30d8a1f949dcb3d596c00b3ecee1db26a0a361 |