PDA

View Full Version : How to Use VBR Audio guide


pacohaas
8th June 2002, 01:25
With the latest BeSweet(1.3), it is now possible to include VBR audio in your SVCD's, here's how:

1. Set up DVD2SVCD as normal, but when calculating max bitrate, use the following for your audio(-v is the VBR setting you plan to use):

-v 0: 320
-v 1: 320
-v 2: 256
-v 3: 256
-v 4: 256
-v 5: 224
-v 6: 192
-v 7: 192
(0 to 5 seems to be the useful range for -v, 0 giving the largest bitrate)

example: -2lame( -e -b 160 -v 3 -m s ), you would put your max bitrate as 2756-256=2500 (perhaps a little less if you are muxing subtitles or just to be on the safe side)

2. Make sure "Don't delete files is checked", also you want to check the edit avisynth script as part of video encoding to give you a pause to do the vbr audio.

3. Set your other settings as desired and start the conversion

4. When the BeSweet window opens(after audio extraction), copy the BeSweet command-line(s) from the DVD2SVCD log tab, and paste them to a .bat file(after the BeSweet line(s), add pause on a new line), then close the BeSweet window.

5. The AVS editor will open up, move it out of the way and edit the -2lame part(s) of your .bat file created in 4 to look like this: -2lame( -e -b 160 -v 3 -m s )

just trust me, I did tons of test encodes and -b 160 is the best to choose, lower than that doesn't decrease the bitrate much(if at all) and higher than that will make the "vbr-ness" of the file worthless. note: for VBR, -b is the minimum bitrate used. As I said earlier, 0 to 5 seems to be the most useful range for -v.

6. Run your bat file, noting the final bitrate of the encoded file(s)

7. Finish editing the avs script so the video encoding starts. Check out the bitrate being used, eg: VBR: 2143(300-2495)kbps

now here's the tricky part:
8. Exit DVD2SVCD, then CCE, and calculate your new Video Bitrate:
example: audio bitrate: 213.3kbps(just round up), video bitrate: 2143kbps
now remember you set the audio bitrate in DVD2SVCD to something based on your -v value you wanted to use, for instance: 256kbps for -v 3.
so, new video bitrate=2143+256-214=2185

9. Open DVD2SVCD again and recover your project, go to the video tab and set your min average and max average to what you found in 8. Go back to the misc tab and Continue!

let encoding finish...
10. bbmpeg seems to have problems muxing VBR audio(which you'll see if you let this continue, final mpg is only slightly larger than the mpv file), so use TMPG's mpeg tools(simple multiplex, make sure to set type to SVCD), save your file as DVD2SVCD would: E:\muxed\bbMPEG_Muxed_File.mpg . You can then recover the DVD2SVCD project if you need to use it to make your bin/cue file.

There are probably a few problems with this method, so maybe some people can try it out and see what's wrong, and what can be done to fix it. Maybe someone can find out why bbmpeg doesn't mux the vbr audio.

One thing I know of is I have only tested this with a single CD movie, without subs. The muxing of subs and splitting into multiple CD's probably have to be done manually, but the point is, it can be done!

DSPguru
8th June 2002, 09:53
thank you for this guide, pacohaas.
now, what about quality ? does it worth doing that long manual process ?

pacohaas
8th June 2002, 22:54
maybe we need a listening test set up for some VBR mp2's vs CBR mp2's. Of course one reason to use this is to have a higher average video bitrate, as you can see in my quick calculations. In fact, all this work may not be worth it, but it's just nice to know it can be done...and maybe dvd2svcd will include this in a future version and it won't be tons of extra work to get this slight increase in quality (video and audio).

DSPguru
8th June 2002, 23:08
Originally posted by pacohaas
...and maybe dvd2svcd will include this in a future version and it won't be tons of extra work to get this slight increase in quality (video and audio). we'll see about that.
another issue we need to test is ac3 replacement for mp2 in terms of compatabilty and quality.

pacohaas
8th June 2002, 23:50
Originally posted by DSPguru
we need to test is ac3 replacement for mp2 in terms of compatabilty and quality. I can't get the thing to burn. Muxing AC3 and mpv with TMPG and bbmpeg both result in a file that VCDEasy can't seem to burn as an SVCD. anybody have suggestions?

orbit-r
9th June 2002, 17:12
hello im sorry
i wantet to give an answer to pacohaas and posted in the wrong thread

so here is it:http://forum.doom9.org/showthread.php?s=&threadid=21714

gruss
orbit-r:rolleyes:

gizmau
8th July 2002, 05:05
bbmpeg doesnt mux vbr because it is unable to (stupid explanation, i know!) - afaik it only supports cbr-audio. in some forum or similar i googled out weeks ago, i found a cutoff of bbmpeg sources, when i remember right.

i made my own tests with the vbr of toolame 0.2i some time ago. the bitrate doesnt go so high as with beesweet/mp2enc so fast, but unfortunatelly it doesnt go down below 192kbit at 48khz. on the other hand this doesnt really matter, because this seems to be the minimum bitrate to let toolame outperform the iso-psy-model (check yourself with frequence analysis of cooledit or something else).

allthough tmpeg made improvements in muxing, the *ONLY* program i can recommend is mplex (from mjpegtools)! have a look at this, you will be amazed - believe me...

your example-command-switch isnt fully useful in my eyes, because it doesnt use the vbr-possibility the right way it could do.
when encoding mp2-vbr, the encoder doesnt look for bitrate at first, but it calculates some kind of signal-noise-ratio. the -b switch gives the minimum bitrate allowed. so i would say that you simply HAVE to use -b 32! why use 160kbit for silence?!

the best way to check the final bitrate and the vbr-ness, as you call it (cool word ;-)!), is encspot http://www.guerillasoft.com/EncSpot2/
yes, i know, svcd doesnt work with mp3 - but encspot works with mp2 as well!! not perfectly, but better than nothing to analyse.

