Capture HDMI with ffmpeg and Decklink 4K Extreme - Linux

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

George Efstathiou

  • Posts: 1
  • Joined: Mon Aug 15, 2016 1:34 pm

Capture HDMI with ffmpeg and Decklink 4K Extreme - Linux

PostMon Aug 15, 2016 1:44 pm

I am trying to capture a video using ffmpeg, from the HDMI input port of the Blackmagic DeckLink 4K Extreme capture card in Ubuntu Linux, but i seem to fail.

As per the ffmpeg Documentation I have tried the following:

Code: Select all
ffmpeg -f decklink -video_input 'hdmi' -i 'DeckLink 4K Extreme (1)@14' -acodec copy -vcodec copy ~/testCapture/card1_f14_hdmi.av


but no matter what I do I always get this picture as a video
Screenshot_1_rs.jpg
colorbars
Screenshot_1_rs.jpg (2.07 KiB) Viewed 12330 times


My ffmpeg version is :

Code: Select all
ffmpeg version git-2016-08-15-4899953 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags=-L/root/ffmpeg_build/lib
--bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac
--enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-decklink
--extra-cflags=-I/root/decklinkSDK/Blackmagic_DeckLink_SDK/Linux/include
--extra-ldflags=-L/root/decklinkSDK/Blackmagic_DeckLink_SDK/Linux/include
--enable-nonfree
libavutil      55. 28.100 / 55. 28.100
libavcodec     57. 51.102 / 57. 51.102
libavformat    57. 46.101 / 57. 46.101
libavdevice    57.  0.102 / 57.  0.102
libavfilter     6. 51.100 /  6. 51.100
libswscale      4.  1.100 /  4.  1.100
libswresample   2.  1.100 /  2.  1.100
libpostproc    54.  0.100 / 54.  0.100


I have two of these cards as per the following:
Code: Select all
ffmpeg -f decklink -list_devices 1 -i dummy
.....
[decklink @ 0x2e9e440] Blackmagic DeckLink devices:
[decklink @ 0x2e9e440]    'DeckLink 4K Extreme (1)'
[decklink @ 0x2e9e440]    'DeckLink 4K Extreme (2)'


The display formats has available hd formats:
Code: Select all
ffmpeg -f decklink -list_formats 1 -i 'DeckLink 4K Extreme (1)'

[decklink @ 0x23b2440] Supported formats for 'DeckLink 4K Extreme (1)':
[decklink @ 0x23b2440]    1   720x486 at 30000/1001 fps (interlaced, lower field first)
[decklink @ 0x23b2440]    2   720x576 at 25000/1000 fps (interlaced, upper field first)
[decklink @ 0x23b2440]    3   1920x1080 at 24000/1001 fps
[decklink @ 0x23b2440]    4   1920x1080 at 24000/1000 fps
[decklink @ 0x23b2440]    5   1920x1080 at 25000/1000 fps
[decklink @ 0x23b2440]    6   1920x1080 at 30000/1001 fps
[decklink @ 0x23b2440]    7   1920x1080 at 30000/1000 fps
[decklink @ 0x23b2440]    8   1920x1080 at 25000/1000 fps (interlaced, upper field first)
[decklink @ 0x23b2440]    9   1920x1080 at 30000/1001 fps (interlaced, upper field first)
[decklink @ 0x23b2440]    10   1920x1080 at 30000/1000 fps (interlaced, upper field first)
[decklink @ 0x23b2440]    11   1920x1080 at 50000/1000 fps
[decklink @ 0x23b2440]    12   1920x1080 at 60000/1001 fps
[decklink @ 0x23b2440]    13   1920x1080 at 60000/1000 fps
[decklink @ 0x23b2440]    14   1280x720 at 50000/1000 fps
[decklink @ 0x23b2440]    15   1280x720 at 60000/1001 fps
...
[decklink @ 0x23b2440]    27   4096x2160 at 25000/1000 fps


Has anyone had any success with this particular card and ffmpeg?
Please do share if you have.
Offline

Reuben

  • Posts: 85
  • Joined: Wed Dec 12, 2012 3:50 pm

Re: Capture HDMI with ffmpeg and Decklink 4K Extreme - Linux

PostWed Aug 24, 2016 9:08 pm

Bars are displayed when the resolution / scan rate selected by the arguments set in ffmpeg does not match the input. You are currently setting it to 1280x720@50p.

There's also HDCP which can cause problems if you are trying to get input from a copyright protected source.

Remember that ffmpeg itself does not control the input format, you are just telling it what format it should expect to get from the card. If you set 1280x720@50p, but you input is something different like 1920x1080@50p then you are going to get bars.
Offline
User avatar

