Skip to main content

AsyFFmpeg

AsyFFmpeg is a Python library for interacting asynchronously with FFmpeg to perform various operations on media files.

Note: When coding links, photos and more, the progress event will not work. Progress is available only when encoding a local video file

Installation

To install AsyFFmpeg, run the following command:

pip install asyffmpeg
pip install -r requirements.txt --upgrade

Usage

An example of how to use the library:

import asyncio
from datetime import timedelta
from asyffmpeg import AsyFFmpeg

async def start(input:str, output:str):
    print(f'[start]: {input} -> {output}')

async def end(encoding_time:timedelta):
    print(f'[end]: {encoding_time}')

async def progress(progress:float, elapsed_time:timedelta, remaining_time:timedelta,
                   frame:int, is_finished:bool, bitrate:float):
    print(f'#{frame} | [{progress}] [{elapsed_time}] [{bitrate}]: [{remaining_time}] [?:{is_finished}]')


async def encode_video():
    ffmpeg = AsyFFmpeg(debug=False)
    ffmpeg.input("input.mp4")
    ffmpeg.output("output.mp4")
    ffmpeg.args({'vf': 'scale=1920:1080', 'codec:a': 'aac'})
    ffmpeg.on_event('start', start)
    ffmpeg.on_event('end', end)
    ffmpeg.on_event('progress', progress)
    await ffmpeg.run()

asyncio.run(encode_video())

Features

  • Asynchronous interface for interacting with FFmpeg.
  • User-friendly API for controlling video and audio encoding.
  • Support for various FFmpeg parameters and filters.
  • Support for events such as progress, start and end.

License

AsyFFmpeg is distributed under the MIT license.

Metadata

Release files for asyffmpeg 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyffmpeg 0.2.4
File Size Uploaded Provenance Actions
asyffmpeg-0.2.4.tar.gz 6.8 kB Without provenance Details for asyffmpeg-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asyffmpeg 0.2.4
File Interpreter ABI Platform Actions
asyffmpeg-0.2.4-py3-none-any.whl Python 3 none any Details for asyffmpeg-0.2.4-py3-none-any.whl

Total release size: 14.3 kB

Release files / asyffmpeg-0.2.4.tar.gz

Download URL asyffmpeg-0.2.4.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e32c1d7d8352011032f85def541cb991722a36bc44b1f6fe3d95e349b822b038
BLAKE2b-256 checksum
How to use checksums
5ba3c7f0180adea511c320882c50d6bad8c61e5242f1a390a735dcde561f0fd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / asyffmpeg-0.2.4-py3-none-any.whl

Download URL asyffmpeg-0.2.4-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73aa7b9c1a1defea6aa60939e9143a74cf0f854a27044c21535f179d5ff3918f
BLAKE2b-256 checksum
How to use checksums
c021f96172cef8df34ac4244704bd793135d81d44ebde5aa9130e11962ae6bd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Security for asyffmpeg 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page