Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Audio encoding

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th April 2009, 10:36   #1  |  Link
OtonVM
Registered User
 
Join Date: Jul 2008
Posts: 17
Demux and remux AC3 (channel mapping)

I had to resample an AC3 5.1 audio track (for PAL -> NTSC conversion) so I used tmpgenc xpress 4 to select each channel and export it into wav.

The result are 6 mono tracks: FR, FL, FC, LFE, BR, BL.

I opened them in Audition and ran a resample script in batch which exported again 6 tracks. I kept the names consistent so I would not confuse which channel is which.

Than I imported them into WAV to AC3 encoder with the MUX Wizard so I could map each channel properly.

The resulting AC3 sounds wrong, panned to the right, dialogues are muffled.

I guess I mapped the channels incorrectly. Am I missing something?
OtonVM is offline   Reply With Quote
Old 14th April 2009, 11:57   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,874
Wav to Ac3 works fine, but in the previous process you must do anything wrong.

Use eac3to or BeHappy to do the process directly without channel mapping problems.
For instance:

eac3to pal.ac3 -slowdown -448 ntsc.ac3

for 448 Kb/s, default bitrate is 640 Kb/s
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 14th April 2009, 12:21   #3  |  Link
OtonVM
Registered User
 
Join Date: Jul 2008
Posts: 17
I tried that. The problem is that slowdown never works! With downsampling to 46033 and than back to 48000 I get perfect results. Maybe I'll try again...
OtonVM is offline   Reply With Quote
Old 14th April 2009, 15:24   #4  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,874
Quote:
Originally Posted by OtonVM View Post
I tried that. The problem is that slowdown never works!
What is the problem?
Quote:
With downsampling to 46033 and than back to 48000 I get perfect results. Maybe I'll try again...
I can understand your method, the conversion PAL -> NTSC is increase the audio duration (increase samples at same samplerate).

If you downsample to 46033 you have less samples and need more samples.

Upsample to 50050 and assign samplerate 48000.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 14th April 2009, 16:33   #5  |  Link
OtonVM
Registered User
 
Join Date: Jul 2008
Posts: 17
Yes, that is what I did so far.

I tried besweet and eac3to with pal to ntsc conversion but the audio always went out of sync towards the second third of the movie.

My method (also found on this forum) works great. All I have to do is align peaks in the waveform in Audition to find any delays and that's it.

It all works with stereo sound. I can't replicate the same process with 5.1 sound at least not with Audition. That is where the demuxing/remuxing comes into play.

I'll try demuxing into wave with belight instead of using tmpgenc, maybe it will help.

Tnx anyway!
OtonVM is offline   Reply With Quote
Old 14th April 2009, 19:55   #6  |  Link
Skelsgard
foobaring my ass off
 
Skelsgard's Avatar
 
Join Date: Nov 2005
Location: Argentina
Posts: 620
Try muxing the fixed mono WAVs into a interleaved 6-ch WAV with Wavewizard, just make sure that the files are in WAV order from top to bottom:
FL
FR
FC
LFE
SL
SR

In wavewizard, Edit --> Preferences. Enable Stream manipulation: Merge files, Ignore size in headers: always, Output format: Wave PCM.

Then you feed this 6ch WAV to Aften (aftengui).
__________________
"Damn, respect my authoritay!!" - E. Cartman
Skelsgard is offline   Reply With Quote
Old 15th April 2009, 17:59   #7  |  Link
OtonVM
Registered User
 
Join Date: Jul 2008
Posts: 17
Ok let me report back.

The problem was with tmpgenc. It maps the channels in a wrong way.
I demuxed the ac3 with belight into 6 mono 32bit waves. It turned out that LFE was silent anyway. I used my method of resampling them in batch with Audition and than used Sonic Foundry Soft Encode to map and reencode the resampled files back into an ac3.

EncWAVtoAC3 and its wizard do not work for some reason. The resulting channels were wrong.

I tried Wavewizard but it took forever to make that wave that was huge in the end. I'm talking 15GB! But I guess i should work in the end.

