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_xml-0.1.0.tar.gz
(32.6 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
mlt_xml-0.1.0-py3-none-any.whl
(32.0 kB
view details)
File details
Details for the file mlt_xml-0.1.0.tar.gz.
File metadata
- Download URL: mlt_xml-0.1.0.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9625c613cc08e5c926e75d24a5b2f8a605aafb400b3ddb4e1d3b8397e6434d63
|
|
| MD5 |
92081aaf5f19cb7ae5931d6c696d4f89
|
|
| BLAKE2b-256 |
7d71688beb3517cfef0ab0c6a611df0a4cc4b1e0d3da361934559e0b7613be8e
|
File details
Details for the file mlt_xml-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mlt_xml-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 |
d410acb971da6457f5e07ca8ba9f2817b98e4296d25b1b65cca8020fc91a8bbd
|
|
| MD5 |
aae6026c13ef6ac5f43d349c4ca70b17
|
|
| BLAKE2b-256 |
7be8a8db653caed4f70aac6f4a3ac08925894509b11ae51b52c78e9eec2f7827
|