Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 21st August 2005, 21:06   #1  |  Link
jellysandwich
Registered User
 
Join Date: Mar 2004
Posts: 247
VfW-mode AVC/h.264 tracks vs. Native Matroska-mode AVC/h.264 tracks

Could someone please explain the difference between vfw mode and native mode, and why native mode is preferred?

I tried google and wikipedia, but couldn't find anything (mostly because I dont know what keywords to search for).

js
jellysandwich is offline   Reply With Quote
Old 21st August 2005, 21:34   #2  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
native mode is the way to store avc in mkv as defined in the mkv specs, anything else you need to know?

vfw mode is a special way for storing streams in mkv as some sort of "private stream" when going via the vfw codec interface (as used in virtualdub) meaning its nowhere defined how the stream is stored in the mkv

here a list about the downsides of vfw mode:
1) you will loose interoperability. if you dont use the native way its not ensured that your files will work with mkv tools meant to support avc following the specs.
placing avc in mkv the vfw way is like placing avc in some private not defined way in .mp4: its not ensured that the files will work anywhere

2) you will get decoding delays with any avc encoding mode not being support in vfw (that is b-frames, b-references or arbitrary frameorders without b-frames).
you will get a delay of 1 in case of b-frames plus 1 additional frame if b-pyramid is used (that is a delay of 80ms for a 25fps stream)

3) you will get an "encoding delay", so called delay frames into the stream. in the case of asp video they will break the compliancy of the video stream to the mpeg-4 standard, dunno if this is true for avc too.
that is an additional delay of 2 frames in the case of useage of 2 b-frames: 80ms (never tested how b-pyramid influences this, but surely not positively). i think the delay will be higher if you use more b-frames (eg 3 delay frames with 3 b-frames aso)

4) the framenumber of the stream will not be correct anymore. you will loose two frames in the case of using 2 b-frames (3 frames with 3 b-frames aso)

5) people will laugh at you if you use it
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free

Last edited by bond; 21st August 2005 at 21:59.
bond is offline   Reply With Quote
Old 21st August 2005, 21:36   #3  |  Link
Sirber
retired developer
 
Sirber's Avatar
 
Join Date: Oct 2002
Location: Canada
Posts: 8,978
@bond

It's coz of #4 I implemented it in RealAnime
__________________
Detritus Software
Sirber is offline   Reply With Quote
Old 21st August 2005, 21:38   #4  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally Posted by Sirber
It's coz of #4 I implemented it in RealAnime
i thought you use x264cli?

moved to container forum
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 21st August 2005, 21:44   #5  |  Link
Caroliano
Registered User
 
Join Date: Feb 2005
Location: São Paulo, Brazil
Posts: 392
Quote:
1) you will loose interoperability. if you dont use the native way its not ensured that your files will work with mkv tools meant to support avc following the specs. placing avc in mkv the vfw way is like placing avc in some private not defined way in .mp4: its not ensured that the files will work anywhere
If you use the native mode you will loose interoperability. If you use native mode way its not ensured that your files will work with older mkv tools that only suport avc in vfw mode, like virtualdubmod. So you have no escape, only define what tools you want to use.

Any way, for more detailed information of the b-frame delay thing you can read this, but it was for ASP, I don't know what changed.

And bond:
Caroliano is offline   Reply With Quote
Old 21st August 2005, 21:47   #6  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally Posted by Caroliano
If you use the native mode you will loose interoperability. If you use native mode way its not ensured that your files will work with older mkv tools that only suport avc in vfw mode, like virtualdubmod. So you have no escape, only define what tools you want to use.
virtualdubmod is the only tool which suffers from this. and of course avc stored the vfw way in mkv will also only work in virtualdub when there is explicit support for the way its stored in there, eg in ffdshow
once someone invents some private storage mode (eg packed bitstream-like) for avc-in-mkv and no vfw decoder (speak: ffdshow) supports it you can go to hell with your vfw mode
the native mode is the only way to ensure interoperability

btw the vfw mode was especially created for supporting old tools, like vdm
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free

Last edited by bond; 21st August 2005 at 21:57.
bond is offline   Reply With Quote
Old 21st August 2005, 21:58   #7  |  Link
stephanV
gone
 
Join Date: Apr 2004
Posts: 1,706
i though x264vfw didnt use delay frames? it seems to me it just outputs nothing the first few frames and VirtualDub responds to that by writing a drop frame. but this doesnt break anything in the bit stream as such...
stephanV is offline   Reply With Quote
Old 21st August 2005, 22:08   #8  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally Posted by stephanV
i though x264vfw didnt use delay frames? it seems to me it just outputs nothing the first few frames and VirtualDub responds to that by writing a drop frame. but this doesnt break anything in the bit stream as such...
indeed but you will get the delay and you will loose frames
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 21st August 2005, 22:11   #9  |  Link
stephanV
gone
 
Join Date: Apr 2004
Posts: 1,706
im not sure how drop frames are handled by avi parsers in the beginning of a file, i thought AVIMux GUI remvoed them, and that MS avi splitter just skipped them too. so i think the only delay you will see is from decoding.

