Printable Version of Topic
Click here to view this topic in its original format
Unofficial VirtualDub Support Forums > VirtualDub Filters and Filter Development > File Imput Filters For Mkv And Rm Formats?


Posted by: trodas Oct 23 2007, 02:52 PM
Hi, guys, I was just wondering, if Mkv and Rm plugins for Virtual Dub to one can work with these files, cut them and stuff wink.gif smile.gif

Posted by: fccHandler Oct 24 2007, 02:40 AM
Hello again. smile.gif

I'd like to elaborate on what I PM'd you, because I had some time today to explore the Matroska format in depth. Now that I've seen inside Matroska, I'm more than a little discouraged. I don't want to rant against it, because it has a big following, and it's pretty capable of storing just about anything you want to put in there. On the other hand, that very extensibility makes it a painful format when it comes to parsing.

I like specs which describe things as being "mandatory," because it helps us to know when we are seeing things that shouldn't be there. In Matroska, there's not a lot that is mandatory, so you're never sure about what you'll find. A broken Matroska file would be a scary place to be, if you were a parser and got lost... ph34r.gif

The best you can do is mentally make a list of things that you'll require to be there, and try to fail gracefully if any of those things are missing. Unfortunately the format is so complex that it's difficult to determine exactly what those required things would be.

Consequently, if I were to make a Matroska plugin, it could only have the most rudimentary functionality. A VirtualDub plugin wouldn't be able to support subtitles, chapters, VBR audio, VFR video, or any of a number of things that people choose Matroska for.

Speaking of VFR, it's a major problem for a VirtualDub plugin. In Matroska there is no frame rate, and all video frames and audio blocks are simply time stamped. Locating a specific sample quickly will probably require generating a detailed index at parse time, similar to what we have to do for MPEG and WMV. WMV doesn't have a frame rate either, and I'm still struggling with that problem in VirtualDub-MPEG2 and the WMV plugin.

Last but not least, I'm not personally motivated to make a Matroska plugin anyway. The few Matroska files I have are fine as they are, and I'm not inclined to do anything with them other than just watch them. I don't have any desire to load them into VirtualDub, so making a plugin would be a pretty dull project for me.

I understand that your motivation has to do with a Matroska file that VirtualDubMod fails to read. But surely there are other alternatives you can try, if you are that motivated. wink.gif

I never say never, but for now I'm going to pass on writing a Matroska plugin, and leave that project for some dedicated Matroska developer to tackle. I'm willing to bet that you're not the only person who wants one, and we now have several examples of working plugins that developers can use for reference.