next problem: the resulting vbr-bitrate differs from movie to movie, unfortunatelly. the rates given in your table are a good reference, but far (???) away from beeing perfect, imho. maybe we should talk to dspguru in order to convince him to improve besweet up to some kind of abr-vbr for mp2, maybe :-)))

pacohaas
8th July 2002, 05:36
the short answer to most of your post is this:

tooLame's encoder is far from as perfect as LAME is, and especially in the vbr mode.

ps I'm quite busy for the next month or so, but perhaps then I will revisit this possibility.

Justinus
5th September 2002, 11:59
I found out the reference from Philip talking about the SVCD specification and it seems that they intend planning to use VBR for both video and audio streams. Accidentally, I searched out this thread and it's very interesting to me. So, I tried to test something with VBR audio. After encoding video stream into m2v (ready to mux with audio), I used BeSweet 1.4RC7 to transcode AC3. The command line is below:
"C:\Program Files\BeSweet\BeSweet.exe"
-core( -input "audio_input.ac3" -output "audio_output.mp2"
-logfile "C:\Program Files\BeSweet\BeSweet.log" )
-azid( -s surround2 -c normal -L -3db ) -ota( -g max )
-ssrc( --rate 44100 ) -2lame( -m s -b 0 -v 0 )
gizmau's idea inspired me about vbr-ness so I set the total bitrate to 0. This is because when the VBR mode in 2Lame is set, the total bitrate is likely to be the minimum bitrate and MNR becomes the maximum bitrate. At first, I was not very sure about pacohaas' idea. However, after I mux the output audio with video stream, played mpg file with Winamp, and checked the audio bitrate, it was in the same pattern as pacohaas reported with slighly difference of bitrate. I have tested the audio stream with the value of MNR varied from 0 to 5. The result is the following:

MNR Avg Bitrate Winamp
---------------------------------------
5 163 320
4 173 320
3 184 320
2 196 320
1 207 384
0 224 384

Note:
Avg Bitrate is the average bitrate of output audio stream reported by BeSweet's log file.
Winamp is the audio bitrate on the MPEG details.

The very strange thing is I played mp2 with Winamp and the bitrate (varied during playing back) never reach what Winamp saw. Maybe Winamp doesn't fully support VBR mp2.

I'm not very sure about the side effect of using VBR audio stream and how PowerDVD measures the VBR audio bitrate but there's no problem playing with both software and hardware (DVD Player).

pacohaas
5th September 2002, 16:57
I'm glad someone else is interested in this idea!

A couple notes about my "guide":

The reason for using the audio bitrates in step 1 is because this is the max bitrate that mp2enc uses with each corresponding -v value. It works exactly like -B in LAME except we have no control over it(DSPGuru is looking into this though). So you have to use the max bitrate if you want to make sure to stay in the SVCD specs as I have said.

Also, the reason I say to use -b 160 (effectively the minimum bitrate) is because I have done many many tests and seen that the average bitrate comes out barely different at all when using -b 32(or -b 0). If someone else wants to do some more recent testing of this and post the results you will see this. So I used some of Dibrom's logic and said "well, if the encoder is not going to drop below this very much anyways, why don't we make sure it doesn't and at the same time ensure a minimum quality level since there is little(or no) size advantage"

