Giter Club home page Giter Club logo

restream's Introduction

reStream

reMarkable screen sharing over SSH.

rm1 rm2

A demo of reStream

Installation

Requirements

On your host machine

  • Any POSIX-shell (e.g. bash)
  • ffmpeg (with ffplay)
  • ssh
  • lz4

Unix

  1. Install lz4 on your host with your usual package manager.
    On Ubuntu, apt install liblz4-tool will do the trick.
  2. Set up an SSH key and add it to the ssh-agent, then add your key to the reMarkable with ssh-copy-id [email protected].

Note: the reMarkable 2 doesn't support ed25519 keys. If it's your case, try generating an ecdsa or rsa key. Try out ssh [email protected], it should not prompt for [email protected]'s password.

Windows

  1. Install ffmpeg for windows.
  2. Download lz4 for windows and extract the zip to a folder where you'll remember it (e.g. C:\Users\{username}\lz4).
  3. Add the ffmpeg and lz4 directories to the windows Path environment. Here is a quick guide how.
    • Control Panel > Edit the system environment variables > Environment Variables
    • Find the Path variable under System variables, click edit.
    • Add two New entries: one to the bin directory in the ffmpeg directory, and one to the lz4 directory you created.
    • Click OK
  4. (Re)start bash so the new Path is used.
  5. Generate a new ssh-key using ssh-keygen.
  6. Send the public key to the reMarkable (connect trough USB cable) using ssh-copy-id -i ~/.ssh/id_rsa [email protected]
  7. Try out ssh [email protected], it should not prompt for a password.

reStream installation

The instructions below will install the files from the latest release. In particular, reStream.sh is the executable on the host, and restream.arm.static is the binary which has to be moved to the reMarkable with the name restream.

Host

Download reStream.sh and make it executable

$ chmod +x reStream.sh
Tip

If you save reStream.sh in a PATH directory as reStream, you can launch it as reStream.
On Ubuntu, list these folders with echo $PATH. One should be/usr/local/bin.
As root, download the executable there:

# wget https://github.com/rien/reStream/releases/latest/download/reStream.sh -O /usr/local/bin/reStream
# chmod +x /usr/local/bin/reStream

reMarkable

You can install restream on reMarkable in three ways.

  • Install via toltec if you use it.
$ ssh [email protected] 'opkg install restream'
  • If you have access to internet on your reMarkable, download directly the binary onto it:
$ ssh [email protected] 'wget https://github.com/rien/reStream/releases/latest/download/restream.arm.static -O /home/root/restream && chmod +x /home/root/restream'
  • Download the restream binary onto your host, move it to reMarkable and make it executable.
$ scp restream.arm.static [email protected]:/home/root/restream
$ ssh [email protected] 'chmod +x /home/root/restream'

Usage

  1. Connect your reMarkable with the USB cable.
  2. Make sure you can open an SSH connection.
  3. Run ./reStream.sh in the script directory or reStream if you've installed it in your PATH
  4. A screen will pop-up on your local machine, with a live view of your reMarkable!

Options

  • -h --help: show usage information
  • -p --portrait: shows the reMarkable screen in portrait mode (default: landscape mode, 90 degrees rotated tot the right)
  • -s --source: the ssh destination of the reMarkable (default: [email protected])
  • -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 for installation instructions.
  • --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 for installation instructions.

If you have problems, don't hesitate to open an issue or send me an email.

Extra Dependencies

On your host machine:

  • Video4Linux Loopback kernel module if you want to use --webcam
  • netcat if you want to use --unsecure-connection

Video4Linux Loopback

To set your remarkable as a webcam we need to be able to fake one. This is where the Video4Linux Loopback kernel module comes into play. We need both the dkms and util packages. On Ubuntu you need to install:

# apt install v4l2loopback-utils v4l2loopback-dkms

In some package managers v4l2loopback-utils is found in v4l-utils.

After installing the module you must enable it with

# modprobe v4l2loopback

To verify that this worked, execute:

$ v4l2-ctl --list-devices

The result should contain a line with "platform:v4l2loopback".

Netcat

To use an unsafe and faster connection, we need the command nc, abbreviation of netcat.
If your system does not provide nc, the output of command -v nc is empty. In this case you need to install it.
Several implementations of netcat exists. On Ubuntu, you can install the version developed by OpenBSD, which is light and supports IPv6:

# apt install netcat-openbsd

Troubleshooting

