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
  • 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.

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)

# run command
ffmpeg = (
    FFmpeg().output(upscaled_clip, path="out.mp4").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.1.tar.gz (128.0 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.1-py3-none-any.whl (56.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ffmpeg_studio-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a97d919780daff87fb381194a944aabc6912049925931daf7c069e42b97f0e75
MD5 262ef6eeca2dbb33a74d2864851773ee
BLAKE2b-256 b048ada5cbc068d268c459c38e9554198e2b1ce946bc5909e18ea8f521e76bc4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ffmpeg_studio-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a7905a1853b9e9e6124d365ca9cef6c4f3a347173edb75acd2a6fd533f0aa4
MD5 f060f680a3fd4790afedd45eb27a6e62
BLAKE2b-256 517d3ed148924e262f1ab775b25d69f305a591e4c91339c33d0a70dbf67f43d1

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