commit b52f9afc282f3171c60d87f801a9be9cc5748411 Author: Rien Maertens Date: Wed Feb 12 13:13:14 2020 +0100 Create reStream.sh diff --git a/reStream.sh b/reStream.sh new file mode 100755 index 0000000..3eff4fe --- /dev/null +++ b/reStream.sh @@ -0,0 +1,40 @@ +#!/bin/sh +set -eo pipefail + +ssh_host="mohowzeg.usb" +landscape=true + +bin_head="/opt/bin/head" +bin_zstd="/opt/bin/zstd" +bin_ncat="/opt/bin/netcat" +width=1408 +height=1872 +bytes_per_pixel=2 + +if ! ssh "$ssh_host" true; then + echo "$ssh_host unreachable" + exit 1 +fi + +for prog in $bin_head $bin_zstd $bin_ncat; do + if ! ssh "$ssh_host" "[ -f $prog ]"; then + echo "Program $prog is not present on $ssh_host." + exit 1 + fi +done + + +window_bytes="$(($width*$height*$bytes_per_pixel))" +landscape_param="$($landscape && echo '-vf transpose=1')" +read_loop="while $bin_head -c $window_bytes /dev/fb0; do sleep .03; done | $bin_zstd" + +ssh "$ssh_host" "$read_loop" \ + | zstd -d \ + | pv - \ + | ffplay -vcodec rawvideo \ + -loglevel error \ + -f rawvideo \ + -pixel_format gray16le \ + -video_size "$width,$height" \ + $landscape_param \ + -i -