Steps you can try if the script isn't working:

  • Set up an SSH key
  • Update ffmpeg to version 4.
  • Make sure RSA keys are allowed on your system:
    • In some modern Unix distributions, RSA keys are considered "legacy" and will no longer work out of the box.
    • Therefore you need to add a section to your ~.ssh/config file to allow use of RSA ssh keys for specified hosts. (according to https://remarkablewiki.com/tech/ssh, Remarkable devices might not work with non-RSA keys, which is the reason for why this is necessary.)
    • This example should work without any additional configuration, although PubkeyAcceptedKeyTypes=ssh-rsa is required if you want to modify it:
      Host remarkable
          HostName 10.11.99.1
          User root
          PubkeyAcceptedKeyTypes=ssh-rsa
      
    • You can then use the -s flag to connect to the Remarkable: ./reStream.sh -s remarkable

Development

If you want to play with the restream code, you will have to install Rust.

There are three ways of building the required restream binary for streaming the reMarkable framebuffer. For these approaches, the generated restream binary will be located under target/armv7-unknown-linux-gnueabihf/release/restream.

  • Using nix flakes With Nix installed you can create the development environment with nix-shell or (when using Nix flakes nix-develop. After which you can simply run cargo build --release to build the restream binary on your machine.

  • Using docker and the toltec toolchain: You can use the toltec toolchain docker images to build a restream binary compatible with the reMarkable.

    docker run --rm -v $(pwd):/project -v /project/.cargo -w "/project" ghcr.io/toltec-dev/rust:latest cargo build --release --target=armv7-unknown-linux-gnueabihf
    
  • Using the reMarkable toolchain: Setup the reMarkable toolchain to do cross-platform development.

Like using reStream?

I made this project in my spare time and received help from a handful of wonderful contributors. If you want to say thanks, please send me an email and be sure to mention how you are using this project.

I do not accept donations. There are charities that need more financial support than I do, so please consider supporting a local charity instead. Preferably one that promotes diversity in technology like GirlsWhoCode, CoderDojo, etc.

restream's People

Contributors

aarondavidschneider avatar abmantis avatar beardhatcode avatar cloudsftp avatar danshick avatar emerinohdz avatar f3fora avatar itay-grudev avatar jegp avatar linuscde avatar lluchs avatar matteodelabre avatar murph avatar nicksen782 avatar rien avatar simlefjes avatar thebeanogamer avatar utopiah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

restream's Issues

unsecure-connection in README.md

The documentation of unsecure-connection flag in README.md is missing.

I think it is sufficient to add a point in the Usage/Options section, for example

  • -u --unsecure-connection: send framebuffer data over an unencrypted TCP-connection, resulting in more fps and less load on the reMarkable. See Unsecure Connection for installation instructions.

And a subsection Unsecure Connection in Requirements. I do not use apt, so I do not know for Ubuntu how is call the package name of netcat, which provides the command nc and which implementation do you want to use.

Add option to pass extra video filters

Add a simple way to add extra video filters to ffplay. I propose -e | --extra-filters which would set the next argument as the initial value for video_filters.

One use case for this would be to invert the video (see issue #69).

unsecure-connection on Windows

Hi,

I was wondering if any special arrangements have to be made for running reStream on windows using --unsecure-connection.
I have a binary for netcat on path (this one), however either with or without it, running reStream results in garbage being printed on stdout (it works fine over ssh).

Am I missing some step, or could it just be a "I'm on windows" problem? (Say, nc being the gnu one rather than bsd).

Permission Issues

This is most likely on some failed configuration on my end, but weirdly reStream stopped working for me after not using it for like two months now and I didn't really change anything.

I tried reinstalling the most recent version of reStream (from the main branch, the version of today included) -- i.e. I also reinstalled the restream.arm binary on the remarkable.

When I start reStream, after entering my ssh password several times, I get the following output:

[email protected]: Permission denied (publickey,password).f=0/0 Input #0, rawvideo, from 'pipe:': 0KB vq= 0KB sq= 0B f=0/0 Duration: N/A, bitrate: 525657 kb/s Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 1872x1404, 525657 kb/s, 25 tbr, 25 tbn, 25 tbc nan M-V: nan fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0

Where might the "Permission denied" part come from?
Did I miss to reconfigure something after my Remarkable made an update or something maybe?

dd optimisation

Is it possible to be more selective with dd or write a c utility that samples the framebuffer better to get the speed up we need. Seems going via gp compression has already proved how much gain is to be had but we undo the good at the other end.

The framebuffer should be structured enough to let us be more intelligent.

Been so long since I did any C coding I may have to hello world and try this.

General optimization idea's and findings

Given that ffmpeg is in entware, has anyone tried to use a real video codec to grab from /dev/fb0 instead of using lz4 on the raw bytes? I think this should in principle implement @rien's bsdiff idea (changes between frames are small, so this will reduce IO throttle) that I saw on the reddit post. I was able to get a stream to show by doing

ssh [email protected] -- /opt/bin/ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -c:v libx264 -preset ultrafast -pix_fmt yuv420p -f rawvideo - | ffplay -i -

but it seems heavily laggy. It does seem to encode at a framerate of just over 1 per second, so there's clearly a long way to go. It also definitely seems like ffplay is waiting for a buffer to accumulate before playing anything. I'm really curious as to whether a more ingenious choice of codecs/ffmpeg flags would be availing.

Here's some sample output of ffmpeg if I set the loglevel of ffplay to quiet:

ffmpeg version 3.4.7 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.0 (OpenWrt GCC 8.3.0 r1148-dbf3d603)
  configuration: --enable-cross-compile --cross-prefix=arm-openwrt-linux-gnueabi- --arch=arm --cpu=cortex-a9 --target-os=linux --prefix=/opt --pkg-config=pkg-config --enable-shared --enable-static --enable-pthreads --enable-zlib --disable-doc --disable-debug --disable-lzma --disable-vaapi --disable-vdpau --disable-outdevs --disable-altivec --disable-vsx --disable-power8 --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-inline-asm --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-mmi --disable-fast-unaligned --disable-runtime-cpudetect --enable-lto --disable-vfp --disable-neon --enable-avresample --enable-libopus --enable-small --enable-libshine --enable-gpl --enable-libx264
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[fbdev @ 0xb80400] w:1404 h:1872 bpp:16 pixfmt:rgb565le fps:1/1 bit_rate:42052608
[fbdev @ 0xb80400] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, fbdev, from '/dev/fb0':
  Duration: N/A, start: 1586221544.651449, bitrate: 42052 kb/s
    Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1404x1872, 42052 kb/s, 1 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0xb84590] using cpu capabilities: none!
[libx264 @ 0xb84590] profile Constrained Baseline, level 5.0, 4:2:0, 8-bit
Output #0, rawvideo, to 'pipe:':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 1404x1872, q=-1--1, 1 fps, 1 tbn, 1 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=   10 fps=1.0 q=2.0 size=     216kB time=00:00:09.00 bitrate= 196.8kbits/s speed=0.919x

I think one of the big slowdowns here is it's taking the input stream as [fbdev @ 0xb80400] w:1404 h:1872 bpp:16 pixfmt:rgb565le fps:1/1 bit_rate:42052608, rather than the 2 bytes-per-pixel gray16le stream that reStream is using - I can't seem to configure this though.

Also, is lz4 really faster than zstd?

Latency grows over time

Hi, I've been trying to use this to stream my remarkable's screen - but although it starts out having low latency, the latency grows significantly over time, to > 5 seconds after less than a minute of use. I'm not sure what is going wrong.

I have lz4 installed (v1.8.1 on host, precompiled version on remarkable), ffmpeg 4.2.2, and I'm on macOS 10.13.6. The tablet is connected via USB.

Thanks for the help!

Invalide buffer size

Hi,
when running reStream I get an ffmpeg error:

[rawvideo @ 0x7f523c004400] Invalid buffer size, packet size 3215360 < expected frame_size 5271552

The screen shows but ffmpeg throws this error.
I am using ffplay version 4.1.4-1build2 and Remarkable 2.1.1.3

FrameBuffer as Video Device

Hi,

Thank you for sharing these scripts, that's awesome!

Do you know if I can use the streamed framebuffer as new "video" device on the host? I would like to select the reMarkable as a video source in WebRTC/Skype/Zoom/etc. calls and wonder what needs to be done for that.

Thanks a lot,
Axel

remarkable 2 (at least with version 2.7.0.51) do have root passwords

I was trying to add my ssh key to my reMarkable 2 running 2.7.0.51 of the software. The README states:

Note: the reMarkable 2 doesn't support ed25519 keys, those users should generate and rsa key. Try out ssh [email protected], it should not prompt for a password.

When I try to copy my key to my reMarkable, I get prompted for a password:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] 
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/mark/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: 

The root password can be found in recent versions of the software by going to:

Settings > Help > Copyrights and licenses > General Information

Beneathe the GPLv3 Compliance statement, there is a paragraph that states the password:

To do so, this device acts as an USB ethernet device, and you can connect using the SSH protocol using the username `root` and the password `YourUniquePassword`

I'm not sure if the root password is new, but I wanted to share this with anyone else encountering this problem.

Blank/white screen when using WSL 2

I'm using WSL 2 with Ubuntu (I read #24 and installed any missing dependencies from there), and the script starts fine and a window shows. However, my window is just a blank white screen. It seems like the first frame may be a valid frame, but subsequent frames just are showing up as blank/white

The console output seems normal:

$ ./restream.sh
[SSH] true
[SSH] cat /sys/devices/soc0/machine
[SSH] [ ! -f ~/restream ] && [ ! -f /opt/bin/restream ]
[SSH] PATH="$PATH:/opt/bin/:." restream -h 1872 -w 1408 -b 2 -f /dev/fb0
ffplay version 4.2.4-1ubuntu0.1 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rawvideo, from 'pipe:':  0KB vq=    0KB sq=    0B f=0/0   
  Duration: N/A, start: 0.000000, bitrate: 1054310 kb/s
    Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1408x1872, 1054310 kb/s, 25 tbr, 25 tbn, 25 tbc

I'm trying to see if this is a WSL specific issue and see if I can get it to work with Windows, but not sure if I'm going to get everything working tonight since Windows isn't great for this kind of stuff haha.

Recording audio from host pc: synchronize audio and video

I've spent an hour trying to record audio and sync'ing with the video. I'm gonna paste my findings here and possibly get back to this issue when I have the time.

Just put -f pulse -ac 2 -i default to ffmpeg command and it'll record the audio. However, ffmpeg is very picky about ordering of the args. You must put these options after output path.

Also, I've tried to use the arg -use_wallclock_as_timestamps 1, but it wasn't good enough. This thread has a few other methods to try: https://superuser.com/questions/1042988/ffmpeg-audio-out-of-sync-when-transcoding-demuxing-from-dv/1054478

I've also tried to replace ffmpeg with gst-launch, but I only managed to capture the first frame and that's another story anyway.

Latency grows over time #2

I have the same issue as in Issue #16, that was acutally never resolved. I have lz4 installed on host and on the reMarkable. It's a reMarkable 1, the software version is 2.5.0.27 and I'm running macOS 11.1 on the host. This is the output of ffmpeg:

ffplay version 4.3.1 Copyright (c) 2003-2020 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.21)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_3 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, rawvideo, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: 1054310 kb/s
    Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1408x1872, 1054310 kb/s, 25 tbr, 25 tbn, 25 tbc
  85.71 M-V:  0.001 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

