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!
-
Well your command takes very many photoshots and does not assemble them as I wished to make a
gallery
. A much better command that I just found is this:ffmpeg -ss 00:00:10 -i in.mp4 -frames 1 -vf "select=not(mod(n\,1000)),scale=320:240,tile=2x3" out.png
. What I miss in that is just to add title, filetype, resolution and size.– wbadJan 20, 2017 at 5:30
vcsi can do this. It is a command-line tool written in Python.
vcsi video.mkv -o output.jpg
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:
-
Well, I want a screenshot GALLERY, that is, the shots should be taken at even timing from the WHOLE video. How to do that using mplayer command?– wbadJan 20, 2017 at 5:48
-
@wbad Lose the 'frames 5` option I gave:
mplayer -nosound -vo png:z=9 file.mp4
– andrew.46 ♦Jan 20, 2017 at 5:54 -
-
@wbad My suspicion is that your answer will come from either FFmpeg or MPlayer with FFmpeg being the better choice...– andrew.46 ♦Jan 20, 2017 at 20:06
scrot
would not be useful for me.