It would be great if I could use avisynth to demux and remux the files so I could drop sonic but I'll have to do some more research for that...


Thanks to everyone!
OtonVM is offline   Reply With Quote
Old 15th April 2009, 18:46   #8  |  Link
TinTime
Registered User
 
Join Date: Jan 2009
Location: UK
Posts: 403
Quote:
Originally Posted by OtonVM View Post
It would be great if I could use avisynth to demux and remux the files so I could drop sonic but I'll have to do some more research for that...
Going back to what tebasuna51 said, try eac3to again as this will let you recode in one step. If the audio is going out of sync towards the end of movies then this suggests that you're not setting the video framerate correctly. It should be 24000/1001fps, assuming you're going from 25p and keeping the video progressive. If you use a different framerate (e.g. 24fps) then you need to tell eac3to this.
TinTime is offline   Reply With Quote
Old 15th April 2009, 19:08   #9  |  Link
OtonVM
Registered User
 
Join Date: Jul 2008
Posts: 17
NTSC is 29.97 fields or 23.976 frames right? This are the settings I used, that is: in besweet 25000 to 23976.

I'll try eac3to and report back. It would be great if I could remove all the steps in between.
OtonVM is offline   Reply With Quote
Old 15th April 2009, 21:08   #10  |  Link
Skelsgard
foobaring my ass off
 
Skelsgard's Avatar
 
Join Date: Nov 2005
Location: Argentina
Posts: 620
The Wavewizard method is slow but failsafe, it can't go wrong unless something is done wrong, so you can use it as a test to check which part of your process is getting screwed up (decoding, remuxing, or encoding).

In essence NTSC is 29.970, but pulldown removal makes it 23.976.

I would use avisynth, avs2wav and aften for this job,
with this script (audio.avs) for decoding and timestretching:
Code:
NicAC3Source("audio.ac3")
TimeStretch(tempo = (23.976*100/25)) #takes audio from 25 fps to 23.976 fps while maintaining the pitch
ConvertAudioTo16bit()
and then, with the command line or in a .bat for loading the script and feeding it to aften:
Code:
avs2wav.exe -f wav -i audio.avs -o - | aften -b 448 - stretched_audio.ac3
It does everything at once, like you wanted it. No intermediary files, saves time and hdd space while decoding, timestretching, and reencoding, retains the pitch. And the tools are free, small and easy to use.
__________________
"Damn, respect my authoritay!!" - E. Cartman
Skelsgard is offline   Reply With Quote
Old 15th April 2009, 21:48   #11  |  Link
OtonVM
Registered User
 
Join Date: Jul 2008
Posts: 17
Very well sir, I'll make sure to let you know what comes out of it. For now, my winxp is slow as hell and I have to blast my image back and reinstall stuff. I'll try this in a day or so.
OtonVM is offline   Reply With Quote
Old 16th April 2009, 04:00   #12  |  Link
TinTime
Registered User
 
Join Date: Jan 2009
Location: UK
Posts: 403
Quote:
Originally Posted by Skelsgard View Post
I would use avisynth, avs2wav and aften for this job, with this script (audio.avs) for decoding and timestretching:
Code:
NicAC3Source("audio.ac3")
TimeStretch(tempo = (23.976*100/25)) #takes audio from 25 fps to 23.976 fps while maintaining the pitch
ConvertAudioTo16bit()
Just a couple of points. The tempo percentage figure should strictly be (24.000/1.001) * (1.0/25.0) * 100.0, although it won't make much difference - about 4ms per 100,000 frames.

Also, if you're slowing down a movie from a PAL DVD then I don't think you'd want to maintain the pitch at all. The act of slowing down will correct the pitch from its incorrect source. If you keep the pitch then it will still be incorrect plus you'll introduce pitch correction artefacts. I'd use rate instead of tempo in TimeStretch, unless you really do want to keep the pitch.