Doug Marsh

  • Posts: 62
  • Joined: Thu Mar 20, 2014 9:33 pm

Re: Capture HDMI with ffmpeg and Decklink 4K Extreme - Linux

PostWed Sep 27, 2017 2:10 am

I too build a custom set of .deb files with DeckLink support:

Code: Select all
dx@x299:~/deb/decklink-ffmpeg-3.3.4$ ls -la
total 22748
drwxrwxr-x 2 dx dx    4096 Sep 24 18:27 .
drwxrwxr-x 5 dx dx    4096 Sep 24 18:27 ..
-rw-r--r-- 1 dx dx 1534142 Sep 24 18:22 ffmpeg_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx 1738990 Sep 24 18:22 ffmpeg-doc_3.3.4-1_all.deb
-rw-r--r-- 1 dx dx 4466548 Sep 24 18:22 libavcodec57_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx 4935942 Sep 24 18:22 libavcodec-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   24536 Sep 24 18:22 libavcodec-extra_3.3.4-1_all.deb
-rw-r--r-- 1 dx dx 4469096 Sep 24 18:22 libavcodec-extra57_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   91360 Sep 24 18:22 libavdevice57_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx  108806 Sep 24 18:22 libavdevice-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx  811824 Sep 24 18:22 libavfilter6_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx  944842 Sep 24 18:22 libavfilter-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   24530 Sep 24 18:22 libavfilter-extra_3.3.4-1_all.deb
-rw-r--r-- 1 dx dx  820978 Sep 24 18:22 libavfilter-extra6_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx  921742 Sep 24 18:22 libavformat57_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx 1101246 Sep 24 18:22 libavformat-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   63048 Sep 24 18:22 libavresample3_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   72302 Sep 24 18:22 libavresample-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   24754 Sep 24 18:22 libav-tools_3.3.4-1_all.deb
-rw-r--r-- 1 dx dx  192106 Sep 24 18:22 libavutil55_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx  293600 Sep 24 18:22 libavutil-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   60226 Sep 24 18:22 libpostproc54_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   60948 Sep 24 18:22 libpostproc-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   65412 Sep 24 18:22 libswresample2_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx   77884 Sep 24 18:22 libswresample-dev_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx  157836 Sep 24 18:22 libswscale4_3.3.4-1_amd64.deb
-rw-r--r-- 1 dx dx  174864 Sep 24 18:22 libswscale-dev_3.3.4-1_amd64.deb


I've installed them and run the following command and get:

Code: Select all
dx@x299:~/capture$ ffmpeg -f decklink -video_input hdmi -audio_input embedded -bm_v210 1 -i 'DeckLink Studio 4K' -acodec copy -vcodec copy bleh.avi
ffmpeg version 3.3.4-1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  avfilter    configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[decklink @ 0x55ed6daa50e0] Cannot enable video input
DeckLink Studio 4K: Input/output error


I can capture video no problem from the Media Express (in MJPEG, 8 or 10 bit YUV or 10 bit RGB, each progressively larger files)... So it isn't an issue of input but what additionally I need to set. I saw for older ffmpeg code a format_code thing but that also didn't work.. so with my newest version:

Code: Select all
 ffmpeg -f decklink -list_formats 1 -i 'DeckLink Studio 4K' dummy
[...]
[decklink @ 0x55c30d5f6000] Supported formats for 'DeckLink Studio 4K':
   format_code   description
   ntsc      720x486 at 30000/1001 fps (interlaced, lower field first)
   pal       720x576 at 25000/1000 fps (interlaced, upper field first)
   23ps      1920x1080 at 24000/1001 fps
   24ps      1920x1080 at 24000/1000 fps
   Hp25      1920x1080 at 25000/1000 fps
   Hp29      1920x1080 at 30000/1001 fps
   Hp30      1920x1080 at 30000/1000 fps
   Hi50      1920x1080 at 25000/1000 fps (interlaced, upper field first)
   Hi59      1920x1080 at 30000/1001 fps (interlaced, upper field first)
   Hi60      1920x1080 at 30000/1000 fps (interlaced, upper field first)
   Hp50      1920x1080 at 50000/1000 fps
   Hp59      1920x1080 at 60000/1001 fps
   Hp60      1920x1080 at 60000/1000 fps
   hp50      1280x720 at 50000/1000 fps
   hp59      1280x720 at 60000/1001 fps
   hp60      1280x720 at 60000/1000 fps
   2d23      2048x1080 at 24000/1001 fps
   2d24      2048x1080 at 24000/1000 fps
   2d25      2048x1080 at 25000/1000 fps
   4k23      3840x2160 at 24000/1001 fps
   4k24      3840x2160 at 24000/1000 fps
   4k25      3840x2160 at 25000/1000 fps
   4k29      3840x2160 at 30000/1001 fps
   4k30      3840x2160 at 30000/1000 fps
   4d23      4096x2160 at 24000/1001 fps
   4d24      4096x2160 at 24000/1000 fps
   4d25      4096x2160 at 25000/1000 fps


