Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cmlburnett/mkvxmlmaker
Python module that makes XML files for feeding mkvmerge
https://github.com/cmlburnett/mkvxmlmaker
Last synced: 3 months ago
JSON representation
Python module that makes XML files for feeding mkvmerge
- Host: GitHub
- URL: https://github.com/cmlburnett/mkvxmlmaker
- Owner: cmlburnett
- Created: 2015-12-30T05:26:23.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-11-07T19:36:32.000Z (about 3 years ago)
- Last Synced: 2024-06-28T17:49:38.762Z (5 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
mkvxmlmaker -- Makes XML files for mkvmerge
This module provides classes that can create XML files for feeding into mkvmerge.
The two XML files supported are for specifying chapters and tags.MKVXML_chapter:
import mkvxmlmaker
c = mkvxmlmaker.MKVXML_chapter()
c.AddChapter('00:00:00.000', "Intro")
c.AddChapter('00:10:00.000', "Act 2")
c.AddChapter('00:20:00.000', "Act 3")
c.AddChapter('00:30:00.000', "Credits")c.Save('./chapters.xml')
Produces the following XML:
1
00:00:00.000
Intro
eng
2
00:10:00.000
Act 2
eng
3
00:20:00.000
Act 3
eng
4
00:30:00.000
Credits
eng
MKVXML_tags
import mkvxmlmaker
c = mkvxmlmaker.MKVXML_tags()
t = c.NewTag()
t.TargetType = 'COLLECTION'
t.TargetTypeValue = 70
t['TITLE'] = 'ER'
t['TOTAL_PARTS'] = 15t = c.NewTag()
t.TargetType = 'SEASON'
t.TargetTypeValue = 60
t['TITLE'] = 'Season 1'
t['PART_NUMBER'] = 1
t['TOTAL_PARTS'] = 25t = c.NewTag()
t.TargetType = 'EPISODE'
t.TargetTypeValue = 50
t['TITLE'] = 'Make of Two Hearts'
t['PART_NUMBER'] = 16
t['WRITTEN_BY'] = 'Woodward, Lydia'
t['DIRECTED_BY'] = 'Leder, Mimi'
t['DESCRIPTION'] = 'Kayson pursues Lewis romantically. Ross and hathaway cope with a young Russian girl with AIDS whose adoptive mother abandons her. A humane policeman hauls in a dog he hit with his car.'c.Save('./tags.xml')
Produces the following XML:
COLLECTION
70
TITLE
ER
eng
TOTAL_PARTS
15
eng
SEASON
60
PART_NUMBER
1
eng
TITLE
Season 1
eng
TOTAL_PARTS
25
eng
EPISODE
50
DESCRIPTION
Kayson pursues Lewis romantically. Ross and hathaway cope with a young Russian girl with AIDS whose adoptive mother abandons her. A humane policeman hauls in a dog he hit with his car.
eng
DIRECTED_BY
Leder, Mimi
eng
PART_NUMBER
16
eng
TITLE
Make of Two Hearts
eng
WRITTEN_BY
Woodward, Lydia
eng
These can then be used with mkvmerge to inject the data into the Matroska file:
mkvmerge -o out.mkv --chapters chapters.xml --global-tags tags.xml in.mkv
Some notes:
* Times provided to MKVXML_chapter.AddChapter are in absolute times, not lengths of the chapter
* Tags are applied globally (if --global-tags is used), hence no UIDs are provided
* AddAttachmentUID(), AddChapterUID(), AddEditionUID(), and AddTrackUID() are available to apply a tag to the specific UIDLinks:
* https://mkvtoolnix.download/doc/mkvmerge.html
* http://matroska.org/technical/specs/tagging/index.html
* http://www.matroska.org/technical/specs/tagging/example-video.html