Dark Mode

Hi! This is a feature request / question.

I was wondering if it'd be possible to stream in "dark mode", where everything is just inverted. I do some streaming and usually I have dark colors for everything, but then I have a big white screen that makes people not as happy 😆

Anyway, love the project and twitch chat is always impressed with how cool it looks :)

Thanks!

lz4 Error 44

Dear guys,

I've installed reStream on an ubuntu system, and run it with my new remarkable 2. My remarkable recently updated to version 2.9. All install steps were seemingly successful.

Running reStream, the output indicates ffplay is executed with a corrupt stream(?), seemingly caused by a decompression problem with lz4(?).

Here's the full output:

[SSH] true
[SSH] cat /sys/devices/soc0/machine
[SSH] [ -f /dev/shm/swtfb.01 ]
[SSH] [ ! -f ~/restream ] && [ ! -f /opt/bin/restream ]
[SSH] PATH="$PATH:/opt/bin/:." restream -h 1404 -w 1872 -b 1 -f :mem:
*** LZ4 command line interface 64-bits v1.9.2, by Yann Collet ***
ffplay version 4.2.4-1ubuntu0.1 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Error 44 : Unrecognized header : file cannot be decoded  0B f=0/0   
Input #0, rawvideo, from 'pipe:':
  Duration: N/A, bitrate: 525657 kb/s
    Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 1872x1404, 525657 kb/s, 25 tbr, 25 tbn, 25 tbc
