View Full Version : ac3 vbr encoding possible with besweet/ac3enc?
gizmau
19th September 2002, 19:41
looking at the logfile after encoding ac3 i found this:
[00:00:00:000] +------- AC3ENC ------
[00:00:00:000] | Bitrate method : CBR
[00:00:00:000] | AC3 bitrate : 384
[00:00:00:000] | Channels Mode : 5.1
[00:00:00:000] | Error Protection: Yes
[00:00:00:000] +---------------------
[01:39:57:184] Conversion Completed !
[01:39:57:184] Actual Avg. Bitrate : 384kbps
when cbr and avg is shown, is the a possibility to encode ac3 as vbr as well? i allready tried -vbr and --vbr, but no luck as expected... :^]
the document http://www.atsc.org/standards/a_52.pdf and its tables and the needed bitrate code in audio_stream_descriptor seems to show, that vbr is allowed, because MSB can be 0 or 1 - meaning absolut bitrate or upper limit.
so whats up now?! i am a little confused...
DSPguru
20th September 2002, 11:21
vbr ac3 is possible.
currently, not offered by ac3enc.
in the future..
Chibi Jasmin
20th September 2002, 14:59
Anything special to do, when muxing VBR AC3 into an AVI? I remember VBR-MP3 being a hack, so I just wonder...never encountered any problems with normal and vbr ac3 muxed at 96ms preload 96ms interleave, but who knows...
gizmau
20th September 2002, 16:50
@Chibi Jasmin
how did you create the vbr-ac3?
pacohaas
20th September 2002, 19:06
i'd imagine he found it on a commercial DVD, i've seen a couple, though the "vbr-ness" is pretty questionable as the ones I've seen only use 2 bitrates and simply switch back and forth between them(seemingly for no good reason)
This was quite a while ago, so i don't recall which dvd's they were, It might be interesting if some users could post dvd's with vbr ac3 if they come across them.
DSPguru
20th September 2002, 19:11
Originally posted by pacohaas
This was quite a while ago, so i don't recall which dvd's they werehttp://forum.doom9.org/showthread.php?s=&threadid=32510
rjamorim
9th November 2002, 18:18
Originally posted by gizmau
@Chibi Jasmin
how did you create the vbr-ac3?
You can create vbr-ac3 using BeSweet + this "patched" ac3enc.dll I attached.
The code was patched by a friend of mine (S_O). The VBR code is horrendous though, I almost had a stroke when I first saw it:
int vbrbrt()
{
int bitrate;
unsigned int qw;
int bitrates[]={640,576,512,448,384,320,256,224,192,160,128,112,96};
srand( time(NULL) );
qw = rand() % 12;
bitrate = bitrates[qw];
return bitrate * 1000;
}
(For those of you who don't understand C: S_O is just randomizing the bitrates - he's not doing any kind of analysis in the audio to decide what BR to use)
Let me stress this: This encoder is intended for testing only. The audio quality provided by ac3enc.dll is already bad, the VBR patch makes it even worse. DON'T USE IT TO MAKE YOUR DVD RIPS!
IMO, the biggest merit of this patch is allowing users to test which AC3 decoders behave well with VBR AC3 and which don't. Valex's, OdioDekoda and AC3dec decode my test file well (although the CLI version of AC3dec outputs some weird errors. Plays fine, anyway). CyberLink and InterVideo choke on it. I didn't test Azid.
Have fun!
Regards;
Roberto.
pacohaas
9th November 2002, 18:44
Originally posted by rjamorim
int vbrbrt()
{
int bitrate;
unsigned int qw;
int bitrates[]={640,576,512,448,384,320,256,224,192,160,128,112,96};
srand( time(NULL) );
qw = rand() % 12;
bitrate = bitrates[qw];
return bitrate * 1000;
}hahahahaha! i like it, does what it says though, this is definately for testing purposes only. Maybe this is the first(one of the first?) in a line of non-deterministic encoders. ;)
DSPguru
9th November 2002, 18:47
btw, the seed should be initialized only once.
rjamorim
9th November 2002, 19:30
Originally posted by DSPguru
btw, the seed should be initialized only once.
Well, feel free to improve it. :D
The modified sources are included in the zip file.
Chibi Jasmin
9th November 2002, 21:10
Originally posted by pacohaas
i'd imagine he found it on a commercial DVD, i've seen a couple, though the "vbr-ness" is pretty questionable as the ones I've seen only use 2 bitrates and simply switch back and forth between them(seemingly for no good reason)
This was quite a while ago, so i don't recall which dvd's they were, It might be interesting if some users could post dvd's with vbr ac3 if they come across them.
Yeah, I found it on a commercial DVD! BTW I am a 'she' :D
gizmau
18th January 2003, 16:56
something new to ac3-vbr-encoding?
will there be a new version of ac3enc which fixes the 'encoded ac3 is much quieter than the original'-problem?
ChristianHJW
19th January 2003, 12:41
any results sending VBR AC3 to external receivers with AC3 decoders yet ?
alexnoe
19th January 2003, 16:58
Forget about AC3 VBR in AVI files, unless M$ has more bugs in DirectShow which would allow this.
ChristianHJW
19th January 2003, 18:10
Originally posted by alexnoe Forget about AC3 VBR in AVI files, unless M$ has more bugs in DirectShow which would allow this. .... hehe !!
I know you were replying to Jasmin and i fully agree ( in fact, i cant agree more :D ), but are there any technical objections to using VBR AC3 in containers that can handle true VBR audio ?
Anybody tested what external decoders ( soundcards, surround receivers ) do with VBR AC3 audio ? Will SPDIF passthrough work with normal soundcard drivers ?
MaTTer !!! Where is the guy if you need him :D ! lol ..
alexnoe
19th January 2003, 18:24
AC3 VBR itself is not a problem.
gizmau
19th January 2003, 18:32
@alexnoe
we allready know this, but unfortunaltelly there seems no programm known which is able to produce them (except the one some posts up :D ) and ac3enc is still buggy und unable to do as well.
alexnoe
19th January 2003, 19:49
Just as a side note: DVD Maestro rejects any AC3 VBR files...is AC3 VBR really DVD-Video compliant?
"I have seen it on a DVD video" is no reason...there are some strange things around :p
MaTTeR
20th January 2003, 18:38
Originally posted by ChristianHJW
Anybody tested what external decoders ( soundcards, surround receivers ) do with VBR AC3 audio ? Will SPDIF passthrough work with normal soundcard drivers ? Tested with a few different receivers and sound cards actually. Both the Sony and Denon amp detected the VBR AC3 just as usual:D Turle Beach Santa Cruz and Hercules Fortissmo II passed the stream via AC3filter 0.64b (pre-release) without any problems. AC3filter's dialog indicated no errors in the stream and indeed showed the bitrate changing from 64kbps-640kbps on the fly.
As you all would expect the sound quality did suffer in certain parts of the clip due to code:D
@Roberto
Nice to see you hanging around here more. Is S_O planning to develop this patch further? The possibilities could be excellent even for a filesize difference of 5-15%
PS. Didn't test an AVI but the AC3 track muxed perfectly in the latest pre-relase build of VdubMOD to an OGM.
Edit- Valex's AC3 plugin for WinAmp plays the file back fine also except for the seek bar jumping around.
rjamorim
21st January 2003, 15:26
Originally posted by MaTTeR
@Roberto
Nice to see you hanging around here more.
Thanks. I try to, but I've been traveling too much lately.
I was the last 10 days at the beach, and in a month I'll go to Chile. :D
Is S_O planning to develop this patch further? The possibilities could be excellent even for a filesize difference of 5-15%
Almost certainly not. AFAIK, he doesn't know anything about audio encoding, so he wouldn't know how to do the audio source analysis in order to select optimal bitrates for each second.
His only reason to create that patch was to verify decoder compliancy with VBR streams, I think.
Edit- Valex's AC3 plugin for WinAmp plays the file back fine also except for the seek bar jumping around.
I noticed that too.
I guess it calculates the file duration by filesize/bitrate for each frame. In order to avoid that, the whole AC3 file would need to be scanned prior to decoding, I guess.
Regards;
Roberto.
ChristianHJW
21st January 2003, 15:43
I am almost 100% certain that a standard PSY model from lame could be used to make a nice form of bitrate management. Of course, this wasnt tuned for AC3 at all and the gain was not big to start with, but some basic PSY behaviour should be the same for all form of lossy audio compression i guess ... maybe a basic AAC profile from FAAC could be used also, as its developed for the same family of audio compression formats :D :D ?? lol ...
S_O
2nd February 2003, 20:50
Iīm the creator of that patch. Sory that I post that late, but I had to wait 5 days until I could post.
Yust to clear some things up:
Iīm not going to develope this any further, because I have no idea how I could do that. I patched the encoder because I had an 44.100Hz file (encoded by SoftEncode), which couldnīt be played by InterVideo/Cyberlink, but Moonlight did it. I found out that in 44.100Hz the farmesize is different (like padding) and it seems that some decoders cannot handle it. To check that I created this vbr-ac3enc with following result:
a52dec / liba52: perfect
valex filter/ winamp-plug-in: just problem with time display
Moonlight: just problem with time display
Azid: failed
Digigram Multichannel Decoder: failed
Sonic Foundry Soft Encode: failed
btw, the seed should be initialized only once.Yes, I already fixed that, but I didnīt send that version to rjamorim, so he posted the old. If you want to fix it, simply cut & paste
"srand( time(NULL) );"
from "vbrbrt" to "AC3ENC_INIT" before "ctx->bit_rate=vbrbrt();". Thatīs all.
VBR should be even better possible in ac3 than in mp3, because ac3 can have timestamps (needed to keep sound on CDs with movie on film in sync), which would mean perfect seeking and correct time display just like in ogg-vorbis.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.