Getting Video Output in C# Through SDK - Trying IDeckLinkDX9

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message


  • Posts: 4
  • Joined: Fri Aug 26, 2016 8:08 pm

Getting Video Output in C# Through SDK - Trying IDeckLinkDX9

PostFri Sep 02, 2016 3:37 pm


I'm still trying to get a preview video stream in C#, but am in the same place with the DirectX PreviewHelper (IDeckLinkDX9ScreenPreviewHelper) as I am with the GL Helper (viewtopic.php?f=12&t=51423&sid=a7550db6d8f9f8ae3712923afa9f67bb#p297128).

I've got a DX9 sample together (using SharpDX), but it just shows a black window. The sample for that is below.

Interestingly, however, if I draw a white triangle on the dx scene, then it will show both the target rect and the triangle with a color that's currently in the feed (image attached) which will change as the source changes, though is still only a single color from the feed. Can attach code for that too, in case it's helpful.

Would be very appreciative of any pointers on this path or to see any functional video output from the card through C# (the DirectShow example crashes the system it's run on, so that path unfortunately isn't open). If it just won't work in C# though, knowing that would help me too.


Code: Select all
class simpleBMDXTest : IDeckLinkInputCallback, IDeckLinkScreenPreviewCallback
        private IDeckLink m_deckLink;
        private IDeckLinkInput m_deckLinkInput;
        private Device device;
        private RenderForm form;
        private Direct3D direct3D;
        public static IDeckLinkDX9ScreenPreviewHelper m_DeckLinkDX9ScreenPreviewHelper;

        private int frameCount = 0;
        private bool dxInitialized;

        public unsafe simpleBMDXTest()

            PresentParameters pp = new PresentParameters()
                BackBufferFormat = Format.Unknown,
                BackBufferCount = 2,
                Windowed = true,
                SwapEffect = SwapEffect.Discard,
                PresentationInterval = PresentInterval.Default

            m_DeckLinkDX9ScreenPreviewHelper = new CDeckLinkDX9ScreenPreviewHelper();

            direct3D = new Direct3D();
            form = new RenderForm("BlackMagic DX9 Render Test Form");
            form.Size = new Size(650, 650);

            device = new Device(direct3D, 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing | CreateFlags.Multithreaded, pp);
            device.Viewport = new RawViewport() { Height = 650, Width = 650, X = 0, Y = 0 };

            var ptr = device.NativePointer;

            var tagRect = new tagRECT()
                top = 10,
                left = 10,
                right = 400,
                bottom = 400

            RenderLoop.Run(form, () =>




        private void InitializeBlackMagicDevice()
            IDeckLink m_deckLink;
            IDeckLinkIterator deckLinkIterator = new CDeckLinkIterator();
            deckLinkIterator.Next(out m_deckLink);

            m_deckLinkInput = (IDeckLinkInput)m_deckLink;

            m_deckLinkInput.EnableVideoInput(_BMDDisplayMode.bmdModeHD720p5994, _BMDPixelFormat.bmdFormat8BitYUV, _BMDVideoInputFlags.bmdVideoInputFlagDefault);

        void IDeckLinkScreenPreviewCallback.DrawFrame(IDeckLinkVideoFrame theFrame)


        void IDeckLinkInputCallback.VideoInputFrameArrived(IDeckLinkVideoInputFrame video, IDeckLinkAudioInputPacket audio)

        void IDeckLinkInputCallback.VideoInputFormatChanged(_BMDVideoInputFormatChangedEvents e, IDeckLinkDisplayMode m, _BMDDetectedVideoInputFormatFlags f)

blackmagic-directx.png (5.08 KiB) Viewed 561 times
Andrew Singer

Carlos Filipe

  • Posts: 5
  • Joined: Sun Mar 27, 2016 1:46 pm

Re: Getting Video Output in C# Through SDK - Trying IDeckLin

PostTue Sep 06, 2016 4:31 pm

Hi Andrew,
I'm using VS 2010 and I choose aForge 2.2.5 library, it's working fine...
Well, using VB.Net but is the same thing as C#
However, only a few HDMI input formats are working, like:
- 576i25 (720x576 - PAL i)
- 576p50 (720x576 - PAL)
- 720p50 (1280x720)
- 1080i25 (1920x1080 i)

I made a broadcasting software with scrolling messages and banners
If you need it I can send it to you, it's an evaluation version but you can see the picture, only a message on the screen comes with this version.


  • Posts: 4
  • Joined: Thu Feb 16, 2017 4:22 pm

Re: Getting Video Output in C# Through SDK - Trying IDeckLin

PostMon Feb 20, 2017 3:35 pm

Do you have sample solution?

Philippe Beau

  • Posts: 2
  • Joined: Tue Mar 14, 2017 7:25 am

Re: Getting Video Output in C# Through SDK - Trying IDeckLin

PostWed Mar 15, 2017 6:29 pm

Dear All,

Do you arrive to have working with aForge 2.2.5 ? VideoCapture is not working with VS 2015/2017 and aForge 2.2.5. But working with aForge 2.2.4 :(

Any idea ?



Return to Software Developers

Who is online

Users browsing this forum: No registered users and 4 guests