Keep posting your tests, I will try to put some together soon as well. Also tooLAME is out and mp2enc is in as far as BeSweet is concerned. I believe it had to do with licensing issues or something. Not sure though, and pages I have read say that tooLAME is faster and higher quality, but I think developement of both is continuing so this could change.

toolame (http://mikecheng.d2.net.au/)
MP2Enc (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cdexos/cdexos/MP2Enc/)

Justinus
6th September 2002, 00:26
Originally posted by pacohaas
maybe we need a listening test set up for some VBR mp2's vs CBR mp2's. Of course one reason to use this is to have a higher average video bitrate, as you can see in my quick calculations. In fact, all this work may not be worth it, but it's just nice to know it can be done...and maybe dvd2svcd will include this in a future version and it won't be tons of extra work to get this slight increase in quality (video and audio).
I used to think the same way as you (and still think :D) about pushing up the average video bitrate higher (in my case, I'm thinking both of video and audio). Even though Winamp can read the mp2 bitrate (somehow maybe from the file's header :confused: ), I found that VBR audio always one step behind that bitrate detected by Winamp. For instance, if Winamp reads 320kbps, the peak bitrate is normally 256kbps or something but never reach 320kbps (in this case the average bitrate is 196kbps). So, I think that if I increase the maximum video bitrate from using this formula:

Maximum (video) = Maximum (video+movie) - 196kbps

It's going to be even better! Because I assume that the video bitrate won't be at peak all the time. Unfortunately, this isn't true. VBR audio bitrate swing a lot (also VBR video) and even more while having action scene, i.e. shooting each other, bombing. So, the audio bitrate may swing up to 256kbps or slightly above. In the case the movie is being played, an overall bitrate will over the standard for sure :( (in the case when both video and audio streams are at peak).

What I'm going to tell is, we know what the possible maximum bitrate of audio stream, and we know the average bitrate from the BeSweet log's file. However, we don't know exactly the maximum peak bitrate of the output file. If we know it, we may be able to control the maximum video bitrate even better otherwise we have to set the maximum video bitrate equals to the case we use with CBR audio.

AFAIK the advantage of this idea at the moment is space! You can reduce a bit of sapce out of your CD if you use VBR audio :rolleyes:
To leverage the maximum or average video bitrate is still a problem. If anybody else knows how to measure the peak bitrate (video or audio), you're all welcome :)

pacohaas
6th September 2002, 03:44
well, if you follow my guide, it shows what max bitrates I have found corresponding to -v settings. I found these out using EncSpot. And later you end up setting the max Video bitrate, so there ya go!

Justinus
8th September 2002, 06:49
Thank you pacohaas :) I've found that it's very useful. No need to play and keep looking at dynamic information from PowerDVD. However, I still have the problem with the peak bitrate of the output video stream due to too-smart software (CCE) :mad:

pacohaas
8th September 2002, 21:11
what's the problem? don't you just set the max video bitrate in CCE?

Justinus
9th September 2002, 02:11
Sorry for going of the topic of this thread for a bit :D Yes, I did set the max video bitrate but sometimes CCE tries to maintain Q factor by going off-limit the max video bitrate as Kb_cruncher said at http://forum.doom9.org/showthread.php?s=&threadid=31196#post166462. So, I tried something new :) by setting an in & out local setting (in Advanced Setting of CCE after generating vaf file) on an entire video stream and then set the max video bitrate. The result was impressive but confusing :confused: I moved a slide bar and checked the bitrate and none of them went above the max bitrate. However, the information area (avg, min, and max of bitrate and Q factor) seemed to be miscalculated. It said avg Q factor = 0.1 and avg video bitrate = 1.6Mbps (I set the avg bitrate = 2Mbps and max bitrate = 2.524Mbps). There's no way of Q factor will be this low.

P.S. I'm happy to discuss about this matter further but maybe we'd find an appropriate thread ;)

ChristianHJW
31st December 2002, 09:49
Originally posted by gizmau allthough tmpeg made improvements in muxing, the *ONLY* program i can recommend is mplex (from mjpegtools)! have a look at this, you will be amazed - believe me...

nice tip .. it took me some time to find out its running under Linux only ... a small hint would have been useful for Windows only users to save their time ...

