Pure Python library for creating and modifying MLT XML files for Kdenlive
Project description
MLT XML Library for Kdenlive
A pure Python library for creating, modifying, and parsing MLT XML files compatible with Kdenlive.
Features
- Pure Python - No MLT framework dependency, direct XML manipulation
- Timecode API - All public methods accept
HH:MM:SS:FFformat - Frame Alignment - Library automatically converts timecodes to frame numbers
- Media Management - Add/modify/delete audio/video files in the bin
- Timeline Editing - Add clips, tracks, filters, and transitions
- Subtitle Support - External SRT file references
- Kdenlive Compatible - Generates XML that Kdenlive can open
Installation
Using uv (recommended)
uv pip install mlt-python
Using pip
pip install mlt-python
For development
git clone https://github.com/gpapp/mlt-python.git
cd mlt-python
uv sync
Quick Start
from mlt_python import MLTProject
# Create a new project
project = MLTProject(profile="hd1080_30")
# Add media to bin
video = project.add_producer("video.mp4", id="vid1")
# Add a video track
track = project.add_track("video", id="playlist0")
# Add a clip using timecodes
project.add_clip(
track_id="playlist0",
producer_id="vid1",
start="00:00:00:00",
duration="00:00:10:00"
)
# Add subtitles from SRT file
project.add_subtitle("subtitles.srt", track=0, start="00:00:00:00")
# Save to file
project.save("project.kdenlive.xml")
Supported Operations
Producers (Media Bin)
add_producer()- Add video/audio/image to binremove_producer()- Remove from binget_producer()- Get producer by ID
Tracks (Playlists)
add_track()- Add video/audio trackremove_track()- Remove trackadd_clip()- Add clip to track using timecodes
Filters & Effects
add_filter()- Add filter to project/track- Built-in filters:
Filters.greyscale(),Filters.volume(),Filters.watermark()
Transitions
add_transition()- Add transition between tracks- Built-in transitions:
Transitions.luma(),Transitions.mix(),Transitions.composite()
Subtitles
add_subtitle()- Add subtitles from SRT fileSRTFile- Utility class for reading/writing SRT files
Profile Presets
hd1080_30- Full HD 1080p @ 30fpshd1080_2997- Full HD 1080p @ 29.97fpshd1080_25- Full HD 1080p @ 25fps (PAL)hd1080_24- Full HD 1080p @ 24fpshd720_30- HD 720p @ 30fpsuhd_30- 4K UHD @ 30fpsuhd_24- 4K UHD @ 24fpssdtv_ntsc- SD NTSC 480isdtv_pal- SD PAL 576i
Example
See examples/example.py for a complete example showing:
- Multiple video/audio tracks
- B-roll with transitions
- Audio mixing
- Subtitle integration
- Filter effects
Running Tests
uv run pytest tests/ -v
License
MIT License - see LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mlt_python-0.1.0.tar.gz
(32.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlt_python-0.1.0.tar.gz.
File metadata
- Download URL: mlt_python-0.1.0.tar.gz
- Upload date:
- Size: 32.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5916b940a0bafdeca4440cb6aeb2c4a411ecd0f7e78fe53cae5cd2ac031e7ce2
|
|
| MD5 |
bd261421b42a00221cea072613ebcb05
|
|
| BLAKE2b-256 |
7206799afc8eb3c24f2d0038b6d8bc147b2c85c8de3e99f6cd2e02e62a9986ba
|
File details
Details for the file mlt_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mlt_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c30a155dd34eed88ef71b102b4499c1724e26fef8c10985ea53ff9614472e61
|
|
| MD5 |
b82c56630494c749c2acc0637c66ae23
|
|
| BLAKE2b-256 |
651ddcf3ac5aafb6154b57c2f3dcd5c22baa69a563c9ae538f225f537652d490
|