^C  nan M-V:    nan fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   

A little googling on lz4 and error 44 pointed me here: lz4/lz4#584 , but I wouldn't hope I need to create my own lz4 to get along..

Any suggestions what could be the reason to my problem, or a way to resolve or debug?

Kind regards,
Aril

Stream rm2 output in color

Hello,

during the implementation of reStream for reMarkable2 one person posted a comment that apparently you can stream the display in full color: #28 (comment)

Would it be possible to integrate this feature into the library, so that for example the "Highlighter" pen actually appears yellow instead of gray (like it does when the PDF is exported)?

Thanks and kudos for this awesome project!

grabbing a single frame as CLI argument or image fileformat

I often need to grab a single image in order to add to my online notebooks or share a drawing to friends and colleagues. What I end up doing is the following

rm rm2.jpg; reStream.sh -s remarkable2 -p -o rm2.jpg & sleep 10 && kill $!; gwenview rm2.jpg

It works reliably well but it's not straightforward.

PS: just discovered https://github.com/cloudsftp/reSnap , not sure if that's better to have 2 separate utilities when arguably most of the work is already done here.

reMarkable screen not shown on computer screen

This is an amazing project, great work and glad you shared it with the community!

I followed the instruction (apart from installing lz4) and for some reason the screen is not showing up for me. Here's the log from my terminal:

./reStream.sh
Your remarkable does not have lz4.
Falling back to gzip, your experience may not be optimal.
Go to https://github.com/rien/reStream/#sub-second-latency for a better experience.
ffplay version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2003-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  89
  Current serial number in output stream:  90

