Capture PCI Video with Blackmagic DeckLink and FFmpeg
This article provides a straightforward guide on how to capture high-quality video from a PCI capture card, specifically focusing on Blackmagic DeckLink hardware, using the powerful command-line tool FFmpeg. You will learn how to verify your system setup, identify your input devices, discover supported video formats, and execute the precise FFmpeg commands needed to record or stream your video feed.
Prerequisites
To capture video from a Blackmagic DeckLink card, you must use a
version of FFmpeg that has been compiled with DeckLink support enabled.
You can verify this by running ffmpeg -protocols or
ffmpeg -buildconf in your terminal and looking for
--enable-decklink. Additionally, you must have the
Blackmagic Desktop Video SDK or drivers installed on your operating
system.
Step 1: Identify Your DeckLink Device
Before capturing, you need to find the exact name of your PCI capture card as recognized by FFmpeg. Run the following command to list all connected Blackmagic devices:
ffmpeg -f decklink -list_devices 1 -i dummyThe output will display the connected devices. Note down the exact
name of your card (for example, "DeckLink Mini Recorder" or
"DeckLink Duo (1)").
Step 2: List Supported Input Formats
Blackmagic cards require you to specify the exact video format
(resolution and frame rate) of the incoming signal. To see the formats
your card supports, run the following command, replacing
"DeckLink Mini Recorder" with your actual device name:
ffmpeg -f decklink -list_formats 1 -i "DeckLink Mini Recorder"Look through the output list for the format code (such as
hp50 for 1080p50, or Hi59 for 1080i59.94) that
matches your input camera or video source.
Step 3: Capture the Video
Once you have the device name and the correct format code, you can start capturing.
To capture the video and audio and encode it to an MP4 file using the H.264 video codec and AAC audio codec, use the following command:
ffmpeg -f decklink -format_code hp60 -i "DeckLink Mini Recorder" -c:v libx264 -preset ultrafast -c:a aac output.mp4Command Breakdown:
-f decklink: Specifies that the input format is a Blackmagic DeckLink device.-format_code hp60: Sets the input format. In this case,hp60typically stands for 1080p at 60 fps (refer to your step 2 output for your specific code).-i "DeckLink Mini Recorder": Defines the input device name.-c:v libx264: Encodes the video stream using the H.264 codec.-preset ultrafast: Uses a fast encoding preset to reduce CPU usage during real-time capture.-c:a aac: Encodes the audio stream using the AAC codec.output.mp4: The final destination file.