TL;DR
- LosslessCut uses Electron and suffers greatly from it
- I'm developing a native alternative to address these issues
Recently, Discord officially announced[1] the move from Electron and React Native to Rust everywhere with GPUI on desktop, and the native toolkits on iOS and Android. I'm not sure about other people, but this very much surprised me. Discord out of everyone seemed like the last company that would ever do that. RIP to Vesktop I guess. Apparently they had been planning this change ever since 2018[2], so I guess they were technically early adopters of Rust, but why has it taken this long? Discord seems like the type of company to love LLM coding, so who knows. Discord aside, I hate Electron. My opinion might be skewed because I have never personally developed an Electron app, but that may be due to the awkward nature of JS apps on the desktop and just JS in general. Many features of Electron are quite useful, but there are libraries out there that provide that functionality, of which is not hard to wire up yourself. I can't really think of a proper argument for Electron as the default choice for apps. Maybe something like an email client, but even then you can just embed a web view (like KMail) like come on! The time you spend working around the limitations of your app just being a website can be better spent making your app better.
Electron apps are bloated too. Hundreds of megabytes in distribution, and they take up so much fucking RAM. This is a massive issue with Vesktop where at idle, it sometimes takes up over a gigabyte, reaching 1.5 sometimes. Discord is a special case for being a rich communication app, but still. The new Phoenix rewrite they announced was shown to be taking up 300 MB at idle[2], which is still leaning on the heavy side, but much better than before, and it most likely won't spike or fluctuate wildly. And for a desktop app, bringing an entire JavaScript runtime + HTML and CSS parsers is super overkill for most apps. You then have to make a tradeoff because Chromium is a massive project with security fixes all the time; do you update for most security fixes and have to push new versions constantly, or wait for them to accumulate, leaving vulnerabilities open (if that even matters for your app).
Tauri is a misleading solution to Electron. It definitely does solve many of the problems like distribution size, RAM consumption, library size, but makes the tradeoff of using the system web view. When I had first heart about Tauri, I was not too familiar with web views or even Rust in general, and to me it seemed that it was basically THE solution to Electron. Keep your UI and frontend in HTML/CSS, and write the backend in a language you don't hate. But, now you essentially depend on a system browser, that will have variations between OSes. I've also heard that WebKitGTK isn't very good, but take that with a grain of salt. Overall though, I do think Tauri is at least a step in the right direction. The effort to port an Electron app to it though is not worth it in my opinion, as you'd be rewriting your backend in Rust, so why not just rewrite your entire app too? Pull the bandaid off in one fell swoop?
Now let's finally get to the main point of this post, LosslessCut. If you don't know what it is, it's a simple lossless video editor (trimmer more accurately) written in Electron. Now, I don't dislike the maintainer of LosslessCut and I understand why Electron was chosen, but I think it was a big mistake. The main functionality of it shells out to FFmpeg, including piping video to it as a subprocess. The latter only occurs during FFmpeg-assisted playback, which is decoding a video with FFmpeg because Chromium's video player doesn't support it, which is an awfully large amount of videos. Most notably, hardware HEVC on Linux! That issue really hits me specifically as I record clips in stupidly high bitrates with the best possible hardware acceleration for 4:4:4 on my GPU, which is HEVC. FFmpeg-assisted playback with my videos is quite laggy and it pisses me off. Considering that LosslessCut is a polished wrapper over FFmpeg copy muxing, Electron does basically nothing for it as many of the issues in LosslessCut can be attributed to Electron or Chromium. Chromium's video element is quite limited in codec support and makes for a subpar video player.
Can we do anything about it? No, unless you want to go tell someone to completely abandon their longstanding project to rewrite it natively. I want to do something about it though, which is why I've started development on a native app very similar to LosslessCut, with some extra features where possible. I'm going to call it RustySlice (yes it's a cliche name I know), but development is currently not public. For simplicity, I chose to use Slint for UI since declarative UI is simple, and nothing more performant or architecturally cleaner is really needed. Video playback will be done utilising libmpv since from my own experience, it is the best video player technical-wise, and the only one to play back my stupidly high bitrate videos with no lag. mpv by default uses its new gpu-next backend for rendering, utilising libplacebo with Vulkan for HDR and such. The only problem being that the render API for embedding an mpv player into a canvas currently only supports the older regular gpu backend, which uses OpenGL and not libplacebo[3].
Sources
- Discord official announcement about Project Phoenix
- Discord CTO talking about Discord Phoenix
- A pending gpu-next pull request for mpv's render API
- LosslessCut icon used in post artwork, by Dimi Kazak licensed under CC 3.0 BY.

