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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th April 2013, 16:38   #1  |  Link
ikantspelwurdz
Registered User
 
Join Date: Jun 2010
Posts: 36
Combining three mono wavs into 2.1 PCM?

I have the following:

A silent MP4 video
-H264 - MPEG-4 AVC part 10 avc1
-1920x1080
-23.976 FPS
-Planar 4:2:0 YUV

Three WAV files
-PCM S16 LE araw
-Mono
-48Khz
-16 bit

The first two are identical, and the second is the base line.

I want to author a Blu-Ray with PCM 2.1 audio. Or if this is possible and supported by BD players, PCM 1.1 (I'm assuming it isn't). I don't want to re-encode any of the audio - I want the three WAV files to be discrete channels in a PCM 2.1 sound track.

How can I go about doing this? I know how to do all of the steps except actually combine the three audio files in the manner I want.
ikantspelwurdz is offline   Reply With Quote
Old 13th April 2013, 17:56   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by ikantspelwurdz View Post
The first two are identical, and the second is the base line.
...
I want the three WAV files to be discrete channels in a PCM 2.1 sound track.

How can I go about doing this?
Are you sure than the bassline contain only low frequencies?

The subwoofer speaker can't play frecuencies over 120/200 Hz.

Maybe is better mix the tracks.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 13th April 2013, 19:10   #3  |  Link
Jenyok
Warm and fuzzy
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
ikantspelwurdz
.
Try this.
.
Code:
Left=WAvSource("Left.wav")
Right=WAvSource("Right.wav")
LFE=WAvSource("LFE.wav")

Audio2_1=MergeChannels(Left, Right, LFE)
.
LFE = means subwoofer.
And so on...
.
__________________
Warm and fuzzy (white and fluffy)
Jenyok is offline   Reply With Quote
Old 13th April 2013, 21:56   #4  |  Link
ikantspelwurdz
Registered User
 
Join Date: Jun 2010
Posts: 36
tebasuna51:
These were ripped from a DVD, originally in 2.1 AC3 format. I imported into Audacity, converted to three 48Khz mono tracks, and all I did to change them was cut some time from the beginning and very slightly reduce the tempo. Then I exported them as WAVs. So as long as the original AC3 file's .1 channel was only in low frequencies, I'm pretty sure my third WAV file should be the same.

Jenyok:
Is that for AviSynth? I've never used AviSynth before, though I'm willing to teach myself how if that's the right tool for this job.
ikantspelwurdz is offline   Reply With Quote
Old 13th April 2013, 23:57   #5  |  Link
ikantspelwurdz
Registered User
 
Join Date: Jun 2010
Posts: 36
I think I figured out how to do what I want to do.

Load Audacity
Edit->Preferences->Import/Export->Export->Use custom mix
Import three WAV files
Export as WAV (Microsoft) signed 16 bit PCM
Set output channels to FOUR
L->Channel 1
R->Channel 2
R->Channel 3
LFE->Channel 4

Doing this generates a 3F/LFE WAV file, which is basically what I want. Filesize is huge, but it's going on a Blu-Ray.
ikantspelwurdz is offline   Reply With Quote
Old 14th April 2013, 09:31   #6  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by ikantspelwurdz View Post
tebasuna51:
These were ripped from a DVD, originally in 2.1 AC3 format.
Sorry, when you say bassline I was thinking you have audio from midi instruments (drums, etc.)

Quote:
Originally Posted by ikantspelwurdz View Post
...
Import three WAV files
Export as WAV (Microsoft) signed 16 bit PCM
Set output channels to FOUR
L->Channel 1
R->Channel 2
R->Channel 3
LFE->Channel 4
If you have 3 wav for what you select 4 channels?
Is enough 3 channels L, R and LFE, 2.1 like original.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 14th April 2013, 15:22   #7  |  Link
ikantspelwurdz
Registered User
 
Join Date: Jun 2010
Posts: 36
Quote:
Sorry, when you say bassline I was thinking you have audio from midi instruments (drums, etc.)
My mistake. I should have called it LFE.

Quote:
If you have 3 wav for what you select 4 channels?
Is enough 3 channels L, R and LFE, 2.1 like original.
I tried that previously. If I select 3 channels, it comes out as 3F, not 2F/LFE. My left and center speaker play stereo, my right speaker plays the LFE, and my sub does nothing.

And it gets worse. When I use Tsmuxer to make the Blu-Ray with my 3F/LFE WAV, the output TS thinks the audio is 4.0.

So now I've tried re-encoding as a SIX channel WAV.

L.wav->Channel 1
R.wav->Channel 2
R.wav->Channel 3
LFE.wav->Channel 4
Nothing->Channel 5
Nothing->Channel 6

This produces the desired result. The final TS treats the audio as 5.1 surround, but the 3F's all fire the same mono track, the 2R's are silent, and the LFE is correct.

