3

I'm using this line to record from the desktop to a video file:

ffmpeg -f gdigrab -framerate 24 -i desktop -preset ultrafast -pix_fmt yuv420p out.mp4

But this will record the whole desktop. Is there any way to record in real time only specific area/part of the desktop ?

2

Two ways:

#1 By specifying gdigrab options:

ffmpeg -f gdigrab -framerate 24 -video_size 960x540 -offset_x 240 -offset_y 450 -i desktop -preset ultrafast -pix_fmt yuv420p out.mp4

This captures a 960x540 video whose top-left corner is at (240,450) measured from the top-left corner of the display.

#2 By cropping it post-capture

ffmpeg -f gdigrab -framerate 24 -i desktop -vf crop=960:540:240:450 -preset ultrafast -pix_fmt yuv420p out.mp4

The former is preferable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.