Skip to main content

FFmpeg Wrapper for Python

Project description

FFmpeg-studio

PyPI License Docs GitHub stars

ffmpeg-studio provides a Pythonic interface to FFmpeg, allowing users to construct and execute FFmpeg commands programmatically.

It simplifies and Handles:

  • Complex filter generation
  • All popular Filters and Baseclass for custom filters
  • Automatic Safe quoting & escaping
  • Input handling & stream selection
  • Output mapping & stream selection
  • Progress tracking with callbacks
  • Allows direct flags in command.
  • Scanning metadata with ffprobe.
  • Long filter graphs.

diagram

Installation

From PyPi

pip install ffmpeg-studio

From Source

pip install git+https://github.com/electro199/ffmpeg-studio.git

Usage

ffmpeg-studio support complex Filters and can be used with apply or apply2.

from ffmpeg import FFmpeg, InputFile, FileInputOptions, Map
from ffmpeg.filters import apply, Scale, Overlay

# set options
clip = InputFile("video.mp4", FileInputOptions(duration=10))
overlay = InputFile("overlay.png")

# apply scale filter on clip
upscaled_clip = apply(Scale(1440, 1920), clip)

# apply scale filter on overlay
overlay = apply(Scale(100, 100), overlay)

# apply overlay filter with overlay on upscaled_clip
upscaled_clip = apply(Overlay(overlay, x=0, y=10), clip)


ffmpeg = FFmpeg()

# add output
ffmpeg.output(upscaled_clip, path="out.mp4")

# run command
ffmpeg.run(progress_callback=print)

For simple media conversion :

from ffmpeg.inputs import VideoFile
from ffmpeg import export

clip = VideoFile("video.mp4")

export(
   clip,
   path="out.mkv",
).run()

Install FFmpeg

This project does not install ffmpeg utility automatically.

Verify ffmpeg is installed:

ffmpeg -version

Windows

Using winget:

winget install --id=Gyan.FFmpeg  -e

or download and install FFmpeg from FFmpeg official website:

  1. Download the latest FFmpeg build from here.
  2. Extract the archive and add the bin directory to your system PATH.

macOS

Using Homebrew:

brew install ffmpeg

Linux

For Debian/Ubuntu:

sudo apt install ffmpeg

To-Do

  • All Input methods

    • Generic(Input) class
    • ImageFile class
    • VideoFile class
    • AudioFile class
    • VituralVideo class
    • VituralAudio class
  • Output options

    • Muliple output per command
    • filter_file for super long filters
    • Per map flags
    • Per output flags
  • Improve progress tracking

    • Support callbacks with frame/time info
    • Provide async interface for streaming progress
  • Documentation & Examples

    • Basic tutorials.
    • Showcase filtergraph construction with helpers
    • Detailed tutorials.
    • Detailed example/gallery.
  • Testing & CI

    • Publish to PyPI every release
    • Publish Docs every release
    • Verify cross-platform behavior (Linux/Windows/macOS)
    • GitHub Actions for automated testing
  • Packaging & Distribution

    • Publish to PyPI

Project details


Download files

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

Source Distribution

ffmpeg_studio-0.1.2.tar.gz (124.7 kB view details)

Uploaded Source

Built Distribution

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

ffmpeg_studio-0.1.2-py3-none-any.whl (56.0 kB view details)

Uploaded Python 3

File details

Details for the file ffmpeg_studio-0.1.2.tar.gz.

File metadata

  • Download URL: ffmpeg_studio-0.1.2.tar.gz
  • Upload date:
  • Size: 124.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for ffmpeg_studio-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7b0a5b93ec3f561db3cbc55641089f5b7c30f5a871d05740324443e30eccc5bb
MD5 ebe5c664fd93a2d2b5d479fde507f906
BLAKE2b-256 5c19a1b0dda832cbe7f4c2b96d9b4dae871c6b18bfb121d07046fb1e29cc6e49

See more details on using hashes here.

File details

Details for the file ffmpeg_studio-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ffmpeg_studio-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 56.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for ffmpeg_studio-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55bbd722b69adf9e67694b1677c268450e1d40d5f17b557bd1e4cbcae3a5d38e
MD5 845d89f4dd316ff41af73a934baaf30f
BLAKE2b-256 1b22f03283d53ee231a84888099a9b40c6c1b45fecbb7b52d0a169fdc2155e76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page