Non-Standard but Better Quality Audio ^^

The encoding guide on the last page is all very well... but it's still not the best quality for a distribution amv you can get. You can do better but there are some hurdles to jump first.

Better mp3s: Variable Bitrate Audio

I touched on VBR audio in Chapter 2 and if you read that you will know that VBR audio is generally a very very good thing. By giving certain areas more bits and other areas less you can have much better quality. There are 2 types of VBR encoding but both of them follow the same principle:

ABR (Average BitRate) is a method which is designed to have practically the same size as a constant bitrate file but the actual bitrate will fluctuate around the average mark to give more bits to the parts that need it most. 128kbps ABR will inevitably sound better in places than 128kbps constant bitrate. This is what was used in the virtualdub audio encoding guide.

VBR (Variable BitRate) is a method in which a bitrate range and a desired quality are selected. So, you might say you can allow any bitrate between 32kbps and 224kbps as long as the quality is at level 3 (quite good). This will then encode the audio and keep the same quality throughout but some sections will be simpler than others and will need fewer bits whereas more complicated sections will get the bits they require.

Sounds great, huh? Well it is... until you stick it on a video.

For one, MPEG-1 streams don't like vbr audio because of the way that they are packetised. As far as I'm aware there is no working method for muxing a variable bitrate mp3 to an mpeg1 video file.

Furthermore, AVIs aren't really designed for dealing with variable bitrate audio. You can have a vbr mp3 as your audio stream but there are some problems. Firstly the method of multiplexing vbr mp3 audio to an avi using Nandub is actually a bit of a hack which allows the files to work in Media Player but causes issues, as Avery Lee pointed out:

"First, DirectShow's buffering does not seem to react very quickly to VBR audio, and if you have high variance in the audio stream, it can cause the video playback to suddenly speed up or slow down. Second, neither DirectShow nor AVIFile will write out an audio stream in this way, so nearly any other program will trash the AVI file when it's rewritten." From Virtualdub news update 02/Dec/2001

So, if there is a big shift in the bitrate it can cause media player to speed up and it also can't be used in many programs for editing. Virtualdub doesn't like them as a source and you can only import them to TMPG by forcing DirectShow. Bummer.

What this means for you is that you can use VBR mp3 audio but it may a) cause speeding up or slowing down during sections in windows media player and b) will cause people problems if anyone wants to mess around with the file such as make a vcd etc.

If you do want to use VBR audio the thing to do is: a) Test it. If it causes speeding up then.... b) Use the normal way.

Most of you may not mind the fact that you wont be able to do much (easily) with the file once it's made as it's only there for people to watch, so it is a valid method - I'm just giving you fair warning.

Basically what this all means is that if you have VBR audio, everyone should be able to play it in media player.

Provided there are no speed problems due to fast changes in bitrates it shouldn't take any more processing power (as WMP is 'supposed' to read every header anyway even if they all say the same thing). It's certainly an option for getting good quality sound in your file so it can be worth considering.

Encoding VBR mp3 audio

There are plenty of different programs that can encode LAME mp3 (which is the best VBR mp3 audio encoder IMHO) but the one I'll use for this guide is BeSweet and the BeSweet GUI. a) because it is a very useful tool generally and b) because has been described a little in the DVD source guide. For this conversion you will need to separate the wav from your video which (if you don't have it separate already) you can do with this guide.

Download BeSweet and the BeSweet GUI and unpack them noth to a folder of your choice.

Open up the Besweet GUI, it will look like this:

BeSweet GUI - with buttons numbered to match instructions

1) Click the folder icon next to BeSweet in the top-left corner and lcoate your "BeSweet.exe" file - NOTE: do not put in the location of the GUI :)

2) Next, click the folder next to input and using the explorer at the top, locate your wav file. Don't worry about all the boxes below the main two - all you have to do is find your wav file in the top boxes and choose OK.

3) Select MP3 in the Lame pulldown menu and 4) click the folder next to output - choose a location and type in a name for the file. Click ok.

5) Tick the Auto gain and Post gain boxes on the main page.

