Record Screen Without Mouse Cursor in FFmpeg
This article provides a quick guide on how to record your desktop screen using FFmpeg while completely hiding the mouse cursor. You will learn the specific command-line parameters required to disable cursor capture across Windows, macOS, and Linux operating systems.
To record your screen without capturing the mouse cursor, you must pass a specific “hide cursor” flag to the input device driver you are using. The parameter and input format vary depending on your operating system.
Windows (using gdigrab)
On Windows, the native device for desktop capture is
gdigrab. To hide the cursor, add the
-draw_mouse 0 option before the input.
Run the following command in your command prompt:
ffmpeg -f gdigrab -draw_mouse 0 -i desktop output.mp4-f gdigrab: Specifies the GDI-based screen grabber.-draw_mouse 0: Disables the drawing of the mouse cursor in the recording.-i desktop: Directs the grabber to capture the entire desktop.
macOS (using avfoundation)
On macOS, FFmpeg uses the avfoundation library for
screen recording. To hide the cursor, use the
-capture_cursor 0 option.
Run the following command in your terminal:
ffmpeg -f avfoundation -capture_cursor 0 -i "1" output.mp4-f avfoundation: Specifies the AVFoundation framework for macOS.-capture_cursor 0: Disables the capture of the mouse pointer.-i "1": Specifies the index of the screen to record (usually “1” for the primary display).
Linux (using x11grab)
On Linux systems running the X11 window system, FFmpeg uses
x11grab. To hide the cursor, use the
-draw_mouse 0 option.
Run the following command in your terminal:
ffmpeg -f x11grab -draw_mouse 0 -video_size 1920x1080 -i :0.0 output.mp4-f x11grab: Specifies the X11 screen grabber.-draw_mouse 0: Instructs the grabber not to draw the mouse cursor.-video_size 1920x1080: Sets the resolution of the capture area (adjust this to match your screen resolution).-i :0.0: Specifies the display and screen number to capture.