https://github.com/vi/hsmkv
Simple matroska (mkv) demuxer and muxer written in Haskell
https://github.com/vi/hsmkv
Last synced: 3 months ago
JSON representation
Simple matroska (mkv) demuxer and muxer written in Haskell
- Host: GitHub
- URL: https://github.com/vi/hsmkv
- Owner: vi
- Created: 2012-02-27T00:50:53.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2017-02-01T15:00:04.000Z (over 9 years ago)
- Last Synced: 2025-03-11T19:41:47.236Z (over 1 year ago)
- Language: Haskell
- Homepage:
- Size: 94.7 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Matroska demuxer and muxer in Haskell.
Feed the content of mkv file to MkvParse.parseMkv and get list of frames (and other events)
The same list of events can be conveted back to ByteString using MkvGen.writeMkv
parseMkv :: Data.ByteString.Lazy.ByteString -> [MatroskaEvent]
data MatroskaEvent = ME_Tracks ... | ME_Info .. | ME_Frame Frame | ...
data Frame = Frame {
fTrackNumber :: Integer,
fTimeCode :: Double,
fData :: [B.ByteString], -- laced subframes
fDuration :: Maybe Double,
fInvisible :: Bool,
fDiscardable :: Bool,
fKeyframe :: Bool
} deriving (Show)
-- See ExamplePrint.hs for more complete example
Supported features:
* decoding of SimpleBlocks and BlockGroups
* handling TimecodeScale
* lacing
* resyncing after errors
* muxing
Not supported features:
* track timecode scale multiplier
* seeking (with index), cues, chapters
* ContentEncoding (except of "header removal")
* Access to various parameters of Track or Info (can be easily added probably)
Included examples:
* ExamplePrint - read matroska file and print info, tracks and frames
* ExampleTransmux - read matroska file and write it
* ExampleUdpRecv - receive UDP packets and write them as frames to matroska file (with timecodes), like in [udp2mkv](http://vi-server.org/pub/udp2mkv.c)
* ExampleUdpSend - read frames from matroska file and send it as UDP packets, honouring timecodes, like in [mkv2udp](http://vi-server.org/pub/mkv2udp.c)
* examples.hs - bundle all example above in one executable
There are compiled versions "examples.hs" for [linux](http://vi-server.org/pub/HsMkv) and [windows](http://vi-server.org/pub/HsMkv.exe).
Python version of demuxer and Matroska XML tools: https://github.com/vi/mkvparse
License=MIT, Vitaly "_Vi" Shukela, 2012.