I'm wondering if there is any command line tool to take clean and fast screenshot gallery of a video?
3 Answers
Once you edited your question I can see what you wish is to extract some frames from a video in order to be used like a gallery of the contents of such video file. So we're going to use the ffmpeg command in order to do this job.
First of all we need to install ffmpeg which can be done by dropping this in a terminal:
sudo apt-get install ffmpeg
Once installed, make sure you are in the right directory in the terminal and once you have found your video file in the results of the ls command, write this in the terminal:
ffmpeg -i video.avi -r 0.5 -f image2 output_%05d.jpg
This will extract a frame from every 2 seconds, which you can adjust if first we explain/understand the parameters of this command as follows:
ffmpeg= Is the program which will do the conversion/extraction.-i video.avi= Indicates the "input" file, can be an absolute or relative path-r 0.5= this indicates the framerate, which can be used to calculate how many frames are we going to use/skip in order to get the right number of frames we need from the video.-f image2= a)-f"force format" b)image2"Image file demuxer" (let's read it as: force convert to image)output_%05d.jpg= it the filename's pattern which be used in order to drop images with sequential filenames with five trailing zeroes so they will be perfectly arranged in a list.
Give this a try and you may wish to read more about the ffmpeg command options by using the ffmpeg --help command in a terminal or in the proper documentation webpage at https://ffmpeg.org/documentation.html
Good luck!
- 19,772
This can be easily accomplished by using the command line mplayer, install this as follows:
sudo apt-get install mplayer
To generate screenshots manually while watching your video use the following syntax:
mplayer -vf screenshot file.mp4
While this running simply press the lower case 's' key to generate a screenshot. To generate multiple screen shots automatically simply press the upper case 'S' key and this will generate screenshots until you press 'S' again.
If you want a little more control of the output try something like the following:
mplayer -nosound -frames 5 -vo png:z=9 file.mp4
This will output the first 5 frames of the media file in high quality png format into the working directory. Similar screenshots can be taken by using jpeg, gif89a, targa and pnm as '-vo'.
References:
- 39,359