Log in

View Full Version : Avisynth Audio Channel Checking?


pinkshiro
30th September 2010, 21:47
I have created a system which lets people create a video by uploading images, soundtracks and voiceovers into a form, and with the help of Avisynth, their content is compiled into a video.

I ran into an issue during testing to do with two audio files with non matching channels. i.e. one file was mono, one was stereo.

I am using mixaudio to mix the two tracks together.

I could ConvertToMono on everything, which is a bit of a cop out.

I am aware of MergeChannels and GetChannel, but they both seem to require you to know how many channels a file has before use.

What if you don't know the channels for each soundtrack prior to mixing? Does Avisynth have a way of checking for channels?

IanB
30th September 2010, 22:15
AudioChannels () (http://avisynth.org/mediawiki/Clip_properties) Will tell you how many audio channels are in a clip.

Script something along these lines :-...
AudioChannels()==1 ? MergeChannels(Last, Last) : Last # Fudge MonoToStereo
...