BlackMagic Declink Card Installation

Go To: https://www.blackmagicdesign.com/support/family/capture-and-playback

Choose the Card from Dropdown List – on Top Right

Note: When the DecLink card is changed to another model, the driver remains the same but need to execute the BlackmagicFirmwareUpdater commands (status/update) for the Linux OS to identify it.

$cd Blackmagic_Desktop_Video_Linux_10.9a7/amd64/deb/
$dpkg -i desktopvideo_*.deb
$apt-get install libgl1-mesa-glx
$apt-get -f install 
$BlackmagicFirmwareUpdater status
$BlackmagicFirmwareUpdater update /dev/blackmagic/io0
$BlackmagicFirmwareUpdater update /dev/blackmagic/io4
$init 6
  • Prequisites:
$apt-get install libavformat-dev libswscale-dev libavresample-dev 
$apt-get install pkgconf cmake yasm libtool libx264-dev
  • Install x264:
git clone https://github.com/qupai/x264.git
# cd x264
# ./configure
# make
# make install
  • x265
# git clone git://github.com/videolan/x265
# cd x265/build
# cmake ../source
# make
# make install
  • fdk-aac
# git clone git://git.code.sf.net/p/opencore-amr/fdk-aac
# cd fdk-aac
# autoreconf -if
# ./configure
# make
# make install
  • opus
# git clone git://git.opus-codec.org/opus.git
# cd opus
# autoreconf -if
# ./configure
# make
# make install
  • libav
# git clone git://github.com/libav/libav
# cd libav
# ./configure --enable-gpl --enable-nonfree --enable-libx264 --enable-libx265 --enable-libfdk-aac
# make -j 8 && make install
Download SDK from https://www.blackmagicdesign.com/support/family/capture-and-playback

Build & Install BMDCapture

# git clone git://github.com/lu-zero/bmdtools
# cd bmdtools
# make SDK_PATH=<path where you unpacked the decklink sdk>/<Target OS>/include

Note: The SDK currently supports Linux and MacOSX. Thus the <Target OS can be either Linux or Mac.

Install BMDCapture
$cp bmdcapture bmdplay /usr/local/bincd /root/Blackmagic_Desktop_Video_Linux_10.9a7/deb/amd64/
$dpkg -i mediaexpress_3.5.3a1_amd64.deb
$apt-get install libatk1.0-0
$apt-get -f install
$dpkg -i mediaexpress_3.5.3a1_amd64.deb
Sample Command to Initiate streaming via wowza:
bmdcapture -C 0 -m 2 -A 2 -c 2  -V 4  -F nut -f pipe:1  | avconv -loglevel warning -i - -async 1 -vsync passthrough -flags +global_header -c:v libx264 -pix_fmt yuv420p -preset:v superfast -tune zerolatency -threads 0  -b:v 700k -minrate 700k -maxrate 700k -bufsize 700k   -r 30 -c:a aac -ar 48000   -strict experimental  -profile:v baseline -f flv rtmp://wowza.abc.com/xyz/123

 

Reference Links

https://coolchevy.org.ua/2010/09/08/decklink-driver-of-blackmagicdesign-on-gentoo-linux/

https://www.blackmagicdesign.com/support

https://www.blackmagicdesign.com/support/download/9d53d0685c754e728c46d6dd57841fc0/Linux

https://www.sitola.cz/igrid/index.php/DeckLink_Setup_(Linux)

https://forum.blackmagicdesign.com/viewtopic.php?f=3&t=92

https://forum.blackmagicdesign.com/viewtopic.php?f=12&t=40854

https://github.com/lu-zero/bmdtools/wiki (Steps are included here)

 

Identify Memory Leak

A memory leak, technically, is an ever-increasing usage of memory by an application.

With common desktop applications, this may go unnoticed, because a process typically frees any memory it has used when you close the application.

However, In the client/server model, memory leakage is a serious issue, because applications are expected to be available 24×7. Applications must not continue to increase their memory usage indefinitely, because this can cause serious issues. To monitor such memory leaks, we can use the following commands.

$ ps aux --sort pmem

USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  1520  508 ?        S     2005   1:27 init
inst  1309  0.0  0.4 344308 33048 ?      S     2005   1:55 agnt (idle)
inst  2919  0.0  0.4 345580 37368 ?      S     2005  20:02 agnt (idle)
inst 24594  0.0  0.4 345068 36960 ?      S     2005  15:45 agnt (idle)
root 27645  0.0 14.4 1231288 1183976 ?   S     2005   3:01 /TaskServer/bin/./wrapper-linux-x86-32

In the above ps command, –sort option outputs the highest %MEM at bottom. Just note down the PID for the highest %MEM usage. Then use ps command to view all the details about this process id, and monitor the change over time. You had to manually repeat ir or put it as a cron to a file.

$ ps ev --pid=27645
PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
27645 ? S 3:01 0 25 1231262 1183976 14.4 /TaskServer/bin/./wrapper-linux-x86-32

$ ps ev --pid=27645
PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
27645 ? S 3:01 0 25 1231262 1183976 14.4 /TaskServer/bin/./wrapper-linux-x86-32

Note: In the above output, if RSS (resident set size, in KB) increases over time (so would %MEM), it may indicate a memory leak in the application.

Critical Server Management Tips

 

If the server is running out of memory !!!

Linux memory management tries to minimize disk access. To do this it will use any unused ram to cache, this is because reading from disk is slow compared to reading from memory. When the cache is used up the data that has been there the longest is freed, theoretically data that is used often will not be removed whilst data that is no longer needed slowly gets moved out of the cache. When an application needs memory the kernel should reduce the size of the cache and free up memory. This is why people sometimes get confused when using the free command, since linux uses memory for cache it can appear to the untrained eye that most of the memory has been used up. This is in fact normal; it’s when the server can no longer free memory from the cache that problems occur.

Freeing cache memory therefore does not usually make your computer faster, but the converse, linux becomes slower having to re read information to the cache. Ironic then that some of the latest distro’s of linux, namely SUSE and Mandriva seem to have forgotten this, there are numerous reports of these, and other linux distro’s, deciding cached memory is too important to free up for actual processes. Luckily a solution was added in kernel 2.6.16 allowing us to free cached memory by writing to /proc/sys/vm/drop_caches. There are three options depending on what you need to do, clean the cache, free dentries and inodes, and free cache, dentries and inodes, we run sync first to ensure all cached objects are freed as this is a non-destructive operation and dirty objects are not freed:

To free cache enter:

sync; echo 1 > /proc/sys/vm/drop_caches

dentries and inodes :

sync; echo 2 > /proc/sys/vm/drop_caches

pagecache, dentries and inodes:

sync; echo 3 > /proc/sys/vm/drop_caches

source