Skip to content

Instantly share code, notes, and snippets.

@tyabu12
Last active December 21, 2018 15:10
Show Gist options
  • Save tyabu12/6d604a35fd8bc72650e9db1e63c9d71b to your computer and use it in GitHub Desktop.
Save tyabu12/6d604a35fd8bc72650e9db1e63c9d71b to your computer and use it in GitHub Desktop.
Thumbnails generator script using VLC.
#!/bin/bash
VLC="vlc -I dummy"
TARGET_DIR="movies"
THUMBNAIL_DIR="movies/thumbnails"
THUMBNAIL_FMT="jpg"
set -eux
gen_options() {
local options=''
while read target; do
filename=`basename $target`;
filename=${filename%.*};
options="$options $target \
--rate=1 \
--video-filter=scene \
--vout=dummy \
--start-time=10 \
--stop-time=11 \
--scene-format=$THUMBNAIL_FMT \
--scene-ratio=24 \
--scene-prefix=${filename}_ \
--scene-path=$THUMBNAIL_DIR"
done
echo $options
return 0
}
$VLC `find $TARGET_DIR -mindepth 1 -type f | gen_options` "vlc://quit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment