LLMs are a wonderful technology that lets me turn dumb, difficult, but technically possible ideas into dumb but functional proofs of concept.

It occurred to me when I was working on Optical Endgame

  • my petitions to the Library of Congress to allow circumventing DRM on optical media in some situations - that a web browser should have everything it needs to decode and play DVD, Blu-ray, and 4K UHD Blu-ray in the browser:

  • WebAssembly allows you to use existing libbluray and libdvdread to parse the disc’s filesystem and issue SCSI commands
  • Websockets allow you to have a bidirectional tunnel for data
  • WebCodecs allow you to decode 1080p/4K H.264 and H.265 with hardware acceleration
  • And we can just compile ffmpeg to wasm for other codecs that don’t work
  • And we just need a bunch of careful buffering and stream synchronization logic to make sure audio and video stay in sync

With the help of a daemon that the browser connects to and forwards SCSI commands to the drive, the web browser can operate the optical drive remotely, giving you a maximum quality, efficient presentation in your browser with no re-encoding. And since it just runs in a browser, any relatively up to date browser on a device with hardware accelerated decoding can now play a movie.

Presenting: Laserweb!

Laserweb dvd style logo

There is something deeply amusing about opening a browser tab and hearing an optical disc drive spin up and start seeking. The anachronism is delicious to be using this modern webtech to drive a disc drive like we’re in the beige PC era.

Laserweb has been tested with:

  • DVD
  • H.264 Blu-ray at 1080p
  • 4K UHD Blu-ray

On:

  • Chrome and Firefox (note that on Linux, you may have to do hackery to enable H.265 decoding)
  • On Linux, Windows 10, ChromeOS, MacOS
  • On a 9 year old Galaxy Tab S3 running Android
  • iPhone 12 on iOS 27
  • Moto G 2021 running latest LineageOS

I was impressed with how few changes libbluray and libdvdread needed to work in a browser remotely over a network. That points to excellent library design. Most of the patching that had to be done to them was actually to remove support for libdvdcss and libaacs (see below).

Quick plug: Optical Endgame

This was created to serve as evidence for my filings with the Copyright Office advocating for consumers to be able to bypass disc DRM. The filing deadline is in about a week, and what I’m missing now are people willing to submit a comment describing how DRM is blocking reasonable and lawful use of media they paid for.

If any of the following applies to you, please reach out to me at opticalendgame@jayd.ml! ASAP

  • Did you ever play Ultra High Definition (UHD) 4K Blu-rays on PC via CyberLink PowerDVD or Corel WinDVD UHD BD?
  • Do you own discs that you can’t play on your computer without VLC - like on ChromeOS, SteamOS, Linux, Mac OS, Android, iOS, iPad OS?
  • Do you have discs that are actively failing (like Stranger Things box sets) where you need to make a personal backup?
  • Did you buy a disc with a digital movie code that didn’t work or was later revoked (like what Funimation did)?
  • Do you own a PC disc drive that is out of production - like a PC 4K UHD Blu-ray drive, DVD drive, or HD-DVD drive and want to back up your movies before they start to degrade?
  • Do you have movies with explicit content that you’d like to filter - like using Clearplay or Vidangel?
  • Do you own a movie on disc that is in the public domain or about to enter the public domain you’d like to copy?
  • Do you need a short clip from a 4K UHD Blu-ray to make content (video essay, documentary, YouTube video)?

Codecs

There was a ton of subtle bugs around WebCodecs and device specific quirks - the poor LLM had to spend hours figuring out all of the platform specific oddities on these Android devices to get smooth playback. But the ancient Android tablet has an HEVC decoder in hardware, and can play 4K discs on its beautiful OLED display!

DVD needs video decoded in software, since browsers don’t ship codecs for MPEG-2, and audio codecs need software decoding across the board. I also did include software H.264 and H.265 decoders for the lulz, on the chromebook (which has H.265 in hardware but ChromeOS doesn’t expose it), the software WASM decoder get about .3 FPS. hilarious. The software H.264 decoder actually kind of works on a swanky enough machine.

The robot also claims it found two bugs in Chrome’s WebCodecs path that it had to work around, probably the reason H.265 is disabled by default on Linux. I know nothing about this, so I’m not sure if I should report them.

ChromeOS bonus

I realized when testing on ChromeOS that Laserweb was 90% of the way there to run without a daemon and allow you to play discs with a browser extension. In my testing ChromeOS will mount a disc drive as removeable media, and allow an extension to open that folder. A little work was needed to read the files directly instead of proxying to the backend, but now there is a native DVD/Blu-ray/UHD player for a dead platform! Hooray!

I also did have it test running Laserweb in ChromeOS’s linux VM, by using USB forwarding from ChromeOS host. This worked with minor modifications - the VM’s kernel doesn’t have the drivers to create /dev/sr0, but since we’re interacting with the drive on such a low SCSI level it worked with minor modifications.

Encrypted Commercial Discs

Laserweb cannot play commercially pressed discs since it doesn’t ship libdvdcss and libaacs. The robot actually had to do a bit of work to patch out the library loading code from those two libraries.

I expect it would take a competent agent about 20 minutes to add them back in though. There is nothing technically presenting it.

Further Work

There is a good amount of polish that needs to happen before this is ready for real usage.

No self signed certs

The main one is that the web features (SharedArrayBuffer, WebCodecs and AudioWorklet) it uses needs a secure context,even over a local network (thanks guys for that pointless roadblock), so these tests used self signed TLS certificates, which is a non-starter for someone self-hosting this.

The proposal is to:

  1. Serve the frontend from a CDN with HTTPS
  2. Use WebTransport instead of WebSockets

    WebTransport allows you to connect to a device on your local network using a temporary self-signed certificate hash. This way the local laserwebd can generate a cert, there is a handoff step to inform the frontend of that self signed cert’s hash, then you can connect to it from the browser

    See MDN docs for more info

This would allow you to install laserweb on an rpi and connect to it without having to install self-signed certs on your devices - the CDN copy has a trusted public cert.

Menus are currently unimplemented. Honestly, I prefer it that way. Just select the title from a dropdown menu and it plays. Done.

Plugins

A plugin system would be nice.

Misc

Claude Code the Video Editor

I learned while filming evidence videos for the filing that Claude Code is a capable video editor using just FFMPEG, the bitter lesson I guess.

I would film a take on an Android phone, Claude would pull the video off over Wireless ADB debugging and file it away if it was a good take. Then it could just use FFMPEG commands to make contact sheets of frames, find cutting points, create insets and timers. Here’s a draft filing video, I find the side by side comparisons it came up with particularly compelling:

DVD Bounce

The Laserweb logo is styled after the iconic DVD Video logo, and of course if you leave the tab idle for too long you get a bouncing logo animation, with a little surprise if it hits the corner.

Filtering

Laserweb includes a filtering tool to allow you to upload a custom skip list to selectively mute or skip scenes in the disc. This is evidence for the argument that the Family Movie Act of 2005 should allow owners to bypass DRM legally for that explicitly lawful purpose. Note that the act does not define what you are expected to filter, and that is very interesting if you think about it.