SHARE
TWEET

screen shots

costmuffled May 29th, 2020 (edited) 1,032 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unset a b c d e
  2. mkdir -p ~/.fonts
  3. if [ -z "$1" ]; then
  4.   echo Usage: ss1 filename sub_track_number \(or blank if raw\)
  5.   exit
  6. fi
  7. if [ -z "$2" ]; then d=-1; else d=$2; fi
  8. b=$1
  9. ln "$b" c.mkv
  10. echo Creating screenshots for $b
  11. if [ $d -ne -1 ]; then
  12.   ffmpeg -dump_attachment:t "" -i c.mkv
  13.   mv *.ttf *.TTF *.otf *.OTF *.ttc *.TTC ~/.fonts
  14.   fc-cache -fv ~/.fonts
  15.   ffmpeg -i c.mkv -map 0:s:$d subs.ass
  16. fi
  17. e=$(($(mkvinfo-text c.mkv | grep \+.Dur | cut -f4 -d' ' | cut -f1 -d'.')*3/4))
  18. # make 24 screenshots, or at least every 10 seconds
  19. if [ "$e" -gt 230 ]; then f=$((e/23)); else f=10; fi
  20. for ((b=1,c=1;(e-b)>0;b+=f,c++))
  21. do
  22.   if [ $d -ne -1 ]; then
  23.     ffmpeg -ss $b -i subs.ass subs2.ass
  24.     ffmpeg -probesize 100M -analyzeduration 100M -ss $b -i c.mkv -vf ass=subs2.ass -vframes 1 -pix_fmt rgb24 $c.png
  25.     rm subs2.ass
  26.   else
  27.     ffmpeg -ss $b -i c.mkv -vframes 1 -pix_fmt rgb24 $c.png
  28.   fi
  29. done
  30. if [ $d -ne -1 ]; then rm subs.ass; fi
  31. rm c.mkv
  32. unset a b c d e
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top