A Python library and GUI for editing MLT (Media Lovin' Toolkit) files used by video editing applications like Shotcut and OpenShot.
- Batch wrap: wrap SRT and simple text (dynamictext) with your prefered characters.
Put the exe file onto any folder of your laptop/machine.
- Python 3.8+
- lxml >= 4.6.0
- Wrap Subtitles or rap Simple Text from rocessing Options.
- Choose Force Wrap if you want to make a new line regardless of space.
- Specify character number if you want to change the default till this tool make a new line.
- Choose your mlt file.
- Run to execute.
- Check a new file, which will be created at the same folder as the original mlt file.
This application can be built using pyinstaller.
Bash
pip install pyinstaller
pyinstaller --onefile --noconsole -n ShotcutMLTToolbox mltpy/gui.py
Once the build is complete, the executable file will be generated in the dist directory.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for working with MLT framework files
- Compatible with Shotcut, OpenShot, and other MLT-based editors
- Uses OpenCV for media file processing
Package an existing .mlt project into a portable zip and upload it to your Flask cloud renderer.
- What the packager does:
- Parse the .mlt as XML
- Rewrite all
producer > property[name="resource"]andchain > property[name="resource"]file paths todata/<filename> - Collect those files into
data.zipunderdata/ - Save a modified MLT as
cloud_rendering.mltand include it in the zip - Optionally POST the zip to your server (default:
http://163.58.36.32/upload)
CLI example:
mltpy --input-path C:\\Users\\user\\Videos\\shotcut\\20250912test\\test1.mlt --cloud-renderProgrammatic example:
from mltpy import MLTDataPackager
packager = MLTDataPackager(r"C:\\Users\\user\\Videos\\shotcut\\20250912test\\test1.mlt")
zip_path = packager.prepare_zip()
status, text = packager.upload("http://163.58.36.32/upload")
print(zip_path, status, text)Server endpoints:
POST /upload(headerX-Filename: data.zip, content-typeapplication/octet-stream)- Optional:
GET /status/<unique_id>,GET /download/<unique_id>
MLT(Media Lovin' Toolkit)ファイルを編集するための Python ライブラリ&GUIツールです。
Shotcut や OpenShot などの動画編集アプリケーションで使用できます。
- 一括ラップ機能: SRTやシンプルなテキスト(dynamictext)を、好みの文字数で自動的に折り返します。
exeファイルをパソコン内の任意のフォルダに置いてください。
- Python 3.8 以上
- lxml >= 4.6.0
- 処理オプションから「字幕を折り返す」または「シンプルテキストを折り返す」を選択します。
- 「強制改行」を選ぶと、スペースに関係なく指定の文字数で改行されます。
- デフォルトの文字数を変更したい場合は、改行する文字数を指定してください。
- 対象となる mlt ファイルを選択します。
- 実行を押して処理を開始します。
- 元の mlt ファイルと同じフォルダに新しいファイルが作成されます。
このアプリケーションは pyinstaller を使用してビルドできます。
Bash
pip install pyinstaller
pyinstaller --onefile --noconsole -n ShotcutMLTToolbox mltpy/gui.py
ビルドが完了すると、dist ディレクトリ内に実行ファイルが生成されます。
- リポジトリをフォーク
- 機能ブランチを作成(
git checkout -b feature/amazing-feature) - 変更をコミット(
git commit -m 'Add amazing feature') - ブランチにプッシュ(
git push origin feature/amazing-feature) - プルリクエストを開く
このプロジェクトは MIT ライセンスの下でライセンスされています - 詳細は LICENSE ファイルを参照してください。
- MLT フレームワークファイルの操作用に構築
- Shotcut、OpenShot、その他の MLT ベースのエディタと互換性があります
- メディアファイル処理に OpenCV を使用
手元の .mlt プロジェクトを ZIP にまとめ、Flask のクラウドレンダラーへアップロードできます。
- パッケージャの処理内容:
- .mlt を XML として解析
producer > property[name="resource"]とchain > property[name="resource"]のファイルパスをdata/<ファイル名>に書き換え- 実ファイルを ZIP 内の
data/配下へ格納 - 修正版 MLT を
cloud_rendering.mltとして保存し、ZIP に含める - 必要に応じて ZIP をサーバ(既定:
http://163.58.36.32/upload)に POST
CLI 例:
mltpy --input-path C:\\Users\\user\\Videos\\shotcut\\20250912test\\test1.mlt --cloud-renderPython からの使用例:
from mltpy import MLTDataPackager
packager = MLTDataPackager(r"C:\\Users\\user\\Videos\\shotcut\\20250912test\\test1.mlt")
zip_path = packager.prepare_zip()
status, text = packager.upload("http://163.58.36.32/upload")
print(zip_path, status, text)サーバ側の主なエンドポイント:
POST /upload:data.zipを送信(ヘッダーX-Filename: data.zip、Content-Type はapplication/octet-stream)- 任意:
GET /status/<unique_id>で進行状況、GET /download/<unique_id>で完成動画をダウンロード