However, it is of course recommended to use the native mode for h264 in MKV. Unless you know what you are doing, you should use things the way they are intended to be used.
stephanV is offline   Reply With Quote
Old 21st August 2005, 22:23   #10  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally Posted by stephanV
im not sure how drop frames are handled by avi parsers in the beginning of a file, i thought AVIMux GUI remvoed them, and that MS avi splitter just skipped them too. so i think the only delay you will see is from decoding.
hm i think the question is with which frame the audio is synced to. if the audio starts with the avi frame 1, but the video actually starts with frame 3 (when using two b-frames) you will get a desync of two frames no matter if the avi parser drops the first two frames (and the audio too) or if nothing gets displayed in the first two frames
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 21st August 2005, 22:23   #11  |  Link
Caroliano
Registered User
 
Join Date: Feb 2005
Location: São Paulo, Brazil
Posts: 392
BTW, there is any tool that can convert a native mode matroska to an vfw mode matroska and vice-versa? W/o re-encoding?
Caroliano is offline   Reply With Quote
Old 21st August 2005, 22:28   #12  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally Posted by Caroliano
BTW, there is any tool that can convert a native mode matroska to an vfw mode matroska and vice-versa? W/o re-encoding?
not for avc.
maybe its possible for asp in mkvmerge, dunno

in any case you can demux the avc to raw .264, import to .mp4 and than remux to .mkv

but of course the best is to encode directly to .mp4 or .mkv as supported in x264 already...
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 21st August 2005, 22:32   #13  |  Link
stephanV
gone
 
Join Date: Apr 2004
Posts: 1,706
Quote:
Originally Posted by bond
hm i think the question is with which frame the audio is synced to. if the audio starts with the avi frame 1, but the video actually starts with frame 3 (when using two b-frames) you will get a desync of two frames no matter if the avi parser drops the first two frames (and the audio too) or if nothing gets displayed in the first two frames
The skipped frames would have a 0s duration, so no delay will occur. Audio is not synched to video frames in AVI (there are no timecodes or anything, remember?). Video is played at constant rate, audio is played at a constant rate and if the rates and start times are such that audio and video are in synch, then that's a bonus.

Quote:
BTW, there is any tool that can convert a native mode matroska to an vfw mode matroska and vice-versa? W/o re-encoding?
It probably is possible by using a combination of tools, but there is not one tool for it.

Last edited by stephanV; 21st August 2005 at 22:34.
stephanV is offline   Reply With Quote
Old 21st August 2005, 23:36   #14  |  Link
Haali
Registered User
 
Join Date: Jul 2003
Posts: 282
Quote:
Originally Posted by stephanV
The skipped frames would have a 0s duration, so no delay will occur.
Not really, dropped frames still occupy time slots. I think VD or VDM had some special code to delete them for mpeg4-2, don't know if the same is implemented for avc.
Haali is offline   Reply With Quote
Old 22nd August 2005, 01:42   #15  |  Link
jellysandwich
Registered User
 
Join Date: Mar 2004
Posts: 247
Wow, very detailed. Thanks a lot. I especially like #5.

js
jellysandwich is offline   Reply With Quote
Old 22nd August 2005, 09:59   #16  |  Link
stephanV
gone
 
Join Date: Apr 2004
Posts: 1,706
Quote:
Originally Posted by Haali
Not really, dropped frames still occupy time slots. I think VD or VDM had some special code to delete them for mpeg4-2, don't know if the same is implemented for avc.
Yes, you're right. Maybe the delays I checked with before never were big enough to notice.
stephanV is offline   Reply With Quote
Old 4th April 2006, 02:46   #17  |  Link
kdm
Registered User
 
kdm's Avatar
 
Join Date: Aug 2005
Location: Russian Federation
Posts: 19
Quote:
Originally Posted by Caroliano
BTW, there is any tool that can convert a native mode matroska to an vfw mode matroska and vice-versa? W/o re-encoding?
AVC2AVI -f framerate -i input.raw -o output.avi
kdm is offline   Reply With Quote
Old 4th April 2006, 07:45   #18  |  Link
Yong
Registered User
 
Join Date: Jun 2004
Posts: 577
Quote:
Originally Posted by kdm
AVC2AVI -f framerate -i input.raw -o output.avi
Of course you have to extract the avc stream from mkv,
by using the mkvextract
Yong is offline   Reply With Quote
Old 29th April 2006, 22:36   #19  |  Link
Eric B
Registered User
 
Join Date: May 2002
Location: France/Germany
Posts: 119
Today, I ve made my first DVD Rip with x264 under VirtualDubMod as I used to for Xvid. I have a soundtrack in OggVorbis. But now, I cannot mux the tracks into a mkv.

If I understood correctly, VDM should not be used for x264.

Is there still a possibility to mux my x264 avi into a mkv or must I reencode the movie?

Last edited by Eric B; 29th April 2006 at 23:32.
Eric B is offline   Reply With Quote
Old 29th April 2006, 22:57   #20  |  Link
thoralf
Registered User
 
Join Date: Dec 2003
Location: Thiersechs
Posts: 165
Quote:
Originally Posted by Eric B
Today, I ve made my first DVD Rip with x264 under VirtualDubMod as I used to for Xvid. I have a soundtrack in OggVorbis. But now, I cannot mux the tracks into a mkv.

If I understood correctly, VDM should not be used for x264. Is there still a possibility to mux my x264 avi into a mkv or must I reencode the movie?
just use the avi2raw / mp4box-approach as suggested by mkvmerge (note that the framerate for pal is 25 and not 23.976). there's definitely no need to reencode.
you end up with a raw .264 stream that should be pretty much identical to a .264 produced by any of the non-vfw-x62-frontends. mkvmerge will quite happily mux such a video stream along with your audio into a perfectly standard-compliant mkv.

hope i didn't confuse you too much,
thoralf.
thoralf is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.