How to easily take a screenshot from the commandline with ffmpeg

How to easily take a screenshot from the commandline with ffmpeg

Show table of contents

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


What are your thoughts?

All comments are moderated and must adhere to the terms of service.

You might enjoy these similar articles:

Subscribe to my newsletter!