My reMarkable software version is 2.2.0.48
Trying it on Ubuntu 18.04

It seems that there's an error in the log:

X Error of failed request:  BadValue (integer parameter out of range for operation)

What could be the possible culprit?

ffmpeg error "Segmentation fault (core dumped)"

Using Windows Subsystem Linux (WSL) I run into the error Segmentation fault (core dumped). Updating ffmpeg to 4.2.2. does not help. Not quite sure how to solve.

Full output:

$ ./reStream.sh
Your remarkable does not have lz4.
Falling back to gzip, your experience may not be optimal.
Go to https://github.com/rien/reStream/#sub-second-latency for a better experience.
ffplay version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2003-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Segmentation fault (core dumped)

Ideas on Mouse support

I am wondering if there are any ideas to incorporate mouse support. i guess this is technically as complex as the whole framebuffer thing, but would be extremely cool. (all following device files are for the RM2)

my idea

  • leftclick on the stream window: emulates touch event (/dev/input/event2) on remarkable, allowing to navigate between documents
  • ctrl+leftmouse ": emulate digitizer (/dev/input/event1) to allow basic drawing.

My first experiements show, that one can simply write to the device files. More precisely i can record and replay an event:

cat /dev/input/event2 > out # stop with ctrl+c
cat out > /dev/input/event2

Since the reading and decoding has already been done by other projects [1,2] i think the technical side should be not that challenging.

I think it would be a valueable addition, however i am not sure how much effort it would be.

[1] https://gitlab.com/afandian/pipes-and-paper/-/blob/master/server.py#L40-70
[2] https://github.com/canselcik/libremarkable/wiki/Reading-from-Wacom-I2C-Digitizer

Terminate reStream after window closed

Would it be possible to terminate reStream command-line process (if used with -p or in plain landscape mode)? That would be quite good if you try to launch it via a .desktop-file so there is no process necessary left in the background.

Misleading tip in README

Point 3 in README.md links to https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key which works great for github, but the main flow described there uses the Ed25519 scheme, which is silently not supported on the distro used for RM2 (at least), which in turn makes your script ask for password (which seems fine) and later fail cryptically.

The fix is to use the default RSA algorithm. Took me a few hours to figure this out.

Otherwise - truly remarkable script, even works on Windows without too much hassle. Thanks a lot!

ffmpeg snap compatibility is broken by ffplay naming convention

I was able to get reStream working very easily on Ubuntu with only the following two snaps:

sudo snap install ffmpeg lz4

However, the ffmpeg snap packages ffplay as ffmpeg.ffplay, so I had to manually edit reStream.sh to use that instead of the default command ffplay. I was wondering if there was a reasonable way to support this use, since it's really nice to only depend on two confined snaps from an installation perspective.

Here are some options:

  • Add a CLI option to specify an alternate ffplay executable: reStream.sh --ffplay-cmd "ffmpeg.ffplay"
  • Read an environment variable like RESTREAM_FFPLAY_CMD to override the default command
  • Always try ffplay first and then ffmpeg.ffplay
  • Does the normal ffmpeg have an alias for ffmpeg.ffplay? If so, default to that instead in the script.
  • Is there some way to use ffplay from the snap? Here is the package description.

Is this functional on OSX?

I have a 2019 Macbook Air running Catalina version 10.15.2. I used Homebrew to install lz4 and ffmpeg and tried to run reStream using the shell script. It prompts me to enter the reMarkable's password three times, then starts ffplay. However, no window pops up and ffplay does not appear to receive any input from the tablet when I'm drawing on it. I've attached a screenshot. (An ffplay task is shown in the taskbar, but it's not drawing anything.)
Screen Shot 2020-03-27 at 5 59 28 PM

Liveview does not open on host (rM2 and git-bash on win10)

I just got my rM2 and I'd love to use it to screen-share and give talks online!
Unfortunately, so far I've been failing to get reStream to work with my win10 laptop. I get the following console output:

console-output

This is the git-bash console on Windows 10.
I've checked the following:

  • I'm on the branch that is rM2 compatible
  • As far as I can tell the shh is working fine
  • lz4 is installed on both the host and the reMarkable
  • ffplay seems to be working fine. ( $ffplay example.mp4 from the same command line opens a window playing the mp4)

I'm sure this is just me missing something obvious, but maybe this is helpful for future reference.

1.2.0 not fully released

I've tried to install the new package manually, as it is not on toltec, on the reMarkable but the download url https://github.com/rien/reStream/releases/latest/download/restream.arm.static in the README resolves to a 404 as there is not such a build artifact.
https://github.com/rien/reStream/releases/latest/download/reStream.sh also doesn't work.
PS Imho it isn't a good idea to have a build artifact like restream.arm.static in a git repository but i'm not a git expert.

Possibility to zoom in in portrait mode

Do you think is it possible to zoom in portrait mode?

Now I tend to use portrait mode, but somehow people will say that the screen is too small if I wrote smaller.

But I guess it is probably difficult in just POSIX sh...?

Screenshot that probably what why want (by rmview)
image

Screenshot that people complains:
image

Checks for zstd not lz4 on host system

Hi there,

your project is superb and I was able to get everything working on Mac OSX (catalina)!

However, after installing lz4 via homebrew, reStream complained about lz4 not being installed on the host system. Sure enough "lz4" exists. I checked the source and found that one of the if conditions still checks for "zstd" instead of "lz4".

elif ! which zstd; then

should be:
elif ! which lz4; then

Keep up the great work!
Christian

Optional Parameters

I really love your component! I experienced sub second latencies even using WiFi.
I think it would be nice if one could use WiFi as an automatic fallback (if the ip is provided in the script) if usb is not available.
And also a command line option to specify if you want to use horizontal or vertical mode.
In my opinion these two things would be quite handy. What do you think?

I could implement this and open a PR, if you want me to.

Thanks again for this awesome method!

OpenSSH 8.8 ssh-rsa problem

There is a problem when trying to log in via OpenSSH 8.8. To solve this, the following options must be added to the script

  • PubkeyAcceptedKeyTypes +ssh-rsa
  • HostKeyAlgorithms +ssh-rsa

In line 93 the ssh call must be adapted as follows: ssh -o ConnectTimeout=1 -o PasswordAuthentication=no -o PubkeyAcceptedKeyTypes=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa "root@$remarkable" "$@"

Error when running reStream.sh

My tablet is 2.10.2.356-patch_27.2.01-0-gbbf4bcd. my laptop is ubuntu.
I installed the reStream on my laptop and on my tablet. I am running it from my laptop and see this message:

Error: Could not find pid of xochitl, is xochitl running?

Streaming in color

Using the pixel_format "rgb565le", I can get color to come through, but not stably: the browser will show color:

image

But when I view a document, the color will disappear after a moment. I suppose this is a function of the reMarkable---but is there any way to overcome this?

restream process not stopping on remarkable when exiting window

I had multiple issues with this script. (rm2 - 2.7.0.51)

  1. The process would not close on my PC.

    The main branch version lacks the kill$$ part at the end of the script

    I tried the stop-on-window-close branch, which didn't work at all. Aparently it changed many things around. So I took it as reference and modified the last block of the main branch script myself.

  2. The process would not close on my RM.

    I noticed this because my RM battery would drain quick after using reStream. I looked into it with htop and saw that there are multiple instances of the restream process running on my RM and chugging the CPU to 100%. After further trial I noticed that one gets added every time I share my screen and it stays active after closing the window.

    I fixed this by adding a trap function and killing the process via ssh. It didn't work in sh, so I changed it to bash as well, no idea if that can be done better.


Here is my full working version of the script that kills both processes on both ends when exiting the window.
https://gist.github.com/Deckweiss/541f85cb2f49dbf138181061130f1850

Video webserver

It would be cool to optionally run a webserver on the host machine, similar to srvfb. This will allow to use reStream on Windows, or share the video on LAN (or even over the internet).

liveview not showing up on local machine

Hello,

I followed the procedure with no error message. Yet the live-view screen does not pop-up on the computer after running "./reStream.sh". Attached is a screenshot of the terminal. Any idea of what is the problem ? The remarkable os version is 2.1.1.3, and I'm using archlinux with gnome desktop.
Thanks.
Capture d’écran de 2020-03-30 18-52-04

The restream binary is not installed on your reMarkable.

Hi, i tried installing restream, managed to add lz4 and the ssh key is authorised on the remarkable, but when I launch the program, i get this :

xxxxxxxxxxxxxxxxxxxxxx:~/Documents/GitHub/reStream$ ./reStream.sh
[SSH] true
[SSH] cat /sys/devices/soc0/machine
[SSH] [ ! -f ~/restream ]
The restream binary is not installed on your reMarkable.
Please install it using the instruction in the README:
https://github.com/rien/reStream/#installation

what does this mean?
btw thank you very much for this open source script!

Donation link?

I use this thing for hours every day. How can I thank you?

