FFmpeg DeckLink output not working

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

tautin

  • Posts: 125
  • Joined: Thu Oct 18, 2018 3:11 pm
  • Real Name: Tim Autin

FFmpeg DeckLink output not working

PostTue Dec 17, 2024 2:15 pm

Hello,

I need to playback files to a DeckLink card using FFmpeg on Ubuntu 22.04 and 24.04. For testing I'm using this file: https://download.blender.org/peach/bigb ... p_h264.mov

The file plays nicely using ffplay:
Code: Select all
ffplay -i $FILE

I can also play it on my DeckLink card using Gstreamer:
Code: Select all
gst-launch-1.0 \
  filesrc location="$FILE" ! tee ! queue ! \
  decodebin ! queue ! \
  videoscale ! videoconvert ! videorate ! \
  decklinkvideosink mode=1080p24 device-number=2

However when using FFmpeg:
Code: Select all
ffmpeg \
    -re -i "$FILE" \
    -filter:v scale=1920:1080 -filter:v fps=24 \
    -an \
    -f decklink -format_code Hp24 -pix_fmt uyvy422 'DeckLink Quad (3)'

Then playback works during ~1.5s but fps drops and it quickly freezes. CPU load is low.
Code: Select all
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --extra-cflags='-I/home/user/softwares/ffmpeg/ffmpeg-7.1/ffmpeg-7.1/include -I/usr/local/cuda/include -I/home/user/sdks/blackmagic/Blackmagic-DeckLink-SDK-14.2/Linux/include/' --extra-ldflags='-L/home/user/softwares/ffmpeg/ffmpeg-7.1/ffmpeg-7.1/lib -L/usr/local/cuda/lib64 -L/home/user/sdks/blackmagic/Blackmagic-DeckLink-SDK-14.2/Linux/include/' --prefix=/opt/ffmpeg/ffmpeg-7.1 --bindir=/opt/ffmpeg/ffmpeg-7.1/bin --pkg-config-flags=--static --extra-libs='-lpthread -lm' --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx265 --enable-nonfree --enable-nonfree --enable-decklink --enable-ffplay
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.100 / 61. 19.100
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'videos/big_buck_bunny_1080p_h264.mov':
  Metadata:
    major_brand     : qt 
    minor_version   : 537199360
    compatible_brands: qt 
    creation_time   : 2008-05-27T18:40:35.000000Z
    com.apple.quicktime.player.movie.audio.gain: 1.000000
    com.apple.quicktime.player.movie.audio.treble: 0.000000
    com.apple.quicktime.player.movie.audio.bass: 0.000000
    com.apple.quicktime.player.movie.audio.balance: 0.000000
    com.apple.quicktime.player.movie.audio.pitchshift: 0.000000
    com.apple.quicktime.player.movie.audio.mute:
    com.apple.quicktime.player.movie.visual.brightness: 0.000000
    com.apple.quicktime.player.movie.visual.color: 1.000000
    com.apple.quicktime.player.movie.visual.tint: 0.000000
    com.apple.quicktime.player.movie.visual.contrast: 1.000000
    com.apple.quicktime.player.version: 7.4.1 (14)
    com.apple.quicktime.version: 7.4.1 (14) 0x7418000 (Mac OS X, 10.5.2, 9C31)
    timecode        : 00:00:00:00
  Duration: 00:09:56.46, start: 0.000000, bitrate: 9725 kb/s
  Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 9282 kb/s, 24 fps, 24 tbr, 2400 tbn (default)
      Metadata:
        creation_time   : 2008-05-27T18:40:35.000000Z
        handler_name    : Apple Video Media Handler
        vendor_id       : appl
        encoder         : H.264
      Side data:
        displaymatrix: rotation of -0.00 degrees
  Stream #0:1[0x2](eng): Data: none (tmcd / 0x64636D74) (default)
      Metadata:
        creation_time   : 2008-05-27T18:40:35.000000Z
        handler_name    : Time Code Media Handler
        timecode        : 00:00:00:00
  Stream #0:2[0x3](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 437 kb/s (default)
      Metadata:
        creation_time   : 2008-05-27T18:40:35.000000Z
        handler_name    : Apple Sound Media Handler
        vendor_id       : [0][0][0][0]