But now I'm having syncing issues. What's strange is that if I use Avidemux to mix the 6-channel WAV with an MKV, the output MKV syncs fine. But if I use Tsmuxer to turn that very same MKV into a TS, the TS desyncs.
ikantspelwurdz is offline   Reply With Quote
Old 14th April 2013, 21:44   #8  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by ikantspelwurdz View Post
If I select 3 channels, it comes out as 3F, not 2F/LFE.
When you select WAV output in Audacity, make a wav file with a simple header without info about the channels present.

We need a header WAVE_FORMAT_EXTENSIBLE
You can convert you 3 channels wav file with simple header to a true 2.1 wav file with:

WavFix 3chan.wav 2.1.wav -m 11

After that any smart soft (tsMuxeR included) must recognize the wav like 2F/LFE

Edit: if wav file is > 4GB
you need add the parameter -ignorelength
and to be read by tsMuxeR must be W64 instead WAV

WavFix 3chan.wav 2.1.w64 -ignorelength -o 3 -m 11


WavFix.exe included here (new version 2016-08-01)
[EDIT]Also WavSplit.exe included
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 29th September 2021 at 17:04. Reason: update link
tebasuna51 is offline   Reply With Quote
Old 16th April 2013, 04:03   #9  |  Link
ikantspelwurdz
Registered User
 
Join Date: Jun 2010
Posts: 36
Thanks for that. The output says "Stereo/LFE" as expected. I will attempt to Tsmux it with the video tomorrow.

Do you know if it's possible to have a 1.1 WAV file, and if so, if that can be Blu-Ray compliant? I'm still assuming no, since nobody has said otherwise, but the question's still open.
ikantspelwurdz is offline   Reply With Quote
Old 16th April 2013, 14:06   #10  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
I don't know if is BluRay compliant, but the wav file 1.1 can be obtained using a MaskChannel of 12:

WavFix 2chan.wav 1.1.wav -m 12

Code:
The default channels mask (-m 0) are:

Mask  Chan. MS channels                Description
----  ----- -------------------------  ----------------
   4   1    FC                         Mono 1.0
   3   2    FL FR                      Stereo 2.0
   7   3    FL FR FC                   Stereo + Center 3.0
  51   4    FL FR BL BR                Quadro 4.0 (2/2.0)
  55   5    FL FR FC BL BR             like Dpl II 5.0 (3/2.0)
  63   6    FL FR FC LF BL BR          Old Surround 5.1 (3/2.1)
 319   7    FL FR FC LF BL BR BC       With back center 6.1 (3/2/1.1)
1599   8    FL FR FC LF BL BR SL SR    Standard surround 7.1 (3/2/2.1)

Some other common channels mask (-m Mask):

Mask  Chan. MS channels                Description
----  ----- -------------------------  ----------------
  12   2    FC LF                      Center + LFE (1.1)
  11   3    FL FR LF                   Stereo + LFE (2.1)
 259   3    FL FR BC                   First Surround (2/1.0)
 267   4    FL FR LF BC                First Surround + LFE (2/1.1)
1539   4    FL FR SL SR                Alternative Quadro 4.0 (2/2.0)
  15   4    FL FR FC LF                Stereo + Center + LFE 3.1
 263   4    FL FR FC BC                like Dpl I (3/1.0)
 271   5    FL FR FC BC LF             like Dpl I + LFE (3/1.1)
  59   5    FL FR BL BR LF             Quadro + LFE (2/2.1)
1543   5    FL FR FC SL SR             Alternative like Dpl II 5.0 (3/2.0)
1551   6    FL FR FC LF SL SR          New surround 5.1 (3/2.1)
1807   7    FL FR FC LF BC SL SR       Alternative surround 6.1 (3/2/1.1)
1591   7    FL FR FC BL BR SL SR       Standard surround 7.0 (3/2/2.0)
 255   8    FL FR FC LF BL BR FLC FRC  With front center left/right (5/2.1)
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 1st August 2016, 11:11   #11  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tebasuna51 View Post
When you select WAV output in Audacity, make a wav file with a simple header without info about the channels present.

We need a header WAVE_FORMAT_EXTENSIBLE
You can convert you 3 channels wav file with simple header to a true 2.1 wav file with:

WavFix 3chan.wav 2.1.wav -m 11

After that any smart soft (tsMuxeR included) must recognize the wav like 2F/LFE

Edit: if wav file is > 4GB
you need add the parameter -ignorelength
and to be read by tsMuxeR must be W64 instead WAV

WavFix 3chan.wav 2.1.w64 -ignorelength -o 3 -m 11


WavFix included in the attached file
I have multi channel wav with Front: L C R, Back: L R, LFE

but the real mask is Front: L C R, Side: L R, LFE