(I realize it's a small script at the end of the day, but the simplicity and stability of this little script has been a blessing.)

ffplay is not showing up even though reStream is capable of capturing a video with ffmpeg

I tried using reStream, but it didn't really work:
First of all I couldn't use "10.11.99.1" for some reason but had to change everything to "192.168.178.47".

Then the ssh-copy-id for some reason didn't work. It didn't report any errors, but the remarkable didn't obtain a ~/.ssh/authorized_keys files.
After I manually added my ssh key it worked though (I accidentally first used a ed25519 key, maybe that was why?).

Anyhow. While using the -o option to record my screen works fine, just plainly using the script won't open an ffplay player.

The script printed:
`ffplay version 4.3.1 Copyright (c) 2003-2020 the FFmpeg developers
built with gcc 9.3.0 (GCC)
configuration: --disable-static --prefix=/nix/store/6rr3cb4fgd0bm54frnab9ay2d95ln38w-ffmpeg-full-4.3.1 --target_os=linux --arch=x86_64 --enable-gpl --enable-version3 --disable-nonfree --enable-shared --enable-pic --disable-small --enable-runtime-cpudetect --disable-lto --enable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --enable-ffmpeg --enable-ffplay --enable-ffprobe --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avresample --enable-avutil --enable-postproc --enable-swresample --enable-swscale --enable-doc --disable-htmlpages --enable-manpages --disable-podpages --disable-txtpages --enable-bzlib --enable-libcelt --enable-libdav1d --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-frei0r --enable-libfribidi --enable-libgme --enable-gnutls --enable-libgsm --enable-ladspa --enable-libmp3lame --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdc1394 --enable-iconv --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmysofa --enable-libopus --enable-librsvg --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvmaf --enable-libvpx --enable-libwebp --enable-xlib --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-lzma --enable-nvenc --enable-openal --enable-libopencore-amrnb --disable-opengl --enable-libopenjpeg --disable-openssl --enable-libpulse --enable-librtmp --enable-sdl2 --enable-libsoxr --enable-libspeex --enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-zlib --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping

libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 0 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
`

Any thoughts?

I used ffmpeg 4.3.1 on NixOS.
ffplay itself is also working (it plays the video I captured with -o just fine)

no space to create dir

I'm getting this error when trying to create the directory in order to install zstd
mkdir: can't create directory '/opt/': No space left on device

Cannot use zstd even though already put into both computer and remarkable.

The following is my error code.

Somehow the shell cannot find zstd in the remarkable.

sh: /home/root/zstd: No such file or directory

I tried both dash and bash.

/usr/bin/zstd
ffplay version n4.2.2 Copyright (c) 2003-2019 the FFmpeg developers
  built with gcc 9.2.1 (Arch Linux 9.2.1+20200130-2) 20200130
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
sh: /home/root/zstd: No such file or directory0KB sq=    0B f=0/0   
zstd: /*stdin*\: unexpected end of file 
Input #0, rawvideo, from 'pipe:':
  Duration: N/A, bitrate: 1054310 kb/s
    Stream #0:0: Video: rawvideo (Y1[0][16] / 0x10003159), gray16le, 1408x1872, 1054310 kb/s, 25 tbr, 25 tbn, 25 tbc

Incompatibility with reMarkable 2 on Linux Ubuntu

I am trying to use reStream for a reMarkable 2 on linux Ubuntu 20.04.1 LTS.
I was able to connect through ssh with a ssh key agent. When I start the stream, a signal is received, unfortunately what I see is a blue screen. I have tried to use rmview (ssh branch) and I got the exact same blue screen.
I suspect there is an error in the video format used to decode the video signal?
Thanks for your help if you can figure out what is going on.

reStream executes ARM binary instead of host

[evan@blackbox reStream] ./reStream.sh 
/home/evan/resources/reStream/zstd
./reStream.sh: line 65: ./zstd: cannot execute binary file: Exec format error
ffplay version 4.1.4 Copyright (c) 2003-2019 the FFmpeg developers
  built with gcc 9 (GCC)

The zstd ARM binary should probably be renamed zstd.arm because the ARM binary is executed instead of the host's binary when the working directory is reStream/.

Does not work on reMarkable 2

Worked well with reMarkable 1. Tried with reMarkable and despite no error and a window appearing it remains black. I tried with the version I received the device with 2.2.1.88 then latest update 2.3.1.27 but to no avail.

Happy to provide logs or any other information that could help.

Here is the output I have without ffmpeg banner.

fabien@fabien-CORSAIR-ONE-i160:~/Prototypes/reStream$ ./reStream.sh 
Your remarkable does not have lz4.
Falling back to gzip, your experience may not be optimal.
Go to https://github.com/rien/reStream/#sub-second-latency for a better experience.
Input #0, rawvideo, from 'pipe:':  0KB vq=    0KB sq=    0B f=0/0   
  Duration: N/A, start: 0.000000, bitrate: 1054310 kb/s
    Stream #0:0: Video: rawvideo (Y1[0][16] / 0x10003159), gray16le, 1408x1872, 1054310 kb/s, 25 tbr, 25 tbn, 25 tbc

Output is only a black image

I tried to use reStream on my Manjaro laptop, but the only output is a black image whatever options (-u, -p, -o) I use or not.
I tried the v1.2 and v1.1 client.
The installed dependencies are:

Package Version
bash/zsh 5.1.8/5.8.1
ffmpeg 4.4
OpenSSH 8.8
lz4 1.9.3
pv 1.6.6

The throughput is about 190MiB/s encrypted and unencrypted.

The version on my rM 2 is 2.10.2.356.

Interestingly the derivate reSnap does work.

$ restream -s remarkable -p -u
[SSH] true
[SSH] cat /sys/devices/soc0/machine
[SSH] [ -f /dev/shm/swtfb.01 ]
[SSH] [ ! -f ~/restream ] && [ ! -f /opt/bin/restream ]
[SSH] PATH="$PATH:/opt/bin/:." restream -h 1872 -w 1404 -b 2 -f /dev/shm/swtfb.01 --listen 16789
[rM] listening for a TCP connection on 0.0.0.0:16789
[SSH] echo $SSH_CONNECTION
[rM] connection received from 10.11.99.2:50606
ffplay version n4.4 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rawvideo, from 'pipe:':  0KB vq=    0KB sq=    0B f=0/0
  Duration: N/A, start: 0.000000, bitrate: 1051315 kb/s
  Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1404x1872, 1051315 kb/s, 25 tbr, 25 tbn, 25 tbc
Switch subtitle stream from #-1 to #-1 vq=    0KB sq=    0B f=0/0
^C[rawvideo @ 0x7f1d64000c80] Packet corrupt (stream = 0, dts = 243).
[rawvideo @ 0x7f1d64015280] Invalid buffer size, packet size 3028864 < expected frame_size 5256576
[SSH] kill $(pidof restream)
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
[SSH] kill $(pidof restream)
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
$ restream -s remarkable -o test.jpg
[SSH] true
[SSH] cat /sys/devices/soc0/machine
[SSH] [ -f /dev/shm/swtfb.01 ]
[SSH] [ ! -f ~/restream ] && [ ! -f /opt/bin/restream ]
[SSH] PATH="$PATH:/opt/bin/:." restream -h 1872 -w 1404 -b 2 -f /dev/shm/swtfb.01
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, rawvideo, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: 1051315 kb/s
  Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 1404x1872, 1051315 kb/s, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
[swscaler @ 0x558609f955c0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'test.jpg':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: mjpeg, yuvj444p(pc, progressive), 1872x1404, q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc58.134.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[image2 @ 0x558609f84480] Could not get frame filename number 2 from pattern 'test.jpg'. Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %03d within the filename.
av_interleaved_write_frame(): Invalid argument
frame=    2 fps=0.0 q=1.6 Lsize=N/A time=00:00:00.08 bitrate=N/A speed=0.878x
video:61kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
^C[SSH] kill $(pidof restream)
^Xkill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
[SSH] kill $(pidof restream)
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Could it be a problem with ffmpeg or does the rM side need a specific dependency like a launcher?

Thanks!

just received my remarkable 2 today and reStream works great.

a very big thank you to all involved hackers.

Implement a better installation/update flow

Installing restream.rs by scp'ing it to the reMarkable is not user-friendly and prone to errors. This also requires the prebuilt binary to be present in the repository, which is not really clean.

We could ask the user on first use (when restream.rs is not found) to install the binary for them by wgeting the latest release from GitHub, or - if toltec is installed - install it with toltec.

This can easily be expanded to an update flow, updating the binary when the script is updated.

no screen on host

I am using this on linux (tumbleweed 5.11.6-1-default) with a remarkable 2 (v2.6.2.75). When I start the script, I get the below output, but no screen on my computer:

Is there a way to dig into this?

If 'reStream.sh' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf reStream.sh
(base) uliw@bonklt4:~> reStream
[SSH] true
Enter passphrase for key '/home/uliw/.ssh/id_rsa': 
[SSH] cat /sys/devices/soc0/machine
Enter passphrase for key '/home/uliw/.ssh/id_rsa': 
[SSH] [ -f /dev/shm/swtfb.01 ]
Enter passphrase for key '/home/uliw/.ssh/id_rsa': 
[SSH] [ ! -f ~/restream ] && [ ! -f /opt/bin/restream ]
Enter passphrase for key '/home/uliw/.ssh/id_rsa': 
[SSH] PATH="$PATH:/opt/bin/:." restream -h 1404 -w 1872 -b 1 -f :mem:
ffplay version 4.3.2 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 10 (SUSE Linux)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' --optflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --enable-libsmbclient --disable-openssl --enable-avresample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libssh --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lto --enable-lv2 --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfdk-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
  nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   00 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.