View Full Version : Need help putting x264 in an MKV wrapper...
Jaxel
4th February 2007, 03:39
For about a year now, I've been doing all of my videos in VirtualDubMod. My videos are encoded using x264 with riff-header wave audio. Unfortunately, VirtualDubMod appears to only be able to dub movies into an AVI wrapper... but I hear MKV wrappers are better so I am trying to get into that.
Video: MPEG4 Video (H264) 640x480 59.94fps [Stream 00]
Audio: MPEG Audio Layer 3 44100Hz stereo 128Kbps [Stream 01]
I tried to encode the following x264 video which I made in VirtualDubMod into an mkv wrapper using both mkv-mux and mkvtools. Unfortunately, neither of them worked. I really dont know anything about those two programs so I think I used them wrong...
http://www.crookedjester.com/downloads/sc3.070127.W2.Rekki.vs.KowTow.avi
Please help me learn how to convert my videos to mkv... and possibly, if it is doable within VirtualDubMod.
check
4th February 2007, 04:31
you cannot use VDM to produce mkv files which are usefully better than the AVI files you produce.
Firstly, the problem with AVI & VDM:
-avi stores video as vfw (video for windows) bitstreams. These use an outdated storage technique which has a number of problems. The most obvious side effect is audio desync, which if you are encoding h264 through VDM, I'm sure you've seen.
- VDM can write to mkv, but it writes the h264 stream as a vfw stream, rather than a native h264 stream. This means you will end up with exactly the same problem.
-mkvmux will not accept vfw-h264 unless you give it a special commandline trigger.
So, now the solutions:
- move to a newer encoding solution that produces native h264 files (I use megui, there are alternatives in the MPEG4 GUI forum)
- continue to encode with x264-vfw, but demux the video to raw .264, then mux to mp4, then mux to mkv with audio. Note that the x264-vfw is somewhat out of date, and does not include all settings that the native x264 does.
- continue using avi
I recommend path 1, but it's your choice.
Jaxel
4th February 2007, 04:45
well I use VDM not only to dub the videos, but also to apply filters and cut sequences... so not using VDM is not an option as I dont have high level video editing software like Adobe Premeire.
Although, I have had ZERO audio-sync problems with x264-vfw...
So what is that special command line trigger for mkvmerge?
HeadBangeR77
4th February 2007, 05:29
well I use VDM not only to dub the videos, but also to apply filters and cut sequences... so not using VDM is not an option as I dont have high level video editing software like Adobe Premeire.
Although, I have had ZERO audio-sync problems with x264-vfw...
So what is that special command line trigger for mkvmerge?
Hi!
Good news for you, hopefully. I've been doing exactly the same thing: encoding x264 Vfw into mkv container, what hasn't caused me any trouble so far (not that I like the limitations of the Vfw version, guess I will have to switch to some GUI, like Lemming's). I've got absolutely no problems, using the the latest MKV Toolnix (2.0.0, update patch from 01.02), to open such an mkv, strip the Vfw header or whatever negative legacy it's got, and remux into mkv as a proper raw AVC stream. No need to use mp4 box nor any other additional steps.
good luck,
HDBR77
Jaxel
4th February 2007, 05:30
uhh... you just completely confused me there... could you explain that to me... I'm pretty dumb when it comes to MKV.
How do I strip the VFW header? How do I remux into mkv as a proper raw AVC stream? What is mp4 box? lol... I'm such a noob.
HeadBangeR77
4th February 2007, 05:36
uhh... you just completely confused me there... could you explain that to me... I'm pretty dumb when it comes to MKV.
I did that yesterday, and I've just tried again to be sure:
- mkvmerge GUI which comes with MKV Toolnix package (versions as above)
- open an mkv you've made with the help of VDM
- you could add names of tracks, comments, chapters, srt subtitles (all the usual matroska stuff all-in-one-invention)
- the program remuxes the streams into mkv again, stripping Vfw header, or whatever it is, thus turning x264 Vfw stream into native AVC stream, fully automagically :D
- that's it? ;)
What problems did you have before?
Jaxel
4th February 2007, 05:42
I dunno if it affected it... but my vids are .avi, not .mkv... When I try to mux them in MKVmergeGUI it puts it together, but I just get black for the video...
I just put together a 15 second x264-vfw in .mkv, but when I try to use mkvmerge it says...
Error: 'Z:\one.mkv' track 0: This AVC/h.264 contains frames that are too big for the current maximum NALU size. You have to re-run mkvmerge and set the maximum NALU size to 3 for this track (command line parameter '--nalu-size-length 0:3').
When I add the extra command line parameter, mkvmerge actually crashes! Error Code -1073741819
Do you have AIM? I am BadBreath911
HeadBangeR77
4th February 2007, 06:12
Format specific options: the latest version defaults to NALU 4, if you happen to have an older one, you should be able to set it manually, and that should do.
VDM can save your files as mkv, so you can encode x264 direclty into mkv, as stated above, however they will remain Vfw streams, unless you remux them with e.g. the application we're talking about.
good nite ;)
EDIT: http://forum.doom9.org/showthread.php?p=947447#post947447
Jaxel
4th February 2007, 06:51
HBR, that version of mkvmerge solved ALL my problems! thanks.
I chose to encode into avi-vfw instead of mkv-vfw before I converted over to real mkv. Why? 2 reasons actually... this way, when I convert the files, it comes up with unique but identical filenames differentiated by extension... and as well because with VDM saving mkv-vfw it claims my video is 720x480 instead of 640x480; this didnt really change anything, but I don feel comfortable with it having wrong information.
Jaxel
4th February 2007, 07:32
http://www.crookedjester.com/downloads/sc3.070127.W2.Rekki.vs.KowTow.mkv
This is the new video... if you get the chance, would you mind looking over it and telling me if there are any problems or changes I should make?
HeadBangeR77
4th February 2007, 14:53
HBR, that version of mkvmerge solved ALL my problems! thanks.
Glad to hear that. :)
I chose to encode into avi-vfw instead of mkv-vfw before I converted over to real mkv. Why? 2 reasons actually... this way, when I convert the files, it comes up with unique but identical filenames differentiated by extension... and as well because with VDM saving mkv-vfw it claims my video is 720x480 instead of 640x480; this didnt really change anything, but I don feel comfortable with it having wrong information.
You can modify some Matroska information, including the display resolution, some tags etc. without reencoding and even without remuxing: plz have a look at Matroska Properties /Shell Extension (http://www.matroska.org/downloads/shellextension/MatroskaPropv2.6.exe).
I'm gonna have a look at your sample soon, though I'm no expert at all. ;)
HeadBangeR77
5th February 2007, 04:13
General #0
Complete name : K:\Downloads\sc3.070127.W2.Rekki.vs.KowTow.mkv
Format : Matroska
File size : 24.5 MiB
PlayTime : 2mn 56s
Bit rate : 1160 Kbps
Encoded date : UTC 2007-02-04 06:31:57
Writing application : mkvmerge v2.0.0 ('After The Rain Has Fallen') built on Feb 1 2007 08:51:47
Writing library : libebml v0.7.7 + libmatroska v0.8.1
Video #0
Codec : MPEG-4 AVC
Codec/Info : MPEG4 ISO advanced profile
PlayTime : 2mn 56s
Width : 640 pixels
Height : 480 pixels
Aspect ratio : 4/3
Frame rate : 59.940 fps
Audio #0
Codec : MPEG1/2 L3
Codec/Info : MPEG1 or 2 Audio Layer 3
Channel(s) : 2 channels
Sampling rate : 44 KHz
I can't see anything unusual here, at least to my eyes. Both the video and audio stream have been properly muxed. Everything seems fine - I've watched the sample. :)
Now I know what you need those 60fps for! ;)
Jaxel
5th February 2007, 18:08
Hehe... yeah, thanks man. Fighting games operate at an internal 60fps (even if your TV only displays 30fps or 24fps)... so the 60fps videos are important as pro-players tend to analyze matches frame by frame.
Jaxel
7th February 2007, 04:55
okay... I am having one other issue... I have noticed, any period with "no-sound" is recorded by mkvmerge as non-MP3 data. For instance, at the beginning of my video, I may have a few frames of silence... this is what mkvmerge will tell me...
mkvmerge v2.0.0 ('After The Rain Has Fallen') built on Feb 1 2007 08:56:12
'Z:\nh3.demo.Ougi.Part1.avi': Using the AVI demultiplexer. Opening file. This may take some time depending on the file's size.
'Z:\nh3.demo.Ougi.Part1.avi' track 0: Using the MPEG-4 part 10 ES video output module.
'Z:\nh3.demo.Ougi.Part1.avi' track 1: Using the MPEG audio output module.
The file 'Z:\nh3.demo.Ougi.Part1.mkv' has been opened for writing.
The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 315 bytes of non-MP3 data at the beginning.
This corresponds to a delay of 19ms. This delay will be used instead of the garbage data.
The cue entries (the index) are being written...
Muxing took 8 seconds.
Now this isnt a problem, it automatically writes in a 19ms delay to even out the areas of non-MP3 data (which is nothing more than "no-sound"). The problem I have is during the video in between scenes, there are also points of "no-sound". I didn't put these points in, when I was recorded the videos off my PS2, during these times, there was just no-sound playing. So during the encode I get the following:
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 358 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 252 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 168 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 178 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 101 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 199 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 91 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 344 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 92 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 394 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 159 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 264 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 48 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 147 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 332 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 344 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 368 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 158 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 112 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 347 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 42 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 186 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 80 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 323 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 228 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 253 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 42 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 252 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 416 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 217 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 58 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 364 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 178 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 319 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 51 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 305 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 228 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 203 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 41 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 344 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 134 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 379 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 30 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 42 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 277 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 52 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 319 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 279 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 37 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 299 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 137 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 67 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 403 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 66 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 198 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 72 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 60 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 121 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 147 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 317 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 113 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 146 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Warning: The MPEG audio track 1 from 'Z:\nh3.demo.Ougi.Part1.avi' contained 256 bytes of non-MP3
data which were skipped. The audio/video synchronization may have been lost.
Each part is not a lot of data... 100-300 bytes here and there isnt a problem... But when this happens 50 times in a single video, by the end the sound is out of sync. Is there any way to get mkvmerge to ignore these errors and keep these bytes intact? Or possibly replace these bytes with delays equivalent to the timing?
Here is the link to the AVI-VFW video I am trying to mux in mkvmerge...
http://www.crookedjester.com/downloads/nh3.demo.Ougi.Part1.avi
foxyshadis
7th February 2007, 10:38
If you aren't afraid of a re-encode (and possible minor degredation) the most full-proof way is probably to just write it out from virtualdub into an uncompressed wav, and then encode it into your favorite audio format. Whatever weirdness it did to the mp3 bitstream, mkvmerge just can't handle it.
Alternately, you can contact Mosu (the maker of mkvmerge) and ask him if he'll take a look at your file to see if it's something he can support.
Edit: Oh, you already did, and he's looking into it. Well never mind then. ^^;
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.