Log in

View Full Version : Realtime AC-3 encoder?


Pages : [1] 2

HarryAngel
17th October 2003, 09:52
I am not sure if this is the right forum for this, but I was wondering if anyone knows if there is something like a working encoder which can encode AC-3 in real time so that the AC-3 stream can then be sent via SPDIF to an external receiver.

I found a direct show filter which does exactly that at http://oss.netfarm.it/ac3encode.php. I even got it to work somehow (i.e. my receiver is receiving 5.1 DD sound from an avi with stereo MP3 sound, but the sound is stuttering and the filter crashes every two minutes).

It seems development of this filter is halted but it would be great if someone else did something similar or continued with this project. It seems for people (like me) who have their multi-speaker systems connected via an external receiver that can only decode DD (and DTS), this would be the only way to really take advantage of these new multi-channel capable formats like OGG Vorbis or AAC.

daphy
17th October 2003, 10:30
I found a direct show filter which does exactly that at http://oss.netfarm.it/ac3encode.php. I even got it to work somehow (i.e. my receiver is receiving 5.1 DD sound from an avi with stereo MP3 sound, but the sound is stuttering and the filter crashes every two minutes).

Hi,

I donīt understand the sens of this transcoding:

You have a MP3 2.0 at letīs say 160Kb/s
and you want transcode it in realtime into a 5.1 DD (letīs at 448Kb/s)???

In my opinon this wouldnīt work because of the missing channels; youīll get something like 5.1 but with definitfly NO surround effect.
The crashing might depend on the missing support of MP3 -> the author of this filter have confirmed that (ītill now) only 16bit WAV PCM input is possible.

I think better results are possible if you use your MP3 analoge input and one of your DSP program which every dolbydigital amp offers.

CYA daphy

HarryAngel
17th October 2003, 11:28
Originally posted by daphy
Hi,

I donīt understand the sens of this transcoding:

You have a MP3 2.0 at letīs say 160Kb/s
and you want transcode it in realtime into a 5.1 DD (letīs at 448Kb/s)???

Well, if I look into this forum and see to what length people are going to transcode stereo to surround I guess there is a need for that. In my opinion, it's only really useful when you have a (non-AC3) multichannel source which you want to listen to in true surround without transcoding it first. That's why I mentioned multi-channel OGG and AAC, which I would like to try, but can't at the moment.

In my opinon this wouldnīt work because of the missing channels; youīll get something like 5.1 but with definitfly NO surround effect.
The crashing might depend on the missing support of MP3 -> the author of this filter have confirmed that (ītill now) only 16bit WAV PCM input is possible.

To my knowledge (and I am not an expert) any directshow MP3 decoder outputs PCM. I only used the MP3-AVI for quick testing and I forgot to mention that in order to to get a multichannel PCM I used matrixmixer to upmix the stereo source, but I assume that doesn't matter as long as you use any filter that outputs 16bit PCM.

So the filter setup looked like this: MP3 Decoder -> Matrixmixer (output 6 channel PCM) -> ac3encode (output AC-3 5.1) -> AC-3 Filter (tried it with Cyberlink and Intervideo; output to SPDIF). Everything seemed to work fine, the AC-3 Filter confirmed that it is receiving an AC-3 5.1 stream and seemed to output it correctly to SPDIF. And I defintively got true surround sound (e.g. muting one channel in matrixmixer actually resulted in no sound in the respective speaker). The sound was stuttering (and with it the video, so it seems it was still in sync) but one could still understand the words and recognize the music.

I think better results are possible if you use your MP3 analoge input and one of your DSP program which every dolbydigital amp offers.

Yes, that might be true for MP3s but certainly not for real multichannel content encoded in anything other than AC-3. And even for stereo sources it would be nice to have all the flexibility and the tools a PC has to offer for DSP and not only rely on the receiver.

Saiya-Jin
20th January 2004, 20:55
I have searched the forums and either I didn't find it or I missed (if I did I truly apologise).

