#!/bin/env bash # usage: script.sh [] if [ ! "$1" ]; then echo Specify an input.; exit; fi if [ ! -e "$1" ]; then echo \"$1\" doesn\'t exist.; exit; fi if [ "$2" ]; then output="${2%.*}.png"; else output="${1%.*}.png"; fi if [ -e "$output" ]; then echo Output exists, specify another name.; exit; fi size=$(echo "sqrt($(stat -c%s "$1")/8)+0.5/1" | bc) cat "$1" /dev/zero - | ffmpeg -f rawvideo -s ${size}:${size} -pix_fmt rgba64be -i - -vframes 1 "$output" echo Playback with\: echo ffmpeg -i \"$output\" -f rawvideo - \| mpv -