- Posts: 3
- Joined: Thu Oct 27, 2016 10:32 am
I am outputting 1080i50 UYVY video through a DeckLink Quad 2 and cannot get the correct transmission rate.
The frames look OK individually, just jerky due to slow output. Using what I think are the correct parameters I am logging 80ms between calls to the output callback. I am expecting one interlaced frame per 40 milliseconds (i.e. 1/25 second).
This is true in a big production project from which I distilled a simple test harness to show the key points. This behaves the same way. These are the key steps of my code - error checking and intermediate fluff removed.
Iterate over the DeckLink devices to get the one I want, then...
Then I loop / sleep while the callback object re-transmits this same frame over and over:
Anyone know what's wrong?
The frames look OK individually, just jerky due to slow output. Using what I think are the correct parameters I am logging 80ms between calls to the output callback. I am expecting one interlaced frame per 40 milliseconds (i.e. 1/25 second).
This is true in a big production project from which I distilled a simple test harness to show the key points. This behaves the same way. These are the key steps of my code - error checking and intermediate fluff removed.
Iterate over the DeckLink devices to get the one I want, then...
- Code: Select all
deckLinkOutput->EnableVideoOutput(bmdModeHD1080i50, BMDVideoOutputFlags::bmdVideoOutputFlagDefault);
- Code: Select all
deckLinkOutput->DoesSupportVideoMode(bmdModeHD1080i50, bmdFormat8BitYUV, BMDVideoOutputFlags::bmdVideoOutputFlagDefault, &supported, &gDisplayMode);
- Code: Select all
gDisplayMode->GetFrameRate(&gFrameDuration, &gTimeScale);
- Code: Select all
frameDispatchCompleteCallback = new DeckLinkFrameDispatchCompleteCallback(deckLinkOutput, gFrameDuration, gTimeScale);
- Code: Select all
deckLinkOutput->SetScheduledFrameCompletionCallback(frameDispatchCompleteCallback);
- Code: Select all
deckLinkOutput->CreateVideoFrame(1920, 1080, 1920 * 2, bmdFormat8BitYUV, bmdFrameFlagDefault, &frame);
- Code: Select all
frame->GetBytes(&pBuffer);
- Code: Select all
memset(pBuffer, rand(), 1920 * 1080 * 2);
- Code: Select all
deckLinkOutput->ScheduleVideoFrame(frame, 0, gFrameDuration, gTimeScale);
- Code: Select all
deckLinkOutput->StartScheduledPlayback(0, gTimeScale, 1.0);
Then I loop / sleep while the callback object re-transmits this same frame over and over:
- Code: Select all
HRESULT DeckLinkFrameDispatchCompleteCallback::ScheduledFrameCompleted(
IDeckLinkVideoFrame* completedFrame,
BMDOutputFrameCompletionResult result
)
{
if (! stopRequest) // A flag variable set when the main loop detects a keypress to halt the program
{
ScheduleNextFrame(completedFrame);
SYSTEMTIME st;
GetSystemTime(&st);
cout << st.wMilliseconds << endl; // 80ms between calls
}
return S_OK;
}
- Code: Select all
HRESULT DeckLinkFrameDispatchCompleteCallback::ScheduleNextFrame(IDeckLinkVideoFrame* videoFrame)
{
this->frameCount++; // Init to 0 in constructor
BMDTimeValue tv = frameCount * this->gFrameDuration;
HRESULT hr = m_pDeckLinkOutput->ScheduleVideoFrame(videoFrame, tv, this->gFrameDuration, this->gTimeScale);
// duration & timescale passed into constructor from set-up code.
// Came from GetFrameRate and are 1000 & 25000
return hr;
}
Anyone know what's wrong?