Extract untouched audio track from mkv/webm programatically
Róbert Kohányi <[email protected]> Tue, 12 Mar 2013 18:24:10 +0100
| Newsgroups | gmane.comp.multimedia.matroska.user |
|---|---|
| Message-ID | <CABFab9fmeZxVyTHwZNxLRhmb-SViyP3-aRiRydVHGqXWrUzWTw@mail.gmail.com> |
Hi, I would like to extract an .ogg file from an .mkv file programatically (maybe from a .webm, but I care more about the .mkv at this point). By this I mean without mkvtoolnix/ffmpeg or such tools or libraries. (The only third party application that I could use to achieve what I want is an EBML parser, and that's it.) I understand that the contents of every .mkv file is described using the EBML format. I use an EBML parser to extract information from .mkv files and this part works great: I can successfully navigate my way through the EBML and find the Tracks element and the TrackEntry for the audio track that I want (which is an ogg vorbis audio track). Now, this is the point where I'm stuck. I've read the manual/specification for EBML but I'm not sure if I got it right. As I understood it the actual data (video and/or audio) are located *inside* the Cluster element, which could contain a lot of Block/SimpleBlock elements. I can find these, *all of them*, but I guess I don't need all of them (only the ones which belong to the TrackEntry I'm interested in). Given these, my first question is as follows. How can I identify the Block/SimpleBlock elements belonging to a particular TrackEntry? (My guess is that by a TrackUID, but I couldn't figure where does a Block/SimpleBlock contains which TrackEntry/TrackUID it belongs to.) But, let's say I've found all the Block/SimpleBlock elements that belong to a single audio ogg vorbis audio track. Can I just *append* these after each other and be done with it? (My guess is *no way*, because that would be too simple.) So, after I found all the Block/SimpleBlock elements I need, how can I make an ogg vorbis audio file from them? If someone could give me heads up/some pointers on these questions that would be nice. I'm not looking for working code snippets or stuff like that, but if anyone knows of a *test case* that is lurking around in some ebml/mkv/whatever code repository which tests mkv audio extraction methods or something like that, than a link pointing to it would be nice too. I did checkout the libebml/libmatroska repositories, but the first didn't seem to be interested in what I would like to achieve and the second one didn't have any useful tests - and the code was a bit overwhelming for me, I didn't know where to start looking. (So, if someone could tell me which classes/methods are responsible to extract audio from an mkv in some code repository, that would be nice too.) Heads up in general are nice too! So, I guess that's it... thanks for any information in advance! Regards, Kohányi Róbert _______________________________________________ Matroska-users mailing list [email protected] http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-users Read Matroska-Users on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.user