Batch extracting audio from video – channels probl

sscheidegger wrote on 7/9/2010, 12:02 AM
Hi everybody. I’m rather inexperienced with Vegas scripting and I’m stuck at the moment.

I need to extract specific audio channels from video files and save them to wave files. I need to do this to a whole folder of video files. Does someone know a script or plug-in for Vegas that can do this? I only have video files, no Vegas project files that already include the videos.

I tried to write my own little script to achieve this in Vegas. So far I managed to add the files to the Vegas MediaPool and, for each file, add the video stream as an event in the video track. I also managed to add audio as an event to an audio track. However, my files have 8 audio channels and I would like to add them to 8 audio tracks in Vegas.

How can I choose the channel of the audio stream for each audio event? The thing I found so far that comes close is “ChannelRemapping” which lets me choose between mono and stereo and so on. But I didn’t find any way to choose the channel. (Manually in Vegas I do a right click on an audio event, go to the menu “Channels” and then I can choose from channel 1 to channel 8, channel 1/2 to channel 7/8 and there are also the options both, left only, right only, mono and so on which are disabled for me.)

Or is there may be an easier way to add media to the timeline with all the video and audio channels (like with drag and drop in Vegas)?

Thanks a lot for your help

Stefan

Comments

JohnnyRoy wrote on 7/9/2010, 7:51 AM
It can't be done with the Script API. This is just an unfortunate limitation (among many unfortunate limitations).

I had tried to do this to create 5.1 tracks and the API simply doesn't allow it. The best you can do is to set your project for 5.1 Surround audio and use the vegas.ImportFile(fileName); call to import the file. This is just like dragging and dropping the file onto the timeline. If the file has 5.1 the audio, the tracks will be created. I don't know if this helps you with your 8 channels of audio though.

~jr
sscheidegger wrote on 7/12/2010, 7:25 AM
Thanks a lot. It works perfectly to import MXF files with all 8 audio channels.
JohnnyRoy wrote on 7/12/2010, 4:53 PM
> Thanks a lot. It works perfectly to import MXF files with all 8 audio channels.

That's good to know. I'm glad it worked for you.

~jr
ForumAdmin wrote on 8/13/2010, 12:11 PM
You can assign which channels are active in an audio event by calling the SetAudioChannels method on the active Take. The first argument to SetAudioChannels is the zero-based index of the first audio channel and the second argument is the number of channels to use (1 for mono or 2 for stereo).