nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

recup-tiny (723B)


      1 #!/bin/sh
      2 
      3 recdir=$(realpath "${1:-$HOME/misc/recordings}")
      4 
      5 mkdir -p "$recdir"
      6 
      7 PICKED=$(eza --oneline --reverse --sort=created "$recdir" | fzf --reverse \
      8 	--preview="ffmpeg -i $recdir/{} -vf 'select=eq(n\,0)' -frames:v 1 -f image2pipe -vcodec png - 2>/dev/null | chafa --format=sixels --size=\${FZF_PREVIEW_COLUMNS}x\${FZF_PREVIEW_LINES} - 2>/dev/null || stat $recdir/{}")
      9 
     10 if [ -n "$PICKED" ]; then
     11 	ffmpeg -i "$recdir/$PICKED" -vf "scale=-2:720" -c:v libvpx-vp9 -deadline realtime -cpu-used 8 -crf 40 -b:v 0 -c:a libopus -b:a 64k -f webm - |
     12 		aws s3 cp - "s3://recordings/${PICKED%.*}.webm" --content-type video/webm
     13 
     14 	shirt "$(aws s3 presign "s3://recordings/${PICKED%.*}.webm" --expires-in 604800 | tr -d '\n')"
     15 fi