Skip to content

Instantly share code, notes, and snippets.

@dillonchr
Created August 5, 2021 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dillonchr/fff8c02c5bef78db979eb23d7d91779f to your computer and use it in GitHub Desktop.
Save dillonchr/fff8c02c5bef78db979eb23d7d91779f to your computer and use it in GitHub Desktop.
scene thumbnailer
#!/bin/bash
SOURCE="$1"
TS_FILE=raw_timestamps
ffmpeg -i "$SOURCE" -filter:v "select='gt(scene,0.4)',showinfo" -f null - 2> $TS_FILE
TIMES=$(grep showinfo $TS_FILE | grep 'pts_time:[0-9.]*' -o | grep '[0-9]*\.[0-9]*' -o)
for ts in $TIMES
do
ffmpeg -ss "$ts" -i "$SOURCE" -vframes 1 -q:v 5 "t_${ts}.jpg"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment