[[[ Capturing your Desktop / Screen Recording ]]] [[PageOutline(1, Contents)]] Here are a few solutions for capturing your desktop and recording a video of your screen with ffmpeg. (A Chinese version of this page is [[Capture/Desktop中文版本|also available]].) For the sake of brevity, these commands do not specify any additional encoder settings. For more info about H.264 encoding, see [[Encode/H.264|the H.264 encoding guide]]. By default, these commands will use the x264 encoder, which should be reasonably fast on modern machines. See [#lossless-recording Lossless Recording] if you need to improve performance. = Linux = Use the [https://ffmpeg.org/ffmpeg-devices.html#x11grab x11grab] device: {{{ ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4 }}} This will grab the image from desktop, starting with the upper-left corner at x=100, y=200 with a width and height of 1024⨉768. If you need audio too, you can use [https://ffmpeg.org/ffmpeg-devices.html#alsa-1 ALSA] (see [[Capture/ALSA]] for more info): {{{ ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f alsa -ac 2 -i hw:0 output.mkv }}} Or the [https://ffmpeg.org/ffmpeg-devices.html#pulse pulse] input device (see [[Capture/PulseAudio]] for more info): {{{ ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f pulse -ac 2 -i default output.mkv }}} = macOS = Use the [https://ffmpeg.org/ffmpeg-devices.html#avfoundation avfoundation] device: {{{ ffmpeg -f avfoundation -list_devices true -i "" }}} This will enumerate all the available input devices including screens ready to be captured. Once you've figured out the device index corresponding to the screen to be captured, use: {{{ ffmpeg -f avfoundation -i ":