I'm trying to play 5.1 audio through SPDIF (optical out) from my Hercules Fortissimo III to my receiver. Ok the thing is Dolby Digital and possibly DTS can be passed through to the receiver without any problem. However in this case I'm trying to play an HE-AAC soundtrack in 5.1 and it's obvious that my receiver won't decode it, so I was wondering if there is a way of passing the decoded stream to my receiver. It does play, but I think it's being downmixed to 2 channels.
My receiver is a Pioneer VSX-D811S if it matters.
If there is no way of playing digitally (which sucks because that's the whole point of getting an expesive optical cable) I could connect my analog outputs to the 5.1 analog input on the receiver, but I really would like to avoid that because, first, I would have to buy more cables (the pc is very close to the receiver at least), the inputs are already being used by my DVD player (for DVD-Audio, gotta hate those stupid restrictions) and analog kinda degrades the quality and stuff. If it's absolutely is the only way, I would like to know if there is some sort of adapter that enables me to connect both the sound card and the dvd audio player at the same time.

So I would greatly appreciate any help, with filters or whatever that would make 5.1 audio playback to my receiver possible. ;)

Cheers,

Saiya-Jin

FlimsyFeet
20th January 2004, 21:57
I don't think it's possible, unless your card can do real-time Dolby Digital encoding; it sounds like it can only do DD pass-through.

Maybe someone else has knows how?

KpeX
20th January 2004, 21:59
AAC 5.1 over SPDIF is currently not possible unless your receiver supports it (very few) and your directshow filter is capable of passing it (none currently).

As you have found, the only way to play 5.1 AAC over an optical connection is to pass the decoded PCM data to your receiver, which is only two channel.

Analog is currently the only way to have true AAC 5.1 sound. The only other possibility would be to encode to 2.0 AAC with a Dolby Pro Logic downmix. hope this helps,

daphy
21st January 2004, 15:02
The only other possibility would be to encode to 2.0 AAC with a Dolby Pro Logic downmix. hope this helps,

-> transcoding into 5.1 AC3 using the optical out-/input might be possible, too :rolleyes:

Saiya-Jin
21st January 2004, 20:11
I see. But will it be possible then with a new directshow filter? Are they working on it? If so, that would be awesome.
And about the analog, is it a bad idea to put an adaptor so I can plug my sound card along with my dvd player in the same set of inputs (I only have one :rolleyes: )?

Thanks for the replies.

EDIT:

As you have found, the only way to play 5.1 AAC over an optical connection is to pass the decoded PCM data to your receiver, which is only two channel

