rien / reStream

Stream your reMarkable screen over SSH.
MIT License
732 stars 56 forks source link
ffmpeg framebuffer remarkable-tablet video4linux-loopback

reStream

reMarkable screen sharing over SSH.

rm1 rm2

A demo of reStream

Installation

Requirements

On your host machine

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 root@10.11.99.1.

    Note: the reMarkable 2 doesn't support ed25519 keys. If it's your case, try generating an ecdsa or rsa key. Try out ssh root@10.11.99.1, it should not prompt for root@10.11.99.1'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 root@10.11.99.1
  7. Try out ssh root@10.11.99.1, 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.

$ ssh root@10.11.99.1 'opkg install restream'
$ ssh root@10.11.99.1 'wget https://github.com/rien/reStream/releases/latest/download/restream.arm.static -O /home/root/restream && chmod +x /home/root/restream'
$ scp restream.arm.static root@10.11.99.1:/home/root/restream
$ ssh root@10.11.99.1 '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

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

Extra Dependencies

On your host machine:

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:

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.

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.