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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyffmpeg-0.2.4.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyffmpeg-0.2.4-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file asyffmpeg-0.2.4.tar.gz.

File metadata

  • Download URL: asyffmpeg-0.2.4.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for asyffmpeg-0.2.4.tar.gz
Algorithm Hash digest
SHA256 e32c1d7d8352011032f85def541cb991722a36bc44b1f6fe3d95e349b822b038
MD5 a02b91806ee6053c88c20d4097da0931
BLAKE2b-256 5ba3c7f0180adea511c320882c50d6bad8c61e5242f1a390a735dcde561f0fd1

See more details on using hashes here.

File details

Details for the file asyffmpeg-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: asyffmpeg-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for asyffmpeg-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 73aa7b9c1a1defea6aa60939e9143a74cf0f854a27044c21535f179d5ff3918f
MD5 a94ecdf697e745e66fed3a873db2fa3c
BLAKE2b-256 c021f96172cef8df34ac4244704bd793135d81d44ebde5aa9130e11962ae6bd8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2

2 files

0.1

2 files

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