Sign inSign up

eswardudi/python-ffmpeg

By eswardudi

Updated over 1 year ago

python:3.13-slim with FFmpeg and Git preinstalled. Ideal for automated multimedia related tasks.

Image
Developer tools
Content management system
1

4.1K

eswardudi/python-ffmpeg repository overview

Python + FFmpeg Docker Image

A production-ready Docker image that combines Python 3.13 with FFmpeg and Git, providing a seamless environment for multimedia processing automation.

What is python-ffmpeg?

python-ffmpeg is a Docker image built on python:3.13-slim with FFmpeg and Git pre-installed and configured. It serves as a drop-in replacement for the standard Python slim image, but with multimedia processing capabilities built right in.

Why does this exist?

Setting up FFmpeg alongside Python applications can be time-consuming and error-prone, especially across different environments. This image eliminates the need to:

  • Manually install FFmpeg dependencies
  • Deal with platform-specific FFmpeg compilation issues
  • Write complex Dockerfiles just to add FFmpeg support
  • Troubleshoot missing codecs or libraries

Perfect for developers working with:

  • Video processing and transcoding
  • Audio manipulation and conversion
  • Media automation pipelines
  • Content management systems
  • Streaming applications
  • Data analysis involving multimedia files
  • Git Version Control System

Quick Start

Basic Usage
# Run interactive Python shell with FFmpeg available
docker run -it eswardudi/python-ffmpeg python

# Run a Python script that uses FFmpeg
docker run --rm -v $(pwd):/app -w /app eswardudi/python-ffmpeg python your_script.py

# Execute FFmpeg directly
docker run --rm -v $(pwd):/media eswardudi/python-ffmpeg ffmpeg -i input.mp4 output.mp3
Using in Your Dockerfile
FROM eswardudi/python-ffmpeg:latest

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
CMD ["python", "main.py"]
Docker Compose Example
version: '3.8'
services:
  video-processor:
    image: eswardudi/python-ffmpeg:latest
    volumes:
      - ./media:/app/media
      - ./scripts:/app
    working_dir: /app
    command: python process_videos.py

Common Use Cases

Using subprocess for FFmpeg Commands
import subprocess

# Batch convert videos
def convert_video(input_path, output_path):
    cmd = [
        'ffmpeg', '-i', input_path,
        '-c:v', 'libx264',
        '-c:a', 'aac',
        '-y', output_path
    ]
    subprocess.run(cmd, check=True)

Image Details

  • Base Image: python:3.13-slim
  • FFmpeg Version: Latest stable from Debian repositories
  • Size: Optimized for production use

Best Practices

  1. Volume Mounts: Always mount your media files as volumes for performance
  2. Working Directory: Set appropriate working directories for your scripts
  3. Resource Limits: Consider memory and CPU limits for intensive processing
  4. Batch Processing: Process multiple files in single container runs when possible
  5. Error Handling: Implement proper error handling for FFmpeg operations

Tags Available

  • latest - Latest stable version
  • 3.13.3 - Python 3.13.3 with FFmpeg

Security & Production Considerations

  • Built on official Python slim images for security updates
  • No unnecessary packages installed
  • Suitable for production workloads

Need Help?

  • Issues: Report bugs on GitHub
  • Examples: Check the repository for more usage examples
  • Contributing: Pull requests welcome!

If you found this image helpful, please consider giving it a star! It helps others find the project and encourages ongoing improvements

If you found this image helpful, please consider giving it a star 🌟 ! It helps others find the project and encourages ongoing improvements.

Contact Me

Tag summary

Content type

Image

Digest

sha256:664c745d4

Size

206.4 MB

Last updated

over 1 year ago

docker pull eswardudi/python-ffmpeg