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 > Video Encoding > New and alternative video codecs

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th January 2007, 11:46   #1  |  Link
Doksa
Registered User
 
Join Date: Dec 2006
Location: Zagreb, Croatia
Posts: 4
Muxing VC-1 in ASF

I'm trying to write an ASF muxer for VC-1, and have some questions. What should be put into extradata space of BITMAPINFOHEADER structure for VC-1 (stream properties)? It seems to me that WM asf writer puts sequence header followed by entry point header there, but i can't find some useful info on that. Also, does WMP support annex b wrapper or is it mandatory to send stream info via extradata. Any other info or experiences, and information source would be greatly appreciated.

Thanks,
Ivan.
Doksa is offline   Reply With Quote
Old 10th January 2007, 02:08   #2  |  Link
zambelli
Doom9ing since 2001
 
zambelli's Avatar
 
Join Date: Oct 2001
Location: Seattle, WA, USA
Posts: 1,966
Looking into this now. I will contact you by PM.
zambelli is offline   Reply With Quote
Old 10th January 2007, 11:02   #3  |  Link
Dmitry Vergheles
Registered User
 
Dmitry Vergheles's Avatar
 
Join Date: Dec 2004
Location: Hamburg, Germany
Posts: 326
Quote:
Originally Posted by zambelli View Post
Looking into this now. I will contact you by PM.
Hi zambelli,

I have a couple of question too

First of all where can I get sample of VC1 with B frames contained within WMV file, provided by WindowsMediaEncoder.

I'm interested in how MS puts -frames to WMV by themselves?
__________________
Regards,
Dmitry Vergeles
Solveig Multimedia - Video Editing Software
Dmitry Vergheles is offline   Reply With Quote
Old 11th January 2007, 04:34   #4  |  Link
zambelli
Doom9ing since 2001
 
zambelli's Avatar
 
Join Date: Oct 2001
Location: Seattle, WA, USA
Posts: 1,966
Quote:
Originally Posted by Dmitry Vergheles View Post
First of all where can I get sample of VC1 with B frames contained within WMV file, provided by WindowsMediaEncoder.
I can provide you samples of this, though if I'm understanding your request correctly, you're not asking for anything unusual - just regular Advanced Profile encoded video with B-frames, right?
zambelli is offline   Reply With Quote
Old 11th January 2007, 04:36   #5  |  Link
zambelli
Doom9ing since 2001
 
zambelli's Avatar
 
Join Date: Oct 2001
Location: Seattle, WA, USA
Posts: 1,966
Sharing the answer to Doksa's question publicly too:

Quote:
You need to stick in

1 byte ASFBinding
Sequence header
Entry header

After the mediaType.

For ASFBinding, you can stick in a 1 if you don’t know anything about the stream.

// ASF Binding enum
#define ASFBINDING_SIZE 1 // size of ASFBINDING is 1 byte
#define ASFBINDING_RESERVED 1 // bit 0 – reserved <-- “should be 1 always”
#define ASFBINDING_NO_BFRAME 2 // bit 1 - when 0, b frame might be present
#define ASFBINDING_NO_SLICECODE 4 // bit 2 - when 0, slice might be present
#define ASFBINDING_NO_MULTIPLEENTRY 8 // bit 3 - when 0, mult. entry headers might be present
#define ASFBINDING_NO_MULTIPLESEQ 16 // bit 4 - when 0, mult. sequence headers might be present
#define ASFBINDING_NO_INTERLACESOURCE 32 // bit 5 - when 0, interlace seq might be present
zambelli is offline   Reply With Quote
Old 13th January 2007, 01:10   #6  |  Link
veffremov
Registered User
 
Join Date: Jan 2006
Posts: 39
"Entry header" is the first Entry Point header. Both Sequence header and Entry point header should contain the start codes as well.

Note on the Sequence header: if you have stream whith multiple sequence headers indicating different video sizes for example:

seq1(720x480),seq2(1280x720),seq3(640x480)

The Sequence header after BITMAPINFOHEADER should be the one indication the max video size (in this case 1280x720).

Last edited by veffremov; 13th January 2007 at 06:43.
veffremov is offline   Reply With Quote
Old 7th February 2007, 10:23   #7  |  Link
lovehis
Registered User
 
lovehis's Avatar
 
Join Date: Feb 2007
Location: Seoul, Korea
Posts: 7
Quote:
Originally Posted by zambelli View Post
I can provide you samples of this, though if I'm understanding your request correctly, you're not asking for anything unusual - just regular Advanced Profile encoded video with B-frames, right?
Did you provide sample stream (ASF with VC-1 B-Frame) to Dmitry Vergheles ?

