STATUS UPDATE
Just wanted to give everyone a quick status update about this module.
Bad news first: the current version in the master branch is malfunctioning. Please revert to a previous version (see post above) until I get time to undo the commit.
EDIT - I’ve reverted the changes that I think broke the master channel. Please try updating your module to the current master branch and test.
Good news! The reason I haven’t fixed the main branch yet is because the most recent version of the Raspbian image (Nov '18) has introduced a native version of VLC with hardware acceleration. I am actively working on a version of this module that will abandon OMXPlayer in favor of VLC, and have a working prototype in the develop branch for anyone interested in testing!
Requirements:
- Must have the most recent version of Raspbian with Desktop (> Nov '18). Google how to upgrade, but you may be better off starting with a fresh image.
- Enable OpenGL (Fake KMS) driver in
raspi-config
- Increase GPU/CPU Memory Split to at least 128 (do this after enabling OpenGL because it will reset it to 64).
- Upgrade Electron to v3.0.13 (v2.0.16 in MM v2.6 is not working with OpenGL–see MM Issue #1500:
cd ~/MagicMirror
# Remove the node_modules folder to start fresh
rm -R ./node_modules
# Either manually update the required electron version in package.json to 3.0.13 or use the sed command below
sed -i 's/electron": "\^2\.0\..*",/electron": "^3.0.13",/g' package.json
# Re-install the MM node modules
npm install
- Delete your MMM-RTSPStream module directory and use the new installer script to install everything:
rm -R ~/MagicMirror/modules/MMM-RTSPStream
bash -c "$(curl -s https://raw.githubusercontent.com/shbatm/MMM-RTSPStream/develop/scripts/installer.sh)"
- Update your config.js section to use VLC:
localPlayer: 'vlc'
Working:
- VLC windows “placed” on top of the main Electron window inside the module’s box
- Plays quickly, minimal lag, low CPU usage (4 streams @ ~35%)
- Visible in VNC client (couldn’t do this with OMXPlayer)
- Fast switching between streams – all VLC windows will remain open, and
wmctrl
utility used to toggle which one is on top.
- Make sure to set a
shutdownDelay
for in your module config section make it longer than it takes to rotate back to that stream time (e.g. if you have rotateStreamTimeout: 10
, and 3 streams, then it will take 20s to get back to the first stream, so you should set shutdownDelay: 22
– 20s + 2s buffer).
- Suspend/Restore functions
- New version of Raspbian also has a hw-accelerated version of FFMPEG; I’ve added a
hwAccel: true
option for ffmpeg
users to use HW-accelerated decoding. FFMPEG still has a big CPU impact for the encoder though.
Not-yet-tested / left to-do:
- Test if sound works
- Figure out what I broke in the OMXPlayer version
Not-gonna-happen:
- Embedding VLC into Electron window (NPAPI-plugins are no longer supported and this is the only way I know how to do that).
- Using VLC as the viewer for “remote” windows (other web browser instances of the MM) – same reason as above.
Known Bugs:
- When VLC windows are first created, you see them move around the screen. After they’re “put in the box” it they won’t fill up the box right away. After ~7 secs they should fill the box.
- I am using
devilspie2
to remove window decorations and move the VLC windows; however, for some reason I have to call it twice (~7s apart) to get VLC to resize it’s video properly. Shouldn’t be an issue in the long-term, unless you are hiding/showing the module often.