Start Capture?

JasonG wrote on 3/19/2009, 9:41 PM
Is the vegas Capture tool scriptable? I didn't see anything in the API that looked like it would work. I'd like to be able to trigger the capture of live video from a firewire camera from another program. Basically I just need to be able to hit the "Start Capture" button and then name the media file that gets created appropriately.

Comments

jetdv wrote on 3/20/2009, 8:32 AM
No it is not.
JasonG wrote on 3/20/2009, 10:38 AM
I found a post from about a year ago from someone looking to do something similar. They had asked about the Sony.MediaSoftware.ExternalVideoDevice namespace
That sounds like it would be useful. Is there any information any where about it? It sounds like its not really supported or documented, but would be useful.
JasonG wrote on 6/1/2009, 11:00 AM
Using the object browser, I've uncovered the class VegasCapturePanel and the class CaptureDockWnd.
I feel like this is totally doable, but I need some help getting it going.
I tried something like this, but I'm not sure how to get it to actually pop up the control and then be able to manipulate it.

CaptureDockWnd dck = new CaptureDockWnd();
VegasCapturePanel vCp = new VegasCapturePanel(vegas, dck);
JasonG wrote on 6/1/2009, 1:55 PM
I've got the interface to show up using the following:

CaptureDockWnd dck = new CaptureDockWnd(); ;
dck.DisplayName = "Test";
dck.PersistDockWindowState = true;
vegas.LoadDockView(dck);

Now I just have to figure out how to access the CapturePanel that gets built and its capsettings.captureclip property.
JasonG wrote on 6/1/2009, 6:37 PM
Making some progress. I'm able to access the docked control and do a few things, but I can't seem to get the capture to happen:

Sony.Vegas.IDockView testI = null;
if (vegas.FindDockView("NewCap", out testI))
{
dck = (CaptureDockWnd)testI;
vegasCapPanel = (VegasCapturePanel)dck.Controls[0];
vegasCapPanel.SetProjectCaptureDir(@"c:\temp");

vegasCapPanel.StartCapture(null, null);

System.Threading.Thread.Sleep(5000);

// vegasCapPanel.StopCapture(null, StopCaptureFlags);


If anyone out there from Sony could hook me up with a wee bit of help, that'd be great. I understand this isn't supported, but now I'm sure it is possible.
JasonG wrote on 6/2/2009, 10:48 AM
Got it. Here's the info in the unlikely case anyone else ever needs to do this...

I'm defining some variables in my main control so I can access them later:
private VegasCapturePanel vegasCapPanel;
private CaptureDockWnd dck;

Then in my function to do the capturing:

Sony.Vegas.IDockView testI = null;
if (vegas.FindDockView("NewCap", out testI))
{
dck = (CaptureDockWnd)testI;
vegasCapPanel = (VegasCapturePanel)dck.Controls[0];
vegasCapPanel.Controller.StartCapture(@"C:\temp\test", "Test", "Tape1", "Comment", "E", null, null);
if (vegasCapPanel.Controller.IsCapturing)
{
System.Threading.Thread.Sleep(5000);
StopCaptureFlags testFlags = new StopCaptureFlags();
vegasCapPanel.Controller.StopCapture(testFlags);
vegasCapPanel.Controller.Load();
MessageBox.Show("captured");
}
else
{
MessageBox.Show("Error Starting Capture");
}

//}
}
else
{
MessageBox.Show("Please Open a Capture Window");
}
IMS wrote on 10/12/2009, 3:31 PM
Hi Jason,
I am not able to run your code.
I started my code with the following:

CaptureDockWnd dck=new CaptureDockWnd();

VP8 throws an exception at the line. Can you please post your entire code

Thanks
JasonG wrote on 10/15/2009, 9:36 AM
Maybe you need to add references to the dll files to your project. I referenced the following in my project:

C:\Program Files\Sony\Vegas Pro 9.0\Sony.Capture.dll
C:\Program Files\Sony\Vegas Pro 9.0\Sony.MediaSoftware.ExternalVideoDevice.dll


Does that help at all? I'm afraid I can't post my full code, because my full program is doing a lot more than just the capture part.
IMS wrote on 10/15/2009, 2:42 PM
I did reference the dll's but still the program throws an exception at
CaptureDockWnd dck = new CaptureDockWnd();

I tried it with Vegas Pro 8 and then Vegas Pro 9 (trial version). May be it works only with Vegas Pro 9 full version.