Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Lame and surround (Read 40838 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Lame and surround

Hi guys. I've read many past threads about Lame and encoding movies soundtracks from AC3 to Dolby Surround1/2. While many people claim that Lame preserves the phase informations thanks to its safe joint stereo mode, in this thread http://www.hydrogenaudio.org/forums/index....t=0&#entry47454 it's stated that only at very high bitrates (for e.g. --alt-preset extreme or insane(!!)) Lame can conserve surround infos in a decent way.

Anyway i've encoded lots of movie soundtracks with Lame, and the --alt-preset standard setting seems quite good to me for surround1/2 tracks.

Thanks for any answer!

Fr4nz

Lame and surround

Reply #1
Pardon me, but did you ask a question?

Lame and surround

Reply #2
Yes, sorry for my english 
The question would be: is LAME good at --alt-preset standard if you want to encode a movie soundtrack in Dolby Surround 1/2?

Lame and surround

Reply #3
[deleted]

Lame and surround

Reply #4
Quote
What do you mean by Dolby Surround?  If you are speaking of files that are hinted for the Dolby Pro Logic technology, then using --alt-preset standard should be adequate for most samples to preserve most imaging, but I would certaintly recommend using "extreme" for the extra headroom.

I can remember back to when the r3mix preset was being moved to use VBR MTRH method, and there was some testing of Pro Logic encoded with LAME MP3.  I believe it was found that the rear channels had definate weirdness when nssafejoint (nsmsfix=1.0) wasn't used.  Keep in mind that was a non-scientific test done ages ago that wouldn't fly around HA nowadays without some real testing.

I'm speaking about AC3->MP3 process done via Besweet using the latest Lame DLL (3.93.1)

Lame and surround

Reply #5
i remember the thread on HA where someone was testing different encoders and how they 'preserve' the pro-logic info and found quite some problems with it, but imho pro-logic should be preserved without any problems even if you dump the track onto old analog tape or use any lossy encoder with any settings.
PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung

Lame and surround

Reply #6
I've always wondered about these two threads:

http://www.hydrogenaudio.org/forums/index....t=0&#entry47454
and
http://www.hydrogenaudio.org/forums/index....=ST&f=11&t=4109

because I had a brief look at this issue during my PhD, and found that it was a huge issue for some encoders, and not for others. I couldn't believe that our favourite encoders (i.e. lame --alt-preset standard, and mpc standard a/k/a --quality 5) could have such problems.

However, I've just tried the same kinds of testing as atom, and have found similar results.

If you listen carefully (and actually create the test sample yourself, and listen to front and surround at once, rather than just the surround on its own) you can figure out what's happening...

We have two channels of information, Left and Right. These can be transformed to Mid (or Sum) and Side (or Difference). These M and S channels can be encoded instead of the original L and R channels when joint stereo encoding is enabled, though the encoder still has the choice of encoding straight L and R if it wishes. Also, the encoder can trade bits between L and R, or M and S as it wishes - so, for a mono signal, S gets no bits.

Of course, M is the same as the centre channel in Dolby Stereo, and S is similar to the surround channel. In Pro Logic decoders, the signal is actively steered between the channels, so if the decoder detects that most of the signal should be going to the surround channel, it cuts off the front left, centre, and right channels - this stops the surround info also being present in the front Left and Right channels - a problem with the older passive Dolby Stereo decoding.


Both lame and Musepack have a problem at the "standard" settings where ever both the front and surround channels carry high frequency information simultaneously. I'm guessing at the psychoacoustic calculations that are involved, but where the out-of-phase components are significantly quieter than (i.e. masked by) the in-phase components, they are dumped.

This makes sense from a psychoacoustic point of view, and (as we know) works perfectly for stereo reproduction. The problem is that the surround decoding process takes the out-of-phase signal component, and moves it behind you. The in-phase signal component that was masking it is now unable to do so. (I found that spatial unmasking was about 15dB for coding noise moved 90 degrees away from the original signal).

Accepting that you won't actually listen to the surround channel in isolation, the coding artefacts are bad enough that they are audible when listening to all channels at once using a typical surround system. I'm judging this by knowing the level of artefacts that are needed to be audible in this context, and comparing it to the level of artefacts I'm now hearing listening via headphones - I haven't verified it using a real surround sound system. But I'm willing to bet that it's true, especially for people who have their surround speakers closer than their front speakers, and don't compensate.

The 8kHz bandwidth on Dolby Pro Logic will help to hide the problem, but the problem goes down to 4kHz, and DPL2 doesn't have this bandwidth limitation.


Now, this result holds when you make an intentionally difficult signal yourself by combining various signals. So why do people encoding movies not encounter serious problems - after all, they're often only using 128kbps!!! Well, because of the steering in Dolby Pro-logic decoders, it's important that the dominant sound source only comes from one direction at once, otherwise they'll be no effective steering. So, in a movie sound track, there shouldn't be an instance where there's significant high frequency info from both the front and surround channels.

If the movie producer wants the sound to come from all around (subtle ambience), then I'd guess the surround has to be loud enough to prevent the steering from shutting it off. So it's possible that, when the mp3 or mpc encoder does destroy the surround channel, the pro-logic encoder has shut it off anyway, and where the pro-logic encoder has left all channels open, there's enough information in each channel that none of it is "masked", and hence none of it is discarded by the encoder.

This assumption may work pretty well for movies, and a dolby decoder. It will probably break for music, which isn't specially encoded to cause a DPL encoder to steer the signal, but can have any relative levels of in-phase and out-of-phase information. It will probably break for an arbitrary dematrix operation (e.g. Logic7, DPL2) which is trying to extract subtle ambient info from "stereo" sources.



In short: Movie sound tracks will probably be OK, but there will almost certainly be instances where music will not be.

Cheers,
David.

P.S. Would it be possible to adapt the lame or musepack psychoacoustic model to perform masking calculations on L, R, M, and S rather than just one pair of them? It would increase the bitrate, but make any stereo source dematrix safe.

EDIT: sorry this is so long - there have been three posts while I was typing this!!!

EDIT 2: Months later, I edited this post to remove all the repeats which were added within the text when it was originally posted by a forum bug (which has since been fixed). I don't normally return to old posts and "correct" them, but I wanted to link to this, and found it unreadable. All the comments below about a long and repeating post were referring to the original "damaged" version.

Lame and surround

Reply #7
Lol you're post is a little fucked up but I understood it. yes it could be a good idea to make a preset for surround 1 || 2 tracks...let's hope that someone of the lame developers takes it into consideration.

Lame and surround

Reply #8
Quote
EDIT: sorry this is so long - there have been three posts while I was typing this!!!

I was going to ask why all your posts are so bl00dy long, but this time I actually bothered to read it, and realised : Its a couple of central themes repeated a few times

Nothing technical to add, m'lord

Lame and surround

Reply #9
David, your post would probably be more understandable with a little editing...

Lame and surround

Reply #10
Quote
David, your post would probably be more understandable with a little editing...

It's not his fault, it's a bug in Invisionboard 1.2 RC1 and/or the way it's set up here. I will have to post a warning on the portal or something... this happens with most long posts these days...

Lame and surround

Reply #11
[deleted]

Lame and surround

Reply #12
Quote
Yeah, it's the board formatting causing the error, but the post is readable if you sit down and work with it. =)

@2Bdecided: Have you determined if nssafejoint (i.e. nsmsfix = 1.0) improves the situation with these tracks?

Excellent idea!

Just tried it. Yes, huge improvement. I wouldn't swear that the surround channel, listened to on its own is transparent - but it may be, and it's certainly more than good enough to be used as a surround channel with the other channels playing from speakers in the same room.

--aps: average: 220.1 kbps  LR: 153 (36.96%)  MS: 261 (63.04%)
--aps --nsmsfix 1.0: average: 245.1 kbps  LR: 368 (88.89%)  MS: 46 (11.11%)


Is adding --nsmsfix 1.0 going to reduce the transparency (i.e. add or increase artefacts) for some signals?

I know the similar approach (ms 15) for mpc won't cause any problems - but mpc doesn't have a hard upper bitrate limit, whereas mp3 does; we know mp3 runs out of bits (or uses them badly!) sometimes already.

Cheers,
David.

Lame and surround

Reply #13
If I remember well --alt-presets uses nssafejoint option....or I am wrong?

Lame and surround

Reply #14
[deleted]

Lame and surround

Reply #15
Quote
Lol you're post is a little fucked up but I understood it.

I don't think his post is fucked up.  I appreciate it all the time he spent writing it up and word it without any tech jargons.  So a layman can understand it.

Thank for all your post 2Bdecided, and I had learn a lot from you. 

Lame and surround

Reply #16
Quote
Quote
Lol you're post is a little fucked up but I understood it.

I don't think his post is fucked up.  I appreciate it all the time he spent writing it up and word it without any tech jargons.  So a layman can understand it.

Thank for all your post 2Bdecided, and I had learn a lot from you. 

You really didn't understand what I meaned...his post is fucked up because of the numerous repetitions (caused by a forum bug).

Lame and surround

Reply #17
So guys --nsmsfix 1.0 is the way to go for encoding surround tracks?

Lame and surround

Reply #18
Quote
So guys --nsmsfix 1.0 is the way to go for encoding surround tracks?

Well, maybe, but you missed three points:

1. In a movie soundtrack intended for Dolby Pro-logic decoding, it's unlikely that you will find the combinations of sounds which cause a problem. That's just my guess though, and it's only a guess. This discussion should be shared with doom9 to get some experts on board!

2. --nsmsfix 1.0 might make things worse elsewhere. Again, that's a guess - I'm not trying to give answers in this post - I'm trying to get other people to test this, and those involved to remember what the issues were when this was tweaked.

3. I'm still not sure it's a 100% solution for the most serious surround problems. It sounds fine to me, but I don't have a propper surround system to test it on, and there are people with better ears here. What I can see it doing to the surround channel in spectral view makes me suspect that there may well be some audible problems remaining.


I'll ask again - is it possible to make lame (or mpc) view the Side channel as a real channel, and perform psychoacoustic calculations on it; rather than viewing it as something that can be dumped? That would be much better than an nsmsfix hack in lame, or than using ms 15 in mpc. I'm happy to help with the algorithm (but not the coding!) because I think some of the spatial masking measurements I made in 1999 might be a good starting point.

Cheers,
David.

Lame and surround

Reply #19
Quote
II guess an interesting test would be to listen to the output of the surround from aps and aps nssafejoint.  If this can be ABX'd, then I think it would be smart to ABX alt-preset extreme vs. alt-preset standard + nssafejoint.  The bitrates will probably be very similar; the real test is to increase the quality of the "surround" channel without degrading the rest of the signal below the level of audible transparency.  Maybe someone else can define a better test methodology -- I've been up for two days now and might not be thinking straight. =)

