高品質に動画キャプチャができるのだから、インタラクティブなシステムや配信などに利用したい。 Blackmagicが公式でSDKを配布しており、マニュアルを見る限り大抵のことはSDK経由で操作可能なように見受けられる。
が、機能が多すぎて読解と実装で膨大な時間を消費する。 しかし映像の取り込みや送出制御程度であればlu-zero氏によって公開されていてる bmdtoolsが利用できそうだ。
今回は bmdtools を利用して録画してみる。
参考:
Setup
bmdtoolsneeds a recent version of libav installed. In order to build it make sure to have the development headers installed.
Building from source
The common scenario assumes you want to use
x264to encode the video andfdk-aacto encode the audio. You might usex265andopusas well but they are not supported in many container formats.The following instructions assume you want to install everything in
/usr/local.
まずはlibavを、必要なライブラリを追加した上でインストールする必要がある。
それは以下にまとめた。
bmdtools のコンパイルに欠かせない Blackmagic 公式の SDK を Blackmagic Design: サポートセンター からダウンロードする。
ダウンロード完了したらSDKを解凍する。
$ unzip Blackmagic_DeckLink_SDK_10.9.5.zip
Build
# git clone git://github.com/lu-zero/bmdtools # cd bmdtools # make SDK_PATH=<path where you unpacked the decklink sdk>/<Target OS>/includeNote: The SDK currently supports Linux and MacOSX. Thus the
<Target OS>can be eitherLinuxorMac.Install
# cp bmdcapture bmdplay /usr/local/bin
まずはgit cloneでソースコードを取得する。
$ git clone https://github.com/lu-zero/bmdtools.git
Blackmagic SDKの中から include ディレクトリを bmdtools ディレクトリにコピーする。
$ cp -r ../Blackmagic\ DeckLink\ SDK\ 10.9.5/Linux/include/ .
make SDK_PATH=includeでビルドする。
sudo make SDK_PATH=include install
mkdir -p //usr/bin
cp bmdcapture bmdplay bmdgenlock //usr/bin
ひとまず、avconvを使って録画してみた。
$ bmdcapture -C 0 -m 9 -F nut -V 3 -A 2 -o strict=experimental:syncpoints=none -f pipe:1 | avconv -vsync passthrough -y -i - -vcodec libx264 test.avi