Giter Site home page Giter Site logo

vi / mkvparse Goto Github PK

View Code? Open in Web Editor NEW
61.0 6.0 16.0 91 KB

Simple Python matroska (mkv) reading library, also mkv2xml and xml2mkv

Python 95.89% Makefile 0.09% C 4.01%
mkv2mkv xml2mkv xml matroska-files matroska python ebml webm multimedia video

mkvparse's Introduction

Simple easy-to-use hacky matroska parser

Define your handler class:

class MyMatroskaHandler(mkvparse.MatroskaHandler):
    def tracks_available(self):
        ...

    def segment_info_available(self):
        ...

    def frame(self, track_id, timestamp, data, more_laced_blocks, duration, keyframe_flag, invisible_flag, discardable_flag):
        ...

and mkvparse.mkvparse(file, MyMatroskaHandler())

Supports lacing and setting global timecode scale, subtitles (BlockGroup). Does not support cues, tags, chapters, seeking and so on. Supports resyncing when something bad is encountered in matroska stream.

Also contains example of generation of Matroska files from python

Also contains mkv2xml and xml2mkv: tools that convert Matroska files to/from XML plaintext. Example XML file . Example command:

$ cat test3.mkv | ./mkv2xml | ./xml2mkv | mplayer - # convert to XML and back and play

Subtitles should remain as text, binary data gets encoded to hex.

Licence=MIT

mkvparse's People

Contributors

astro-johnny avatar danudey avatar dericed avatar guest271314 avatar vi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mkvparse's Issues

Cannot import mkvparse as a "library"

Cannot import mkvparse on Python 2.7 as it is installed by setup.py

Steps to reproduce:

  1. Install the package via setup.py
  2. Try import mkvparse in interpreter (running from anywhere but the working directory of mkvparse).

Possible solutions:
A. Add an empty __init__.py file in the tree.
This will make mkvparse a proper package, allowing importing modules as:
from mkvparse import mkvparse

B. Declare mkvparse as "bare" module
This will avoid installing mkvparse.py under a subdirectory, so that module is visible directly and can be imported as:
import mkvparse

Here's the changes:

diff --git a/setup.py b/setup.py
index 442d480..1b3aab0 100644
--- a/setup.py
+++ b/setup.py
@@ -20,2 +20 @@ setup(
-    packages=['mkvparse'],
-       package_dir={'mkvparse': ''},
+    py_modules=['mkvparse'],

The diff will install only mkvparse.py. You may add mkvgen and mkvuser to py_modules, but they do not appear to be reusable modules but rather executable scripts.
More about including scripts in package here

mark a release

I find this utility really useful and would like to make a homebrew installer for it. Could you mark a release so that I could point the installer to that, otherwise the installer can only be head-only.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.