I'm also interesting about it. Can you share to me?

Actually, Now I'm writing an ASF demuxer from scratch.
ASF has to mux video samples with growing time stamps, but Video with B frames can't be that way.

Is there someone who can explain "how MS can put B-Frames in to ASF container" to me ?

Thanks in advance.

Last edited by lovehis; 7th February 2007 at 10:26. Reason: correct typo
lovehis is offline   Reply With Quote
Old 7th February 2007, 11:48   #8  |  Link
zambelli
Doom9ing since 2001
 
zambelli's Avatar
 
Join Date: Oct 2001
Location: Seattle, WA, USA
Posts: 1,966
Quote:
Originally Posted by lovehis View Post
Did you provide sample stream (ASF with VC-1 B-Frame) to Dmitry Vergheles ? I'm also interesting about it. Can you share to me?
Sure. Here are two videos, one Main Profile, one Advanced Profile, both with B-frames:

http://www.citizeninsomniac.com/video/MP_B_Frames.wmv
http://www.citizeninsomniac.com/video/AP_B_Frames.wmv

B-frame distance of 1 was used for both.
zambelli is offline   Reply With Quote
Old 7th February 2007, 16:47   #9  |  Link
lovehis
Registered User
 
lovehis's Avatar
 
Join Date: Feb 2007
Location: Seoul, Korea
Posts: 7
Quote:
Originally Posted by zambelli View Post
Sure. Here are two videos, one Main Profile, one Advanced Profile, both with B-frames:

http://www.citizeninsomniac.com/video/MP_B_Frames.wmv
http://www.citizeninsomniac.com/video/AP_B_Frames.wmv

B-frame distance of 1 was used for both.
Thank you zambelli.
lovehis is offline   Reply With Quote
Old 7th February 2007, 16:59   #10  |  Link
Doksa
Registered User
 
Join Date: Dec 2006
Location: Zagreb, Croatia
Posts: 4
Quote:
Originally Posted by lovehis View Post
Is there someone who can explain "how MS can put B-Frames in to ASF container" to me ?

Thanks in advance.
Lovehis, demuxer should use timestamps to properly order the frames. Muxer's job is to put increasing timestamps, even if pts's that encoder sends are sometimes decreasing (b-frames, something like 0 3 1 2 6 4 5). It's also good practice to put some meaningful values for timestamps for sake of indexing.

I have another question, maybe someone will know - I have written ASF muxer for VC-1, and even though I have index object that looks ok, seeking doesn't work (at all - not that it works badly).

Thanks, Ivan.
Doksa is offline   Reply With Quote
Old 7th February 2007, 17:26   #11  |  Link
lovehis
Registered User
 
lovehis's Avatar
 
Join Date: Feb 2007
Location: Seoul, Korea
Posts: 7
Quote:
Originally Posted by Doksa View Post
Lovehis, demuxer should use timestamps to properly order the frames. Muxer's job is to put increasing timestamps, even if pts's that encoder sends are sometimes decreasing
You mean, VC-1 decoder shall re-ordering timesamps when it deocde B-frame. Am I correct?


Quote:
Originally Posted by Doksa View Post
I have another question, maybe someone will know - I have written ASF muxer for VC-1, and even though I have index object that looks ok, seeking doesn't work (at all - not that it works badly).
If you share your ASF files... I will check it out.
lovehis is offline   Reply With Quote
Old 8th February 2007, 10:21   #12  |  Link
Doksa
Registered User
 
Join Date: Dec 2006
Location: Zagreb, Croatia
Posts: 4
Quote:
Originally Posted by lovehis View Post
You mean, VC-1 decoder shall re-ordering timesamps when it deocde B-frame. Am I correct?
Decoder doesn't care for ASF timestamps at all. It only needs frames in proper order, so timestamps need to be increasing but that's the only condition.
Doksa is offline   Reply With Quote
Old 8th February 2007, 11:45   #13  |  Link
lovehis
Registered User
 
lovehis's Avatar
 
Join Date: Feb 2007
Location: Seoul, Korea
Posts: 7
Quote:
Originally Posted by Doksa View Post
Decoder doesn't care for ASF timestamps at all. It only needs frames in proper order, so timestamps need to be increasing but that's the only condition.
How about different between "decoding time" and "presentation time" in a stream with B Freams?
lovehis is offline   Reply With Quote
Old 11th February 2007, 18:58   #14  |  Link
mediator
Registered User
 