So does that mean that optical connection is only capable of passing PCM in 2 channels? That bites :(

KpeX
21st January 2004, 21:43
Originally posted by Saiya-Jin
I see. But will it be possible then with a new directshow filter? Are they working on it? If so, that would be awesome. Correct, but only if your hardware device supports it, which very few do. If you really have a receiver that can decode AAC, I suppose you could ask the CoreAAC developers to look into it. Originally posted by Saiya-Jin
And about the analog, is it a bad idea to put an adaptor so I can plug my sound card along with my dvd player in the same set of inputs (I only have one :rolleyes: )? As long as you aren't planning on using them at the same time, I see no problem with this. But to me it'd be pain to turn off the PC every time I wanted to use my DVD player. You should be able to find a switcher box that could switch between the outputs for fairly cheap, if all else fails, you could rig it up with three stereo line-in switchers.Originally posted by Saiya-Jin
So does that mean that optical connection is only capable of passing PCM in 2 channels? That bites :( Correct.

daphy
22nd January 2004, 09:01
Originally posted by Saiya-Jin
So does that mean that optical connection is only capable of passing PCM in 2 channels? That bites

Correct.

:D I managed to mux (http://www-user.tu-chemnitz.de/~noe/Video-Zeug/AVIMux%20GUI/index-eng.html) a 5.1/5.0 DTS-WAV (PCM) into a AVI - this might solve your problem, because if your amp understands PCM (maybe limited to 44.1, canīt remember whether 48 is also supported) it also could interpret this PCM as DTS-WAV!!! (My KISS DP450 + Yamaha A2 did it)
You can try to do this also with a DD-WAV ;)

result -> PCM (5.1) in AVI

please give us some feed back

CYA Daphy

Saiya-Jin
22nd January 2004, 18:46
My amp actually can handle 24/96 sound so that's covered.
It sounds great what you did buy the thing is PCM is huge and there's no way I could save that to a CD, it would be bigger than the movie itself, hehe.

Is it too cpu intensive to convert aac to dts or dolby digital in real time, so that it could be passed through with a possible future DS filter? Just a crazy idea hehe.

KpeX
22nd January 2004, 18:52
Originally posted by Saiya-Jin
Is it too cpu intensive to convert aac to dts or dolby digital in real time, so that it could be passed through with a possible future DS filter? Just a crazy idea hehe. It's quite possible, some soundcards do it already via hardware encoding. Although the DShow filter encoder idea is definitely viable. There are open source AC3 encoders (FFMPEG) and S/PDIF filters (AC3filter) available.

Saiya-Jin
23rd January 2004, 03:32
Originally posted by KpeX
It's quite possible, some soundcards do it already via hardware encoding. Although the DShow filter encoder idea is definitely viable. There are open source AC3 encoders (FFMPEG) and S/PDIF filters (AC3filter) available.

Really?! That sounds interesting. I'm sure my sound card won't do it, cos it's rather cheap, although pretty good. You think that they could implement the real-time encoding in a DS filter or something like that?
But still, I'm not so sure that my current pc can handle it, it's only a 1.4Ghz P4, one of the first models, 256MB of RAM, and there will be the video decoding going on as well, so it might not be up to the task. Well, anyway it would really be nice if they could implement that in the filter. ;)

KpeX
23rd January 2004, 04:09
It's very possible. The problem really would be quality loss, because you'd be decoding a lossy AAC stream, and reencoding into lossy AC3, so the quality would be far from perfect.

The other problem would be finding a developer to code it. Valex (AC3Filter author) could probably do it, if he had the time and the desire to code such a filter.

I think the way to go would be to make a standalone filter similar to MatrixMixer that could take any 5.1 audio output by some other filter such as CoreAAC or CoreVorbis, encode to AC3 and output SPDIF on the fly.

Saiya-Jin
23rd January 2004, 07:06
Originally posted by KpeX
It's very possible. The problem really would be quality loss, because you'd be decoding a lossy AAC stream, and reencoding into lossy AC3, so the quality would be far from perfect.

Yea, I kinda figured that....

I suppose it's better for me to just use the analog outputs.
The quality shouldn't be too bad, right?
Anyway, thanks a lot for the replies, everyone. :D

Stux
23rd January 2004, 08:37
Originally posted by KpeX
It's very possible. The problem really would be quality loss, because you'd be decoding a lossy AAC stream, and reencoding into lossy AC3, so the quality would be far from perfect.


Well, the quality loss might not be that bad... after all you can use the maximum ac3 bitrate, would a 192kbps HE-AAC 5.1 soundtrack re-encoded into AC3 at 768kbps (or whatever) really have that much loss?

wtbreen
7th February 2004, 17:27
As an answer on the orriginal question:
this week I bought a SPDIF cart (costs: € 14,--, that is aproximatly $ 17,--) and a coax-cable (5 meters, € 19,--).
The cart is from Epox as is my motherboard. I wanted to listen to at least ac3-tracks out of my pc trough my receiver, because I make them by myself (see the guide Eye of Horus wrote). Before I burn my projects on cd or dvd, I want to listen the result (could spare me a lot of cd's / dvd's).
I play the tracks with windvd platinum and as output select SPDIF.

Ac3-tracks are no problem: my receiver accepts the stream and shows the DD-symbol. It sounds as you would expect: 5.1.
DTS-tracks (in wav-format) are a problem: hissing trough the speakers.

I think the problem here is that ac3-tracks are in 48 KHz and dtswav-tracks in 44.1 KHz. I haven't yet tried to convert dts-tracks to 48 KHz in surcode. Maybe that could work.

It is strange though, because dts-tracks burned on a cd and played with my dvd-player via my receiver are also in 44.1 KHz. Here the receiver gives the DTS-symbol as I want it.
My dvd-player has NO decoder; my receiver does.
44.1 KHz is no problem for my receiver, but out of the pc it doesn't work. It has to be the SPDIF-card what can't handle 44.1 KHz.

I hope this helps a bit.

One warning: you cannot use every card on every pc (motherboard). It is possible that + en - are different between the card and the motherboard. I burned a cable from an Asus-spdif card and was verry pleased that there was no other dammage :readguid:

Umma
8th February 2004, 16:14
I think the problem here is that ac3-tracks are in 48 KHz and dtswav-tracks in 44.1 KHz. I haven't yet tried to convert dts-tracks to 48 KHz in surcode. Maybe that could work.

It is strange though, because dts-tracks burned on a cd and played with my dvd-player via my receiver are also in 44.1 KHz. Here the receiver gives the DTS-symbol as I want it.
My dvd-player has NO decoder; my receiver does.
44.1 KHz is no problem for my receiver, but out of the pc it doesn't work. It has to be the SPDIF-card what can't handle 44.1 KHz.

If you already have a dts wav in 44.1, you will not be able to change it to 48. Re-encoding the original source (the mono wav files)- IF the source is 48 - with Surcode DVD DTS encoder would work, but that is it.

It is my understanding that the sound card, like a DVD player, must be capable of passing on the 5.1 dts signal for the receiver to decode it. The M-Audio Revolution card, I have read (AND intend to purchase), will do this. The Audigy (sp?) card upsamples the 44.1 to 48 and messes up 44.1 dts cd...I think: someone correct me if I'm wrong, please...when someone tries to play it back. I read that the M-Audio and Logitech Z680 speakers work well together, and the sound is not upsampled to 48. I intend to get the both of them "soon."

I would think, from reading your posts, that the AC3 5.1 that you burned are on DVD. Right? I've never tried to burn a 44.1 AC3 onto DVD, but I know with dts it's a no-go unless the music is in 48 KHz.

Someone please correct me if I'm wrong.

wtbreen
8th February 2004, 16:43
Sorry for the misunderstanding: I didn't mean to convert 44.1 to 48, but when I make new dts-files I will go for the 48 KHz-option in surcode right away.
I'm curious if that will work.

Untill now I only burned dts-wavs on CD, not on DVD. They were all in 44.1. It is possible to burn ac3-files on CD, but you have to use a program like sonics dvd architect together with Nero and make a mini-DVD. That also works. The ac3-files are in 48 KHz.

An add-on spdif-card is, in my opinion, not realy a sound-card; it only transports the bits, without any encoding or decoding to another place, in my case a receiver.

gircobain
21st February 2004, 20:15
Maybe some directshow genius aka gabest could take a look at it and make it work properly ;)
It would be awesome to be able to transcode 5.1 AAC and output it through SPDIF

