What's New in TinyPilot's May 2022 Update
May 16, 2022
The May release of TinyPilot adds experimental support for H264, a faster and more performant format for video streaming.
H264 video over WebRTC
TinyPilot has always used the MJPEG format to stream the display from your target computer back to your browser. MJPEG is a simple format, but it consumes a large amount of bandwidth.
Our May releases of TinyPilot Pro and TinyPilot Community offer experimental support for H264, a newer, high-performance video format with several benefits over MJPEG.
H264 has lower latency, so you'll notice that your mouse movements will feel snappier as you control your remote computer through TinyPilot.
H264 also uses network bandwidth more efficiently, so picture quality will be higher while placing less load on the network. You'll especially benefit from H264 if you access your TinyPilot over the Internet.
The demo below shows TinyPilot using the default MJPEG format and then switching to H264 compression. The bandwidth drops from 21 Mbps to less than 5 Mbps without any loss in video quality:
Enabling H264 video
We're still polishing the H264 feature, so it's not yet available through the web UI. If you'd like to try it out, you can enable it on your device through the command-line.
Requirements:
-
TinyPilot Voyager 2, Voyager 1, or an HDMI to CSI bridge
- HDMI to USB hardware will technically work, but you'll see increased latency due to CPU-based video encoding.
- TinyPilot Pro 2.4.1 or TinyPilot Community 1.7.1
- Raspberry Pi OS Buster (the default for pre-made TinyPilot devices)
To enable H264, SSH into your TinyPilot device, and run the following commands:
echo 'ustreamer_h264_sink: tinypilot::ustreamer::h264
ustreamer_h264_sink_mode: 777
ustreamer_h264_sink_rm: yes
ustreamer_compile_janus_plugin: yes
tinypilot_install_janus: yes' | sudo tee --append /home/tinypilot/settings.yml && \
for package in libnice10 libsrtp2-1 libwebsockets16; do
sudo apt-get remove --yes "${package}" || true
done && \
sudo /opt/tinypilot/quick-install && \
sudo apt-get autoremove --yes && \
sudo reboot
Note: Enabling H264 for the first time currently takes about 20 minutes. We know this is painfully slow, and we're working on it.
To serve video over WebRTC, we're using the open-source Janus server. Janus has no official binary package, so we're compiling it from source on the TinyPilot device.
We're in the process of building a pre-compiled binary package for Janus, which will drastically speed up the installation.
Tuning bandwidth with H264
By default, TinyPilot targets 5000 kbps of network bandwidth for streaming video. If you'd like to optimize this value for your network, you can choose a new target with the following commands:
TARGET_BITRATE_KBPS=3000 # Change to any target bitrate
sudo sed --in-place \
"s/--h264-sink-rm.*$/--h264-sink-rm --h264-bitrate ${TARGET_BITRATE_KBPS} \\\/g" \
/lib/systemd/system/ustreamer.service && \
sudo systemctl daemon-reload && \
sudo service ustreamer restart
We're working on a friendly web UI for this setting so that you can tune the streaming bandwidth from your browser the way you currently can with MJPEG.
Turning off H264
If you try out H264 and decide it's not for you, no problem. You can disable H264 and go back to MJPEG with the following commands:
TINYPILOT_SETTINGS='/home/tinypilot/settings.yml'
sudo sed --in-place '/^ustreamer_h264_sink:/d' "${TINYPILOT_SETTINGS}" && \
sudo sed --in-place '/^ustreamer_h264_sink_mode:/d' "${TINYPILOT_SETTINGS}" && \
sudo sed --in-place '/^ustreamer_h264_sink_rm:/d' "${TINYPILOT_SETTINGS}" && \
sudo sed --in-place '/^ustreamer_compile_janus_plugin:/d' "${TINYPILOT_SETTINGS}" && \
sudo sed --in-place '/^tinypilot_install_janus:/d' "${TINYPILOT_SETTINGS}" && \
sudo systemctl disable janus && \
sudo service janus stop && \
sudo /opt/tinypilot/quick-install && \
sudo reboot
Reporting bugs and feedback
The best way to report bugs you find with the H264 feature is by creating an issue on TinyPilot's public Github.
If you're not a Github user, you can report bugs in the TinyPilot help forums.
Full changelog
For the full list of changes in TinyPilot Pro 2.4.1, see the changelog.
Updating to the latest version
You can update to the latest version of TinyPilot by clicking System > Update in the navigation bar:
Acknowledgments
Special thanks to Maxim Devaev for his extensive work adding H264 support to uStreamer, which paved the way for this feature.
Written by Michael Lynch, TinyPilot Founder and CEO