Related products: Video Capture SDK .Net

How to start capture without stopping preview (separate capture) in console application in Video Capture SDK .Net

Sample code, that demonstrate usage:

private static void TestVideoCapture()
{
  string outputFolder = @"c:local	empoutput";

  VideoCapture capture = new VideoCapture();

  capture.Video_CaptureDevice = capture.Video_CaptureDevices[0];
  capture.Video_CaptureFormat_UseBest = true;

  capture.Audio_CaptureDevice = capture.Audio_CaptureDevices[0];
  capture.Audio_CaptureFormat_UseBest = true;

  capture.Video_Renderer = VFVideoRenderer.None; // No video renderer

  capture.Mode = VFVideoCaptureMode.VideoCapture;

  capture.Output_Format = new VFMP4v8v10Output();

  capture.SeparateCapture_AutostartCapture = false;
  capture.SeparateCapture_Mode = VFSeparateCaptureMode.Normal;
  capture.SeparateCapture_Enabled = true;

  string fileName = Path.Combine(outputFolder, GetOutputFileName(DateTime.Now));

  capture.Output_Filename = fileName;

  capture.Start();

  Console.WriteLine("Started capture.");

  if (capture.SeparateCapture_Start()) 
  {
    Console.WriteLine("Start capture to: {0}", fileName);

    while (true)
    {
      for (int i = 0; i < 50; ++i) 
      {
        Application.DoEvents();

        Thread.Sleep(100);
      }

      fileName = Path.Combine(outputFolder, GetOutputFileName(DateTime.Now));

      if (capture.SeparateCapture_ChangeFilenameOnTheFly(fileName)) 
      {
        Console.WriteLine("Changed output file to: {0}", fileName);
      } 
      else 
      {
        Console.WriteLine("Failed changing output file.");
      }
    }
  }
}

private static string GetOutputFileName(DateTime now)
{
  return string.Format("{0}.mp4", now.ToString("yyyy-MM-dd_HHmmss"));
}

VisioForge © 2006-2020

  • GitHub-Mark-64px
  • Twitter Социальные Иконка
  • VisioForge Facebook page
  • YouTube channel