user19596: 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 ?

user1871: 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.

19596: <p>I'm using this line to record from the desktop to a video file:</p>

<pre><code>ffmpeg -f gdigrab -framerate 24 -i desktop -preset ultrafast -pix_fmt yuv420p out.mp4
</code></pre>

<p>But this will record the whole desktop.
Is there any way to record in real time only specific area/part of the desktop ?</p>
 1871: <p>Two ways:</p>

<p><strong>#1</strong> By specifying gdigrab options:</p>

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

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

<p><strong>#2</strong> By cropping it post-capture</p>

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

<p>The former is preferable.</p>
