View Full Version : How to set EX flag in AC3
Top Cool
29th November 2005, 10:46
Hi there,
As you know a lot of DVDs encoded in dolby EX don't have the famous flag enabling the audio stream to be identify as such. My receiver (Yamaha RX-V550) cannot be set manually on dolby EX, so I am missing the great "EX experience" on most DVDs. :(
I have looked everwhere for a small software that could set that %&"#@!§ flag in AC3 file to correct those dolby EX streams.
If anyone knows where to find such a tool, thanks to tell me.
Top Cool
3rd December 2005, 18:31
Has anyone even an idea of how I could patch my dolby EX files?
I would program this myself but I do not know anything about AC3 files and
how to set the flag on.
Please help!
Top Cool
21st December 2005, 09:17
Am I all aolne in the world? Is anyone having the same problem? If there is any lifeforms out there please contact me.
tebasuna51
21st December 2005, 11:41
In A_52 document say:
"Annex C:
Alternate Bit Stream Syntax (Normative)
1. SCOPE
...
This alternate bit stream syntax is identified by setting the bsid to a value of 6."
This is easy to modify, but after say:
"2.3.1.7 xbsi2e: Extra bit stream information #2 exists, 1 bit
If this bit is a 1, the following 14 bits contain extra bit stream information.
2.3.1.8 dsurexmod: Dolby Surround EX mode, 2 bits
This 2-bit code, as shown in Table C7, indicates whether or not the program has been encoded in Dolby Surround EX."
If the 'xbsi2e' bit is set to 0 there are not space in the header to insert the field 'dsurexmod' without reencode the full ac3.
There are not reasons to expect 'xbsi2e' set to 1, an after don't fill the field 'dsurexmod' with the adequate value.
I think is not possible your request. If you want send me a sample (only 32 ms are needed) to analyze the header.
Top Cool
23rd December 2005, 23:16
Thanks a lot for your answers.
If I have well understand, two different informations are necessary to be indentified as dolby EX (xbsi2e and dsurexmod).
I have joined you an example of ac3 file containing EX sourround without
the EX flag so you can see if xbsi2e is set on 1 or not.
Wouldn't that be a problem for decoders, if the extra EX stream is present
without being annouced by xbsi2e bit?
Anyway thanks a lot for your help!
Sycho
24th December 2005, 18:54
Hi there,
As you know a lot of DVDs encoded in dolby EX don't have the famous flag enabling the audio stream to be identify as such. My receiver (Yamaha RX-V550) cannot be set manually on dolby EX, so I am missing the great "EX experience" on most DVDs. :(
I have looked everwhere for a small software that could set that %&"#@!§ flag in AC3 file to correct those dolby EX streams.
If anyone knows where to find such a tool, thanks to tell me.
i've got an rx-v650 and it's wicked easy to force EX decoding.
press "amp" on the remote
the press "+10" on the remote and select which EX mode you want, you should have "EX", "PLIIx:Music" or "EX/ES"
tebasuna51
26th December 2005, 13:46
I can't download your example.rar (Attachments Pending Approval).
Try to put the link directly, like this: http://www...../.../example.rar
without use the 'attachments' utility.
Top Cool
31st December 2005, 22:10
Thanks Sycho for your advice but RX-V550 doesn't seems to be as easy to force as RX-V650 for I only have the 3 following options in EX/ES menu :
1-OFF (No center rear)
2-PLIIx:Music (recreates a center rear channels from left et right sourround)
3-AUTO (Enable EX or ES when detected only !!!)
I have tried many confirguration but as the manual says that EX and ES are only available when detected I didn't tried any further settings on my receiver.
Anyway, this question of missing flag is really bugging me and it seems incredible to me than nothing exists to correct this. If this is really the case then we ought to do something about this!
tebasuna51, thank for helping me doing this. you will find hereafter a direct link, I hope you will have more luck with this one, it worked for me.
example.ac3 (http://patrick.caillier.free.fr/example.ac3)
And as 2006 is now at our door, I wish to all of you a Happy New Year
tebasuna51
1st January 2006, 11:52
@Top Cool. Happy New Year!
Sorry, but your example.ac3 have:
File to analyze: D:\INTERNET\example.ac3
SampleRate 0 : 48000 KHz.
BitRate 15 : 448 Kb/s.
Version (bsid) 8 : Standard.
Bit Stream mode (bsmod) 0 : main audio service: complete main (CM)
Audio coding mode (acmod) 7 : 3/2 - L, C, R, SL, SR
Center Mix Level 0 : 0.707 (-3.0 dB)
Surround Mix Level 0 : 0.707 (-3 dB)
Low frequency effects channel 1 : Present
Dialogue normalization - 27 dB
RF atenuattion -5,6 dB
Languaje 0 : Not present
Audio Production Info 0 : Not present
CopyRight bit 1
Original bit 1
Timecode1 0 : Not present
Timecode2 0 : Not present
Additional Bsi 0 : Not present
Block switch flags 0
Dither flags 31
Dynamic Range gain -5,44 dB Frame: 1
---------------------------------------------------------
File length : 168448 bytes.
Frames : 94
Duration : 3,008 seconds. ( 0 h. 0 m. 3,008 s.)
RF Ov. Pr. min/max : -5,6 /-4 dB
Dyc. Range min/max : -5,44 /-3,88 dB
bsid : 8 (must be 6 for alternate bit stream syntax)
xbsi2e : 0 (Timecode2 in Standard syntax, bsid = 8, then there are not space in the header to insert the field 'dsurexmod' without reencode the full ac3).
Or your ac3 is not dolby EX, or is bad codified.
Top Cool
1st January 2006, 17:45
Ok, thanks a lot.
The example given is extracted from a DVD (star wars II) clearly noticed as dolby EX. Altough it is maybe possible that this not true, I am more likely to think as I a have seen on the net that those dolby EX stream are not correctly encoded. It seems that at the beginning of dolby EX, compatibility issue appeared with some existing receivers and that this "bad" encoding was done on purpose to ensure correct decoding on 5.1 systems. I don't think also that the ripping process could have changed the header though it is also a possibility. To be sure, I have placed an other file which tests the different channels.
Test.ac3 (http://patrick.caillier.free.fr/Test.ac3)
As I cannot force EX mode, the 3 rear channels are blended, if anyone can force EX mode on its receiver, it would be interesting to know if the 3 rear channels are clearly separated which would indicated that the stream is really EX even though the header is false.
So it appears that those dolby stream are really identifed as standard 5.1 which seems to be logical in regards to the compatibility issues. We know now that we need to re-encode the file to correct the header.
I am ready to develop a small tool that would do that. It doesn't seem so difficult but the less you know the easiest things seem to be. To do this we need to replace bsid from 8 to 6 and insert 'dsurexmod' in xbsi2e. So what we need is to know where to find the header in the file, to localize bsid and where to insert xbsi2e value. Maybe other fields are to be corrected like the header's size if defined somewhere.
tebasuna51 am I correct or is the whole thing much more complicated ?
Sycho
2nd January 2006, 02:48
Thanks Sycho for your advice but RX-V550 doesn't seems to be as easy to force as RX-V650 for I only have the 3 following options in EX/ES menu :
1-OFF (No center rear)
2-PLIIx:Music (recreates a center rear channels from left et right sourround)
3-AUTO (Enable EX or ES when detected only !!!)
put it on PLIIx:Music and use the < and > arrows you should be able to cycle throught some modes, then set it to EX, that should work
tebasuna51
2nd January 2006, 03:53
I think isn't more complicated, is imposible.
The ac3 frame have a fixed size (1792 bytes for 48 KHz, 448 Kb/s) and you need insert 14 bits (expected after a xbsi2e = 1). What others bits you want eliminate?
I make a tool for set the Dolby Prologic flag. This is a 2 bits fied present only for 2/0 (stereo mode), after modify this 2 bits I need recalculate and modify the CRC1 (at the beginning of frame) for each frame, the CRC2 (at the end of frame) don't change. Is complicated, but posible.
I can't help you about the test, I have only a 5.1 audio system.
Austin Forgotten
2nd January 2006, 08:18
If you need a Dolby Digital Surround EX encoded ac3, just demux the Waterfall vob here: http://www.cinenow.com/fr/vobtrailer.php3/id,63/
I can detect this now with Transcode as well as DTS-ES & DTS 96/24, but how can you determine DD-EX as 6.1 or 7.1? Since the extra channel(s) is (are) derived from matrixed rear surrounds, I suppose its regarded discretely as 5.1 channels. So is it up to the capable hardware to decode the 6th and/or 7th channels [if it sees dmixmod=2.. oops, I meant to say when dsurexmod=2 (after xbsi2e not xbsi1e)]?
Sycho
2nd January 2006, 15:42
put it on PLIIx:Music and use the < and > arrows you should be able to cycle throught some modes, then set it to EX, that should work
ok, for a better discription look on page 29 of the manual.
Top Cool
2nd January 2006, 21:16
Ok, Sycho you were right and I am really a idiot! Thanks a lot.
Anyway, I been searching on dolby spec to see if "light" reencoding
would be possible, here are my conclusion:
Problem 1 - timecod2e or xbsie2e beeing set on 0, there is 14 bits missing in the header to give all the relative information. I have check a true EX file and sbsie1e is also set on 1 which seems to show that we may need even 28 bits.
Problem 2 - Inserting those bits in the right place would mess up the synchronization information. One solution would be re-encode the data part which is a bit too challenging for me. On other solution would be to increase the bitrate by changing the value of syncword and leave the free space as auxilary data. This would be the easiest way to solve the problem but would increase the file size by around 10% for no good reason.
Problem 3 - Error check value contained in crc1 and crc2 has to be recalculated, because of the different bits modification. Not really easy either.
I have tried to set bsid on 6 and correct crc1 without setting xbsie2e on 1. The file was readable but not reconize as EX which is pretty normal. I might continue a little bit just for the fun. If anyone is interessed by this re-encoding tool to correct EX file, let me know, it will give me motivation to carry on.
Anyway, thanks a lot for your help.
NoiZe
3rd January 2006, 02:12
how can you determine DD-EX as 6.1 or 7.1?
DD-EX is 6.1 only.
It is noted as 7.1 because two speakers for the extra mono channel are recommended.
For those who don't know, the 6th (rear) channel is matrixed in
the stereo surround channels just like the old pro logic encoding was done
(phase reverse), unlike DTS-ES which has an actual extra channel.
So only an extra flag can make DD-EX digitaly recognizable.
To Top Cool, there is always interest in tools like the one your speaking of.
Austin Forgotten
4th January 2006, 01:22
Thanks for the quick reply NoiZe! Before I replied I had to do a bit of research because I wasn't sure what '(phase reverse)' meant. I found a nice pdf (http://www.prosoundweb.com/studyhall/lastudyhall/polarity_and_phase.pdf) which explains the diff between polarity & phase, and 180 degree phase shift. Fig 18 explains that their is a severe cancellation of the low frequencies due to the polarity reversal. However the document does not mention what "phase reverse" is, but I keep searching for more info and found some freeware s/w which will excute the dsp effect:
1) RS Phase Reverse (Simple 180° Phase Reverse) VST by Rough Surface (http://www.roughsurface.com/VST/RSPhaseReverse.rar)
2) AnalogX's Vocal Remover (DirectX) does the same thing.
(http://www.analogx.com/contents/download/audio/vremover.htm)
But this seems to me removes the "Center" information (i.e. Vocal/Dialog) which is the opposite of what the rear DD-EX channel wants.
I later experimented with Moitah's dsp_centercut Winamp Plugin (http://moitah.net), and found the 'Center Cut - Center (Mono) setting' to do the job.
Anyway this is probably an old but interesting topic which I'm still trying to grasp. If only it were possible to reproduce DDPLIIx stereo to multichannel output via software (without the use of graphedit/DVD player filters).
Yes, I know DTS-ES has descreet channel data, I should have clarified, that I can detect those flags etc. in my 'Tranzcode' utility now, since I've added AC-3/DDWav multichannel decoding via liba52 source code (which is what libdts was also based on), having similar functions helps me understand the code easier. I haven't released a new ver of Tranzcode for awhile rewriting portions several times, still having some unfinished work. I was just thinking about a way of reproducing/outputting this rear center matrix channel to a multichannel wav (for standalone playback) with or without the need of the DD-EX flagging on 3/2 (5.x) ac3's for PC's having a 6.1 or better settup. Unfortunately I don't have any hardware (H-Theater/Sound Card) to take advantage of the extra channels. In any case as you said to Top Cool, this would be a welcome tool, as well as an interesting one.
-AF
Top Cool
4th January 2006, 23:49
Looks like, I am begining to master a little bit the subject. I have solved the
crc issue. I am joining a the piece of code that correct crc1 and crc2 in a ac3 file
This enables to modify some bits of the header (or any of the bitstream) and still have the correct control words crc1 and crc2.
CORRECTme.exe (http://patrick.caillier.free.fr/CORRECTme.exe)
CORRECTme.bas (http://patrick.caillier.free.fr/CORRECTme.bas)
I have developed this small code under VB. (Please don't hit me !! ;) ) I know it must the least efficient langage for this type of job but it is the most convienient for me at the time beeing (Keep in mind that I am not really a software developer). Anyway the code is small and can be easily rewritten if needed, don't hesitate to given sugestion on this matter.
I am now starting to work on the main problem. I really would like avoid to increase the bitrate just because of 14 bits!!! So I will try to crop any not really necessary data. Unfortunatly in the tested file langcode and audprodie are already set on 0. I was thinking of putting compre to 0 but I am not quite sure of the consequences and I am still needing 6 more bits.
If anyone has an idea of were to find easily bits to crop...
Austin Forgotten the utility your working on seems interesting, where can it be found ? Even if it's far above my knowledge of DD file, It would be interresting to know how this rear center matrix channel is decoded.
As for DTS, I thought there was 2 formats for DTS-ES the matrix one and the discrete (real 6.1). As far as I have seen discrete DTS-ES doesn't seems to be wildely spread. I was also wondering about sound card given as 7.1 or more, what's the use? Is there any sound format to take avantage of the extra channel?
Austin Forgotten
5th January 2006, 04:12
Hi Top Cool,
Don't be shy or feel ashamed about programming in VB, I used to few years ago, it just limits you to doing some things. I forget if it has bit manipulation (i.e. shift left/right), anyway as long as you can produce the results you desire who cares.
Your probably right about DTS-ES, only samples I've seen and tested with were in DTSWavs found here: http://www.sr.se/multikanal/english/e_index.stm
(i.e. Saga, Norway Demo)
It was just an exercise to see if I could determine the file information correctly, I can't decode the extra discreet channel anyway, same goes for 96/24. Maybe once I get done adding the feature to my app and get then working bug free will I experiment with those extended types.
Why I jumped into this thread was to make available a link to a DD-EX encoded file, which I thought may be useful to you, and also since I had been searching high and low for one for quite some time, just to see if I could detect it, and be able to display the extra info about the ac3 (didn't want to spend money for a test file). When NoiZe mentioned "phase reverse" it got me interested so I did a few hours searching the web for info to help me understand how to draw a center channel from 2 channels via this method. I came across the dsp_centercut Winamp Plugin and found the 'Center Cut - Center (Mono) setting' to infact verify the method. As a bonus the source code is available although its in the form of a plugin, it could be interesting to experiment with ;)
Good luck with your application.
-AF
Top Cool
5th January 2006, 21:48
I DID IT !
Well it wasn't that difficult but quite challenging for me. You can find here after :
1-The crc correction routine modify to cope with file not begining with syncword (0B 77). While testing I found that some demuxing tools just cut the DD stream anywhere leaving unuseable bit in the head of the file. The previous version was not working with those type of files.
CORRECTme v0.1.exe (http://patrick.caillier.free.fr/CORRECTme%20v0.1.exe)
2- A "clean" version of the tool which uses over bitrating to ensure that there is enough space for the 14 bits added (256 Bytes should be enough :D )
EXme_over_bitrate.exe (http://patrick.caillier.free.fr/EXme_over_bitrate.exe)
EXme_over_bitrate.bas (http://patrick.caillier.free.fr/EXme_over_bitrate.bas)
The result is perfect but it increase the file by around 14%. This increased bitrate might cause problem when re-muxed on DVD (I am not sure if there is a maximum audio bitrate for DD on DVD or if the global maximum video bitrate might not be exeeded). Anyway this loss of space is really anoying.
3- A "brutal" version of the tool which uses the same bitrate and crushes any lasting bits that would possibly exeed the framesize. Practically, EXme tool set the header as small as possible, if the original file has some information added ( langcode, audprodie, timecod1e or timecod2e set on1) the result should be Ok. The file I used for testing only enabled me to save 8 bits with the compr information which is also cropped. So 6 bits were crushed per frame. As there is some very few unsued bits at the end of the frame, the result is readable and hearable but if you pay attention you hear micro cuts and high pitch sound from time to time.
EXme_same_bitrate.exe (http://patrick.caillier.free.fr/EXme_same_bitrate.exe)
EXme_same_bitrate.bas (http://patrick.caillier.free.fr/EXme_same_bitrate.bas)
So now, it would be really great, if we could find 6 more bits to crop in the audioblocks. One bit per channel would be sufficient, if anyone has a idea...
Thanks Austin for your encouragements, the fact is that this tool is really slow (twice as long as the file duration). I am sure that the speed can dramatically increased by using the proper langage (VB doesn't have bits manipulation which implies many heavy calculations). When I was young (a long time ago) I used to program in turbo pascal which was pretty convienient because you could include assembly code when performance was needed (At that time units were only the kB for rmemory and kHz for CPU frequency!!) .Now I am more interested in C++ (Visual or not that is the question) and it seems to be more common. All suggestions about what might be the most performant langage for the job are welcome.
Austin Forgotten
6th January 2006, 06:05
Way to go Top Cool!
Now you will be able to use your audio system's setup to its full potential! Yes, with success, confidence is built. If you like VB, Delphi me be the better choice. If you already know C then try to learn C++ and become very familier with object oriented programming and design. If not maybe you can learn C before C++ (C is what I'm using on Tranzcode), besides there is a lot of free source code out there written in C where you can use/modify for you own purposes.. like I do :D. Later you can learn MFC and Windows programming. Many have migrated to Visual Studio .NET (C#, VB.NET), but I lost interest in it (Luke beware the dark side... :devil: ).
-AF
Skelsgard
9th January 2006, 19:53
I was also wondering about sound card given as 7.1 or more, what's the use? Is there any sound format to take avantage of the extra channel?
The SB Audigy 2 ZS and up soundcards have DTS-ES and DD Surround EX built-in decoding. For DD EX, they do the matrix decoding of the Rear Center channel x1 in 6.1 and x2 on 7.1 (they double the output of the Rear Center).
For DTS-ES they support Matrix, Discrete 6.1 and 96/24. The Matrix decoding can be disabled manually, and is automatically disabled on Discrete 6.1 (so it doesnīt do Matrix decoding of RL and RR when thereīs already a real RC). I tested it myself with the DTS-ES samples from the Swedish radio, while recording the stream with Vegas thru ASIO.
But all this done thru SPDIF output from the rendering software.
I.e. in GraphEdit:
DTS source ---> AC3Filter (PCM 24 bits, SPDIF enabled) --> SB Audigy 2 ZS Audio (C000).
I usually like to set the Dolby flags to EX when I know the movie was encoded as such, DRC off, plus +2dB Gain (to get it louder), but as there is no software able to changed this flags, I have to re-encode with Vegas AC3 Pro Encoder. Not that it bothers me, just that wish there was a simpler way that dowsnīt involved re-encoding.
Top Cool
11th January 2006, 10:52
Ok, so 7.1 cards can recreates extra rear channel from classic DD or DTS stream. It seems pretty limited for the moment as there is no sound 7.1 format. Still looks for me more like a commercial add but I recognize that as having a receiver doing all the decoding job, I am less interested in all soundcard features. All I need is a good SPDIF output!
As for my EXme tool, I have all started over in C++. As I don't master this language, it is taking me more time. I have solved for many case the bit problem by croping also the dynrng byte in block0. I know it theorically can change the dynamic range of the output but the fact is I haven't notice the slightest difference. So in most cases, I now avoid bit crushing at the same bitrate.
Wonderbra, I can change some settings in the header but I haven't seen anything about DRC or global gain (all I have is center mix level and sourround mix level). If you know where is the information you want to modify in the file I could look at this.
With time I could do a nice tool giving information and enabling to change some settings on ac3 files but first I have to finish the main step about EX setting.
Skelsgard
11th January 2006, 20:51
Ok, so 7.1 cards can recreates extra rear channel from classic DD or DTS stream.
not all 7.1 cards have DD and DTS extended decoding, some just multiply the SL-SR channels and output them thru RL-RR. The one I describe u DOES have extended decoding built-in, no extra tools or codecs provided. What u do is to send the AC3/DTS thru a decoder (AC3Filter, Intervideo Audio Decoder, Cyberlink Decoder, etc...) by SPDIF. But then the card receives the signal and, If u specified it, it decodes it or just do passthrough thru the SPDIF output.If u donīt have "SPDIF passthrough" selected, the card manages the decoding.
The DTS-ES Discrete format can take advantage of the 6.1 7.1 cards, if supported.
Wonderbra, I can change some settings in the header but I haven't seen anything about DRC or global gain (all I have is center mix level and sourround mix level). If you know where is the information you want to modify in the file I could look at this.
Sorry, donīt have the knowledge on that. Iīm not a coder (wish I were), but more of an audiophile.
Iīm really rooting for u to get this working
Top Cool
14th January 2006, 22:56
Just a short post to tell you I am working on the C++ version of my tool and it's coming out pretty well. Performance, GUI and features will have nothing in common with the first version in VB. I have inserted many assembly code to have decent performances. The last big issue for me be to manage multi-threading which could be interesting with all the disk access. Still a have finally master those &('é"&*% pointers. The result should be really neat!
For the huge crowd :rolleyes: waiting for this new version, I can tell that the first release will be in a couple days in worldwide exclusivity on doom9! :D
Top Cool
18th January 2006, 23:03
OK, there it is !
You will find just beneath the link to download last version of EXme tool.
EXme.exe (http://patrick.caillier.free.fr/EXme.exe)
The thing is quite interesting now so don't hesitate to test it and to give feed back. The conversion time has been divided by more than 300!! compare to the version in VB. Thank to C++ and assembly. I didn't bother trying to implement multi-threading as I can now convert a 2 hour movie sound track on my system in less than 1 minute. Although some the program may run slower on other system, I think it will convert any ac3 file in a reasonable time. The stuff was developped under XP, as I didn't test it on other system, there can be compatibility issues maybe with other operating system.
As for the features, I have added the possibility to change Center and Surround mix level. The fact is I didn't notice any difference! I am not sure this value is really used by the decoder.
In many case, conversion will go OK without increasing the file size but I have noticed that supressing the dynamic Range value decreases the sound volume. So if you want a perfect clean conversion use the "increase file size" option. I am still looking for idea not to have to supress "compr" and "dynrng" value, if you have any ...
I am still thinking of other features, one interesting could be to convert the audio stream directly in the .vob file. I know almost nothing about vob containers. Does somebody know if direct access to streams are easy ( No decoding or compression ) ?
If you like the tool tell me. If you're interested in other features tell me also.
I have a little bit of time for the moment but it won't last long !
daphy
19th January 2006, 06:30
Hiho,
the whole thread sounds very interesting, I just tried to start your new version and get this error -> vcl60.bpl is missing.
Okay, Iīm at work now, so my office computer might need some more packages :o but if not ... :scared:
Can someone check this plz :)
:goodpost:
Edit: on my home computer (running on WinXP SP2 ) the same error message apears :(
Top Cool
19th January 2006, 19:17
Ok, I checked this out. The missing file was part of C++ builder but you souldn't need it. I have re-built the program with the correct options. Now it's bigger but it should work alone (I hope !!:D ).
You can try to download it again. Sorry to have you being my tester but this tool sure needs to be validated !!
:thanks: for your participation!
daphy
20th January 2006, 07:34
short reply
-> Now itīs possible to start this application on my office computer :)
Top Cool
23rd January 2006, 09:16
Fine! Have you been able to convert ac3 file? I could also change dialog normalization and maybe also convert EX to normal 5.1. Do you think these features would be interesting?
daphy
23rd January 2006, 14:20
sorry Top Cool
I meanwhile did have found the time to do a test with your app.
One reason is the lack of some Dolby EX files the other is the lack of time - I have to work the whole weekend :scared:
again sorry
Top Cool
23rd January 2006, 14:46
It's ok daphy, but I sure hope the thing works well because my hard disk crashed, I thought I had backup but no :( . All I have left is the .exe, it is really a shame and I am really mad about that !:angry:
If anyone knows any means to reverse engineer the .exe file but I don't have much hope, I will still try to recover the hard disk but I don't have much hope either.
Sad weekend...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.