6) Press the LAME 1 button and we'll set up some mp3 options:

BeSweet > LAME1  settings

7) Tick mode and choose Joint Stereo (or Stereo if you are doing high bitrates or prefer true stereo compression - see Chapter 2 for details)

8) Check 'Alt Preset' and choose -insane if you want highest possible quality and don't really care about the size (this will be 320kbps) - this is probably much more than you neeed but this is the advanced guide :)

If you want very very high quality with large-ish mp3s choose -extreme (approx 256kbps)

For something a little more manageable, use -standard which will give good quality at an average of around 192kbps.

If you want to specify the average bitrate, instead choose 'Alt Preset' and ABR and enter a bitrate. Anything 128kbps or higher is good. 192 is nice if you think you have the space but if you do you might be better off trying -extreme or -standard.

Go back to the main BeSweet page by pressing the BeSweet button (underneath AC3 & OGG). If you really want to convert down to 44.1kHz from 48kHz then use the SSRC tick box, if not leave it alone.

9) Click the "wav to mp3" button on the main BeSweet page - a dos-style command window will appear to do the encoding, don't close it :).

In a few minutes, your mp3 file will be ready.


Adding the VBR mp3 audio to your avi.

Get Nandub. Load it up and open your avi file. You can do this ready for encoding with nandub for DivX or after you've encoded your video - it doesn't matter.

Choose Audio -> (VBR) MP3 Audio...

Keep 'Direct Stream Copy' chosen in the Audio menu and as you've already encoded your DivX/XviD choose 'Direct Stream Copy' in the video menu too.

File -> Save as Avi

That should be it.


Other Audio Formats: Ogg Vorbis, MP3pro and Windows Media Audio

Ogg Vorbis is a very cool patent-free audio codec that is definitely worth looking at as an alternative for mp3s. Similarly MP3Pro is being hailed as having the ability to encode 128kbps quality mp3s at 64kbps so it is also worth looking at as an audio encoding solution.

Windows Media Audio is argued by some to be also better than mp3 at the same bitrates but that's not what my ears tell me by a long shot. WMA is probably better for very low bitrates but I wouldn't recommend having those for your audio anyway.

Then there's AAC, which I doubt many of you will use but those of you who will don't need me to tell you about it. It's the audio format designed for use with ISO-compliant mpeg4 and it's pretty nice.

Finally there's AC3 which is the audio format used on commercial dvds.

As for using these as audio streams on your amv... I wouldn't, personally.

It's not that it isn't possible, in fact it's very possible to do for all the above but these are my reasons as to why not:

Ogg Vorbis: Sounds good but how many people really have the codec? Not many. Linux users will be happy though ^_^ For Ogg stream options, has some good guides on the subject. Personally I love Ogg, and I think Ogg media streams are fantastic but I don't think I'm going to be the one to start the trend.... well, I might - we'll see :)

MP3Pro - As far as I understand, it is possible to use MP3Pro audio just like you can with normal mp3 but apparently you don't get any of the quality benefits with current implementations when playing back in media player. So there's no point. (I'm not 100% certain on the exact details on this.. If it becomes a more valid method, I will do an update)

Windows Media Audio - Using this audio is possible but I personally don't like it and not everyone has the wma audio codecs installed. Of course, if you are making a video with Windows Media Video then you will also encode with wma but I don't recommend wmv either because it's just not as good as DivX ^_^

AAC - Not everyone has an MPEG4 player software. There are players available for both windows and MAC OS but people don't like change. Wait until it's a universal format - which may be quite a while as Microsoft, for one, prefer to plug their own.

AC3 - Difficult to encode well and probably too big for what you want and not everyone has AC3 filters. Not recommended.

RealAudio - Currently a locked codec and I don't like it anyway.

In conclusion, mp3 is still the best way to go at the moment. There's nothing that beats it right now for general support and availability.

That's All Folks!

Well, for now that's all from me. I hope you've found this guide useful.

If there are any topics that you feel need to be covered in the guide, please let me know,

AbsoluteDestiny - October 2002