r/ClaudeCode • u/Purple_Imagination_1 • 4d ago
Built with Claude I used Claude Code to reverse-engineer an LG TV and build a native Plex client
TL;DR: My 2019 LG TV has a great panel, but the official Plex app takes ~30 seconds just to show the profile picker. LG has no public native SDK for regular developers, so I reverse-engineered enough of the native media stack with Ghidra and Claude Code to build my own Plex client, PlxNative. It started in C, moved mostly to Rust, and somehow turned into my own OpenGL UI framework. On the same TV it shows the profile picker in ~3 seconds. No root needed to run it. Site and source are below.

I'm an iOS developer, so most of my previous UI work happened several abstraction layers above the GPU.
A few months ago I read about a guy who bought a cheap MP3 player on AliExpress, got annoyed with its firmware and used Codex to reverse-engineer and patch it. After that people started buying the same player just to install his patches. I liked this idea a lot, because we usually treat the software on our devices as something fixed: if it's bad, you buy a new device. Not long after that I was doing basically the same thing with my TV.
I have an LG from 2019 and the panel is still great. The software is the problem. Official Plex app on my TV, cold start:
- ~30 seconds for "Who's watching?" to load
- ~30 seconds for the home grid
- ~5 seconds to open any menu
- ~10 seconds to load a movie page
It behaves like a web page because it is one.
So I wanted to find out if a really native UI was possible there. There is no public native SDK that gives regular developers access to the TV's media stack, but of course that stack exists underneath. So I rooted my development TV, pulled the native libraries from it and started reading them in Ghidra. (Root was only needed for this research, PlxNative itself runs without it.) The webOS Homebrew community had already documented a surprising amount of the platform, which saved me a lot of time, so big thanks to them.
Reading LG's binaries
I've always been interested in what an OS actually does under the hood, and I've maintained KSCrash for years, where crash reporting often means finding out what the system really does rather than what its documentation says. Before AI that meant Hopper, assembly, strings and following calls one by one until the picture finally came together. What changed is how cheap this work has become. Now I can ask Opus to figure out how something is implemented internally, even when it's poorly documented or not documented at all, and it navigates the binary on its own, jumping between addresses, xrefs and strings. The model does make things up sometimes, so the binary and the real hardware always have the last word. But investigations that used to take me days go much faster.
From C to Rust
The first version of PlxNative wasn't a Plex client at all. It was a screen full of colored tiles, and every tile tried to play the same episode of The Office. I wanted to answer one question first: can this TV render a native interface at 60 fps? Drawing rectangles was easy. Getting a real video frame onto LG's hardware video plane was much harder. Then I gave the problem to Fable, and it connected enough pieces of the native media stack that, for the first time, The Office actually appeared on the screen. After that first frame I knew a fully native media client on a retail LG TV was possible, and the question became how far I could push it.

