importing video with more than 2 audio tracks separatly into Vegas 20

21stCenturyStudios wrote on 2/6/2023, 12:58 PM

Having trouble importing multi-channel audio Sony .mxf files or any type of file for that matter with multiple audio tracks on a 5.1 surround project or any stereo project. When the file is imported it only shows up as one regular 2 channel track on the timeline that also seems to sometimes mix t2 audio tracks into just one left/right track. Anybody have a clue???

Comments

jetdv wrote on 2/6/2023, 1:32 PM
using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;
        bool ChannelsAddedForTrack;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    ChannelsAddedForTrack = false;
                    foreach (TrackEvent evnt in myTrack.Events)
                    {
                        if (evnt.Selected)
                        {
                            Media media = evnt.ActiveTake.Media;

                            int chCount = media.StreamCount(MediaType.Audio);

                            bool found6 = false;
                            for (int i=0; i<chCount; i++)
                            {
                                AudioStream astream = (AudioStream)media.GetAudioStreamByIndex(i);
                                int asChannels = astream.Channels;

                                if (asChannels == 6)
                                {
                                    found6 = true;
                                    AddChannel(myTrack.Index, astream, evnt);
                                }
                            }
                            if (!found6)
                            {
                                MessageBox.Show("No channels above 2 were found.");
                            }
                            else
                            {
                                ChannelsAddedForTrack = true;
                            }
                        }

                    }
                }
            }
        }

        private void AddChannel(int tIndex, AudioStream astream, TrackEvent evnt)
        {
            TrackEventGroup grp = new TrackEventGroup();
            myVegas.Project.Groups.Add(grp);
            grp.Add(evnt);
            addEvent(tIndex + 1, astream, evnt, 0, 2, grp);
            addEvent(tIndex + 2, astream, evnt, 2, 1, grp);
            addEvent(tIndex + 3, astream, evnt, 3, 1, grp);
            addEvent(tIndex + 4, astream, evnt, 4, 2, grp);
        }


        private void addEvent(int tIndex, AudioStream astream, TrackEvent evnt, int FirstChannel, int ChannelCount, TrackEventGroup grp)
        {
            AudioTrack aTrack = null;

            if (!ChannelsAddedForTrack)
            {
                aTrack = new AudioTrack(tIndex);
                myVegas.Project.Tracks.Add(aTrack);
            }
            else
            {
                aTrack = (AudioTrack)myVegas.Project.Tracks[tIndex];
            }

            AudioEvent mynewAEvent = new AudioEvent(evnt.Start, evnt.Length);

            aTrack.Events.Add(mynewAEvent);
            Take myNewtake = new Take(astream);
            mynewAEvent.Takes.Add(myNewtake);
            myNewtake.SetAudioChannels(FirstChannel, ChannelCount);
            myNewtake.Offset = evnt.ActiveTake.Offset;
            grp.Add(mynewAEvent);
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

This should properly import a 5.1 audio stream if the clip contains one. It will be fully explained in a tutorial in a few weeks.

Illusion wrote on 2/6/2023, 2:16 PM

Maybe you can start by this. The default is unchecked.

 

  • ASUS ROG Strix X570-E
  • Ryzen 9 3900x 12-core
  • 128GB RAM (4x32GB)
  • Nvidia RTX 2070 8GDDR6
  • 1TB WD Black NVMe M.2 for OS/Prog
  • 1TB WD Black NVMe M.2 for Media
  • 1TB/2TB/4TB SATA3 SSDs for projects/media
  • 4TB WD Red drive for local cache
  • 10TB EXOS Enterprise, 14TB Toshiba drive for local cache
  • 32in 4K main monitor, 24in 1080 second
  • Win 11 Pro
  • 28TB NAS for long term archive storage
  • Sony a6000
  • Sony A7C
  • GoPro Hero 8
  • GoPro Hero 11
  • Sony BRAVIA XR X90J 75" 4K HDR10
  • Nvidia Shield TV Pro media player (GigE wired)
  • JBL Bar 5.1

 

Illusion wrote on 2/6/2023, 2:22 PM

When checked, I got 8 audio channels imported, which matches the mediainfo of the file.

General
Complete name                            : D:\1\20210703_A7C0134.MXF
Format                                   : MXF
Format version                           : 1.3
Format profile                           : OP-1a
Format settings                          : Closed / Complete
File size                                : 952 MiB
Duration                                 : 17 s 17 ms
Overall bit rate                         : 469 Mb/s
Package name                             : 20210703_A7C0134
Encoded date                             : 2023-02-01 23:11:05.000
Writing application                      : Sony Catalyst 2022.1
Writing library                          : Sony MXF Development Kit (Win32) 4.20.0.153.1

Video
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High 4:2:2 Intra@L5.1
Format settings, CABAC                   : No
Format settings, GOP                     : N=1
Format settings, wrapping mode           : Frame
Codec ID                                 : 0D01030102106001-0401020201323001
Duration                                 : 17 s 17 ms
Bit rate                                 : 460 Mb/s
Maximum bit rate                         : 480 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 1.851
Stream size                              : 933 MiB (98%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Delay_SDTI                               : 69995459

Audio #1
ID                                       : 3
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Audio #2
ID                                       : 4
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Audio #3
ID                                       : 5
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Audio #4
ID                                       : 6
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Audio #5
ID                                       : 7
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Audio #6
ID                                       : 8
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Audio #7
ID                                       : 9
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Audio #8
ID                                       : 10
Format                                   : PCM
Format settings                          : Little
Format settings, wrapping mode           : Frame (AES)
Codec ID                                 : 0D01030102060300-0402020101000000
Duration                                 : 17 s 17 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 152 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 48.0 kHz
Frame rate                               : 29.970 FPS (1601.6 SPF)
Bit depth                                : 24 bits
Stream size                              : 2.34 MiB (0%)
Delay_SDTI                               : 69995459
Locked                                   : Yes

Other #1
ID                                       : 1-Material
Type                                     : Time code
Format                                   : MXF TC
Frame rate                               : 29.970 (30000/1001) FPS
Time code of first frame                 : 19:26:35;16
Time code of last frame                  : 19:26:52;15
Time code settings                       : Material Package
Time code, stripped                      : Yes

Other #2
ID                                       : 1-Source
Type                                     : Time code
Format                                   : MXF TC
Frame rate                               : 29.970 (30000/1001) FPS
Time code of first frame                 : 19:26:35;16
Time code of last frame                  : 19:26:52;15
Time code settings                       : Source Package
Time code, stripped                      : Yes

Other #3
ID                                       : 11
Format                                   : Acquisition Metadata
Muxing mode                              : Ancillary data / RDD 18
Duration                                 : 17 s 17 ms
Frame rate                               : 29.970 FPS
Delay_SDTI                               : 69995459
CaptureGammaEquation_FirstFrame          : BT.709

Other #4
Type                                     : Time code
Format                                   : SMPTE TC
Muxing mode                              : SDTI
Frame rate                               : 29.970 (30000/1001) FPS
Time code of first frame                 : 19:26:35;16

 

  • ASUS ROG Strix X570-E
  • Ryzen 9 3900x 12-core
  • 128GB RAM (4x32GB)
  • Nvidia RTX 2070 8GDDR6
  • 1TB WD Black NVMe M.2 for OS/Prog
  • 1TB WD Black NVMe M.2 for Media
  • 1TB/2TB/4TB SATA3 SSDs for projects/media
  • 4TB WD Red drive for local cache
  • 10TB EXOS Enterprise, 14TB Toshiba drive for local cache
  • 32in 4K main monitor, 24in 1080 second
  • Win 11 Pro
  • 28TB NAS for long term archive storage
  • Sony a6000
  • Sony A7C
  • GoPro Hero 8
  • GoPro Hero 11
  • Sony BRAVIA XR X90J 75" 4K HDR10
  • Nvidia Shield TV Pro media player (GigE wired)
  • JBL Bar 5.1

 

21stCenturyStudios wrote on 2/6/2023, 2:23 PM

hey youre awsome thanks- didnt see it... it works ...i was going nuts over here!!!

21stCenturyStudios wrote on 2/6/2023, 2:31 PM

Hey illusion its not an illusion that youre a function checker genius.....

21stCenturyStudios wrote on 2/6/2023, 2:33 PM
it wasnt a 5.1 stream , just different camera mikes but I look forward to the tutorial on that as we venture into 5.1 thanks