Skip to main content

Python-first media processing API

Project description

SimpleMP

SimpleMP is a well tested, Python-first media processing API that provides a clean, reliable interface over FFmpeg through PyAV — without exposing users to the complexities of codec quirks or invalid configurations.

It focuses on deterministic behavior, strict validation, and sensible defaults to ensure media transcoding is predictable, repeatable, and easy to integrate in production.

Why simplemp?

FFmpeg is powerful, but:

  • The API surface is complex
  • PyAV exposes low-level internals directly
  • Codec support is inconsistent across builds
  • Invalid inputs can cause silent failures
  • Filter graphs can segfault or misbehave
  • Validation is basically up to the user

SimpleMP fixes this by providing a well-defined, safe, high-level API that handles:

  • Input introspection
  • Encoder, format and options compatibility validation
  • Sample rate and bitrate safe range
  • Container compatibility checks
  • Error handling and reporting
  • So developers can focus on using it, not debugging it.

Features

Simple, high-level API

from simplemp import transcode

transcode(
    input_file="/path/to/inputfile", output_file="/path/to/outputfile",
    audio_encoder="wmav1", video_encoder="h264",
)

No direct FFmpeg arguments. No command strings. Safe, predictable, declarative config.

Installation

Available on PyPI:

pip install simplemp

Requires av and numpy

Deterministic Validation Layer

SimpleMP includes a reliable validation system that rejects invalid or unsafe configurations before encoding begins.

Validation includes:

codec ↔ container compatibility

codec ↔ sample format compatibility

codec ↔ channel count support

codec ↔ sample rate range

bitrate sanity checks

output path and directory checks

Over 400 validation tests are executed against supported formats.

Codec Support (Audio)

Lossy: AAC MP3 Opus Vorbis Speex WMA v1/v2

Lossless: FLAC ALAC PCM (8–32 bit, be/le) A-Law µ-Law

File Formats

Multi-container support: .mp3 .m4a .opus .ogg .oga .flac .wav .3gp .aif / .aifc / .aiff .wma .aac .adts

Test Suite & Quality Assurance

SimpleMP is tested like a industry grade project:

250+ test matrix entries in total Tests for all valid codec/sample-fmt combinations Tests for invalid combinations Tests for failure mode correctness Static analysis (mypy) Unit tests + integration tests

Example of the test matrix:

Extension Codec Pixel Format Status
.mkv hevc yuv420p10le ✔️
.mkv hevc yuv422p10le ✔️
.mkv hevc yuv422p10le ✔️
.mkv mpeg4 yuv420p ⚠️
.mkv vp8 yuv420p ⚠️
.mkv vp8 yuv422p
.mkv vp8 yuv444p

Total more than 150 tests has logged in the test matrix. Check docs/testing/TEST_MATRIX.md for more details.

Author

Main api created by S.M Sadat and TUI is being developed by Atia Farha

Future Plan: High-Performance C++ Edition

A C++ backend is planned using libav*, with:

templates

constexpr validation

noexcept pipelines

SIMD optimized paths

Custom filter engine

extended codec support

Estimated code size:

3,000+ LOCs validation layer 10,000+ LOCs total implementation 10,000+ LOCs for filter engine

Python edition will remain as:

easy to use sane defaults fast to prototype

C++ edition will be:

low-latency ultra-high-performance enterprise-ready

Philosophy

SimpleMP is built on three principles:

  • No user should need to understand codec chaos
  • Invalid configs must fail instantly, not silently
  • Defaults should produce production-ready results

Developer experience is a feature.

Documentation

API usage guide: Check docs/api/ Examples: Check docs/examples/ Test matrix: Check docs/TEST_MATRIX.md

Contributing

Contributions welcome!

Especially:

  • test samples
  • codec benchmarks
  • metadata extraction
  • validation logic
  • CI pipelines

License

Open source, permissive license. To be finalized.

Warning

API is still in it's early development phase, so expect some instability

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

simplemp-0.7.5.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

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

simplemp-0.7.5-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file simplemp-0.7.5.tar.gz.

File metadata

  • Download URL: simplemp-0.7.5.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for simplemp-0.7.5.tar.gz
Algorithm Hash digest
SHA256 8d69c14c10a34f35a1ec21a08b419d125fd659954feb7adb953bacfde0e094d1
MD5 132a525e3ac089bbb8ff71f80ae14814
BLAKE2b-256 8898e7973efcd07d10301ae17468d393d17f18a765f343fa3ffea212f7f87472

See more details on using hashes here.

File details

Details for the file simplemp-0.7.5-py3-none-any.whl.

File metadata

  • Download URL: simplemp-0.7.5-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for simplemp-0.7.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ea040efa32ad2bbf27b78ef2f2d5b02aec35453983acc33e75ab8805d5d7fdb5
MD5 cc5ff55ab6fef4c653e3b2a759692213
BLAKE2b-256 96b1fcb63888ae1b089dc2d1fbe24aeb81f00ba6037c0e5d07cc742af4775ad6

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