GetChannel

GetChannel (clip, int ch1 [, int ch2, ...])
GetChannels (clip, int ch1 [, int ch2, ...])

Prior to v2.5 GetLeftChannelreturns the left and GetRightChannelthe right channel from a stereo signal. GetChannelis present starting from v2.5 and it returns one or more channels of a multichannel signal. GetChannelsis an alias to GetChannel.

The ordering of the channels is determined by the ordering of the input file, because AviSynth doesn't assume any ordering. In case of stereo 2.0 WAV and 5.1 WAV files the ordering should be as follows:

WAV 2 ch (stereo):

1left channel
2right channel

WAV 5.1 ch:

1front left channel
2front right channel
3front center channel
4LFE (Subwoofer)
5rear left channel
6rear right channel

 

# Removes right channel information, and return as mono clip with only left channel:
video = AviSource("c:\filename.avi")
stereo = WavSource("c:\afx-ab3_t4.wav")
mono = GetLeftChannel(stereo)
return AudioDub(video, mono)

# Using v2.5 this becomes:
video = AviSource("c:\filename.avi")
stereo = WavSource("c:\afx-ab3_t4.wav")
mono = GetChannel(stereo, 1)
return AudioDub(video, mono)

# You could also obtain the channels from the avi file itself:
video = AviSource("c:\filename.avi")
return GetChannel(video, 1)

# Converts avi with "uncompressed 5.1 wav" audio to a stereo signal:
video = AviSource("c:\divx_wav.avi")
audio = WavSource(c:\divx_wav.avi)
stereo = GetChannel(audio, 1, 2)
return AudioDub(video, stereo)

Remark1:

Every file format has a different channel ordering. The following table gives this ordering for some formats (useful for plugin writers :))

reference: channel 1:channel 2:channel 3:channel 4:channel 5:channel 6:
5.1 WAVfront left channelfront right channelfront center channelLFErear left channelrear right channel
5.1 AC3front left channelfront center channelfront right channelrear left channelrear right channelLFE
5.1 DTSfront center channelfront left channelfront right channelrear left channelrear right channelLFE
5.1 AACfront center channelfront left channelfront right channelrear left channelrear right channelLFE
5.1 AIFFfront left channelrear left channelfront center channelfront right channelrear right channelLFE

* 5.1 DTS: the LFE is on a separate stream (much like on multichannel MPEG2).
* AAC specifications are unavailable on the internet (a free version)?

Remark2:

At the time of writing, Besweet still has the 2GB barrier. So make sure that the size of the 5.1 WAV is below 2GB, otherwise encode to six separate wavs or use HeadAC3he.

$Date: 2006/10/24 19:47:56 $