View Full Version : How can I open MKV with MPEG inside in AviSynth?
cyberyman
27th October 2014, 16:16
Hello,
I recently ripped all my old TV-Show DVDs with "MakeMKV". Now I have a lot *.mkv files (one per episode) with the untouched MPEG-stream inside.
Some DVDs are heavely interlaced and I want to deinterlace with highest quality possible.
I never used AviSynth before, but I want to learn how to use QTGMC as I read it is recommened by a lot of users.
My first problem ist, how can I import those MKV with MPEG video?
MPEG2Source or DirectShowSource("C:\Users\kruger\Downloads\title00.mkv") gave me an error (file not supported) :(
I read that DGDecode.dll should be used for MPEG-2 but i also gave me an error, I think it can't handle mkv container? (It would make much more work first to remux all mkvs again)
(I want to use AviSynth to apply the QTGMC deinterlacing filter on all mkv files and reencode them with a HQ x264 crf setting. Audio should stay untouched.)
Reel.Deel
27th October 2014, 17:37
My first problem ist, how can I import those MKV with MPEG video?
MPEG2Source or DirectShowSource("C:\Users\kruger\Downloads\title00.mkv") gave me an error (file not supported) :(
I read that DGDecode.dll should be used for MPEG-2 but i also gave me an error, I think it can't handle mkv container? (It would make much more work first to remux all mkvs again)
With MPEG2Source you have to index the file first with DGIndex, that will create a .d2v file. Once that's done load the .d2v file with MPEG2Source("title00.d2v"). Regarding DirectShowSource (don't use it!), there are better alternatives (FFMS2 (https://github.com/FFMS/ffms2/releases) , LSMASHSource (http://avisynth.nl/index.php/LSMASHSource)).
feisty2
28th October 2014, 02:26
sure, u can either use ffvideosoure/lwlibavvideosource or extract ur mpeg stream with mkvextract first, then use dgmpgdec
manolito
28th October 2014, 13:23
@cyberyman
Since you have "a lot" of MKV files you need to convert, it probably makes sense to use an integrated solution (X264 GUI) where you do the setup only once and then convert your files with just two or three clicks...
The ones I am familiar with are MeGUI, RipBot264 and StaxRip, and for your needs I would recommend StaxRip. It lets you edit filter profiles so you can easily add QTGMC to your deinterlace filters. Audio can be passed through, and the encoder is fully configurable. It supports up to 2 audio tracks, subtitles are supported, and it automatically uses the source chapters. And if you run into any problems, there is a StaxRip thread in the "H264 Encoder GUIs" section where you will get any help you need...
Cheers
manolito
LemMotlow
29th October 2014, 03:10
Some DVDs are heavely interlaced and I want to deinterlace with highest quality possible.Why? Commercial DVD is almost always "heavily" interlaced (what does "heavily" mean, anyway?), or telecined. What would you consider to be only "moderately" interlaced? Or do you mean to say the DVD looks defective or poorly processed? Commercial BluRay and standard AVCHD are also interlaced except for high-res film based source and 720p. It's done because set top players and TV's are programmed to recognize certain formats as interlaced. Fortunately, decent PC media players deinterlace on the fly. If your video is NTSC at 29.97 fps, deinterlacing will double the number of frames and play at 59.94fps. If you decimate frames to maintain 29.97fps, you'll have motion problems playing on TV and your video will be re-encoded at half its original temporal resolution. If your TV-shows were created on film (a great many of them are), then they aren't interlaced. They're telecined, which should not be deinterlaced. Have you taken any of this into consideration?
Is this for PC-only or web display? If so, you'll have to deinterlace as well as resize for the web. Either way, you'll have to re-encode. If you think re-encoding from lossy MPEG to lossy h264 won't involve quality issues, you've been misled.
Why did you rip your DVDs into mkv containers? I'm always curious about why people do such things, since "ripping" DVD results in an MPEG2 copy, not an mkv. Why place MPEG2 in an mkv container when MPEG2 is its own container? Was this simply a container change, or did you re-encode to h264 to get the mkv? An MPEG2 in an mkv container would be the same file size as an MPEG2 in an MPEG2 container, so what was the point? Or was this really a rip-plus-reencode? I'm afraid you're not giving enough information for anyone to give solid advice.
qyot27
29th October 2014, 04:37
Why did you rip your DVDs into mkv containers? I'm always curious about why people do such things, since "ripping" DVD results in an MPEG2 copy, not an mkv. Why place MPEG2 in an mkv container when MPEG2 is its own container? Was this simply a container change, or did you re-encode to h264 to get the mkv? An MPEG2 in an mkv container would be the same file size as an MPEG2 in an MPEG2 container, so what was the point? Or was this really a rip-plus-reencode? I'm afraid you're not giving enough information for anyone to give solid advice.
The OP mentioned they used MakeMKV in their first post. It outputs all of its title-based rips (and by default, it does only decrypt them, even though it does have options to rip-and-transcode) inside Matroska, not just the H.264 or VC-1 Blu-ray cases where putting them in MKV actually makes sense. So even MPEG-2 streams from Blu-ray or DVD get muxed into MKV on output when you use it for single titles (for whole-disc backup, it'll keep things as-is, but MakeMKV only makes whole-disc easy for Blu-ray - for DVD, you have to enable streaming and grab the decrypted vobs from localhost).
manolito
29th October 2014, 10:48
Ripping a DVD into an MKV container with MakeMKV does make a lot of sense IMO. It removes the encryption (no need to buy AnyDVD) and it retains the chapters. And having to deal with a single file instead of a whole VIDEO-TS folder also helps.
Plus there are several H264 GUIs which do not support DVD input directly (StaxRip is one of them). For such scenarios ripping the DVD to MKV first is a logical workflow.
For me the interesting question is if it makes sense to deinterlace the content before reencoding it to H264. For X264 I remember hearing more than once that encoding in interlaced mode is a lot less efficient than in progressive mode. And how good are current TVs and projectors at deinterlacing on the fly?
Cheers
manolito
kuchikirukia
30th October 2014, 22:03
Use MeGUI. Automatic deinterlacing will probably do you.
Alternately, Handbrake. You're stuck with 8 bit H.264, but on the chance that your source has any hybrid material, their decomb/detelecine supports Variable Frame Rate output without needing to spend a week banging your head against the wall trying to figure out how to get it to work with AviSynth.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.