Welcome! Log In Create A New Profile

Advanced

Howto thumbnail videos in thunar

Posted by PrinceAMD 
Howto thumbnail videos in thunar
September 11, 2007 12:58PM
first open terminal as root
then
1, touch /usr/libexec/mplayer-thumbnailer
2, scite /usr/libexec/mplayer-thumbnailer
paste this in scite

#!/bin/bash
videofile=$(echo "$1" | sed -e 's/%20/ /g' | sed -e 's/%26/\&/g' | sed -e 's/%5B/\[/g' | sed -e 's/%5D/\]/g' | sed -e 's/%40/\@/g'  )

# If we only have a chunk, then file will return "data", so we must exit to prevent mplayer from hanging
[ "$(/usr/bin/file --brief "$videofile" | grep -e "^data$"wink" ] && exit

thumbfile="$2"
LENGTH=$(mplayer -nocache  -identify -vo null -ao null -frames 0 "$videofile"  | awk -F= '/ID_LENGTH/ {print $2}'| awk -F. '{print $1}')
RANDOM=$(date %+s)
START=$(((LENGTH / 100) * 15)) ; END=$(((LENGTH / 100) * 70)); LENGTH=$(($END - $START)) ; SHOT=$((($RANDOM % $LENGTH) + $START))
/usr/bin/mplayer -nojoystick -nolirc -nocache -noautosub -nosound -vf scale -vo jpeg:outdir=/tmp:quality=100 -ao null -ss "$SHOT" -frames 3 -zoom -xy 128 -slave "$videofile"
mv /tmp/00000002.jpg "$thumbfile" || rm -f /tmp/00000002.jpg 
rm -f /tmp/00000001.jpg /tmp/00000003.jpg 

then save.
3, chmod 755 /usr/libexec/mplayer-thumbnailer

4, touch /usr/share/thumbnailers/video-thumbs.desktop
5, scite /usr/share/thumbnailers/video-thumbs.desktop

paste this in scite

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=VIDEO Thumbnailer
MimeType=video/x-ms-wmv;video/mpeg;video/x-msvideo;video/quicktime;video/x-ms-asf;application/vnd.rn-realmedia;application/x-flash-video;video/x-matroska;video/mp4
X-Thumbnailer-Exec=/usr/libexec/mplayer-thumbnailer %i %o

then save.
6, chmod 644 /usr/share/thumbnailers/video-thumbs.desktop

7, /usr/lib/thunar/thunar-vfs-update-thumbnailers-cache-1

THE END!!!
Sorry, only registered users may post in this forum.

Click here to login