Tuesday 28 March 2017

Take screeshot gallery of a video

#apt-get install ffmpeg
#apt-get install imagemagick
#!/bin/bash
# This script will create a screenshot gallery of a given video very fast


filename=$1

videolable=$1

#ffmpeg  -i $filename -r 0.0033 -vf scale=-1:120 -vcodec png capture-2d.png

ffmpeg -ss 00:00:10 -i $filename -frames 1 -vf "select=not(mod(n\,1000)),scale=320:240,tile=2x3" ff.png


res=`ffmpeg -i $filename 2>&1 | grep -oP 'Stream .*, \K[0-9]+x[0-9]+'`

size=`du -h $filename | awk '{print $1}'`

duration=`ffmpeg -i $filename 2>&1 | grep Duration | cut -d ' ' -f 4 | sed s/,//`


#montage -border 10x10 -pointsize 14  -background black -fill white -gravity NorthWest  -title "\n$filename ( $res )\nSize:$size  Duration:$duration "  out.png screenshotgallery.png



width=`convert ff.png -ping -format "%w" info:`
height=120
fontsize=20


text="$videolable\nResolution($res)\nSize:($size)\nDuration:$duration\n"




convert -background white -fill black  \
           -size ${width}x${height} -pointsize 24 label:${text}  label.gif






convert -append ff.png   label.gif out.jpg

rm ff.png

echo "Done!"

How to install ffmpeg on Debian 8

is now available for Jessy as a backport: https://packages.debian.org/jessie-backports/ffmpeg
Add something like this to /etc/apt/sources.list (with your preferred mirror):
deb http://ftp.uk.debian.org/debian jessie-backports main
Then
apt-get update
apt-get install ffmpeg

Source: https://superuser.com/a/1082860