Format
This commit is contained in:
parent
006d83e9b8
commit
a46eb517e8
226
reStream.sh
226
reStream.sh
@ -25,85 +25,85 @@ unsecure_connection=false # Establish a unsecure connection that
|
|||||||
# loop through arguments and process them
|
# loop through arguments and process them
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-v | --version)
|
-v | --version)
|
||||||
echo "reStream version: v$version"
|
echo "reStream version: v$version"
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
-p | --portrait)
|
-p | --portrait)
|
||||||
landscape=false
|
landscape=false
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-c | --cursor)
|
-c | --cursor)
|
||||||
cursor=true
|
cursor=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-s | --source)
|
-s | --source)
|
||||||
remarkable="$2"
|
remarkable="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-o | --output)
|
-o | --output)
|
||||||
output_path="$2"
|
output_path="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-f | --format)
|
-f | --format)
|
||||||
format="$2"
|
format="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-m | --measure)
|
-m | --measure)
|
||||||
measure_throughput=true
|
measure_throughput=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-w | --webcam)
|
-w | --webcam)
|
||||||
webcam=true
|
webcam=true
|
||||||
format="v4l2"
|
format="v4l2"
|
||||||
|
|
||||||
# check if there is a modprobed v4l2 loopback device
|
# check if there is a modprobed v4l2 loopback device
|
||||||
# use the first cam as default if there is no output_path already
|
# use the first cam as default if there is no output_path already
|
||||||
cam_path=$(v4l2-ctl --list-devices \
|
cam_path=$(v4l2-ctl --list-devices |
|
||||||
| sed -n '/^[^\s]\+platform:v4l2loopback/{n;s/\s*//g;p;q}')
|
sed -n '/^[^\s]\+platform:v4l2loopback/{n;s/\s*//g;p;q}')
|
||||||
|
|
||||||
# fail if there is no such device
|
# fail if there is no such device
|
||||||
if [ -e "$cam_path" ]; then
|
if [ -e "$cam_path" ]; then
|
||||||
if [ "$output_path" = "-" ]; then
|
if [ "$output_path" = "-" ]; then
|
||||||
output_path="$cam_path"
|
output_path="$cam_path"
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Could not find a video loopback device, did you"
|
|
||||||
echo "sudo modprobe v4l2loopback"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
shift
|
else
|
||||||
;;
|
echo "Could not find a video loopback device, did you"
|
||||||
--mirror)
|
echo "sudo modprobe v4l2loopback"
|
||||||
# do nothing if --webcam is not set
|
|
||||||
hflip=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-t | --title)
|
|
||||||
window_title="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-u | --unsecure-connection)
|
|
||||||
unsecure_connection=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-h | --help | *)
|
|
||||||
echo "Usage: $0 [-p] [-c] [-u] [-s <source>] [-o <output>] [-f <format>] [-t <title>] [-m] [-w] [--hflip]"
|
|
||||||
echo "Examples:"
|
|
||||||
echo " $0 # live view in landscape"
|
|
||||||
echo " $0 -p # live view in portrait"
|
|
||||||
echo " $0 -c # show a cursor where the pen is hovering (rM2 only)"
|
|
||||||
echo " $0 -s 192.168.0.10 # connect to different IP"
|
|
||||||
echo " $0 -o remarkable.mp4 # record to a file"
|
|
||||||
echo " $0 -o udp://dest:1234 -f mpegts # record to a stream"
|
|
||||||
echo " $0 -w --mirror # write to a webcam (yuv420p + resize + mirror)"
|
|
||||||
echo " $0 -u # establish a unsecure but faster connection"
|
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--mirror)
|
||||||
|
# do nothing if --webcam is not set
|
||||||
|
hflip=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-t | --title)
|
||||||
|
window_title="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-u | --unsecure-connection)
|
||||||
|
unsecure_connection=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h | --help | *)
|
||||||
|
echo "Usage: $0 [-p] [-c] [-u] [-s <source>] [-o <output>] [-f <format>] [-t <title>] [-m] [-w] [--hflip]"
|
||||||
|
echo "Examples:"
|
||||||
|
echo " $0 # live view in landscape"
|
||||||
|
echo " $0 -p # live view in portrait"
|
||||||
|
echo " $0 -c # show a cursor where the pen is hovering (rM2 only)"
|
||||||
|
echo " $0 -s 192.168.0.10 # connect to different IP"
|
||||||
|
echo " $0 -o remarkable.mp4 # record to a file"
|
||||||
|
echo " $0 -o udp://dest:1234 -f mpegts # record to a stream"
|
||||||
|
echo " $0 -w --mirror # write to a webcam (yuv420p + resize + mirror)"
|
||||||
|
echo " $0 -u # establish a unsecure but faster connection"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -146,45 +146,45 @@ fi
|
|||||||
rm_version="$(ssh_cmd cat /sys/devices/soc0/machine)"
|
rm_version="$(ssh_cmd cat /sys/devices/soc0/machine)"
|
||||||
|
|
||||||
case "$rm_version" in
|
case "$rm_version" in
|
||||||
"reMarkable 1.0")
|
"reMarkable 1.0")
|
||||||
width=1408
|
width=1408
|
||||||
|
height=1872
|
||||||
|
bytes_per_pixel=2
|
||||||
|
fb_file="/dev/fb0"
|
||||||
|
pixel_format="rgb565le"
|
||||||
|
;;
|
||||||
|
"reMarkable 2.0")
|
||||||
|
if ssh_cmd "[ -f /dev/shm/swtfb.01 ]"; then
|
||||||
|
width=1404
|
||||||
height=1872
|
height=1872
|
||||||
bytes_per_pixel=2
|
bytes_per_pixel=2
|
||||||
fb_file="/dev/fb0"
|
fb_file="/dev/shm/swtfb.01"
|
||||||
pixel_format="rgb565le"
|
pixel_format="rgb565le"
|
||||||
;;
|
else
|
||||||
"reMarkable 2.0")
|
width=1872
|
||||||
if ssh_cmd "[ -f /dev/shm/swtfb.01 ]"; then
|
height=1404
|
||||||
width=1404
|
fb_file=":mem:"
|
||||||
height=1872
|
|
||||||
bytes_per_pixel=2
|
|
||||||
fb_file="/dev/shm/swtfb.01"
|
|
||||||
pixel_format="rgb565le"
|
|
||||||
else
|
|
||||||
width=1872
|
|
||||||
height=1404
|
|
||||||
fb_file=":mem:"
|
|
||||||
|
|
||||||
# Use updated video settings?
|
# Use updated video settings?
|
||||||
if is_current_rm_firmware_version_ge $rm2_old_firmware_version; then
|
if is_current_rm_firmware_version_ge $rm2_old_firmware_version; then
|
||||||
echo "Using the newer :mem: video settings."
|
echo "Using the newer :mem: video settings."
|
||||||
bytes_per_pixel=2
|
bytes_per_pixel=2
|
||||||
pixel_format="gray16be"
|
pixel_format="gray16be"
|
||||||
video_filters="$video_filters colorlevels=rimin=0:rimax=29/255:gimin=0:gimax=29/255:bimin=0:bimax=29/255,transpose=3"
|
video_filters="$video_filters colorlevels=rimin=0:rimax=29/255:gimin=0:gimax=29/255:bimin=0:bimax=29/255,transpose=3"
|
||||||
# Use the previous video settings.
|
# Use the previous video settings.
|
||||||
else
|
else
|
||||||
echo "Using the older :mem: video settings."
|
echo "Using the older :mem: video settings."
|
||||||
bytes_per_pixel=1
|
bytes_per_pixel=1
|
||||||
pixel_format="gray8"
|
pixel_format="gray8"
|
||||||
video_filters="$video_filters,transpose=2"
|
video_filters="$video_filters,transpose=2"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
;;
|
fi
|
||||||
*)
|
;;
|
||||||
echo "Unsupported reMarkable version: $rm_version."
|
*)
|
||||||
echo "Please visit https://github.com/rien/reStream/ for updates."
|
echo "Unsupported reMarkable version: $rm_version."
|
||||||
exit 1
|
echo "Please visit https://github.com/rien/reStream/ for updates."
|
||||||
;;
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# technical parameters
|
# technical parameters
|
||||||
@ -278,10 +278,10 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2086,SC2090
|
# shellcheck disable=SC2086,SC2090
|
||||||
$receive_cmd \
|
$receive_cmd |
|
||||||
| $decompress \
|
$decompress |
|
||||||
| $host_passthrough \
|
$host_passthrough |
|
||||||
| (
|
(
|
||||||
"$output_cmd" \
|
"$output_cmd" \
|
||||||
-vcodec rawvideo \
|
-vcodec rawvideo \
|
||||||
-loglevel "$loglevel" \
|
-loglevel "$loglevel" \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user