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 using colorlog

๐Ÿ“ฆ Installation

From PyPI (coming soon)

pip install video-editing-lib

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
  • colorlog 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.3.tar.gz (12.3 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.3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: media_manipulator_lib-0.1.3.tar.gz
  • Upload date:
  • Size: 12.3 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.3.tar.gz
Algorithm Hash digest
SHA256 39a33834e4c8c804b4df11a5d09ff802f9c8ac74475da55a081dbac47a6cb50e
MD5 a1a00aea2b94bf04c3b37edaa92c1600
BLAKE2b-256 f89495a4f2b205f5bfd2d74de37339f1eab63fc1221898f6824b54b06640661a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for media_manipulator_lib-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d1539d2089f2351db0e8a694a9b4fb0dfbf389289d7629aedd4102624de5ec64
MD5 494761a154cf93f3452721752ceaf400
BLAKE2b-256 51472020bf9c973fd3c7ef1553e9ed6f1e02e1204a7d4236e16b0b1e4c1c1e3d

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