How to easily take a screenshot from the commandline with ffmpeg

/images/blog/old_uploads/FFmpeg_Logo_new.svg_-825x343.png
FFmpeg Logo new.svg  825x343

In this post I intend to show how easy it is to take a screenshot from the CommandLine.

Why would you want to do that?
Well there are times when you simply want to take a screenshot of the screen at certain times to track your activity. Or to make a simple screencast without having to install additional tools.

FFMPEG can be downloaded and installed from the following website: https://www.ffmpeg.org/

For Linux you can also install it via the commandline

To install libav:

apt-get install libav-tools

To install ffmpeg:

apt-get install ffmpeg

To take a screenshot on Linux just type the following in your terminal

ffmpeg -f gdigrab -i desktop -vframes 1 screenshot.jpeg

Take a screenshot on  Windows

ffmpeg -f x11grab -video_size $(xdpyinfo | grep dimensions | cut -d" " -f7) -i $DISPLAY -vframes 1 screenshot.jpg

 

Subscribe to my Newsletter

Receive emails about Linux, Programming, Automation, Life tips & Tricks and information about projects I'm working on