VANC output with 8 bit video format ?

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

Pavel Cerna

  • Posts: 3
  • Joined: Thu Nov 24, 2016 2:46 pm

VANC output with 8 bit video format ?

PostMon Mar 11, 2019 6:50 pm

Hello, I am working on adding subtitles into VANC for output via Decklink SDK.

The samples provided by BM show video format at 10 bit when working with VANC ( capture or output ).

According to the info at the link below, since SDK 10.11 it should be possible to emit the 10 bit VANC data independent of the video format.

I tried to modify the ClosedCaptions sample project. I converted it to 8 bit bmdFormat8bitYUV, which works fine, if I disable the call to AttachPacket.
Calling the AttachPacket make the subsequent call to ScheduleVideoFrame to fail with E_FAIL.

I guess my questions are:
- is it true that the latest SDKs since 10.11 allow usage of 8 bit video formats with VANC output ?
- if so, could BM, please, share with us a example of such an use ?

Many thanks, Paul Cerna.

https://github.com/CasparCG/server/issu ... -405271544
Offline

bobyorke

  • Posts: 2
  • Joined: Wed Mar 13, 2019 11:33 am
  • Real Name: Robert Yorke

Re: VANC output with 8 bit video format ?

PostWed Mar 13, 2019 11:47 am

Hi Paul,

Just filling in the blanks for anyone who may have joined this thread and not seen our message on the CasparCG GitHub discussion, it does look like my understanding of the docs may be wrong and that even with the newer SDK (10.11.x), you still need to have the same pixel format for active picture as for ancillary data (and that'll have to be 10-bit YUV).

I was reading up on this last July, and may have got the wrong end of the stick. Sadly, I can no longer even remember my sources to try and offload the blame elsewhere!

Some reading and re-reading might indicate that the 4k DeckLink cards are capable of this (handling distinct pixel formats for active picture and VANC), but it wasn't totally clear to me if this was for both capture/input and replay/output.

There is one thing that you should try though: I've just tested the IDeckLinkVideoConversion::ConvertFrame() method and this did work. I tried going from 8-bit BGRA to 10-bit YUV, and it was fine. I'd assume that 8-bit YUV -> 10-bit YUV is simpler still (from a CPU/processing point-of-view; code is probably not much harder either way).

What worked for me (SDK 10.4):-
You'll need to call
Code: Select all
CoCreateInstance(CLSID_CDeckLinkVideoConversion, NULL, CLSCTX_ALL, IID_IDeckLinkVideoConversion, (void**)&deckLinkVideoConverter);
when setting up
When creating video frames, create two (different params):-
Code: Select all
deckLinkOutput->CreateVideoFrame(kFrameWidth, kFrameHeight, itmRowBytes, itmPixelFormat, bmdFrameFlagDefault, &interimFrame);

Code: Select all
deckLinkOutput->CreateVideoFrame(kFrameWidth, kFrameHeight, kRowBytes, kPixelFormat, bmdFrameFlagDefault, &convertedFrame);

Fill your interim frame
Convert:
Code: Select all
deckLinkVideoConversion->ConvertFrame(interimFrame, convertedFrame);

You're done with the interim frame, so do release it!
Code: Select all
interimFrame->Release();


Appreciate this code is very shorthand, but hopefully you get the gist.

I don't know how much extra CPU this requires. Also, it might be worth checking that there aren't any colourspace-conversion issues.

Good luck!
Offline

Pavel Cerna

  • Posts: 3
  • Joined: Thu Nov 24, 2016 2:46 pm

Re: VANC output with 8 bit video format ?

PostWed Mar 13, 2019 7:31 pm

Robert - thanks for the source code.

Here I will admit my ignorance of the SDI format. I understand the YUV 8 bit output of Decklinc becomes 10 bit words in the SDI stream.
What will the SDI output be if I select the 10bit YUV pixel format ? 12 bits per pixel ? Or is the 10bit YUV pixel format of the Decklink SDK some transparent binary option, which will get to the SDI output unaltered ?

I guess my need is to preserve the existing SDI output format 8 bits of YUV in 10 bit words, while adding VANC data.

BMD Support - please, I am waiting and hoping for any ideas or suggestions of how to add VANC output to an video source in 8 bit BGRA pixel format, even if it involves going through additional pixel conversions.
The new VANC packet level API in SDK 10.11. looked promising, as it would allow to provide VANC packet body - which I believe is in 8 bit words, while allowing the driver to supply the 10 bit values needed for the ADF. That does not seem to work.
Is there no "transparent" pixel output option, which would allow to set the pixel format at 10 bits, supply properly formated YUV words, and be able to emit VANC ?
The SDK documentation says that 4K Decklink cards allow 10 VANC access independent of the video format on CAPTURE. The document does not state anything like this for output. Does this mean the 4K Decklink offering still needs 10 bit video pixel format in order to emit VANC ?
Any other ideas on this ?

Thanks, Paul.
Offline

bobyorke

  • Posts: 2
  • Joined: Wed Mar 13, 2019 11:33 am
  • Real Name: Robert Yorke

Re: VANC output with 8 bit video format ?

PostThu Mar 14, 2019 11:08 am

Hi Paul,

Just to fill you in on a bit of detail about the SDI specification, for HD video (technical spec if called BT Rec. 709) the YUV bit depth is always 10-bit. This is always the case, regardless of what you supply to the DeckLink API (even if you supply more bits, such as 12-bit YUV).

Other output formats (for example SD SDI, or 4K, or even 8K) will use other bit depths. To be honest, I spend most of my time with HD SDI, so my knowledge of the other specs is patchy at best. I *think* it's 8-bit YUV for SD SDI (BT Rec. 601), and 12-bit YUV may be used for 4K/8K (possibly...not sure). But for your application, it'll be 10-bit YUV.

I know you're waiting for BMD support to offer their solution, but the ConvertFrame method may work for you. Populate/fill the video with whatever format you want to work with; convert to 10-bit YUV using the BMD API; then attach your VANC.

I'm also re-wondering whether this does mean more CPU cycles are used if you convert in software. Presumably even if you were working with 8-bit, conversion has to happen at some point--just a question of whether that ordinarily happens in software, or on the DeckLink hardware.

Hope this makes sense. Please shout if it doesn't and I'll try to explain it better! :-)
Offline

uli peters

  • Posts: 104
  • Joined: Mon Aug 27, 2012 12:44 pm

Re: VANC output with 8 bit video format ?

PostSat Mar 16, 2019 3:18 pm

Regular "broadcast" SDI is 10 bit on wire most of the time (SD, HD, UHD) - but never less. There are some special (4:4:4) formats for post production, cinema etc. which do support higher bit depths.

"8 bit" on SDI means that the two least significat bits of the a 10 bit word are not used / ignored.

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 3 guests