#!/bin/bash # blurp last frame from video to ascii # not using anything from singularity, needs: # ffmpeg and jp2a (and maybe imagemagick) # usage: # lastFrame *.mp4 # with parallel: # find . -name "*.mp4" | parallel --gnu lastFrame {} # tmp dir http://mywiki.wooledge.org/BashFAQ/062 tmp="/tmp/$RANDOM-$$" trap '[ -n "$tmp" ] && rm -fr "$tmp"' EXIT mkdir -m 700 "$tmp" || { echo '!! unable to create a tmpdir' >&2; tmp=; exit 1; } # main while [ $# -gt 0 ]; do # blurp frame termheight="$(tput lines)" height="$(( termheight / 3 * 2 ))" #echo $termheight $height ffmpeg -hide_banner -loglevel error -sseof -1 -i "$1" -update 1 -q:v 1 "$tmp/last.png" -y && echo "$1" && jp2a --colors --color-depth=24 --background=dark --height=${height} --fill --border "$tmp/last.png" echo; echo shift done #stty sane