- 1 year ago
Record region of screen using FFMPEG?
To record a specific region of your screen using FFmpeg, you can use the gdigrab
input device in combination with the appropriate parameters to specify the region. Here's the FFmpeg command to achieve this:
bashffmpeg -f gdigrab -framerate 30 -offset_x X -offset_y Y -video_size WIDTHxHEIGHT -i desktop output.mp4
Here's what each parameter does:
-f gdigrab
: Specifies the input format asgdigrab
, which allows capturing the screen on Windows systems.-framerate 30
: Sets the frame rate for the recording. Adjust this value as needed.-offset_x X
: Specifies the X-coordinate of the top-left corner of the region you want to record. ReplaceX
with the desired value in pixels.-offset_y Y
: Specifies the Y-coordinate of the top-left corner of the region you want to record. ReplaceY
with the desired value in pixels.-video_size WIDTHxHEIGHT
: Sets the size of the region you want to record. ReplaceWIDTH
andHEIGHT
with the desired values in pixels.desktop
: Captures the screen desktop.output.mp4
: Specifies the output filename and format. You can use other video formats as needed, such as.avi
,.mkv
, etc.
Before running the command, make sure you have FFmpeg installed on your system and accessible in the command line.
Note: The gdigrab
input device is available on Windows systems only. If you are using a different operating system, you'll need to use a different input device for screen capture, such as x11grab
on Linux or avfoundation
on macOS. The specific command may vary depending on the operating system you're using.