questions about processing 525i59.94 NTSC scheduled output

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

Andres Gonzalez

  • Posts: 23
  • Joined: Tue Apr 21, 2015 2:05 am

questions about processing 525i59.94 NTSC scheduled output

PostMon Sep 07, 2020 7:34 pm

Hi,

I am using a Studio 4K card and playing with the analog composite output and I am confused about what is the proper way to implement field-base scheduled output.

I configure the analog output connector for the DisplayMode of 525i59.94. My code appears to be working fine, I can see the video output of the YUV file I am using.

However, using scheduled output mode for interlaced video, I would expect the callback to be called at the field rate of around every 16.7 milliseconds. The StartScheculedPlayback() routine takes the timescale argument so I would expect that would configure the driver for how often my FrameCompletionCallback is called. But the timescale doesn't appear to effect the rate at which my the completion callback is called. I have tried both 30000 and 60000 for the timescale and my FrameCompletionCallback is ALWAYS being called every 66.7 milliseconds regardless. That is 15fps which seems very odd to me. I have ensured that my callback is processing each frame fast enough because I have measured it and each callback is taking less than 2 milliseconds to complete.

Question 1: Why is the FrameCompletionCallback not being called every 16.7 milliseconds for field-based 525i59.94 NTSC? Either 16.7 or 33.4 milliseconds seems reasonable to be, assuming I should schedule each field in a single callback or 2 fields in a single callback. But 66.7 milliseconds seems wrong to me.

Question 2: What is the proper/recommend way to process fields in the FrameCompletionCallback for interlaced output modes? Should I schedule/queue 2 fields in 2 separate IDeckLinkMutableVideoFrame objects in each single callback, for both the even and odd fields, or should I only schedule a single field in each callback? If I schedule 2 per callback, I would expect the callback to be called at the frame rate and not the field rate.

Thanks for any clarification you might provide.

-Andres
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 294
  • Joined: Mon Sep 04, 2017 4:05 am

Re: questions about processing 525i59.94 NTSC scheduled outp

PostMon Sep 07, 2020 11:07 pm

Hi Andres,

The expected callback rate for NTSC is 29.97 callbacks per second - you will get a IDeckLinkVideoOutputCallback::ScheduledFrameCompleted callback for every full frame (fields 1 + 2) output.

Similarly you will scheduled full frame (with fields 1/2 interlaced) with IDeckLinkOutput::ScheduleVideoFrame, typically with timescale of 30000 and frame duration of 1001.

I suspect you are seeing a callback rate fo 15fps (half the expected rate) as you are not prerolling sufficient frames before you call IDeckLinkOutput::StartScheduledPlayback. Typically you should preroll at least 2 frames. In any frame period, 1 frame is output on the wire, while the next frame is in flight to DeckLink via PCIe. If your preroll is too small, the issue could be that you don't have a scheduled frame in system memory available when requested by the DeckLink card, and you will be scheduling half as many frames.

You should also check that your implementation of IDeckLinkVideoOutputCallback::ScheduledFrameCompleted is not taking longer than 1 frame period and delaying further callbacks.

Regards
Cameron
Offline

Andres Gonzalez

  • Posts: 23
  • Joined: Tue Apr 21, 2015 2:05 am

Re: questions about processing 525i59.94 NTSC scheduled outp

PostMon Sep 07, 2020 11:15 pm

HI,

Here is some additional information I found interesting.

As I mentioned, using a time scale of either 60000 or 30000 does not change the how often the FrameCompletionCallback routine is called, it is always every 66.7 milliseconds using either time scale value. So the timescale argument in the StartScheduledPlayback() or ScheduleVideoFrame() does not set the rate at which the FrameCompletionCallback is called by the driver.

But every callback shows that the BMDOutputFrameComlpetionResult flag is set to bmdOutputFrameDisplayedLate. This makes sense because the driver is receiving all of the frames slower than it should, so the frames are being displayed late. But the driver is determining how fast it gets the frame by how fast it is invoking the my completion callback routine.

So I set the timescale to 15000 (even thought my DisplayMode is set to 525i59.94 NTSC) when I call both the ScheduleVideoFrame() and StartScheduledPlayback() routines. That indeed stopped ALL of the bmdOutputFrameDisplayedLate status for all frames--all frames are completed on time successfully--the video looks good.

So there is something in my configuration that is setting the completion callback rate the driver is using to call my completion callback routine to half of what it should be. But I cannot find anything in the API that might be applicable to this situation.

BTW, I am using a recent Studio 4K card that I purchased just a few months ago and the DeckLink API driver version 11.5.

-Andres
Offline

Andres Gonzalez

  • Posts: 23
  • Joined: Tue Apr 21, 2015 2:05 am

Re: questions about processing 525i59.94 NTSC scheduled outp

PostTue Sep 08, 2020 12:06 am

Cameron,

That did it, you were correct. When I pre-rolled 3 initial frames the callback rate is correct.

Again, thank you for your support.

-Andres

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests