MKV extract

If you have questions about compression/encoding/converting look here.
User avatar
Faltzer
Joined: Mon May 26, 2008 11:28 am
Status: There's no such thing as no such thing.
Location: In your underpants!! PANTSU PANTSU!!!
Contact:
Org Profile

MKV extract

Post by Faltzer » Fri Oct 31, 2008 11:29 am

Ok so I 've always had problems with the mkv container in terms of extracting footage from them.

Let's say as an example I have an anime episode that I want to use (take a scene from there for a AMV), the episode is mkv format. Now I'd have to use mkvextract to extract the raw file from the container, this raw file is a raw h.264 file that nothing supports. So then because of this problem I use an application called avc2avi to convert the raw file to h.264 avi which gives me 'problems'. If I try to extract a scene from this now converted avi file (using lets say, VirtualDub/VirtualDub MOD) the application always complains about the file (bframe reference problems, etc.) If I try to extract a scene with VDub, the output file contains either nothing(black all the way) or just the first frame. The only application that seem to work with the converted avi is Total Video Converter, but as you know (if you didn't already know), TVC gives absolutly crap video quality.

Now is there a way to '"properly" extract a scene from a mkv file? I've tried using VDub MOD directly on the mkv file, but it always complains about the file having a frame it dosen't like,etc (dosen't make a difference what video it is, as long as it's mkv, it gives the problem).

I've also tried using the program Avidemux to capture directly from the mkv file but it also gives problems like "bframe problem" and "h264 detected - can lead to crashes" and it's almost impossible to get a scene from the mkv file...

Any help??? :cry: :cry: :cry:

User avatar
Kariudo
Twilight prince
Joined: Fri Jul 15, 2005 11:08 pm
Status: 1924 bots banned and counting!
Location: Los taquitos unidos
Contact:
Org Profile

Post by Kariudo » Fri Oct 31, 2008 1:04 pm

avisynth + ffmpegsource() should do it
Image
Image

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Post by Qyot27 » Fri Oct 31, 2008 1:05 pm

As one of the local MKV supporters, I feel somewhat obligated to respond.

There are two big reasons why these steps are giving you trouble:
A) Matroska can handle two main types of video - Native video, and VFW. Yes, this is a gross simplification, but it helps explain this. VFW is the same type of video (the only type) that AVI supports. Native video is the type that you'd find in MPEG-1, MPEG-2, or MP4 files. Historically, MKVs that house XviD-encoded video streams use VFW. Because of the inherent problems with using H.264 in AVI, however, most H.264 MKVs use Native - which, by the way, is the proper way to store such streams in MKV.

B) VirtualDubMod can handle MKVs just fine, as long as the video streams use VFW. The H.264 AVI files produced by avc2avi will only work if you have a VFW decoder that is capable of decoding H.264 (ffdshow's VFW interface can do this, for example). The kinds of warnings that can occur in the event of trying to open one of these files without the proper decoder can be as long as my arm. In short, it's generally a bad idea.

Now, there is a proper way to open any MKV file in VDubMod (or VDub itself). It requires a very simple AviSynth script. First, make sure that AviSynth is installed. Second, make sure you have the FFmpegSource plugin and put that plugin in AviSynth's plugins directory (usually C:\Program Files\AviSynth 2.5\plugins). Then use a script like this:

Code: Select all

FFmpegSource("video.mkv",atrack=-1)
It'll take a little bit to open the first time because the plugin indexes the MKV, much like DGIndex does for MPEG-2 files. The ,atrack=-1 parameter is optional, but necessary if you want audio as well - by default, the plugin doesn't load audio.

If you don't want to necessarily remember to write scripts and all, you can make a template for VDubMod to use that will generate one for you. Just copy and paste this into Notepad and then save as ffmpegsource.avst in VDubMod's template directory:

Code: Select all

#ASYNTHER FFmpegSource
[FFmpegSource("%f",atrack=-1)]
After that, you can access FFmpegSource with the drop-down menu in the Open via AviSynth* dialog (for VDubMod 1.5.10.1), or again in the drop-down menu for AviSynth templates in the standard Open video dialog (for VDubMod 1.5.10.2 and 1.5.10.3).

*Open via AviSynth, despite it's name, is not for opening .avs files. You select a real video file and AviSynth will generate an .avs and then open it based on which source filter you've chosen. Thankfully later versions of VDubMod merged this with the main Open dialog so there's less confusion about it.

User avatar
Faltzer
Joined: Mon May 26, 2008 11:28 am
Status: There's no such thing as no such thing.
Location: In your underpants!! PANTSU PANTSU!!!
Contact:
Org Profile

Post by Faltzer » Sat Nov 01, 2008 8:41 am

Dosen't seem to work, it says there's no function called FFmpegSource, etc. BTw, I just want to know, the downloaded plugin is a zip file, do you place the zip file itself in the avisynth plugin folder or the contents of the zip file (FFmpegSource.dll) ???
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination!

User avatar
Kariudo
Twilight prince
Joined: Fri Jul 15, 2005 11:08 pm
Status: 1924 bots banned and counting!
Location: Los taquitos unidos
Contact:
Org Profile

Post by Kariudo » Sat Nov 01, 2008 11:59 am

you unzip the file and put the .dll in the plugins folder
Image
Image

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Post by Qyot27 » Sat Nov 01, 2008 12:02 pm

Faltzer wrote:Dosen't seem to work, it says there's no function called FFmpegSource, etc. BTw, I just want to know, the downloaded plugin is a zip file, do you place the zip file itself in the avisynth plugin folder or the contents of the zip file (FFmpegSource.dll) ???
You put the .dll in there. If it still doesn't load (which it should, but maybe there's something wrong elsewhere), then using

