wiki:Capture/Blackmagic

Windows

Blackmagic is using the protocol dshow with DirectLink, I have tested the commands in this page with a Blackmagic intensity Pro 4K PCI-E, you might have different settings.

You need to be specific on the parameters you define, otherwise ffmpeg is going to record a black video.

List devices

Check with ffmpeg if your Blackmagic device is installed correctly by running the following command:

ffmpeg -list_devices true -f dshow -i dummy

[dshow @ 000000a9a5eaa880] DirectShow video devices (some may be both video and audio devices)
[dshow @ 000000a9a5eaa880]  "Blackmagic WDM Capture"
[dshow @ 000000a9a5eaa880]     Alternative name "@device_pnp_\\?\decklink#avstre am#5&2550cef9&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\decklinkcapture1"
[dshow @ 000000a9a5eaa880]  "Decklink Video Capture" 
[dshow @ 000000a9a5eaa880]     Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\{44A8B5C7-13B6-4211-BD40-35B629D9E6DF}"
[dshow @ 000000a9a5eaa880] DirectShow audio devices
[dshow @ 000000a9a5eaa880]  "Line In (Blackmagic Audio)"
[dshow @ 000000a9a5eaa880]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{E4A3FD31-CA95-412B-9463-58084D0D11A6}"
[dshow @ 000000a9a5eaa880]  "Decklink Audio Capture"
[dshow @ 000000a9a5eaa880]     Alternative name "@device_sw_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\{AAA22F7E-5AA0-49D9-8C8D-B52B1AA92EB7}"

Video supported

ffmpeg -list_options true -f dshow -i video="Decklink Video Capture"

[dshow @ 0000007201cda8a0] DirectShow video device options (from video devices)
[dshow @ 0000007201cda8a0]  Pin "Capture" (alternative pin name "1")
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=720x486 fps=29.97 max s=720x486 fps=29.97
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=720x576 fps=25 max s=720x576 fps=25
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=23.976 max s=1920x1080 fps=23.976
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=24 max s=1920x1080 fps=24
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=25 max s=1920x1080 fps=25
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=29.97 max s=1920x1080 fps=29.97
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=30 max s=1920x1080 fps=30
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=50 max s=1920x1080 fps=50
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=59.9402 max s=1920x1080 fps=59.9402
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1920x1080 fps=60.0002 max s=1920x1080 fps=60.0002
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1280x720 fps=50 max s=1280x720 fps=50
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1280x720 fps=59.9402 max s=1280x720 fps=59.9402
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=1280x720 fps=60.0002 max s=1280x720 fps=60.0002
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=3840x2160 fps=23.976 max s=3840x2160 fps=23.976
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=3840x2160 fps=24 max s=3840x2160 fps=24
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=3840x2160 fps=25 max s=3840x2160 fps=25
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=3840x2160 fps=29.97 max s=3840x2160 fps=29.97
[dshow @ 0000007201cda8a0]   pixel_format=uyvy422  min s=3840x2160 fps=30 max s=3840x2160 fps=30
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=720x486 fps=29.97 max s=720x486fps=29.97
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=720x576 fps=25 max s=720x576 fps=25
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=23.976 max s=1920x1080 fps=23.976
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=24 max s=1920x1080 fps=24
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=25 max s=1920x1080 fps=25
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=29.97 max s=1920x1080 fps=29.97
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=30 max s=1920x1080 fps=30
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=50 max s=1920x1080 fps=50
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=59.9402 max s=1920x1080 fps=59.9402
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1920x1080 fps=60.0002 max s=1920x1080 fps=60.0002
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1280x720 fps=50 max s=1280x720 fps=50
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1280x720 fps=59.9402 max s=1280x720 fps=59.9402
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=1280x720 fps=60.0002 max s=1280x720 fps=60.0002
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=3840x2160 fps=23.976 max s=3840x2160 fps=23.976
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=3840x2160 fps=24 max s=3840x2160 fps=24
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=3840x2160 fps=25 max s=3840x2160 fps=25
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=3840x2160 fps=29.97 max s=3840x2160 fps=29.97
[dshow @ 0000007201cda8a0]   vcodec=v210  min s=3840x2160 fps=30 max s=3840x2160 fps=30
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=23.976 max s=1920x1080 fps=23.976
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=24 max s=1920x1080 fps=24
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=25 max s=1920x1080 fps=25
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=29.97 max s=1920x1080 fps=29.97
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=30 max s=1920x1080 fps=30
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=50 max s=1920x1080 fps=50
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=59.9402 max s=1920x1080 fps=59.9402
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1920x1080 fps=60.0002 max s=1920x1080 fps=60.0002
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1280x720 fps=50 max s=1280x720 fps=50
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1280x720 fps=59.9402 max s=1280x720 fps=59.9402
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=1280x720 fps=60.0002 max s=1280x720 fps=60.0002
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=3840x2160 fps=23.976 max s=3840x2160 fps=23.976
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=3840x2160 fps=24 max s=3840x2160 fps=24
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=3840x2160 fps=25 max s=3840x2160 fps=25
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=3840x2160 fps=29.97 max s=3840x2160 fps=29.97
[dshow @ 0000007201cda8a0]   vcodec=r210  min s=3840x2160 fps=30 max s=3840x2160 fps=30

Audio format

ffmpeg -list_options true -f dshow -i audio="Decklink Audio Capture"

My solution to find out the correct parameters

Open your Blackmagic Media Express and in the preferences check all combination until you can see the live capture. You can narrow it down by video format and framerate if you know what kind of output your device is giving.

I was capturing from a Lumix GH4, so my settings were:

  • Resolution = 1920x1080
  • FPS = 59.94
  • Pixel format = uyvy422

Most importantly, Lumix shows that it outputs at 60 FPS but ffmpeg needed to set to 59.94 rather than 60, and this was a difference from a black video and a real capture.

Recording video

ffmpeg -y -f dshow -video_size 1920x1080 -pixel_format  uyvy422 -rtbufsize 702000 -framerate 59.94 -i video="Decklink Video Capture" -codec:v libx264 -pix_fmt yuv420p -preset ultrafast -an -crf 0  output.mp4

The line above is capturing a full HD video at 60 FPS and converting into lossless H.264 video–that means your file is going to be very big! In my case I was capturing few seconds so I didn't care much. I added the parameter -an to remove audio capturing as I wasn't interested in audio, but I suppose by removing -an it will capture the audio without adding extra parameters.

On my final command line I had to add -vsync drop before -f dshow due to a strange issue where ffmpeg needed to be restarted 5 times before capturing at 60 FPS.

Re-encoding

In my case I was doing a re-encoding after the capture in H.264 but with higher compression.

ffmpeg -y -i output.mp4 -pix_fmt yuv420p -c:v libx264 -crf 23 compressed.mp4

Don't forget to add -pix_fmt yuv420p otherwise some players would not able to play the file, only VLC.

Source

Last modified 9 years ago Last modified on Apr 20, 2016, 10:40:50 PM
Note: See TracWiki for help on using the wiki.