I reran a capture as follows:

Code: Select all
ffmpeg -f decklink -video_input hdmi -audio_input embedded -bm_v210 1 -format_code Hp59 -i 'DeckLink Studio 4K' -acodec copy -vcodec copy bleh.avi
ffmpeg version 3.3.4-1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  avfilter    configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[decklink @ 0x5585cd9d31c0] Found Decklink mode 1920 x 1080 with rate 59.94
[decklink @ 0x5585cd9d31c0] Frame received (#1) - No input signal detected - Frames dropped 1
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, decklink, from 'DeckLink Studio 4K':
  Duration: N/A, start: 0.000000, bitrate: 2653092 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Stream #0:1: Video: v210 (V210 / 0x30313256), yuv422p10le, 1920x1080, 2651556 kb/s, 59.94 tbr, 1000k tbn, 1000k tbc
Output #0, avi, to 'bleh.avi':
  Metadata:
    ISFT            : Lavf57.71.100
    Stream #0:0: Video: v210 (V210 / 0x30313256), yuv422p10le, 1920x1080, q=2-31, 2651556 kb/s, 59.94 tbr, 600 tbn, 1000k tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  579 fps= 63 q=-1.0 Lsize= 3128852kB time=00:00:09.64 bitrate=2657497.0kbits/s speed=1.04x


and it appears to be capturing.. I am posting this here to inform those of my progress. I will report back, I will attempt to capture into a DNxHD format from the command line from the HDMI port as Resolve can't do that natively (apparently can only capture from SDI inputs from INSIDE the application... a real *sad trombone* if you ask me... Not having the ability to select input port.

--Doug (dx9s)
Offline
User avatar

Doug Marsh

  • Posts: 62
  • Joined: Thu Mar 20, 2014 9:33 pm

Re: Capture HDMI with ffmpeg and Decklink 4K Extreme - Linux

PostWed Sep 27, 2017 2:33 am

UPDATE

tried the following:

Code: Select all
dx@x299:~/capture$ ffmpeg -format_code Hp59 -f decklink -video_input hdmi -audio_input embedded -bm_v210 0 -i 'DeckLink Studio 4K' -acodec pcm_s24le -vcodec dnxhd -vf scale=1920x1080,fps=60000/1001,format=yuv422p -b:v 220M out.mov
ffmpeg version 3.3.4-1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  avfilter    configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-decklink --enable-nonfree --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-netcdf
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[decklink @ 0x55bdf8c4a220] Found Decklink mode 1920 x 1080 with rate 59.94
[decklink @ 0x55bdf8c4a220] Frame received (#1) - No input signal detected - Frames dropped 1
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, decklink, from 'DeckLink Studio 4K':
  Duration: N/A, start: 0.000000, bitrate: 1990203 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Stream #0:1: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, 1988667 kb/s, 59.94 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:1 -> #0:0 (rawvideo (native) -> dnxhd (native))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> pcm_s24le (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'out.mov':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0: Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p, 1920x1080, q=2-1024, 220000 kb/s, 59.94 fps, 60k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc57.89.100 dnxhd
    Stream #0:1: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32, 2304 kb/s
    Metadata:
      encoder         : Lavc57.89.100 pcm_s24le
frame=  400 fps= 63 q=1.0 Lsize=  360283kB time=00:00:06.67 bitrate=442275.2kbits/s speed=1.04x   
video:358400kB audio:1877kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001779%


getting color bars too (unless I put -draw_bars 0 which doesn't draw bars on no-signal). Tried a few variations of 'Hp60' and so forth. WHEN it is capturing, the input source displays on the output so it is passing through the card. The newest SDK might have issues with ffmpeg and not capture the frame coming in. I also tried -bm_v210 1 and format=yuv722p10 and bitrate of 440M as well.

NOTE: I hear the audio from the source in the recording.. Even tho I see some source of 16 bit being mentioned in debug.

Hmmm.... getting much closer but still no cigar... or is the saying more like "light at end of tunnel" (and it's a train)..

If I capture via Media Express in 10 bit mode and transcode into DNxHD (440M 10 bit) it works fine.. just was hoping to get a nice command line scriptable way to capture live from HDMI input.

The important thing to note in output:
Code: Select all
[decklink @ 0x55bdf8c4a220] Found Decklink mode 1920 x 1080 with rate 59.94
[decklink @ 0x55bdf8c4a220] Frame received (#1) - No input signal detected - Frames dropped 1


Does that mean it just dropped ONE frame and gives up?! Need to bug the ffmpeg mailing list. Perhaps a setting in the card setting might fix this. I did see a pre-roll thing in the Media Express which leads me to believe one might need to discard a few frames at the beginning while things get "rolling"

Back to poking around.

--Doug (dx9s)
Offline
User avatar

Doug Marsh

  • Posts: 62
  • Joined: Thu Mar 20, 2014 9:33 pm

Re: Capture HDMI with ffmpeg and Decklink 4K Extreme - Linux

PostFri Sep 29, 2017 5:59 am

I've been working with the ffmpeg-devel folks. I grabbed the latest GIT version of FFMPEG and compiled it against the current/latest BMD SDK and have been able to now successfully capture video from the command line into MOV DNxHD files. Still tweaking optimal settings:

Code: Select all
dx@x299:~/capture$ ffmpeg -format_code Hp59 -f decklink -video_input hdmi -audio_input embedded -raw_format argb -i 'DeckLink Studio 4K' -acodec pcm_s16le -vcodec dnxhd -vf scale=1920x1080,fps=60000/1001,format=yuv422p10 -b:v 440M out.mov
ffmpeg version N-87614-g3d4f8b9-dx9s-decklink Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr/local/ffmpeg --extra-version=dx9s-decklink --build-suffix=-dx9s-decklink --toolchain=hardened --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-decklink --enable-nonfree
  libavutil      55. 77.101 / 55. 77.101
  libavcodec     57.106.104 / 57.106.104
  libavformat    57. 82.102 / 57. 82.102
  libavdevice    57.  9.101 / 57.  9.101
  libavfilter     6.106.100 /  6.106.100
  libavresample   3.  6.  0 /  3.  6.  0
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[decklink @ 0x55de002c0300] Found Decklink mode 1920 x 1080 with rate 59.94
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, decklink, from 'DeckLink Studio 4K':
  Duration: N/A, start: 0.000000, bitrate: 3978870 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Stream #0:1: Video: rawvideo (ARGB / 0x42475241), argb(progressive), 1920x1080, 3977334 kb/s, 59.94 tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:1 -> #0:0 (rawvideo (native) -> dnxhd (native))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'out.mov':
  Metadata:
    encoder         : Lavf57.82.102
    Stream #0:0: Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p10le, 1920x1080, q=2-1024, 440000 kb/s, 59.94 fps, 60k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc57.106.104 dnxhd
    Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc57.106.104 pcm_s16le
frame=  247 fps= 62 q=1.0 Lsize=  222089kB time=00:00:04.12 bitrate=441505.8kbits/s speed=1.03x   
video:221312kB audio:773kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001993%


The important thing is a recent patch (only in git) that adds RGB input support as HDMI can be YUV or RGB (and when coming from computer *IS* RGB -- nVidia has option for full or limited color range on source computer but the black levels between computer output and typical consumer monitor are a bit different -- more on this in issues below)

Outstanding issues.

1) Audio is currently capturing in 16-bit. I will have to look at reference code and see on adding option to provide 24-bit or change/hard-code a switch to 24-bit (when I get time).

2) If you are capturing over existing file, it will stop and ask you to over-write while the buffering is started (video monitor output spins up).

3) color space (especially in the dark regions) will require a LUT or something. I have some test video I am capturing from HDMI that has really dark regions. When importing and editing on time line, it looks fine but when exporting and viewing in totem or VLC, the dark levels are really off. Trying to figure out if there is an OUTPUT LUT or INPUT LUT that will simplify this process somehow. (I an new to LUT, and started hand writing some cube ones for testing purposes)

Built with the following configuration options:
Code: Select all
./configure --prefix=/usr/local/ffmpeg --extra-version=dx9s-decklink --build-suffix=-dx9s-decklink --toolchain=hardened --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl  --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-decklink --enable-nonfree


In summary, it appears the issue as to why DaVinci *CAN'T* capture from HDMI inside the application is they don't have any RGB->YUV color space conversion code inside it for use with the HDMI input (or the ability to select the HDMI input to begin with?!).. I need to do more testing now I think about it here. Perhaps if I output YUV from an attached computer (over HDMI) one CAN capture from HDMI into DaVinci Resolve directly. Will test soon and report back.. I am tired!

--Doug (dx9s)
Offline

brayan1405

  • Posts: 1
  • Joined: Thu Jan 24, 2019 4:53 pm
  • Real Name: Brayan Piñeros

Re: Capture HDMI with ffmpeg and Decklink 4K Extreme - Linux

PostThu Jan 24, 2019 9:12 pm

hello
I need to capture the SDI signal with ffmpeg and DeckLink Duo, operating system in Centos7; Who can help me, please?
Thank you

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 20 guests