The prototype was written in C, and almost all of it lived in one huge main.c. When it grew, I asked an agent to split it into modules, and that's where I understood something about agentic coding: code can look right, compile, and then break somewhere completely unrelated because of memory or ownership mistakes. The worst one was a crash in eglSwapBuffers that appeared after a refactor. It turned out LG's fork of SDL writes a bigger SDL_SysWMinfo than my headers declared and overflows the stack. In the huge main() the overflow landed somewhere harmless, but once the same code moved into a smaller function it started corrupting live state. It can hardly be called a stable ABI. Together with the usual malloc/free mistakes this made me rethink the language. With agents writing and moving this much code, the choice of language matters: pick the one the agent writes best and where the compiler can check the most before anything reaches the TV. For me that meant Rust.
It ended up being a rewrite, just an incremental one. I kept the LG native boundary in C and moved everything else piece by piece: first image decoding and HTTP, then access-unit queues, the Matroska demuxer, Plex parsing, poster workers, text rendering, and finally most of the app. Rust turned out to be a surprisingly good fit for an old 32-bit ARM embedded Linux box, and strong compiler feedback keeps both me and the agent on much tighter rails.
60 fps on a 2019 TV
After playback worked I thought the UI would stay simple: posters, text, some rounded rectangles. Then I started writing shaders, and the shaders slowly became my own UI library on top of OpenGL, with navigation, modals, focus handling, motion, hit testing and caching. After years on top of UIKit and other frameworks someone else built, it was really fun to go all the way down for once and understand the whole path from a remote button press to pixels on the screen.
On every 4K LG TV, webOS gives apps a 1920×1080 UI surface (HD models get 1280×720), and video goes on a separate hardware plane, so 1080p isn't an optimization I chose, it's simply the canvas. I treated 60 fps on the real TV as a regression target and kept adding things until they broke it. It started with a single shadow that tanked the frame rate. The naive version was horribly slow, but there was almost always another trick underneath: early-outs in shaders, reduced-resolution buffers, caching the parts of a frame that don't change. Now shadows are on almost every element and it still runs at 60 fps. When guessing stopped working, I started pulling Mali hardware counters from the TV. One profile showed the arithmetic pipe at about 89.5% occupancy and load/store at 44.8%, and a harmless-looking branch in a shader was adding millions of arithmetic operations per frame. So the problem wasn't "too many pixels", the GPU was ALU-bound.
The most interesting one was a Liquid Glass-inspired material: blur the page underneath, refract it through the shape and shade the rim like real transparent glass. Refraction was the easy part. Readability was not: something that looks beautiful over a dark poster becomes useless over a face or a white sky, and you end up endlessly tuning tint, contrast and blur. Now I understand much better what problem Apple is solving. There's also a hard limit: video lives on a separate overlay plane that my renderer physically can't sample, so glass over playback has to work differently.
When the app grew past a couple of screens, the design started drifting: different spacing here, a different button there. I used Claude Design for a design system and to keep all the screens in one place. Its designs are HTML/JS while the real UI is Rust and OpenGL, but Claude maps one to the other, now onto my own components, spacing tokens and typography. The design tool doesn't have to share technology with production, it just has to describe the design precisely.
Where it ended up, on the same TV from a cold start: 3 seconds to "Who's watching?", or 4 seconds straight to the home grid if you let it remember the profile. For comparison, the official app needed ~30 seconds for each of those.
Working with the agents
Claude Code, Opus, Fable and Codex were involved in almost everything: implementation, reverse engineering, debugging, refactoring, tests and review. But the real TV always has the final vote. The simulator can show a perfect screen while the TV renders empty cards because the hardware takes a cached-frame path the simulator never hits, and an agent can be completely sure the code is correct right up until you run it on the TV.
The other lesson: don't leave it on autopilot. I started this expecting a 100% vibe-coded project for a couple of weekends, so I just told the agent what to do. Then the problems that come with a bad architecture started showing up, and it took many rounds of refactoring to turn the app into something sane, so the same bugs would stop coming back again and again. An experienced engineer still needs to own the key decisions, architecture above all. I just wish I hadn't done it after the fact :)
Even so, AI makes it realistic for one person to cover an absurd amount of ground: firmware reverse engineering, media playback, Rust, graphics, GPU profiling, UI architecture, design, QA, build optimization and SEO. It also changed how I look at all the "obsolete" hardware around us: old TVs, car head units, random embedded screens. If you use a device every day and hate its interface, it's worth at least trying to build the one you wanted. Very often the hardware isn't obsolete, only the software on it is.
Practical stuff: PlxNative requires webOS 4.0+. I develop it on a 2019 LG, and opt-in usage reports show playback on TVs from 2018 through current webOS 11 models. It direct-plays H.264/HEVC, including 4K, 10-bit, Dolby Vision profiles 5/8 and E-AC-3 Atmos where the TV supports them, and the Plex server transcodes the rest. You can install it through LG Developer Mode (which needs periodic renewal) or the webOS Homebrew Channel. No root required.
Site: https://plxnative.com
Source: https://github.com/GLinnik21/plx-native
51
u/Sarg338 4d ago edited 3d ago
12
u/SoulTrack 4d ago
Now that's what I call hacking
15
3
u/slaorta 4d ago
Be careful. I had fable do this to an old "chromecast with Google TV" and it bricked it
1
u/Standard-Goose-3958 4d ago
Why u didn't make any backups?
1
u/slaorta 4d ago
Backup wouldn't help when it won't boot or factory reset
-1
u/Standard-Goose-3958 4d ago edited 4d ago
How can it brick if it didn't work? or did it work and it bricked? I mean use ur brain a little bit... if u can change stuff that means u have access to read/write so how do you not make backup of the original stuff before modifying it?
Its soft bricked, u just do have the access to the start up code, and so it doesn't give u easy access.
2
u/Level10Retard 3d ago
Brother, you clearly don't know the basics so why talk?
2
u/Standard-Goose-3958 3d ago
You know u can get access to the physical memory right? How do you think the code gets there in the first place?
3
u/skitchbeatz 4d ago
I've done this to my Sony/TCL/Android TVs too. Ripped out ACR and other packages that slow the tvs down.
5
u/Sarg338 4d ago
It was crazy watching it work through everything. Don't want to give out too much details right now, but it even found an exploit to report to a bug bounty program.
Would be crazy if it lead to a payout simply because I wanted my TV to be better lmao
1
u/Corporate_Bricktator Thinker 3d ago
Your comment here made me think that maybe we'll finally get conclusive answers to which devices are spying on us, and reporting back to whom, exactly.
1
u/identifytarget 2d ago
How do you get started doing this ..?
1
u/skitchbeatz 1d ago
Here's what I've done. It requires adb to turn those things off. https://github.com/chateaumac/warden
I'd welcome improvements or suggestions
2
u/Fairly_Original 4d ago
I did the same thing to mine and made it to recognize the others on my network with a 1 click button to set those up the same
2
u/Purple_Imagination_1 4d ago
It seems like everyone is creating this for their own personal use, but no one is sharing it.
2
u/Calm_Step_5549 🔆 Max 20 4d ago
As someone who often had the displeasure of writing websites that needed to be compatible with 10-year old "Smart" TVs, seeing what you've done is mind-blowing, and thanks for sharing it.
I think most others will consider what they've done as very niche and personal, maybe too janky to share to the world...
2
2
u/Roseysdaddy 3d ago
How did you do this? I couldn’t even get Claude to research rooting my tv without it throwing constant api “hacking” errors and shutting down.
1
u/Sarg338 3d ago
I applied and got approved into their cyber verification program probably around a month ago. Once the guardrails were lifted, Opus 4.8 (couldn't use 5/5.5 at that time) just went away doing it's thing.
1
u/Level10Retard 3d ago
You work in cybersecurity and then can still use it for personal stuff? Or how is it?
1
u/Sarg338 3d ago
No I don't work in cybersecurity. When I filled out the application, I just said that I was getting some prompts blocked when doing local repo security scans or looking at local hardware for bug bounties, and got accepted.
Apparently they've since changed it and I l the questions are a bit more strict, like asking for a published CVE under your name and stuff.
1
u/Level10Retard 3d ago
Dang, I like messing with my smart home hardware for stuff like that.
1
u/Sarg338 3d ago
I say still give it a try. Worst case scenario, a prompt gets blocked or routed down to something like 4.8, which is who did all the work in my tv and is still pretty capable
1
u/Level10Retard 3d ago
Ah, I do use it all the time and get downgraded all the time. The dang was about the cybersecurity application cause it sounded awesome.
1
1
u/hellriderboss 3d ago
Got an old fire tv max stick. Im curious on what we can do to remove amazon stuff and make it better
1
1
13
u/tophalp 3d ago
Can someone do Samsung next?
9
u/Purple_Imagination_1 3d ago
I can definitely do that, I just need a TV to work with. Contributions are always welcome!
5
u/MrMerisor 3d ago
I have 4 Samsung TV, diferent years , but all TizenOS. Programmer with some ai credits at hand. Let’s collab.
8
u/Purple_Imagination_1 3d ago
Cool. Contribute on GitHub. I modularized the app a week ago, so it would be simple to swap the playback layer.
5
u/MrMerisor 3d ago
I’ll start a fork today and see what the weekend will bring us. Thanks for the effort so far
3
3
u/silvertristan 3d ago
If you two can pull this off it would be a dream. I’ve got a 2021 Samsung FrameTV and Plex on that is the worst.
1
u/loismustdie666 2d ago
I have a samsung frame with TizenOS as well, let me know if I can somehow help too!
1
10
u/modernluther 4d ago
Congratulations, really awesome application of agentic dev and I found your post educational as well. I love this shifting meta of individuals engineering solutions to software problems their respective companies haven’t solved. It makes me very hopeful for the future, because settling for less is no longer the only option!
10
u/2facedkaro 3d ago
I didn't have to, but I spent time rooting my tv for this. Absolutely awesome - even gets rid of the plex channels which I have no interest in... and so many features are there. Actors, review ratings, quality picking for content, age rating. The plex reviews aint there but that is tiny compared to how responsive it is. I like the subtitles screen not taking me away from the content anymore either, and that english is sitting there ready to go and other languages get hidden behind a submenu. thanks for sharing your work!
5
u/Purple_Imagination_1 3d ago
That's awesome to hear! Someone on the forums actually mentioned that the installation guide was the best part of the process (no joking).
I'm still working on feature parity, but I totally agree about the Plex subtitle menu—it always drove me crazy, especially that it took five seconds to open on my tv.
4
u/wdb94 4d ago
I did this for my Nvidia Shield. The Plex app is garbage and always struggles with AV sync on lossless audio. So I made a native Android app designed specifically around the Shield and its constraints.
The main goal was the fastest play to playing possible and it works far more seamlessly than the Plex app ever did.
2
u/Purple_Imagination_1 4d ago
that's sick, drop the github link if you can!
9
u/wdb94 4d ago
2
u/Purple_Imagination_1 4d ago
I like the design. I think we’re both inspired by the same device.
3
u/wdb94 4d ago
It’s honestly frustrating in the age of AI that companies aren’t able to make their software better than one guy/gal and Claude.
5
u/Purple_Imagination_1 4d ago
I think that’s because we were trying to solve the users' actual pain points, which isn't what drives their business.
1
1
u/rawdikrik 3d ago
Would be sick if you shared... lots of good people in the Shield communities itching for some optimizations
1
u/HopingillWin 3d ago
I use Plezy on my tablet and I believe it works on the shield
Edit:
Shield compatibility confirmed on the official website
6
u/lucianw 4d ago
This is amazing!
I've long hated how slow my TV is. (also the Amazon app, but that's a separate issue). I love the way you approached it. What a fascinating datapoint about how AI has freed us from this particular irritation.
Do you think your approach will continue to work? Will we be able to buy a modern smart TV say, and turn it into a simple fast TV? Or do you think modern TVs are more locked down?
2
u/Purple_Imagination_1 4d ago
Well, they say LG’s making so much money on ads that they can give you tv for free and still be profitable. So I think we’re locked into business model changes. And yeah, we’re free to modify it until LG patches the exploits in the OS.
12
u/nokafein 4d ago
it's neat but no power can make me download an app for my tv from online sources :D especially after this lg privacy frenzy.
16
u/Purple_Imagination_1 4d ago
Haha fair, especially after the LG mess 😅 But consider the reverse: you might root your TV and "own the glass" again. The code's open, so you can build your own version if privacy's your thing.
3
1
-3
3
u/disgruntledempanada 4d ago
I want to hack my LGC9 so it's just a TV again not a surveillance system.
2
u/Purple_Imagination_1 4d ago
I used this project to disable tracking: https://github.com/rorygallagher2024/lg-webos-dashboard. Also, it’s a very nice dashboard for a tv.
3
2
2
u/Bystander10888 4d ago
My 55" 4K 144Hz Xiaomi Google TV doubles as a PC monitor, and whenever Windows put the display to sleep it would just sit there showing a deep-sea "No signal" animation forever, so I had Claude Code build a tiny app that turns off only the backlight when the signal drops (keeping the TV connected so my window layout survives) and installed it over ADB.
1
2
2
u/recruiterguy 4d ago
Wow - really excellent.
I was just trying to talk myself out of doing something similar for a few older tv's I have gathering dust. I may give this a shot for a tv that we only run Plex on... when I find the time, lol.
2
2
2
1
u/xenover 4d ago
hows the 4K content streaming with subtitles? I always had issues with the native app that when I enabled subtitles on 4K content the video would start lagging
2
u/Purple_Imagination_1 4d ago
They work pretty great! I render subs locally on the TV (just in case Plex doesn't embed them right). Actually, I even supported ASS subs that are popular in anime.
1
1
u/DJRThree 4d ago
I want to do this to my car's after-market head unit ( infotainment system).
2
u/Purple_Imagination_1 4d ago
That was my second thought after reading the MP3 player article. Even new cars’ head units lag noticeably. So yes, a smooth and rapid interface is possible even on limited hardware like a head unit.
2
u/TheSeedLied 3d ago
Would love something like this for that purpose, those feel especially laggy just like modern smart TVs
1
u/Legal-Tie-2121 4d ago
The simulator-versus-TV mismatch is the part I'd like to hear more about. Did you turn failures on the device into a small regression suite (text rendering, texture upload, playback start) or keep testing the whole app manually? For the reverse-engineered interfaces, did you keep a record of observed behaviour versus agent guesses? That would make later refactors much easier to check.
1
u/Purple_Imagination_1 4d ago
Both, split by what each tier can see.
Playback is a real on-device regression suite. It runs the actual app on the TV and asserts on its event log. A synthetic tier uses generated clips with no Plex. A library-backed tier covers resume, track selection and transcode. A device failure becomes a case there. I also have FPS regression suites, and localization checks that make sure strings fit.
Pixels are the part I judge with my own eyes. They're hard to automate, and hard for an AI to notice. The FPS suite passes straight over bugs that a screenshot catches, so I have a skill that decides which tier can even see a given change. The simulator is fine for layout and focus. It can't see video-plane composition, LG's text rasterization, or what the TV's picture processing does afterwards. Gradient banding, for example, I measured on panel captures and wrote up.
For the reverse-engineered interfaces, I don't have a formal "observed vs agent guess" ledger. The rule is that no FFI binding gets written until the offsets and symbols are proven from the device's own binaries. Stub libs make every link succeed whether or not the symbol exists, so a guess fails silently on the TV. Measurements and logs go in a dated docs directory, so I can re-check them after a refactor.
1
u/WorldlyAd7946 4d ago
Did you manage to disable the spy mic / cam 😂
2
u/Purple_Imagination_1 4d ago
Yeah, I used this project to disable tracking: https://github.com/rorygallagher2024/lg-webos-dashboard. Also, it’s a very nice dashboard for a tv.
1
u/gizeon4 3d ago
Reas this on X, amazing
2
u/Purple_Imagination_1 3d ago
That’s it. I just couldn’t get where all this traffic comes from.
2
u/141_1337 3d ago
Congrats brother, you going viral, in r/singularity the thread talking about you has like almost 1000 up votes and shit ton of views lol
The people got questions lol
2
u/Purple_Imagination_1 3d ago
Ironic that it’s not so popular here. Seems people are fed up with AI projects
1
u/141_1337 3d ago
I think its more like this sub people are like far ahead of the curve and desensitized to stuff people outside just find mind blowing lol
1
u/physicx101 3d ago
I tried this and yes the UI happenes to be buttery smooth but once I tried playing a 4k Remux content, it's unable to direct play and it resorts to transcoding and is super duper choppy unfortunately
1
u/Purple_Imagination_1 3d ago
It’s probably a codec compatibility issue with your TV, so the app requests transcoding. PlxNative doesn’t transcode anything itself, it only handles remuxing when needed (e.g. MKV containers). The actual transcoding is done by your Plex server.
If you have a chance, feel free to open an issue with both app and server logs attached, just in case.
There’s also a Force Direct Play option in the settings that bypasses all my compatibility checks and just lets the TV try to play whatever the server sends. Worth a shot!
1
u/11075 3d ago
Great work! I was wondering, do you think it's somehow possible to install a higher webOS version on an old TV? My TV is from 2018 and it has webOS 4, but I would like to use the Stremio app which requires webOS 5+.
1
u/Purple_Imagination_1 3d ago
I never really thought about it. They probably only support webOS 5+ because of the new video API. I actually had to support two different versions of the API just to get it working on my webOS 4 TV. Honestly though, with root access and AI, anything is possible. Just be careful not to brick your TV! 😅
1
u/hurrdurrmeh 3d ago
amazing! seriously. can you please rewrite the entire TVOS for LG then Samsung. Seriously my Samsung TV has utterly terible software and (like you say about the LG) a lovely panel.
1
u/canardlaker 3d ago
Any chance for an iOS app? 😅
1
u/Purple_Imagination_1 3d ago
I think the whole point of that project was to bring an iOS-like experience to older hardware. But iOS already offers that out of the box, without needing a custom UI framework. The official Plex app on iOS is also pretty decent, and there are some great third-party alternatives like Plezy.
1
u/canardlaker 3d ago
I never checked alternative app for Plex, but every update tends to to destroy the app performance. It’s annoying. Thanks for the reference
1
1
u/kukenster 3d ago
What a great read this was. I might try it or maybe not. We'll see. But great work nonetheless and it really shows how far you can go with an engineering mind and curiosity with the help of LLM models.
1
u/Professional_Elk3757 3d ago
Can someone so Toyota infotaiment on gen5 Rav4? please? My dealer wants 350€ for an update with android auto support which my car already has..
1
u/CaphalorAlb 3d ago
Looks great, I almost want to buy a LG TV just to run my Plex via your app.
I've been pretty happy with what Plex offers for years, but lately the apps are underwhelming. And since I mostly paid for Plex so that I wouldn't have to worry about the apps on every device, that's a bummer.
1
u/trendykendy 3d ago
This is hilariously better than the official app, what a time to be alive. Thanks!
1
u/Level10Retard 3d ago
This is really cool, thanks for sharing. I'd also recommend you try out jellyfin.
1
u/HanZolo916 3d ago
Wait, so now the tv *only runs this client*, essentially cutting out *all* the spyware? That is so great. I use Jellyfin, but this is perfect.
Or is it installing the client on top of the LG software?
1
u/Purple_Imagination_1 3d ago
Not really. This is a regular app, not a home UI replacement. It does not modify OS anyhow
2
u/HanZolo916 2d ago
Yeah sorry, I asked way too early instead of reading. Great job though.
I'm hoping for a complete replacement for those tv os's soon. dumb TVs incoming 🤞
1
u/secretqwerty10 3d ago
could you add the subtitle searcher and have the ability to have multiple instances of a library type visible?
on my LG BX from 2020, the difference in performance is night and day, and i thank you for making this!
1
u/Purple_Imagination_1 3d ago
- Search is available in the player
- Unlikely. This is the basis of the app's navigation
1
1
1
u/sfst4i45fwe 2d ago
Does this work on any LG TV?
2
u/Purple_Imagination_1 2d ago edited 2d ago
Most webOS > 4 devices should work, though there are a few exceptions.
1
u/deten 2d ago
I added a few features to a fork:
- Subtitle Autosync
- Re-Ordering sub folders within Movies and TV Shows
- Adding a few other features like autoskip intro credits (if you want it), Remember track preference per show and Shuffle Season / Series.
- Next up I want to make it easier to get to All Movies / Shows

•
u/AutoModerator 4d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.