KpeX
21st February 2004, 21:04
Wow, I must have missed this thread the first time around.Originally posted by gircobain
Maybe some directshow genius aka gabest could take a look at it and make it work properly ;)
It would be awesome to be able to transcode 5.1 AAC and output it through SPDIF Agreed, this would be great for 5.1 AAC. I can connect a 5.1 AAC stream with this filter through GraphEdit but the output is extremely poor as mentioned above.

gircobain
21st February 2004, 21:28
Yes I guess that's because ac3encode is based on ffmpeg, which is known to provide bad quality ac3 encoding.

KpeX
21st February 2004, 22:15
Originally posted by gircobain
Yes I guess that's because ac3encode is based on ffmpeg, which is known to provide bad quality ac3 encoding. I'd have to disagree, BeSweet encoded AC3 streams (using ffmpeg) sound much better than the output from this filter. Encoded at a high bitrate and played in real time, I think it could work.

E-Male
21st February 2004, 23:43
a real time ac3 encoder filter would be really great

it would finally make new 5.1 formats like ogg and aac a real option, i'd love that


also it could find usage in non movie relateded subjects, like games (duke3d in 5.1, would be cool IMO)

brute
22nd February 2004, 13:19
I need such things, too!

Imagine what you can do, you could encode a multichannel Ogg, which is really small compared with AC3, or you can play games with EAX and the signal is encoded into AC3, so only 1 cable is needed to connect the PC to your receiver and you still get surround gaming.


And there's really what we're searching for on the market, and since some years now.

The nVidia Nforce Soundstorm hardware encoder. That's the only realtime AC3 encoder worldwide. That thing can all we need, but therefore we need to buy an nforce board :(


bah, my english is so bad, I'm sorry for this shit :(

