magiruuvelvet / LightweightQtDRMStreamViewer

A lightweight as possible DRM stream viewer based on the Qt Web Engine
MIT License
17 stars 4 forks source link
amazon-video drm netflix qtwebengine streaming

Lightweight Qt DRM Stream Viewer

This application uses the Qt Web Engine to implement a tiny and lightweight as possible way to view DRM (Digital Rights Management) streams (Netflix, Amazon Video, Maxdome, etc.) without any useless UI clutter which the average web browser is made of.

Background

I made this for the only purpose to have something to watch (mainly) Netflix which doesn't kill my RAM and generates a lot of useless CPU usage. Using a full featured Browser with a lot of UI elements and tons of other features is just nonsense for this purpose. As well that browsers have a UI full of the usual web navigation stuff which is just disturbing.

In the past I used Chrome (in --app=... --kiosk mode) but it spawns just too many different processes (10 tbh) with tons of threads (60+) I really don't understand what they are good for. On my laptop the total memory usage of all processes was over 4GB.

One day I had enough of this nonsense and attempted to try something out with Qt and its Web Engine. Since I mainly develop in Qt this became very handy. Now this app was born. The total number of processes now is 4 (3 of QtWebEngineProcess [PepperFlash, Renderer, Zygote] and the main app process) with a total memory usage of just about 300MB maximum and about 20 threads. Over 1333% difference! That's a lot.

I'm releasing this here on GitHub in case anyone else is looking for web browser alternative to watch Netflix, Amazon and what not :D

Requirements

Note: On some Linux distros you can find PepperFlash in the repositories for easy installation. You still need to download Widevine manually. Due to licensing issues I can't mirror it here.

Qt is looking for PepperFlash at the following locations: see the Qt Web Engine Features overview for a detailed list of paths

Widevine must be obtained using Google Chrome, grep it from their Website. Qt is looking for it in either its plugin location or the browsers default install location.

Arch Linux

Just install pepper-flash and qt5-webengine-widevineAUR to get started.

Hint about possible random crashes (if you encounter one)

See this comment for details. Adding --disable-seccomp-filter-sandbox to the app command line is a workaround to this issue. Only enable this if you actually suffer from random crashes.

Main Interface

Main Interface

The main interface is just made of a client-side title bar, a really tiny close button (can you spot it?) and the list of streaming services. The theme is hard-coded and dark. Personally I prefer light themes but because so many people like dark colors I made it dark. That way I can easily spot the window on my desktop xD

Note: Services needs to be added manually. See below how.

Usage

Adding Services to the list

Run the app for at least once (optionally from a terminal). It will create its configuration directory and tell you where it is.

Default is ~/.config/LightweightQtDRMStreamViewer (on Linux) and %LOCALAPPDATA%/LightweightQtDRMStreamViewer (on Windows).

A global system configuration is also supported.

Once in the config directory there should be a providers subfolder in there (create if it doesn't exist). Inside that directory the app is looking for streaming services to generate the list in the user interface.

All files with the .p extension are parsed in alphabetically order. Prepand numbers to the filenames like 01-provider1.p, 02-provider2.p, 0n-providerN.p to sort the list in the user interface to your liking.

A provider file looks like this:

name:Netflix
icon:netflix.svgz
url:https://www.netflix.com

Lines starting with a hash (#) are ignored.

Options

Command line arguments

There are command line arguments to skip the main UI and load straight into the browser window to start watching.

For my part I added this command line arguments mainly to skip the UI to create .desktop files to straight start watching without unnecessary clicks. The UI is just there for an overview :D

Hint: Setting a valid icon for a provider makes it the window icon which is shown in the task bar.

Shortcuts & Navigation

Browser Window

The application is completely frameless, while the main UI should be movable, the browser window is not. If you use window managers like KDE/KWin, Compiz or any tiling window manager this is no problem at all. On Windows you may want to take a look at the titlebar option (see above).

Hacks

A useful list of hacks you can make use of.

Script Injection

This app supports the injection of UserScripts into web pages. The format is filename,injection_point(optional), which means you may not have a comma sign (,) in filenames. Filenames can be relative to the current provider file or absolute.

Injection Points

This is an optional value. The default injection point is auto when this option is omitted.

Important Notice

Make sure your script filename ends with .user.js when working with UserScripts. Apparently this makes a difference when the Qt Web Engine parses JavaScript files.

Browser Profiles and Caches

Every provider has its very own browser profile and caches. They are located in the WebEngineProfiles subfolder in the configuration directory. Additionally Qt also stores data into the generic data path of your OS under LightweightQtDRMStreamViewer/QtWebEngine. On XDG platforms this is ~/.local/share and on Windows its the AppData directory.

Login credentials are remembered if you tick that "Remember me" checkbox. No need to login every single time :)

Disclaimer

The Qt Web Engine has plenty of settings. I tweaked the settings to be sufficient and optimized for streaming. Please do not use this app as a regular web browser! You have been warned.

Credits

Screenshots

Netflix as "dedicated" app (not really :^))

Netflix