[vost#0:0/wrapped_avframe @ 0x651ff00f3bc0] Multiple -filter/-af/-vf options specified for stream 0, only the last option '-filter:v fps=24' will be used.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[decklink @ 0x651feffc5cc0] Found Decklink mode 1920 x 1080 with rate 24.00
Output #0, decklink, to 'DeckLink Quad (3)':
  Metadata:
    major_brand     : qt 
    minor_version   : 537199360
    compatible_brands: qt 
    timecode        : 00:00:00:00
    com.apple.quicktime.player.movie.audio.gain: 1.000000
    com.apple.quicktime.player.movie.audio.treble: 0.000000
    com.apple.quicktime.player.movie.audio.bass: 0.000000
    com.apple.quicktime.player.movie.audio.balance: 0.000000
    com.apple.quicktime.player.movie.audio.pitchshift: 0.000000
    com.apple.quicktime.player.movie.audio.mute:
    com.apple.quicktime.player.movie.visual.brightness: 0.000000
    com.apple.quicktime.player.movie.visual.color: 1.000000
    com.apple.quicktime.player.movie.visual.tint: 0.000000
    com.apple.quicktime.player.movie.visual.contrast: 1.000000
    com.apple.quicktime.player.version: 7.4.1 (14)
    com.apple.quicktime.version: 7.4.1 (14) 0x7418000 (Mac OS X, 10.5.2, 9C31)
    encoder         : Lavf61.7.100
  Stream #0:0(eng): Video: wrapped_avframe, uyvy422(tv, bt709, progressive), 1920x1080, q=2-31, 200 kb/s, 24 fps, 24 tbn (default)
      Metadata:
        creation_time   : 2008-05-27T18:40:35.000000Z
        handler_name    : Apple Video Media Handler
        vendor_id       : appl
        encoder         : Lavc61.19.100 wrapped_avframe
frame=   25 fps=0.3 q=-0.0 size=N/A time=00:00:01.37 bitrate=N/A speed=0.0146x

I got the same behavior when using:
  • another card (a DeckLink 8K Pro)
  • an older FFmpeg version (4.4.3)
  • an older DeckLink SDK version (12.7)
  • other files
  • an RTSP stream
  • a webcam
Is it working for anyone on Ubuntu?
Last edited by tautin on Tue Dec 17, 2024 4:37 pm, edited 3 times in total.
Offline

Julusian

  • Posts: 59
  • Joined: Mon Aug 03, 2020 9:36 pm
  • Real Name: Julian Waller

Re: FFmpeg DeckLink output not working

PostTue Dec 17, 2024 3:15 pm

What version of the decklink driver do you have installed?

As you can see in viewtopic.php?f=12&t=213331, the driver breaks backwards compatibility in 14.3, even when compiling against older versions of the SDK
Offline

tautin

  • Posts: 125
  • Joined: Thu Oct 18, 2018 3:11 pm
  • Real Name: Tim Autin

Re: FFmpeg DeckLink output not working

PostTue Dec 17, 2024 3:18 pm

I've tried 12.4.2, 12.7, 14.2 & 14.3. Got the same behavior with the 3 first ones, and FFmpeg is not yet compatible with the later and does not compile.
Offline

pabloko

  • Posts: 3
  • Joined: Sun Apr 20, 2014 2:49 pm

Re: FFmpeg DeckLink output not working

PostWed Dec 25, 2024 3:41 am

FFmpeg + DeckLink status:
  1. Output under Driver >13.3 = broken. Cause: IDeckLinkVideoFrame::QueryInterface unhandled. IDeckLinkOutputVideoCallback driver code access it.
  2. Input under Driver > 13.3 = NC (I dont own a card with input support)
  3. Compiling under SDK > 13.3 = broken. Causes: Changes on the api, notably IDeckLinkMemoryAllocator has been reworked and also IDeckLinkVideoFrame

Mitigation:
  1. Downgrade interfaces to SDK compatible legacy version using _v14_2_1 suffix
  2. Implement QueryInterface on implemented classes

Patch: https://patch-diff.githubusercontent.co ... ll/1.patch
https://github.com/pabloko/FFmpeg/pull/1/files
Offline

tautin

  • Posts: 125
  • Joined: Thu Oct 18, 2018 3:11 pm
  • Real Name: Tim Autin

Re: FFmpeg DeckLink output not working

PostMon Dec 30, 2024 2:30 pm

Hi Paloko,
Thank you very much, I'll give it a try in a couple of weeks.

Happy New Year to all :)
Offline

