MergeChannels: Difference between revisions

From Avisynth wiki
Jump to navigationJump to search
No edit summary
 
add link to avs+ documentation
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:FuncDef|MergeChannels(clip1 ''clip'', clip2 ''clip'' [, clip3 ''clip''])}}
<div style="max-width:62em" >
<div {{BlueBox2|40|0|3px solid purple}} >
{{AvsPlusFullname}}<br>
Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/mergechannels.html https://avisynthplus.readthedocs.io]
</div>


Starting from v2.5 MergeChannels replaces [[MonoToStereo]], and can be used to merge the audio channels of two or more clips.
Don't confuse this with mixing of channels ([[MixAudio]] and [[ConvertToMono]] do this) - the sound of each channel is left untouched, the channels are only put into the new clip.


Before merging audio is converted to the sample type of clip1.
Merge the audio channels of two or more clips.  


Example, converts "uncompressed wav" audio to a 44.1 kHz stereo signal:
There is no ''mixing'' of channels &ndash; [[MixAudio]] and [[ConvertToMono]] do this. The channels are added to the new clip unchanged.


video = AviSource("c:\divx_wav.avi")
audio = WavSource("c:\divx_wav.avi")
l_ch = GetChannel(audio, 1)
r_ch = GetChannel(audio, 2)
stereo = MergeChannels(l_ch, r_ch).ResampleAudio(44100)
return AudioDub(video, stereo)


Note, this is the same as:
{{FuncDef
|MergeChannels(clip ''clip1'', clip ''clip2'' [, clip ''clip3'', ...] )
}}


video = AviSource("c:\divx_wav.avi")
Output video, framerate and running time are taken from {{FuncArg|clip1}}.
audio = WavSource("c:\divx_wav.avi")
stereo = GetChannel(audio, 1, 2).ResampleAudio(44100)
return AudioDub(video, stereo)


All audio is [[ConvertAudio|converted]] to the sample type of {{FuncArg|clip1}}.
For example, given the following source clips:
:''A'' (mono)
:''B'' (mono)
...and merging them:
<div {{BoxWidthIndent|24|0}} >
MergeChannels(A, B)
</div>
Results in a clip with the following [[Clip_properties|properties]]:
:video = ''A''
:audio channel 1 = ''A''
:audio channel 2 = ''B''
This is equivalent to using [[MonoToStereo]].
For a more complex example, given the following source clips:
:''A'' and ''B'' (stereo)
:''C'' and ''D'' (mono)
...and merging them:
<div {{BoxWidthIndent|24|0}} >
MergeChannels(A, B, C, D)
</div>
Results in a clip with the following [[Clip_properties|properties]]:
:video = ''A''
:audio channel 1 = ''A'' channel 1
:audio channel 2 = ''A'' channel 2
:audio channel 3 = ''B'' channel 1
:audio channel 4 = ''B'' channel 2
:audio channel 5 = ''C''
:audio channel 6 = ''D''
</div>


[[Category:Internal filters]]
[[Category:Internal filters]]
[[Category:Audio_filters]]

Latest revision as of 06:37, 18 September 2022

AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io


Merge the audio channels of two or more clips.

There is no mixing of channels – MixAudio and ConvertToMono do this. The channels are added to the new clip unchanged.


MergeChannels(clip clip1, clip clip2 [, clip clip3, ...] )

Output video, framerate and running time are taken from clip1.

All audio is converted to the sample type of clip1.


For example, given the following source clips:

A (mono)
B (mono)

...and merging them:

MergeChannels(A, B)

Results in a clip with the following properties:

video = A
audio channel 1 = A
audio channel 2 = B

This is equivalent to using MonoToStereo.


For a more complex example, given the following source clips:

A and B (stereo)
C and D (mono)

...and merging them:

MergeChannels(A, B, C, D)

Results in a clip with the following properties:

video = A
audio channel 1 = A channel 1
audio channel 2 = A channel 2
audio channel 3 = B channel 1
audio channel 4 = B channel 2
audio channel 5 = C
audio channel 6 = D