View Full Version : HOWTO: calculate m2ts overhead?
moviefan
13th December 2008, 11:34
Hi guys,
in order to exhaust the maximum space available of a chosen medium, I need to calculate the total overhead of the m2ts container, AC3, and DTS. Can anyone help me there or name a calculator for these formats? I haven't found one ...
Regards
moviefan
turbojet
13th December 2008, 15:47
ripbot264 does a good job but it only supports 1 audio stream
odin24
14th December 2008, 01:40
It depends on the file types and sizes in the container. Is there a particular medium use generally use?
You can mux each stream to it's own m2ts, compare the muxed file and the raw file for the difference. Do this for all streams and it will give you a fairly accurate picture.
When I do my own DVD9's I always use h264 video and DTS @ 1536 kb/s, the overhead is pretty close to 570mb always. I have muxed a 2 hour TrueHD track once just for curiosity sake and the overhead was close to 1.3 GB... the track itself was close to 3.5 GB
G_M_C
14th December 2008, 11:00
Hi guys,
in order to exhaust the maximum space available of a chosen medium, I need to calculate the total overhead of the m2ts container, AC3, and DTS. Can anyone help me there or name a calculator for these formats? I haven't found one ...
Regards
moviefan
I use a riugh percentage of the total size i want the project to reach ( 2 x DVD5, or 1 dvd9). In my experience a percentage of 6 percent should be good, but many times i use 7 to be sure ;)
ildocteur
23rd December 2008, 14:20
If ripbot264 is close to geeting the optimal bitrate for a given media size would someone then be able to privide the formula used
I have been trying to find the source for ripbot264, but i don't think it's avaiable.
ildoc
MadMonkey57
23rd December 2008, 15:29
Here's what I do...
A DVD-R is approximately 2,298,496 sectors. With 2,048 bytes per sector, that makes it 4,707,319,808 bytes.
It is commonly accepted that the overhead for M2TS is about 6% - 7% (as G_M_C reported a couple of posts ago). Let's assume 7%.
4,707,319,808 - 7% = 4,377,807,421
In a typical movie only BD5, you need a few more kilobytes for the rest of the BD structure... and I am a rather conservative person... and I like round numbers... and I hate to waste time... so let's make it 4,375,000,000 bytes available for 1 video stream and 1/+ audio streams (and possibly subtitles streams... but let's ignore them in our case, they are pretty small anyway).
My next move is to approximate the optimal value for video bitrate given 1/+ audio streams :
Video_bitrate = ( 4,375,000,000 x 8 / 1024 / movie_length_in_sec ) - audio_bitrate
"4,375,000,000" is the total number of bytes available for video and audio
"x 8" turns this available space into bits
"/ 1024" turns this available space into kbits
"/ movie_length_in_sec" gives us the available bitrate in kbits/s for video and audio
The final step "- audio_bitrate" gives us the remaining space for the video
Example : a 1h30 movie, with 2 audio streams, 640kbits/s each, to fit on a DVD-R, what is the optimal video bitrate ?
Video_bitrate = ( 4,375,000,000 x 8 / 1024 / 5400 ) - 1280
Video_bitrate = 5049 kbits/s
Hope it helps.
G_M_C
23rd December 2008, 15:43
Here's what I do...
A DVD-R is approximately 2,298,496 sectors. With 2,048 bytes per sector, that makes it 4,707,319,808 bytes.
It is commonly accepted that the overhead for M2TS is about 6% - 7% (as G_M_C reported a couple of posts ago). Let's assume 7%.
4,707,319,808 - 7% = 4,377,807,421
In a typical movie only BD5, you need a few more kilobytes for the rest of the BD structure... and I am a rather conservative person... and I like round numbers... and I hate to waste media... so let's make it 4,375,000,000 bytes available for 1 video stream and 1/+ audio streams (and possibly subtitles streams... but let's ignore them in our case, they are pretty small anyway).
My next move is to approximate the optimal value for video bitrate given 1/+ audio streams :
Video_bitrate = ( 4,375,000,000 x 8 / 1024 / movie_length_in_sec ) - audio_bitrate
"4,375,000,000" is the total number of bytes available for video and audio
"x 8" turns this available space into bits
"/ 1024" turns this available space into kbits
"/ movie_length_in_sec" gives us the available bitrate in kbits/s for video and audio
The final step "- audio_bitrate" gives us the remaining space for the video
Example : a 1h30 movie, with 2 audio streams, 640kbits/s each, to fit on a DVD-R, what is the optimal video bitrate ?
Video_bitrate = ( 4,375,000,000 x 8 / 1024 / 5400 ) - 1280
Video_bitrate = 5049 kbits/s
Hope it helps.
Yep i reported 6%~7%, and i use 7% to be shure. But since the last few projects i've been recording filesizes before and after the mux. And in reality the percentage hovers around 5.6%. So if you really really really want to squeeze aut everyting you can get, than 6% should be doable.
MadMonkey57
23rd December 2008, 16:14
Yep i reported 6%~7%, and i use 7% to be shure. But since the last few projects i've been recording filesizes before and after the mux. And in reality the percentage hovers around 5.6%. So if you really really really want to squeeze aut everyting you can get, than 6% should be doable.
If I'm not too lazy and not too coward, I'll try my next projects with 4,400,000,000 then...:rolleyes:
n0mag!c
23rd December 2008, 22:56
Guys, I hope Atak_Snajpera will not be so lazy to share his formula with us.
Till then I'll be not so lazy to share my knowledge with you. Many years I use this formula for raw stream of any type:
Smb=Tmin*Bkb*0.0075, where
Smb - size in megabytes
Tmin - length of stream in minutes
Bkb - bitrate in kbits/s
0.0075 - is enough precise factor, you can easily try this formula for yourselfs.
We must use different CONTAINER FACTOR for different containers. And muxing test gives me 1.065 result for m2ts container.
for example: Total bitrate (kbit/s) will be 4700(media size) / CONTAINER FACTOR / Tmin / 0.0075.
Then video bitrate will be "Total bitrate" - "audio1 bitrate" - "audio2 bitrate" - ...
So G_M_C is quite right when using 7-8%%, especially if we wanna use subtitles...
G_M_C
23rd December 2008, 23:01
If I'm not too lazy and not too coward, I'll try my next projects with 4,400,000,000 then...:rolleyes:
It's not about the laziness or cowardness, but usefull to know if you got a project to go on DVD5 and you absolutely want to squeeze every bit out of it that you can.
I use 1,07 (7%) normally, or sometimes 1,08 (8%) when i want to have some room to split the clip/movie into 2 DVD5's. The extra room gives me "playroom" to choose a nice split-point (on a chapter or scene-change for instance).
n0mag!c
24th December 2008, 08:11
CONTAINER BITRATE
I did few tests and seems that I was wrong about it.
The conclusion is that final m2ts file size depends only on sizes of the muxing streams.
So I've edited my previous post to match new facts and not to confuse all readers.
MadMonkey57
24th December 2008, 09:47
It's not about the laziness or cowardness, but usefull to know if you got a project to go on DVD5 and you absolutely want to squeeze every bit out of it that you can.
I use 1,07 (7%) normally, or sometimes 1,08 (8%) when i want to have some room to split the clip/movie into 2 DVD5's. The extra room gives me "playroom" to choose a nice split-point (on a chapter or scene-change for instance).
I meant lazyness coz it makes me change my habits.
And cowardness coz if for a specific movie it doesn't fit, I'll have to start it all over again, and it's a real pain...
But hey... it was just a joke, you know... Of course I'll try your settings (and thanks for the tip by the way).
MadMonkey57
28th December 2008, 09:52
... I'll try your settings (and thanks for the tip by the way).
@G_M_C
As promised, my report on the 4,400,000,000 bytes dedicated to audio/video (i used to use 4,375,000,000 in my formula (http://forum.doom9.org/showthread.php?p=1227078#post1227078)). it works fine, tested so far on 4 movies, longest was 2h06mn, there's a longer one coming (n0mag!c found that the overhead could be dependent on the length of the movie).
turbojet
28th December 2008, 12:01
Atak posted RipBot264's calculations here (http://forum.doom9.org/showthread.php?p=1220277#post1220277) very accurate from my tests, except the new subtitle*2 added recently seems to undersize. I can understand why he did it though.
n0mag!c
28th December 2008, 13:53
n0mag!c found that the overhead could be dependent on the length of the movie
Sorry, I was wrong. :o
odin24
28th December 2008, 14:20
Example : a 1h30 movie, with 2 audio streams, 640kbits/s each, to fit on a DVD-R, what is the optimal video bitrate ?
Video_bitrate = ( 4,375,000,000 x 8 / 1024 / 5400 ) - 1280
Video_bitrate = 5049 kbits/s
Hope it helps.
MadMonkey57, do you think this formula will work with a TrueHD or DTS HD-MA track on a BD-R... just plug the proper numbers in?
MadMonkey57
28th December 2008, 18:54
MadMonkey57, do you think this formula will work with a TrueHD or DTS HD-MA track on a BD-R... just plug the proper numbers in?
I can't confirm based on my experience coz I don't own a BD burner, but I can't think of an obvious reason why the formula couldn't apply to BD-RE and HD audio streams (would mean that M2TS muxing strategy is somehow based on the content itself...).
MadMonkey57
28th December 2008, 18:55
Sorry, I was wrong. :o
Never mind... ;)
MadMonkey57
29th December 2008, 21:42
@G_M_C
As promised, my report on the 4,400,000,000 bytes dedicated to audio/video (i used to use 4,375,000,000 in my formula (http://forum.doom9.org/showthread.php?p=1227078#post1227078)). it works fine, tested so far on 4 movies, longest was 2h06mn, there's a longer one coming (n0mag!c found that the overhead could be dependent on the length of the movie).
And my final comment on this... A 2h30mn movie fits on a DVD using 4,400,000,000 bytes in my formula. So cool !
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.