PauluzzNL

  • Posts: 1
  • Joined: Fri Feb 14, 2025 4:21 pm
  • Real Name: Paul van Staalduinen

Re: FFmpeg DeckLink output not working

PostFri Feb 14, 2025 4:28 pm

I found this thread after extensively Googling and pulling my hairs out. I had similar issues:

Code: Select all
C:\Apps\ffmpeg>ffmpeg -re -i rtmp://127.0.0.1/feed-main-realtime/live -f decklink -pix_fmt uyvy422 -s 1920x1080 -r 60000/1000 -c:a pcm_s16le -ar 48000 -ac 2 -format_code Hp60 -c:v v210 "DeckLink Duo (2)"

Giving me:
Code: Select all
ffmpeg version n7.1-ffmpeg-windows-build-helpers Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 10.2.0 (GCC)
  configuration: --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/runner/work/ffmpeg-stable-autobuild/ffmpeg-stable-autobuild/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libopenjpeg --enable-libopenh264 --enable-libvmaf --enable-libsrt --enable-libxml2 --enable-opengl --enable-libdav1d --enable-gnutls --enable-libsvtav1 --enable-libvpx --enable-libaom --enable-nvenc --enable-nvdec --extra-libs=-lz --extra-libs=-lpng --extra-libs=-lm --extra-libs=-lfreetype --extra-libs=-lshlwapi --extra-libs=-lmpg123 --extra-libs=-lpthread --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCACA_STATIC --enable-amf --enable-libmfx --enable-libaribcaption --enable-gpl --enable-frei0r --enable-librubberband --enable-libvidstab --enable-libx264 --enable-libx265 --enable-avisynth --enable-libaribb24 --enable-libxvid --enable-libdavs2 --enable-libxavs2 --enable-libxavs --extra-cflags='-mtune=generic' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/home/runner/work/ffmpeg-stable-autobuild/ffmpeg-stable-autobuild/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-decklink
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.100 / 61. 19.100
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
Input #0, flv, from 'rtmp://127.0.0.1/feed-main-realtime/live':
  Metadata:
    |RtmpSampleAccess: true
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 1920
    displayHeight   : 1080
    fps             : 60
    profile         :
    level           :
  Duration: 00:00:00.00, start: 904.929000, bitrate: N/A
  Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 163 kb/s
  Stream #0:1: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 15360 kb/s, 60 fps, 60 tbr, 1k tbn
Incompatible pixel format 'uyvy422' for codec 'v210', auto-selecting format 'yuv422p'
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> v210 (native))
  Stream #0:0 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[decklink @ 00000200483d1c80] Found Decklink mode 1920 x 1080 with rate 60.00
Output #0, decklink, to 'DeckLink Duo (2)':
  Metadata:
    |RtmpSampleAccess: true
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 1920
    displayHeight   : 1080
    fps             : 60
    profile         :
    level           :
    encoder         : Lavf61.7.100
  Stream #0:0: Video: v210, yuv422p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2654208 kb/s, 60 fps, 60 tbn
      Metadata:
        encoder         : Lavc61.19.100 v210
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
      Metadata:
        encoder         : Lavc61.19.100 pcm_s16le
frame=   61 fps= 13 q=-0.0 size=N/A time=00:00:01.10 bitrate=N/A dup=66 drop=0 speed=0.237x


I was using https://github.com/AnimMouse/ffmpeg-sta ... d/releases release of ffmpeg with the latest BlackMagic Desktop Video 14.4.1. After uninstalling the BM software and installing Desktop Video 12.9, it properly worked again. I hope more people find this through Google :)

@pabloko: I see that you made a patch that supposedly fixes this. I'm unable to compile ffmpeg so I cannot verify that the patch works. Is there however any other way I can contribute to getting your changes into mainstream ffmpeg?

E.g. if you have a build I can run, test/validate or something similar? Is the PR now stuck on the mailing list or any other action required to get it approved for merging?

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 68 guests