so I try to edit the .wav with

Code:
wavfix "old.wav" "new.wav" -ignorelength -m 1551
but the new.wav still Front: L C R, Back: L R, LFE
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 1st August 2016, 19:51   #12  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by real.finder View Post
I have multi channel wav with Front: L C R, Back: L R, LFE

but the real mask is Front: L C R, Side: L R, LFE
Are you sure than the real mask include Side channels?

If the wav was obtained decoding AC3/DTS 5.1 the surround channels (120º) are more near of Back (130º) channels than to the Side (100º) channels.

BTW both channelmask are valid for standard 5.1 configuration.

Quote:
but the new.wav still Front: L C R, Back: L R, LFE
Yep, is a bug, when wavfix read a channelmask in wav input ignore the passed like parameter with -m.
Only work when input wav file don't have channelmask (simple header).
I must do a new version.

By the moment you can use:
eac3to "old.wav" "new.wav"
than change the Back to Side if you really need it.
__________________
BeHappy, AviSynth audio transcoder.

Last edited by tebasuna51; 1st August 2016 at 19:54.
tebasuna51 is offline   Reply With Quote
Old 1st August 2016, 19:57   #13  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tebasuna51 View Post
Are you sure than the real mask include Side channels?

If the wav was obtained decoding AC3/DTS 5.1 the surround channels (120º) are more near of Back (130º) channels than to the Side (100º) channels.

BTW both channelmask are valid for standard 5.1 configuration.



Yep, is a bug, when wavfix read a channelmask in wav input ignore the passed like parameter with -m.
Only work when input wav file don't have channelmask.
I must do a new version.

By the moment you can use:
eac3to "old.wav" "new.wav"
than change the Back to Side if you really need it.
yes, but the sox make it Front: L C R, Back: L R, LFE

Looking forward to the new version
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 1st August 2016, 21:44   #14  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by real.finder View Post
yes, but the sox make it Front: L C R, Back: L R, LFE
Is correct for me, for what you need L C R, Side: L R, LFE?
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 1st August 2016, 22:11   #15  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tebasuna51 View Post
Is correct for me, for what you need L C R, Side: L R, LFE?
the original DTS like that
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 1st August 2016, 22:42   #16  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by real.finder View Post
the original DTS like that
Nope, a standard DTS 5.1 have the layout M (see the image), with channels: L C R, Ls, Rs, LFE

The exact channel correspondence can be see in 7.1 layout A:

L = FL
C = FC
R = FR
Lss = SL (Side Left)
Rss = SR (Side Right)
Lsr = BL (Back Left)
Rsr = BR (Back Right)
LFE = LF

The DTS channels Ls (Left Surround) and Rs (Right Surround) don't have a exact correspondence with WAV channels. Are between Side and Back channels, maybe near Back.
Then both channelmask must be accepted.

BTW I put a new WavFix version in precedent post.
Attached Images
 
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 1st August 2016, 23:03   #17  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by tebasuna51 View Post
Nope, a standard DTS 5.1 have the layout M (see the image), with channels: L C R, Ls, Rs, LFE

The exact channel correspondence can be see in 7.1 layout A:

L = FL
C = FC
R = FR
Lss = SL (Side Left)
Rss = SR (Side Right)
Lsr = BL (Back Left)
Rsr = BR (Back Right)
LFE = LF

The DTS channels Ls (Left Surround) and Rs (Right Surround) don't have a exact correspondence with WAV channels. Are between Side and Back channels, maybe near Back.
Then both channelmask must be accepted.

BTW I put a new WavFix version in precedent post.
I just see what the mediainfo said (I know it's not always correct)

and thank you for WavFix new version
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 2nd August 2016, 21:22   #18  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Quote:
Originally Posted by ikantspelwurdz View Post
I don't want to re-encode any of the audio - I want the three WAV files to be discrete channels in a PCM 2.1 sound track.

How can I go about doing this?
It can be done with ffmpeg if you want; the command line below combines the channels, but re-encoding is required due to the amerge filter. (note that PCM-to-PCM reencoding is both lossless and extremely fast)
Code:
ffmpeg 
-i "FL.wav" -i "FR.wav" -i "LFE.wav" 
-filter_complex "[0:0][1:0][2:0] amerge=inputs=3" 
-channel_layout "2.1" 
-vn -c:a pcm_s16le 
"out.wav"
(line breaks added for clarity)

EDIT I don't know if this should be called "re-encoding" or not: the audio samples are being merged into a single stream without changing the samples themselves. The only reason for the above caveat is that ffmpeg disallows the -codec copy option when filtering, so one could argue that (trivial) re-encoding is being done.

Last edited by raffriff42; 3rd August 2016 at 01:16.
raffriff42 is offline   Reply With Quote
Reply


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 06:22.


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