Skip to content
WJunction - Webmaster Forum

[linux] Create video thumbnails for all video in a specific folder

Status
Not open for further replies.
Need totem installed

- Copy the following script and save it as videothumb.sh

PHP:
#!/bin/bash

for video in "$1"/*.avi;
do
file=${video##*/}
wext=${file%%.*}
totem-video-thumbnailer -g 18 -s 200 "$video" "$wext".png
done

for video in "$1"/*.mpg;
do
file=${video##*/}
wext=${file%%.*}
totem-video-thumbnailer -g 18 -s 200 "$video" "$wext".png
done

for video in "$1"/*.mpeg;
do
file=${video##*/}
wext=${file%%.*}
totem-video-thumbnailer -g 18 -s 200 "$video" "$wext".png
done
- Move it to folder /bin

- Make it executable
Code:
chmod +x videothumb.sh
Usuage:

Code:
videothumb.sh <folder>
 

7 comments

If you want to add other video extension

add the following code at the end and replace mpeg with your desired video extension (it must be supported by totem)

PHP:
for video in "$1"/*.mpeg;
do
file=${video##*/}
wext=${file%%.*}
totem-video-thumbnailer -g 18 -s 200 "$video" "$wext".png
done

Yes, you can have the output to jpeg or jpg

by changing all png throughout the script by jpeg or jpg

-----

If you want to reduce the file size, change 200 (which is the width of each thumbnail) and 18 (which is the number of thumbnail to be taken) to a lower value :)
 
Status
Not open for further replies.

About the author

S
Active Member · Joined
625
Messages
18
Reactions
18
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom