From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

DirectShow .NET LabVIEW SDK (Video, Audio, IP streams)

Code and Documents

Attachment

Inspired from LabVIEW portal - reference link

 

Library and examples provided as is, minor bugs (aka. features) included but still can be useful for someone who needs to acquire, compress and edit video/audio streams from various sources, directshow compatible devices and internet streams.

Works with GigE cameras if manufacturer provides directshow compatible filter. (Tested with Basler family).

DirectShow has a steep learning curve but once you get familiar with GraphEdit then samples from internet and examples from below should be sufficient to create sophisticated applications.

 

To back check your LabVIEW creating add

DsROTEntry.png

Wire it to your FilterGraph and open in GraphEdit program for inspection and debugging.

 

Requires:

Microsoft Windows SDK - download

Directshow.net library - download

DirectX.Capture class library - download

References:

MSDN DirectShow documetation

DirectShow Debugging/ConceptProofing Tools:

GraphEdit (Microsoft Windows SDK)

 

Alphabetical and Numerically Logical String Array Sort for user menu facelift

 

BEFORE Opening any vi make sure you have in the same directory:

DirectShowLib-2005.dll

DShowNET.dll

DirectX.Capture.dll

logicalstringarraysort.llb

 

Great links:

 

H.264 CUDA Encoder directshow filter -> Examples Added 02/16/2013

Directshow virtual video capture source - aka printscreen

Other articles from Maxim Kartavenkov

 

02/16/2013 Update

 

H264Encoder requires:

  • BaseClassesNET.dll
  • H264Encoder.dll

 

I went with wrapper mode implementation. Check Maxim Kartavenkov forum for details.

H264 CUDA Encoder directshow filter example can be done entirely in BaseClassesNET.dll. Which might be done one day...

No error checking on CUDA capabilities.

Use with Nvidia GPU's only

H264.png

Examples:

  • Capture Video and H264 CUDA.vi
  • Render Media Stream.vi

 

Updates to Library:

  • Add H264 CUDA Filter.vi
  • Create AviMux.vi - overrite file option added
  • Enum Pin Media Type.vi
  • Enum PinMediaTypes.vi
  • Enum Pins.vi
  • Free PinInfo.vi
  • H264 CUDA Get Filter Options.vi
  • H264 CUDA Set Filter Options.vi
  • H264 Object Wrapper.vi
  • H264 Settings.ctl
  • Media Mode.ctl
  • Media State.ctl
  • MediaFormatType to String.vi
  • MediaSubType to String.vi
  • MediaType to String.vi
  • AMMediaType to String.vi
  • Picture Snap (32-bit RGB Image).vi - updated auto init
  • Picture Snap (DIB Image).vi - updated auto init
  • Set Sample Grabber.vi
  • WaveFormatEx.ctl
  • Capture.vi - updated to reflect above changes
  • Minor tweaks

 

02/07/2013 Update

 

 

Examples:

 

  • Acquire Video.vi
  • Acquire Audio.vi
  • Acquire Video plus Sample Grabber.vi
  • Capture Video.vi
  • Capture Video with Preview.vi
  • Capture Video with Preview and Sample Grabber.vi

Acquire Video.png

Acquire Audio.png

Acquire Video plus Sample Grabber.png

Capture Video.png

Capture Video with Preview.png

Capture Video with Preview and Sample Grabber.png

 

 

Updates to Library:

  • Release Object.vi
  • Init Capture Preview.vi
  • Configure Capture plus Preview.vi
  • Configure Video with Sample Grabber.vi
  • Media Control - StartStopPause.vi

 

 

 

Updates to Capture.vi

  • Preview in Capture Mode
  • Proper Objects release upon start/stop/exit

DS Capture.png

Update 10/08/2014:

DShow - JPEG dump example.

 

-Artur

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
viScience
Active Participant
Active Participant
on

Greetings to all - I have successfully run several of the examples provided and can now capture video from my Blackmagic Ultrastudio SDI, very nice!

My goal is to be able to stream AVI files created in LV to the SDI output of the Ultrastudio.  I noticed an example called Render Media Stream and was wondering if it could be modified to stream an AVI.  I will continue to study the libraries and Direct Show documentation but if anyone has a few pointers I would be greatly appreciative.  Thanks.

null_and_void
Member
Member
on

Hi,

I am trying to run the DirectShow - Example - Acquire Video.vi in Windows 10 environment. I installed everything and copied DLLs into the same folder as the LLB as directed. I would like to capture the HDMI input from the AVerMedia PCIe adapter and display it in a Labview panel. I had a success running the same example in the same Labview 2016 64-bit version on a Windows 7 computer but on Windows 10 the picture box remains black while VI is running without errors. Interestingly, if I run the Acquire Video plus Sample Grabber.vi the Sample Grabber control displays the video while Picture Box control remains black. Did anybody on this forum have a similar problem under Windows 10? I also get a warning message on both Win7 and Win10 machines stating that expected assembly "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKey Token=[token number]", but found "System.Windows.Forms, Version=4.0.0.0, Culture etc."

...

Expected assembly "System.Windows.Forms, Version=2.0.0.0 etc." but found "System.Windows.Forms, Version=4.0.0.0 etc."

 

These warnings go not seem to impede the example from functioning correctly in Win7 though.

bim4
Member
Member
on

Hi,

You can  try to add a labview.exe.config file in the same folder than labview.exe.

This file contains on my side :

 

<?xml version ="1.0"?>
<configuration>
   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0.30319"/>
   </startup>
</configuration>

 

Hope it helps,

 

Bim

null_and_void
Member
Member
on

Thanks for responding, Bim. That did not work for me.

viScience
Active Participant
Active Participant
on

 

 

I have setup an AVI streaming graph and it works perfectly in graphedit.  In my LV code, I am getting a 1172 error (class not registered) from a AVIReader .net constructor   I have Visual Studio 2015 and the Windows 7 SDK installed.  All of the recommended dll's are present, is there anything else I need to do?

 

avireader.png

 

 

bseguin
Active Participant
Active Participant
on

Is anybody found a way to get the manufacturer serial number of the camera with those .dll?

Thanks

 

Benoit

viScience
Active Participant
Active Participant
on

I am trying to get the Render Media Stream example working and am receiving a error 1172 in the Enum Pins vi

All of the incoming refnums look valid but the IEnumPins method (in red) produces an error.  Any ideas?

 

Untitled.png

telles_s
NI Employee (retired)
on

 Great job GriffinRU.

I have got a Blackmagic Intensity Pro 4k, then I created the post: Acquire Blackmagic Intensity Pro 4K Images (HDMI and Analog Video Inputs), due some questions about that in the forum.

GKxn
Member
Member
on

Hello,

 

I use this library since a few years. It is a great library. Builds of my softwares are ok on Windows 10 Version 1607. But, since last Windows 10 updates, I encounter problems with builds. In Labview developpement 2017, it seems ok. But after in build, it does not function anymore. PictureBox remains grey. I'm quite sure it is something with Windows 10 creators update.

 

Do you guys have a solution bout this issue?

 

 

jprestrepou94
Member
Member
on

Hi.

I want to capture images using Labview, the drawback that I have is that the image is delivered to me by a videofluoroscope (Biomedical equipment), through a DVI output, I want to take the image to a laptop and Labview, which is not possible without using a video capture, someone recommended me to use this already developed program together with this captured (https://www.amazon.com/StarTech-com-DVI-Video-Capture-Card/dp/B01IEW58NO). I would like to know if someone has done something similar and it has worked for them, or if as such it is possible to do it.

Thank you

Contributors