Finally, unless aften requires it (I don't think it does) then don't convert to 16 bit at the end of the script. In fact, convert to the highest precision supported by aften before resampling.

But eac3to will do all these things for you automatically in one command line, plus it will check for clipping
Code:
eac3to input.ac3 output.ac3 -slowdown
TinTime is offline   Reply With Quote
Old 16th April 2009, 09:14   #13  |  Link
Skelsgard
foobaring my ass off
 
Skelsgard's Avatar
 
Join Date: Nov 2005
Location: Argentina
Posts: 620
Quote:
Originally Posted by TinTime View Post
Just a couple of points. The tempo percentage figure should strictly be (24.000/1.001) * (1.0/25.0) * 100.0, although it won't make much difference - about 4ms per 100,000 frames.
You're right about that. I always forget about the 24000/1001 factor when dealing with 23.976.

Quote:
Originally Posted by TinTime
Also, if you're slowing down a movie from a PAL DVD then I don't think you'd want to maintain the pitch at all. The act of slowing down will correct the pitch from its incorrect source. If you keep the pitch then it will still be incorrect plus you'll introduce pitch correction artefacts. I'd use rate instead of tempo in TimeStretch, unless you really do want to keep the pitch.
Not necessarily. That's only assuming it's a Hollywood movie. If the DVD is original PAL (instead of a PALed NTSC), like a french or UK movie, then the audio pitch IS correct in its source.

Quote:
Originally Posted by TinTime
Finally, unless aften requires it (I don't think it does) then don't convert to 16 bit at the end of the script. In fact, convert to the highest precision supported by aften before resampling.
ConvertAudioTo16bit() is there just to ensure compatibility. I've had tools bitch before for whatever reason about files that they were supposed to accept. So, to be on the safe side...
avs2wav outputs FLOAT when using NicAudio. If Aften is accepting FLOAT, then he can strip it off or else take it to ConvertAudioTo32bit().

Later
__________________
"Damn, respect my authoritay!!" - E. Cartman
Skelsgard is offline   Reply With Quote
Old 16th April 2009, 11:48   #14  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,874
Quote:
Originally Posted by Skelsgard View Post
Not necessarily. That's only assuming it's a Hollywood movie. If the DVD is original PAL (instead of a PALed NTSC), like a french or UK movie, then the audio pitch IS correct in its source.
Yes, if pitch is correct in PAL audio we can preserve the pitch with
Code:
NicAC3Source("audio.ac3")
TimeStretch(tempo=96.0/1.001)
If the pitch is previously changed and need recover the original pitch is better use TimeStretch(rate=96.0/1.001) and best use:
Code:
NicAC3Source("audio.ac3")
SSRC(50050).AssumeSampleRate(48000)
without phase problems (TimeStreetch work fine with stereo audio but with 5.1 there are phase problems between channels)

This last method is equivalent to eac3to slowdown.
Quote:
If Aften is accepting FLOAT, then he can strip it off or else take it to ConvertAudioTo32bit().
Aften accept all formats, then better preserve the original 32 bits float output from NicAudio. Don't put any ConvertAudioToX.

BTW, avs2wav always crash in my systems. An alternate method is use Wavi:
Code:
Wavi audio.avs - | aften -b 448 - stretched_audio.ac3
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 18th April 2009, 23:39   #15  |  Link
OtonVM
Registered User
 
Join Date: Jul 2008
Posts: 17
Well, reporting back!

eac3to works! Used it with two different files and it worked alright which saves me a lot of work. So thanks a lot for that one. I would like to make it use nero but no luck so far (even with nero 7). I would really like to squeeze as much quality as possible from the original since I'm forced to reencode (also why I used 32 float waves for resampling). I'll research that elsewhere.

Haven't tried avisynth and probably will not for the present. Too much work in research for that and I have exams all the time. But a lot of info connected with that debate that will probably come in handy one day.

So again this forum proves useful! Thank you guys! Later!
OtonVM is offline   Reply With Quote
Reply

Tags
ac3, audition, channel, ntsc, pal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.