Posted by: squid_80 Oct 24 2007, 08:14 AM
Personally if I were going to attempt it, I'd start by looking at Gabest's directshow mkv splitter since it seems to behave pretty well (and unlike Haali's, has source code). But unfortunately I've got no time at all.

Posted by: buzzqw Oct 27 2007, 01:07 AM
avinaptic has also a matroska parser based only on specs

BHH

Posted by: trodas Nov 14 2007, 02:28 PM
fccHandler - thanks a lot for finding time to write such detailed reply. Very informative, thanks tongue.gif
And well, when I spoken about Mkv imput filter, I mean functionality like in VirtualDubMod - just see the streams and be capable working with them (oh, wait, that require VirtualDub can handle them like the VDubMod does in the first place) and converting the video or taking clips from it for YouTube and stuff. Surely I did not require the subtitles and other fancy stuff. In fact, I prefer external, easy to edit, subtitles and I delete all internal Mkv subtitles. About the file, well, in the end I used AVI Mux GUI to get rid of the streams I did not want (Italian audio, 3 subtitles). The scary thing, tough, is that AVI Mux GUI failed miserably on other Mkv file to even parse it... It is just a pretty kinky manga stuff, regardless it make me worry about to have a tool that can be used for the job with Mkv.
Neverless at least basic parser for Mkv to one can take a part of it and reencode it to low quality for net would be great.

Same goes for the RealMedia format. Especially I just learned that YouTube did not recognize it - eg. fail to convert it. (Failed (unable to convert video file))

So a simple re-encode to Xvid AVI would save all the troubles...

And yes, the cursed framerate. Perhaps there is even a slight bug in the WMV imput filter, but when I cut like last half of clip and reencoded it for net, then the audio was out of sync. Not much, but... That is proably the result of the no-framerate stuff?
Why not the sync to the audio? Of course, it is probably not that easy rolleyes.gif

Too much formats, too much problems.

Posted by: Toff Nov 24 2007, 10:08 AM
QUOTE (squid_80 @ Oct 24 2007, 02:14 AM)
Personally if I were going to attempt it, I'd start by looking at Gabest's directshow mkv splitter since it seems to behave pretty well (and unlike Haali's, has source code). But unfortunately I've got no time at all.

For your information, the source code of the Haali's Matroska parser is available on his web page :
http://haali.cs.msu.ru/mkv/
See "Core parser library"

Posted by: levicki Dec 13 2007, 01:41 PM
QUOTE (fccHandler @ Oct 24 2007, 03:40 AM)
I never say never, but for now I'm going to pass on writing a Matroska plugin, and leave that project for some dedicated Matroska developer to tackle. I'm willing to bet that you're not the only person who wants one, and we now have several examples of working plugins that developers can use for reference.

@fccHandler:
I understand your lack of motivation for mkv plugin. When I first saw mkv I thought "YAUIFF" (Yet Another Useless Incompatible File Format in open-source lingo).

However, at least the basic ability to open and re-encode the file to different format would be nice. Just the basic video and audio stream, no need for subtitle or chapter support or anything else, just the raw dump from the beginning to the end would be enough for me so I can recode mkv to avi. I believe many others would agree because most people just hate that format.

Perhaps mkv is not so bad, but it is more proprietary than AVI and heck even than VMW. I hate it when I need to have 10+ players and codecs installed to be able to watch all the videos I have.

Posted by: ChristianHJW Dec 23 2007, 09:10 AM
Virtualdub, by its current design, can not handle most MKV files out there. Period. If this would be possible, then VirtualdubMod would never have been discontinued in the first place.

Cyrius, VdubMods main developer, soon realized that MKV would not be used for standard VfW codecs and MP3 audio, because AVI was already pretty good for that (maybe except for the ability to handle VBR MP3 properly).

And especially when Gabest created a muxer allowing to put Realvideo (RV9,RV10) into MKV, and this was soon after that supported by Mosu in mkvtoolnix, he found himself stranded in trying to accomodate this in Vdub, mainly for two reasons :
- RV9/10 can be VFR (Variable Framerate), and there is absolutely NO way to cope with that in Video for Windows (VfW)
- There are no OSS libs for Realvideo, as RealNetworks never wanted this to happen, not even for decoding

As a matter of fact, an input plugin for MKV into Virtualdub will make no sense at all, it would just lead to major frustration as the bigger part of the existing MKV files out there could not be handled properly.

I know this is hard to accept for the bigger part of the users out there, but rest assured we do know why, and it would be much too hard to explain to you how many detail problems are blocking this completely.

Phaeron will know best, and he was always making clear he has no interest in doing such ;-) .....

Regards

Christian
matroska project admin

Posted by: Wilbert Dec 23 2007, 03:03 PM
QUOTE
As a matter of fact, an input plugin for MKV into Virtualdub will make no sense at all, it would just lead to major frustration as the bigger part of the existing MKV files out there could not be handled properly.

I know this is hard to accept for the bigger part of the users out there, but rest assured we do know why, and it would be much too hard to explain to you how many detail problems are blocking this completely.

Sure it will make sense in some cases, but perhaps not always as much as people want.

RV9/10 in MKV is rare i think, besides they are adding RV3/4 decoding in ffmpeg at the moment. So your second point will be moot soon.

But there also is a lot of other stuff which is vfr. It just needs to be converted to cfr when importing it in VirtualDub. Yes, i know that the downside is that the final encoding will not play smooth anymore, which could be a problem.


Posted by: levicki Dec 23 2007, 03:52 PM
QUOTE
Virtualdub, by its current design, can not handle most MKV files out there. Period. If this would be possible, then VirtualdubMod would never have been discontinued in the first place.


I don't see why it wouldn't be possible, because majority of mkv files out there are CFR. I never asked for VFR support.

If I understand it correctly, each frame can have a different time duration in VFR?

Would it be possible to find common denominator and produce CFR video by repeating frames with say 10x higher framerate to lose the decimal point and then decimating it down to match the audio timecode?

Posted by: phaeron Dec 23 2007, 08:25 PM
Alright guys, this discussion has gone on long enough. We all know that:

  • MKV is like the TIFF of video
  • Partial MKV support would be possible in an input plugin
  • Some features of MKV can't be supported in an input plugin right now
  • There are people who want MKV support
  • Nobody is currently working on MKV support


I don't think we need to hear any more about whether MKV is or isn't good, whether someone should or shouldn't write an MKV plugin, or what it could or couldn't do. If you can code, let us know if you begin working on an MKV plugin. If you can't, wait until someone who can does it and help test if/when that happens. Nobody here is employed to work on this stuff.

Posted by: levicki Dec 24 2007, 12:17 AM
QUOTE (phaeron @ Dec 23 2007, 09:25 PM)
Alright guys, this discussion has gone on long enough. We all know that:

  • MKV is like the TIFF of video
  • Partial MKV support would be possible in an input plugin
  • Some features of MKV can't be supported in an input plugin right now
  • There are people who want MKV support
  • Nobody is currently working on MKV support


I don't think we need to hear any more about whether MKV is or isn't good, whether someone should or shouldn't write an MKV plugin, or what it could or couldn't do. If you can code, let us know if you begin working on an MKV plugin. If you can't, wait until someone who can does it and help test if/when that happens. Nobody here is employed to work on this stuff.

I respect your work, I was mainly interested in technical obstacles. You two (phaeron, fccHandler) surely know better than I do, that is why I asked here and not on some other forum.

Posted by: trodas Jan 3 2008, 11:46 PM
VFR, lol... Well, theoretically the file can be parsed and the highest framerate found in it used to decode it - and just "draw more frames" where the frames are dropped before.

That sounds like true challenge to code, tough laugh.gif

When I started talking about MKV support, I had in mind the ability to import classic MKV files, witch typically consist of hi-res h264 video with MP3 audio. And then scale them down, to create a preview and stuff...

Picking the worsest coding nightmare - implementing full range of MKV support and even the crazy full RM format support with VFR in it was not what I had in mind, tought the ablity to import RM files would be great, at least if they use CFR and not VFR. It will be later a great bonus to add the VFR support, but... I just can't wait to hear someone complaining that the imput RM VFR file with mostly static scenes and then small yet intensive motion was first like 5MB big and after encoding it to Xvid, it is like 25MB big laugh.gif tongue.gif
I just can't wait to see that complain! cool.gif

Posted by: ChristianHJW Feb 4 2008, 06:29 PM
QUOTE (trodas @ Jan 4 2008, 01:46 AM)
VFR, lol... Well, theoretically the file can be parsed and the highest framerate found in it used to decode it - and just "draw more frames" where the frames are dropped before.

Nope, won't work like that. Your only chance would be to find the smallest common denominator framerate. Like, if you video will contain

24 fps
25 fps
30 fps

the smallest common denominator would be 1 fps. For

25 fps
30 fps

it would be 5 fps. All the missing frames had to be interpolated, or (in worst case) just copied. In short :

NOT DOABLE

Christian
matroska project admin

Posted by: trodas Feb 5 2008, 12:10 AM
Well, what is wrong with he copy-frame stuff?
When playing, the RealPlayer / Real player format decoders do just that. So, what?

Besides, using the DirectShow input filer I already see RealPlayer movie INTO VirtualDub. There are some quirks - the movie says it is only 428 x 480 pixels big, but that is BS smile.gif

Look:
http://img144.imageshack.us/my.php?image=realplayerinvirtualdubmz4.jpg

Almost ready!

Posted by: trodas Sep 16 2012, 11:54 AM
DirectShow filter make re-endocing of RealMedia possible - same movie as before and look, it is working much better now:

http://i48.tinypic.com/2eledc8.png

Hooray! But still no-one is trying the basic MKV format support? Maybe it will work using DirectShow input filter too biggrin.gif

Posted by: ale5000 Sep 16 2012, 01:40 PM
@trodas: Haven't you tried the Matroska input plugin?
http://forums.virtualdub.org/index.php?act=ST&f=7&t=19488

Posted by: lansing Sep 30 2012, 02:22 AM
i posted about this in doom9 earlier, apparently still not that many ppl know about it:

http://codecpack.co/download/FFInputDriver.html

it's using the ffmpeg library, which mean you can open anything that ffmpeg supports

Posted by: Gral Sep 30 2012, 11:50 PM
@lansing
Already announced.
Has even its own thread.
http://forums.virtualdub.org/index.php?act=ST&f=7&t=19488
http://forums.virtualdub.org/index.php?act=ST&f=7&t=20025

Powered by Invision Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)