FFmpeg ddagrab: How to Capture Desktop at 120fps

This article explains how to capture high-frame-rate desktop video at 120 frames per second (fps) on Windows using FFmpeg’s Desktop Duplication API (ddagrab) input. You will learn the exact FFmpeg command structures, the importance of hardware-accelerated encoders, and optimization techniques to ensure smooth, stutter-free, high-speed screen recordings.

Why Use ddagrab for 120fps?

The default Windows grabber in FFmpeg, gdigrab, relies on the CPU and GDI engine, which struggles to capture video beyond 30 to 60 fps without dropping frames. The ddagrab input utilizes the Windows Desktop Duplication API (DDA), which directly accesses the GPU’s frame buffer. This hardware-level access reduces CPU overhead to almost zero, making 120fps capture highly efficient and feasible on modern systems.

Prerequisites

To capture desktop video at 120fps, your system must meet the following requirements: * Operating System: Windows 8 or later. * Graphics Card: A dedicated GPU (NVIDIA, AMD, or Intel) with up to date drivers. * Monitor Refresh Rate: Your monitor should ideally be running at 120Hz or higher. If your monitor runs at 60Hz, capturing at 120fps will result in duplicate frames. * FFmpeg: A modern build of FFmpeg (configured with --enable-libd3d11va and --enable-dxva2).

The 120fps Capture Command

For 120fps capture, you must combine the ddagrab input with a hardware-accelerated encoder. Below is the optimized command using NVIDIA’s NVENC hardware encoder:

ffmpeg -hwaccel d3d11va -f ddagrab -framerate 120 -i desktop -c:v h264_nvenc -preset p1 -cq 19 -pix_fmt yuv420p output.mp4

Alternative: Command for AMD GPUs (AMF)

If you are using an AMD graphics card, use the following command:

ffmpeg -hwaccel d3d11va -f ddagrab -framerate 120 -i desktop -c:v h264_amf -quality speed -pix_fmt yuv420p output.mp4

Alternative: Command for Intel GPUs (QSV)

If you are using Intel Integrated Graphics, use the following command:

ffmpeg -hwaccel d3d11va -f ddagrab -framerate 120 -i desktop -c:v h264_qsv -preset veryfast -pix_fmt nv12 output.mp4

Command Breakdown

Performance Optimization Tips

If you experience skipped frames or stuttering during a 120fps recording, apply the following adjustments: