diff --git a/README.md b/README.md index 69879c1..16c02a9 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ $ ssh root@10.11.99.1 'chmod +x /home/root/restream' - `-o --output`: path of the output where the video should be recorded, as understood by `ffmpeg`; if this is `-`, the video is displayed in a new window and not recorded anywhere (default: `-`) - `-f --format`: when recording to an output, this option is used to force the encoding format; if this is `-`, `ffmpeg`’s auto format detection based on the file extension is used (default: `-`). - `-w --webcam`: record to a video4linux2 web cam device. By default the first found web cam is taken, this can be overwritten with `-o`. The video is scaled to 1280x720 to ensure compatibility with MS Teams, Skype for business and other programs which need this specific format. See [Video4Linux Loopback](#video4linux-loopback) for installation instructions. -- `--hflip`: mirror the web cam video (`--webcam` has to be set). By default or as only choice, some programs, such as Zoom and Discord, mirror the camera. This flag restores the correct orientation. +- `--mirror`: mirror the web cam video (`--webcam` has to be set). By default or as only choice, some programs, such as Zoom and Discord, mirror the camera. This flag restores the correct orientation. - `-m --measure`: use `pv` to measure how much data throughput you have (good to experiment with parameters to speed up the pipeline) - `-t --title`: set a custom window title for the video stream. The default title is "reStream". This option is disabled when using `-o --output` - `-u --unsecure-connection`: send framebuffer data over an unencrypted TCP-connection, resulting in more fps and less load on the reMarkable. See [Netcat](#netcat) for installation instructions. diff --git a/reStream.sh b/reStream.sh index c08d29f..d26a24a 100755 --- a/reStream.sh +++ b/reStream.sh @@ -59,7 +59,7 @@ while [ $# -gt 0 ]; do fi shift ;; - --hflip) + --mirror) # do nothing if --webcam is not set hflip=true shift @@ -81,7 +81,7 @@ while [ $# -gt 0 ]; do 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 --hflip # write to a webcam (yuv420p + resize + mirror)" + echo " $0 -w --mirror # write to a webcam (yuv420p + resize + mirror)" echo " $0 -u # establish a unsecure but faster connection" exit 1 ;; @@ -93,6 +93,11 @@ ssh_cmd() { ssh -o ConnectTimeout=1 -o PasswordAuthentication=no "root@$remarkable" "$@" } +# SSH_CONNECTION is a variable on reMarkable => ssh '' instead of ssh "" +remarkable_ip() { + ssh_cmd 'echo $SSH_CONNECTION' | cut -d\ -f3 +} + # check if we are able to reach the remarkable if ! ssh_cmd true; then echo "$remarkable unreachable or you have not set up an ssh key." @@ -215,7 +220,7 @@ if $unsecure_connection; then listen_port=16789 ssh_cmd "$restream_rs --listen $listen_port" & sleep 1 # give some time to restream.rs to start listening - receive_cmd="nc $remarkable $listen_port" + receive_cmd="nc $(remarkable_ip) $listen_port" else receive_cmd="ssh_cmd $restream_rs" fi