I encoded an AC3 sample from matrix with --aps --nsmsfix 1.0 and --ape

--aps --nsmsfix 1.0 gave me ~198kbps

--ape gave me 242kbps!!!

So there's a great difference in terms of kbits between these 2 modes.

It would be nice to have a preset optimized for surround tracks like 2BDecided suggests

Lame and surround

Reply #20
I've had an email from Frank. He asked 6 sensible questions...

1. What piece of music is affected?
2. What Dolby Surround Prologic or Dolby Surround Prologic II decoder is used?
3. In the case of Dolby Surround Prologic II: Music or Movie mode?
4. Delay for the rear channels?
5. Distance difference between front and rear speakers?  ||front - listener|| -
||rear - listener||
6. What type of loudspreakers are used?


I tried listening via speakers, sending the "centre" channel to a speaker infront of me, and the "surround" channel to a speaker behind me. A poor man's experimental surround system, if you like.

Despite the obvious problems present in the surround channel when auditioned on its own, I can't hear any problems with it when replayed over speakers at the same time as the centre channel.

OK - I can hear problems if I put my ear quite close to the surround speaker - but with both speakers equidistant, the distortion in the surround channel is totally inaudible.


I emailed Frank to tell him this (I'm sure he already knows!!!) but asked, since he once had a braindead profile for people who insist on judging codecs by spectral analysis (i.e. the wrong way), maybe it would be worth his time adding a switch to preserve the surround channel for people who insist of judging codecs by listening to the surround channel in isolation (i.e. the wrong way!).


In the mean time, if anyone can find a sample which gives audible artefacts using a real surround decoder and sensible speaker placement, I think Frank might be interested.

Cheers,
David.

 

Lame and surround

Reply #21
David you're totally right. If I put my ears next to surround loudspeakers I can hear evident artifacts, but if I listen to all the loudspeakers the sound is perfect.

Try also this: put your ears next to the right/left loudspeaker, you should hear artifacts also there 

Lame and surround

Reply #22
David are you alive?? I'm waiting for a PM reply from you!