Skip to main content

A composable FFmpeg-based video editing library

Project description

๐ŸŽฌ Media Manipulator Library

A modular, pluggable video editing library built with Python and FFmpeg. Supports programmatic video transformations like text (watermark) overlay and audio merging using strategy and interpreter design patterns.


๐Ÿš€ Features

  • Add watermark (text overlay) to videos
  • Overlay audio tracks onto videos
  • Process nested JSON editing instructions
  • In-memory and tempfile-based FFmpeg pipelines
  • Clean, extendable strategy-based architecture
  • Custom command interpreter for complex video editing workflows
  • Developer-friendly logging

๐Ÿ“ฆ Installation

From PyPI (coming soon)

pip install media-manipulator-lib==0.1.5

https://pypi.org/project/media-manipulator-lib/0.1.5/

From source

git clone https://github.com/angel-one/media-manipulator-library
cd media-manipulator-library
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

๐Ÿงช Testing

pytest            # all tests
pytest tests/unit         # only unit tests
pytest tests/integration  # only integration tests

๐Ÿ”ง Usage Example

from video_editor import process_json_command

command = {
    "operation": "overlay",
    "left": {
        "operation": "overlay",
        "left": {
            "type": "video",
            "value": base64.b64encode(open("video.mp4", "rb").read())
        },
        "right": {
            "type": "text",
            "value": "Aditya Sharma",
            "style": {
                "position_x":380,
                "position_y":380,
                "size": 52,
                "style": ""
            }
        }
    },
    "right": {
        "type": "audio",
        "value": base64.b64encode(open("audio.mp3", "rb").read())
    }
}

result = process_json_command(command)

with open("output.mp4", "wb") as f:
    f.write(result["bytes"].getvalue())

๐Ÿ“‚ Project Structure

media-manipulator-lib/
โ”œโ”€โ”€ media_manipulator/                  # Main package
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py                          # CLI entry point (if used)
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ interpreter.py             # JSON โ†’ command parser
โ”‚   โ”‚   โ”œโ”€โ”€ processor.py               # Operation executor
โ”‚   โ”‚   โ”œโ”€โ”€ strategy_registry.py       # Registers available strategies
โ”‚   โ”‚   โ””โ”€โ”€ strategies/                # Strategy pattern implementations
โ”‚   โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚       โ”œโ”€โ”€ add.py
โ”‚   โ”‚       โ”œโ”€โ”€ base.py
โ”‚   โ”‚       โ”œโ”€โ”€ clip.py
โ”‚   โ”‚       โ”œโ”€โ”€ concat.py
โ”‚   โ”‚       โ”œโ”€โ”€ overlay.py
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ audio.py                   # Audio processing helpers
โ”‚   โ”‚   โ”œโ”€โ”€ helpers.py                 # Generic utilities
โ”‚   โ”‚   โ”œโ”€โ”€ logger.py                  # Logger setup
โ”‚   โ”‚   โ””โ”€โ”€ video.py                   # Video processing helpers
โ”œโ”€โ”€ tests/                              # Unit and integration tests
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ MANIFEST.in
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt                   # Optional (for dev setup)
โ””โ”€โ”€ setup.py

๐Ÿ› ๏ธ Built With

  • Python 3.11+
  • FFmpeg + ffmpeg-python
  • pytest for testing
  • json for colored logging

๐Ÿ“œ License

MIT License ยฉ 2025 Aditya Sharma / AngelOne


๐Ÿ™‹โ€โ™‚๏ธ Contributing

Contributions welcome! Please submit issues or pull requests for improvements or new features.


๐Ÿ“ซ Contact

For questions or support, open a GitHub issue or reach out to aditya.3sharma@angelone.in

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

media_manipulator_lib-0.1.5.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

media_manipulator_lib-0.1.5-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file media_manipulator_lib-0.1.5.tar.gz.

File metadata

  • Download URL: media_manipulator_lib-0.1.5.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for media_manipulator_lib-0.1.5.tar.gz
Algorithm Hash digest
SHA256 a3da1823c8b860fa843052066154ece801c55977fedc184ac928eb09f7520aba
MD5 ac807b6ff4355e2d61d33190cf474304
BLAKE2b-256 916ab96d331367b5720e696df11fe9142d02d8cb943febe352a2a1355f533ee8

See more details on using hashes here.

File details

Details for the file media_manipulator_lib-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for media_manipulator_lib-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 03d7835bdda85f79f75e08e496f989b9f48f73764613cbacf2589c937c569442
MD5 88ee9acb81b31701852dbc74853d2722
BLAKE2b-256 98f2f2cdd20afcb13ff5c155a3add2d70d44d6c672f9df8038bbdef5f7e38fd2

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