Haaan
22nd February 2004, 14:36
I have developped a very basic DirectShow filter which does AC3 data -> AC3 SPDIF output AND PCM 6channel data -> AC3 SPDIF output.
It's based on the ffmpeg avcodec dll for the ac3 encoding (and AC3Filter's sources helped me a lot to know how to "communicate" with SPDIF).

PM me if you're interesting, you just must know that it's still very buggy (it's a 7 days old project) and there is not yet any UI.

Haaan
22nd February 2004, 14:42
I've developped something, just see my post here (http://forum.doom9.org/showthread.php?s=&threadid=69206#post448231).

It's based on ffmpeg and encodes in 448Kbps, but everything can be changed with your experts advices ;)

gircobain
22nd February 2004, 15:42
I must say I am very interested in trying it out

PM sent :D

wtbreen
22nd February 2004, 20:48
That sounds very hopefull.
PM is coming!

gircobain
23rd February 2004, 03:47
Wow i just tried it out on my htpc

I played a matroska file with 5.1 aac audio and the receiver does get a nice dolby digital signal

Too bad my htpc is too slow (p3 866) to decode aac and encode to ac3 at same time without losing sync with video (I have an athlon 1700 laying around, just need a new mobo, guess that's reason good enough to make the investment :D )

Unfortunately the only file with 5.1 aac sound i have at hand is a small 2 min sample, guess i'll be doing a few dvd backups to test it out thoroughly

Hopefully i'll post more info later this week

Keep on the good work, this is all I need to switch to matroska + aac once for all :D

KpeX
23rd February 2004, 05:13
Very nice work, channel mapping is spot on with MP4 and OGG ( MP4 transcoded with FAAC through FB2k, Ogg transcoded through besweet ). (Test file here (http://www.tfm.ro/ac3/download/test_ac3.rar)) @ Haaan any idea why higher bitrates crash the filter?

Quality is quite nice, and decoding LC AAC + encoding AC3 + decoding 704*320 mpeg-4 video only takes about 15-40% CPU on a 2.0 Ghz P4. This should be very useful.

ChristianHJW
23rd February 2004, 09:57
Originally posted by Haaan
I've developped something, just see my post here (http://forum.doom9.org/showthread.php?s=&threadid=69206#post448231).

It's based on ffmpeg and encodes in 448Kbps, but everything can be changed with your experts advices ;)

This is something everybody has been waiting for for a long time now, and will definitely help AAC 5.1 and Vorbis 5.1 to get more widely used.

However, i recommend to increase output bitrate to 640 kbps, the maximum allowed in the AC3 standard, as file size is of no interest here ( we just send it over SPDIF to the receiver, it doesnt get stored anywhere ). Hopefully FFMPEG has such an option already, if not then we should have a short look at the target bitrate definition in the code, shouldnt be too big of a problem i guess ....

Haaan
23rd February 2004, 10:59
Originally posted by ChristianHJW
This is something everybody has been waiting for for a long time now, and will definitely help AAC 5.1 and Vorbis 5.1 to get more widely used.

However, i recommend to increase output bitrate to 640 kbps, the maximum allowed in the AC3 standard, as file size is of no interest here ( we just send it over SPDIF to the receiver, it doesnt get stored anywhere ). Hopefully FFMPEG has such an option already, if not then we should have a short look at the target bitrate definition in the code, shouldnt be too big of a problem i guess ....

It's done in the next version (actually, you'll have the choice lucky boys)

Haaan
23rd February 2004, 11:01
Originally posted by KpeX
Haaan any idea why higher bitrates crash the filter?


If your talking of AC3 bitrates, it's just because ffmpeg doesn't support higher bitrates than 640 and I tried 768 when I say that it crashes

clima
23rd February 2004, 15:13
/you a un nouvel ami

KpeX
23rd February 2004, 18:34
Originally posted by Haaan
If your talking of AC3 bitrates, it's just because ffmpeg doesn't support higher bitrates than 640 and I tried 768 when I say that it crashes I see. Well an option for bitrate might not be a bad idea for future versions. Customizable between maybe 384-640. Keep up the good work, cheers,

Edit: Saw your post on this matter in the other thread. Merging the threads now for clarity.

E-Male
23rd February 2004, 21:29
Haaan's filter works exelent on my system
i can now play a matroska file containing xvid and 5.1 ogg with tcmp getting 5.1 on my amp

Haaan
23rd February 2004, 22:16
by the way http://acidbao.free.fr/isoft/dlpage.php?prog=DolbyOutDS

bond
23rd February 2004, 22:45
Originally posted by E-Male
file containing xvid and 5.1 ogg5.1 ogg vorbis doesnt make any sense as vorbis doesnt offer channel coupling
before using vorbis for multichannel better stay with ac3

E-Male
23rd February 2004, 22:55
ok, first i have to ask: what is "channel coupling"?

but even thought i might not knwo alltechnical details i kmow what i just tested
and 5.1 ogg worked fine at bitrates below ac3

Ana
23rd February 2004, 23:27
This something I have dreamed. Thank you! I love'd to test it but there seems to be little problem. The ffdmpeg site is down so I can't find the necessary avcodec.dll. Any way to get it?

E-Male
23rd February 2004, 23:45
just download the filter
the needed dll is included in the archive

Haaan
24th February 2004, 02:11
Originally posted by Haaan
by the way http://acidbao.free.fr/isoft/dlpage.php?prog=DolbyOutDS

Updated:
* You can swap channel orders (you have the three same choices as in Besweet, the default one works fine with an ogg 5.1 encoded with the default besweet channel order)
* You can mute any channel you want (to test one by one)
* You can redirect any channel to Left and mute the other to check the channel order manually.
* You can choose AC3 bitrate (256-640)
* You can enable or disable priority on AC3 streams and 6ch-PCM streams.

KpeX
24th February 2004, 02:23
@Haaan

Nice work, testing now.

@E-Male

Channel coupling (http://www.audiocoding.com/wiki/index.php?page=channel+coupling) is the sharing of information between channels to increase encoder efficiency. In stereo this is called joint stereo. Since this has not been correctly implemented in Vorbis yet, vorbis is very inefficient in six channel mode, and a bitrate as high or higher than AC3 would be required to achieve the same quality. That is why bond recommended you not transcode AC3 to OGG.

gircobain
24th February 2004, 02:30
It's a bit late at this side of the pond, but I'll be testing the new version tomorrow.

Meanwhile, may I suggest adding a config entry point to the filter, in the same fashion as used in VobSub, AC3Filter, MatrixMixer, etc, so one would be able to invoke the configuration dialog by running rundll32 DolbyOutDS.ax,config for instance?

Haaan
24th February 2004, 02:40
Originally posted by gircobain
It's a bit late at this side of the pond, but I'll be testing the new version tomorrow.

Meanwhile, may I suggest adding a config entry point to the filter, in the same fashion as used in VobSub, AC3Filter, MatrixMixer, etc, so one would be able to invoke the configuration dialog by running rundll32 DolbyOutDS.ax,config for instance?

Okay, i will :)

daphy
24th February 2004, 09:59
@ Umma
The M-Audio Revolution card, I have read (AND intend to purchase), will do this.

you bought this card? Is it a good one?
Iīve read many reviews about this card - hardware dts/ac3 decoding, 7.1 support, circle surround support ... sounds good :rolleyes:
but no SPIF input - this is not that what I expect from such card :(

CYA Daphy

KpeX
24th February 2004, 18:11
@Haaan

An idea for future versions: What about an option to resample (preferably using SSRC) to 48Khz for sound cards that only allow 48Khz output over S/PDIF. This could be useful especially since the Nero AAC encoder likes 44.1 khz or lower sampling rate for most input.

E-Male
24th February 2004, 18:13
so ac3 got teh advantage of channel coupling
but does this have such a great effect that ogg's vbr advantage is gone??

bond
24th February 2004, 18:23
Originally posted by E-Male
but does this have such a great effect that ogg's vbr advantage is gone??the most important thing you have to realise is that you will NEVER get better quality than the source with reencoding! meaning when reencoding from ac3 to any other vbr able format there is no such thing as a "vbr advantage"

the only advantage with reencoding is that you can have ~ the same/little (hopefully not hearable) worse quality at a lower bitrate

as vorbis doesnt really offer that at a reasonable lower bitrate it doesnt really make sense to use it for multichannel

if you want reasonable lower bitrates with ~ the same quality you definitely should go with he-aac!