Log in

View Full Version : What overhead (or underhead ?) is to be used with latest VDM for matroska ?


Tuning
8th December 2003, 05:03
The latest VDM has introduced new lacing schemes and bcoz the output size obtained is very much less. (Its comparable with mkvtoolnix too)

For example, if I have 600MB video and 100 MB audio, the output mkv will probably of size 696MB, that is less than total audio and video size. So I think its actually underhead.:p

For the time being, I want to have output size of 702MB and give the maximum bitrate to video.

Can anyone give calculating equation to correcly determine output size ?. Hence the video bitrate used for encoding ?

Thankyou :)

Atamido
8th December 2003, 06:33
Originally posted by Tuning
Can anyone give calculating equation to correcly determine output size ? Short answer: No.

Long answer: Not really.

Overhead calculation depends on many factors, not the least of which is the size of the frames that you are working with. If large frames are grouped together or spread out throughout the stream, it can alter the overhead. The type of audio stream you are using can make really big differences due to the types of audio lacing.

Matroska now uses three types of lacing.

1. Xiph lacing. Good for small frames of variable size.
2. EBML lacing. Good for large frames of variable sizes.
3. Fixed lacing. Super good for frames that are all the same size.

The lacing type is chosen each time a lace is done depending on which would be most efficient. And each lacing type has a different amount of overhead. So, you don't really know for sure how it will lace until you try to mux it, although certain guesses can be made depending on the type of audio. For instance MP3 and AC3 have mostly fixed frame sizes, so most of those will use Fixed lacing.

Perhaps alexnoe would give you some pointers? But he doesn't like to give formulas that such a high degree of inaccuracy.

Tuning
8th December 2003, 09:11
Hi Pamel,
Thanks for the detailed info. The news on different lacing techniques for different frame sizes was new to me.

I found a temporary solution, using VDM, instead of creating avi first create mkv directly. Then the overall size is approximately sum of encoded mkv and audio file. Only while encoding this is helpful. I have to try more on that with different audio types.
Though this method requires to calculate mkv (with video only) size on bitrates. Can mkv (with out sound and considering lacing dependency only on frame sizes) size determined from bitrates ?
Or any other method ?

Thanks

JimiK
8th December 2003, 10:49
I'm using another way. I do encode to Avi (using XviD) and I keep the 1st pass. Then I mux the first pass with my audio and subs and look at the overhead. For me, the overhead of the second pass was exactly the same. So you could perfectly calculate the second pass size. I'm not using VDM, but mkvtoolnix for muxing, but I think it should be the same.
Best regards,
JimiK

Tuning
8th December 2003, 12:29
Thanks JimiK for this suggestion. I will try that next. The current encoding's pass1 was done and already started 2nd. Because of space restriction I always discard pass1 output. I think as the bitrate is very high (in your case) and there is no change in no:frames......the overhead is depending on the no frames.

Thanks

ssjkakaroto
8th December 2003, 17:06
pamel would it be possible to calculate the overhead using the stats file from the first pass and the audio file? that way a program could be created to scan the stats file (either divx or xvid) and scan the audio file (ogg, ac3, mp3, etc) and calculate the overhead for us

tia

Tuning
8th December 2003, 17:12
ssjkakaroto, I think its not possible as mkv decides what lacing scheme to be used while muxing. More than that the stats file gives the expected size in first pass and its actually for avi.:). Then as you mentioned if a program can be made then its enough for determining second pass final size.(No need to calculate pass1 file size)

Atamido
8th December 2003, 17:43
Well, if you imported the audio into MKA first, then you would know the lacing sizes used for the audio. Using that and a stats file you could probably come up with a reasonable accurate file size prediction.

The biggest thing is the audio. If you put that into MKA, then the difference of the MKA + AVI(video only) should not be really far off.

Tuning
8th December 2003, 17:55
Pamel, if I do muxing avi(with out sound) then there is difference.
Some tests results:
Original avi---------mkv (first one is muxed directly from avi and second one is re-mux of that mkv)
Test:1
14,067,712 bytes - > 14,049,406 bytes
14,049,419 bytes

difference:
14,067,712 -
14,049,412
--------------
18,300 bytes


Test:2
15,583,232 bytes - > 15,571,659 bytes
15,571,672 bytes

So I think video is also need to be considered. And if the size is large the difference can be large. (I think)

Back with audio and video:
----------------------------------------
Test:3
Both Audio and Video( avi+mp3 - > mkv)
------------------------------------
Direct muxing:
15,843,328 bytes - > 15,787,897 bytes
15,787,072 bytes----------------*
-------------------------------------
|
|
|
V


video:14,354,432 bytes(avi)(Video only)
video:14,330,236 bytes(mkv)(Video only)
audio: 1,452,672 bytes(mp3)
--------------------------------------
Sum: 15,807,104 bytes(avi+mp3 -> mkv)
Sum: 15,782,908 bytes(mkv+mp3 -> mkv)--------*
-----------------------------------------

Here test:2 and test:3 is on same clip and you can see the direct muxing results are comparable with test:3 results with mkv+mp3 -> mkv. If I use mka and then mux the result will be almost correct.


*Edit*
How can I convert mp3/ac3/aac/ogg -> mka. Is there a application for that ?

ssjkakaroto
9th December 2003, 02:38
Tuning you can use mmg (mkvtoolnix) for that ;)
say Pamel are you up for the task of doing such a program? :wink: :wink:

Atamido
9th December 2003, 07:33
Only one programmer ever tried to do that, and he went mad. Last I heard he was trying to put AAC into AVI.

Really, its mostly guesses. I don't think that there is much I could offer here.

Tuning
9th December 2003, 09:47
Thanks ssjkakaroto, I will try that. Only one programmer ever tried to do that, and he went mad. Last I heard he was trying to put AAC into AVI.
I wonder who was that pgmr ?

But I think as Gknot is gonna support this, len0x is going to do some calculations. Do i need to wait that long ?:(