dvd2svcd
31st December 2002, 11:51
mplex works in windows too, just download TSCV 0.84b1 and install it. If you use the default folders look in: C:\TSCV\VCDImager0712 there you'll find mplex. One problem with mplex however is that it does not support 2 audio streams (or rather it didn't when I tried it a few month ago).

gizmau
12th January 2003, 18:40
mplex does from commandline, but tscv doesnt support it within the gui. i didnt use it for a long tome now, but when i remember right, it only worked when the svcd-preset is NOT used...
afair i first tried it when zoolander came out in germany - this movie is only watchable in englisch - nearly all jokes and sarcasm is translated away :-(

RB
16th January 2003, 14:51
@DVD2SVCD: latest mplex and MJPEGTools are available here: ftp://ftp.vcdimager.org/pub/mjpegtools/mjpegtools-1.6.0-rc2.win32.exe_only.zip . The version of mplex included here muxed two audio streams just fine. Also look here for a true Win32 DLL implementation of the MJPEGTools: http://sourceforge.net/projects/mjpgtools

dvd2svcd
16th January 2003, 15:27
That's cool. Maybe I should start making some tests see if I can get rid of bbMPEG.

RB
16th January 2003, 18:48
If it makes your life easier, give it a shot. You deserve it :)

arlsair
21st February 2003, 11:30
@DSPGuru:
Since the development of tooLAME goes further and the new version has VBR improvements, can I still use BeSweet ? Or is there any change in the commandline ?

DSPguru
22nd February 2003, 13:26
Originally posted by arlsair
@DSPGuru:
Since the development of tooLAME goes further and the new version has VBR improvements, can I still use BeSweet ? Or is there any change in the commandline ? i had created tooLame.dll out of v0.2k.
you can use it in BeSweet v1.5b16. just replace the -mp2enc( ) section with -toolame( ) ;)

arlsair
22nd February 2003, 18:18
That a great news. Thanks

pacohaas
23rd February 2003, 07:49
cool stuff, though all the new stuff in v0.2l look very promising (new psymodel and ATH calculations)

When i get my new computer put together (i've been computer-less for a few months now) I'll try to test some of this stuff and give some sort of update if I can.

symonjfox
25th February 2003, 20:13
I'm happy to see that Toolame has been updated and VBR is better than before, but the only thing that should be IMPORTANT for SVCDs hasn't been implemented yet.

The MAX BITRATE setting in VBR! :eek:

It's difficult to know what will be the highest peak in a given audio file, but if we limit it while encoding ... you understand.

For example if i create

Min bitrate = 32 kbs
Max bitrate = 160 kbs

you understand that VIDEO could have peaks up to 2560 kbs (so 2520 for security).

Keep in mind that movies sound tracks are made of noises, rumours, voices and other things that should be easy to compress. And while watching a movie, I don't care about the music or other (in SVCD, in DVD I like High quality audio.:cool: )

symonjfox
28th February 2003, 21:54
Done some tests:

Using lastest Toolame i tried to create the smallest possible clip from a waveform

My smallest line was:

toolame.exe -m j -b 112 -v 0 -e "e:\audio.wav" "e:\audio.mp2"

I noted that everything under -b 112 will create an invalid mp2 stream.
I tried also to check the bitrate values and I discovered that the minimum bitrate used was 112 kbs (unsing EncSpot).
I made at least 20 tests changing the command line, but there weren't anything under 112 kbs.

Using -b 112 (that is the minimum allowed bitrate), I discovered that there were many peacks up to 224 kbs so many SVCDs lovers (like me) must wait until a new, low bitrate enabled, relase (because a max peak bitrate of 2496 kbs for video is somewhere low).

arlsair
28th March 2003, 08:38
Next version of TooLame will have a MAX value.

If you want it now, here a workaround from mike:


For now, if you desperately want to change it, you can grab the source and recompile.

In encode_new.c, look for:

int vbrlimits[2][3][2] = {
/* MONO */
{ /* 44 */ {6, 10},
/* 48 */ {3, 10},
/* 32 */ {6, 10}},
/* STEREO */
{ /* 44 */ {10, 14},
/* 48 */ {7, 14},
/* 32 */ {10, 14}}
};

In the last three lines of this array, change the "14" to a lower value.
14 = 384kbps
13 = 230
12 = 256
11 = 224
10 = 192

pacohaas
29th March 2003, 04:59
Originally posted by arlsair
Next version of TooLame will have a MAX value.Excellent! Hopefully DSPGuru will have a chance to update BeSweet to take advantage of this.