Input Capture Looped back to Output Port in Same Card

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

Anand Joshi

  • Posts: 5
  • Joined: Thu Oct 20, 2016 10:20 pm

Input Capture Looped back to Output Port in Same Card

PostTue Mar 27, 2018 8:52 pm

Hello I have a Blackmagic Decklink 4k Extreme 12G Card. I am using Ubuntu 16.0.4 and the latest DesktopVideo and SDK (10.9.11). My requirement is following:
Capture the Input from One of the Input SDI port and send a frame out from one of the Output Ports in the same Card at the same rate as input. I looked at the Example code LoopThroughWithOpenGLCompositing, but it requires two Cards to be present in the system. Is there an example code which provides this functionality?

Basically I am trying to embed the code in TestPattern.cpp inside Capture.cpp. But it only works for first 64 frames and then ScheduleFrame fails.

I made changes in Capture.cpp at two places.

in main routine added

// Get the output (display) interface of the DeckLink device
if (delegate->m_deckLink->QueryInterface(IID_IDeckLinkOutput, (void**)&delegate->m_deckLinkOutput) != S_OK)
goto bail;

// Get the display mode
idx = 0;

result = delegate->m_deckLinkOutput->GetDisplayModeIterator(&displayModeIterator);
if (result != S_OK)
goto bail;

while ((result = displayModeIterator->Next(&delegate->m_displayMode)) == S_OK)
if (idx == 0)



delegate->m_displayMode->GetFrameRate(&delegate->m_frameDuration, &delegate->m_frameTimescale);

// Calculate the number of frames per second, rounded up to the nearest integer. For example, for NTSC (29.97 FPS), framesPerSecond == 30.
delegate->m_framesPerSecond = (unsigned long)((delegate->m_frameTimescale + (delegate->m_frameDuration-1)) / delegate->m_frameDuration);

// Set the video output mode
result = delegate->m_deckLinkOutput->EnableVideoOutput(delegate->m_displayMode->GetDisplayMode(), bmdVideoOutputFlagDefault);
if (result != S_OK)
fprintf(stderr, "Failed to enable video output. Is another application using the card?\n");
goto bail;
// Generate a frame of colour bars

result = delegate->m_deckLinkOutput->CreateVideoFrame(delegate->m_frameWidth, delegate->m_frameHeight, delegate->m_frameWidth * 2, bmdFormat8Bit\
YUV, bmdFrameFlagDefault,&delegate->m_videoFrameBars);
// Start capturing

Then in VideoInptFrameArrived
// Schedue frames of color bars
if (m_deckLinkOutput->ScheduleVideoFrame(m_videoFrameBars, (g_frameCount * m_frameDuration), m_frameDuration, m_frameTimescale) != S_OK)
printf("ScheduleVideoFrame Failed!!\n");

if (rightEyeFrame)


Am I missing something here?

Thanks in Advance

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 5 guests