Using FFMpeg decklink output from C++

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


  • Posts: 1
  • Joined: Wed Feb 10, 2021 9:16 am
  • Real Name: Radosław Sterna

Using FFMpeg decklink output from C++

PostWed Feb 10, 2021 9:58 am


I know that my question is more ffmpeg related that decklink related, but maybe someone here will know the answer.

I'm trying to add support for decklink devices in an video streaming app that my company is developing. We're using C++ and FFMpeg as a processing library. Other types of inputs and outputs are working. Adding support for decklink inputs was really easy, it just worked (at least with the device we tested it on - DeckLink SDI Quad). But for outputs... I'm fighting this for 3 days as of now with no results. I cannot find any docs for this, neither I can find any code example, how should I initialize AVFormatContext and other parts that are needed.

By reading FFMpeg's decklink avdevice code, I managed to get to the point that AVFormatContext doesn't complain about incorrect data format anymore. I'm using wrapped_avframe and pcm_s16le as a codecs, I'm setting (converting) video and audio params to values accepted by device, I'm sending AVPackets with av_interleaved_write_frame, and it doesn't work. Couple of packets are being accepted, couple of threads are spawned, and it just locks - my output thread locks on some 80-ish call to av_interleaved_write_frame. And it is a deadlock, it never goes any further. Debugger shows only that it is waiting for something:
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fe34c0402c8) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7fe34c040178, cond=0x7fe34c0402a0) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7fe34c0402a0, mutex=0x7fe34c040178) at pthread_cond_wait.c:638
#3 0x00007fe35c69bd04 in ?? () from /lib/
#4 0x00007fe371394ac7 in ?? () from /lib/
#5 0x00007fe370f249ad in ?? () from /lib/
#6 0x00007fe370f26615 in av_interleaved_write_frame () from /lib/

I'm obviously doing something wrong, but I can't find what...
Can anyone point me to some documentation or (working) code example how it should be done?

Thanks in advance :)

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 2 guests