Code: Select all

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\FFmpegSource.dll")
on the first line of the script, before calling FFmpegSource itself, should work. Actually, using LoadPlugin you can have the plugin anywhere on the computer, but it's easier if it just autoloads - the reason for putting it in the plugins directory.

User avatar
Vivaldi
Polemic Apologist
Joined: Sat Sep 29, 2007 9:39 am
Location: Petting mah cat..
Org Profile

Post by Vivaldi » Sat Nov 01, 2008 1:26 pm

I should point out that if FFmpegSource is giving you more trouble than it's worth, just use:
Directshowsource ("blah") instead. FFmpegsource is superior, but directshowsource will get the job done well enough.
Image
Image
<Kenzichu> HAHAHA!!
<Kenzichu> everyone died!

User avatar
Faltzer
Joined: Mon May 26, 2008 11:28 am
Status: There's no such thing as no such thing.
Location: In your underpants!! PANTSU PANTSU!!!
Contact:
Org Profile

Post by Faltzer » Sun Nov 02, 2008 5:25 am

Still doesn't seem to work :cry:

Ok this is what I do:

- Install Avisynth 2.57
- Copy the plugin (FFMpegSource.dll) to the plugin dir. of Avisynth
- Open up Notepad and enter the code:

Code: Select all

FFmpegSource("video.mkv",atrack=-1)
- Save as a .avs file
- Open then .avs file with VDub MOD 1.5.10 (Am I meant to do this?)
- Complains: '"cannot open mkv file"

I think it has something to do with the second last line up there? I never used AviSynth before so I'm not too sure. :?
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination!

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Post by Qyot27 » Mon Nov 03, 2008 12:29 am

Faltzer wrote:Still doesn't seem to work :cry:

Ok this is what I do:

- Install Avisynth 2.57
- Copy the plugin (FFMpegSource.dll) to the plugin dir. of Avisynth
- Open up Notepad and enter the code:

Code: Select all

FFmpegSource("video.mkv",atrack=-1)
- Save as a .avs file
- Open then .avs file with VDub MOD 1.5.10 (Am I meant to do this?)
- Complains: '"cannot open mkv file"

I think it has something to do with the second last line up there? I never used AviSynth before so I'm not too sure. :?
You need to replace "video.mkv" with the actual filename of the MKV - but remember to keep the quotes around it. Also, make sure the script is in the same directory as the MKV - if it's not, you need to specify the full path.

User avatar
Faltzer
Joined: Mon May 26, 2008 11:28 am
Status: There's no such thing as no such thing.
Location: In your underpants!! PANTSU PANTSU!!!
Contact:
Org Profile

Post by Faltzer » Mon Nov 03, 2008 2:36 pm

Ok, it seems to work, but it still complains about opening the mkv file if I don't specify the full path, otherwise, everything seems to work!!! THANK YOU!!!! :D :D :D
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination!

Locked

Return to “Conversion / Encoding Help”