Join Date: Aug 2004
Posts: 133
Looking at AP_B_Frames.wmv, we have:

Frame 0, pts 0:000, Keyframe, 10732 bytes
Frame 1, pts 0:040, Delta frame, 6324 bytes
Frame 2, pts 0:080, Delta frame, 1766 bytes
Frame 3, pts 0:120, Delta frame, 5199 bytes
Frame 4, pts 0:160, Delta frame, 1419 bytes
Frame 5, pts 0:200, Delta frame, 5312 bytes
Frame 6, pts 0:240, Delta frame, 1793 bytes

We can assume that frames 2,4,6,... are B-frames. But their presentation times are not correct if one takes the needed reordering into account. Concluding from this, it seems ASF is not any better in terms of B-frame support then AVI (since decoder hacks are needed get get right association of timestamps).
mediator is offline   Reply With Quote
Old 12th February 2007, 02:42   #15  |  Link
lovehis
Registered User
 
lovehis's Avatar
 
Join Date: Feb 2007
Location: Seoul, Korea
Posts: 7
Quote:
Originally Posted by mediator View Post
We can assume that frames 2,4,6,... are B-frames.
Is there a simple way to know which frame is B-Frame (or I, P Frame) Before decoding? How do we know that? Please, let me know.

Quote:
Originally Posted by mediator View Post
it seems ASF is not any better in terms of B-frame support then AVI
I'm totally agree with you mediator.
lovehis is offline   Reply With Quote
Old 12th February 2007, 08:29   #16  |  Link
mediator
Registered User
 
Join Date: Aug 2004
Posts: 133
Quote:
Is there a simple way to know which frame is B-Frame (or I, P Frame) Before decoding?
The ASF-cotnainer just tells you about key- (I-) frames. But you will not be able to tell B-frames from P-frames without actually parsing them. Partially, you can try to rely on the ASFBinding byte, but if ASFBINDING_NO_BFRAME is 0, you have to parse in any case...
mediator is offline   Reply With Quote
Old 6th March 2009, 09:00   #17  |  Link
mareers
Registered User
 
Join Date: Feb 2009
Posts: 1
Reg Header size

Guys does header size remain constant all the time or keeps changing?? can anyone expalin
mareers is offline   Reply With Quote
Old 18th March 2009, 15:22   #18  |  Link
Toti
Registered User
 
Join Date: Oct 2002
Posts: 160
Quote:
Originally Posted by Doksa View Post
Lovehis, demuxer should use timestamps to properly order the frames. Muxer's job is to put increasing timestamps, even if pts's that encoder sends are sometimes decreasing (b-frames, something like 0 3 1 2 6 4 5). It's also good practice to put some meaningful values for timestamps for sake of indexing.

I have another question, maybe someone will know - I have written ASF muxer for VC-1, and even though I have index object that looks ok, seeking doesn't work (at all - not that it works badly).

Thanks, Ivan.
Hello Ivan, would you share your ASF muxer? I haven't been able to get VC1 into .wmv successfuly. The only thing that kind'a worked was "Solveig ASF Muxer" with "Haali Media Splitter 11012009" installed and must be in .m2ts

Even then it does not makes a good .wmv
__________________
VAIO VGX-XL3 4gig RAM, 4Tb HDD. MEDIA CENTER WINDOWS 7 simply the best!!
Toti is offline   Reply With Quote
Old 24th March 2009, 17:17   #19  |  Link
Toti
Registered User
 
Join Date: Oct 2002
Posts: 160
Please share the tool

I would appreciate it if you can post the application for testing.
__________________
VAIO VGX-XL3 4gig RAM, 4Tb HDD. MEDIA CENTER WINDOWS 7 simply the best!!
Toti is offline   Reply With Quote
Old 2nd April 2009, 03:57   #20  |  Link
Midzuki
Unavailable
 
Midzuki's Avatar
 
Join Date: Mar 2009
Location: offline
Posts: 1,401
Quote:
Originally Posted by Toti View Post
Hello Ivan, would you share your ASF muxer? I haven't been able to get VC1 into .wmv successfuly. The only thing that kind'a worked was "Solveig ASF Muxer" with "Haali Media Splitter 11012009" installed and must be in .m2ts

Even then it does not makes a good .wmv
Use MKVmerge for wrapping VC-1 in MKV, then transfer it to an ASF file with Graphedit.
Midzuki 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 14:11.


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