Rearranging the computer

Reading time: 1 minute


Programming the computer allows you to take something you see and rearrange the pieces a bit to better fit your needs. It’s really a delightful and powerful thing.

A few weeks ago, Daisy and I were staying in a cottage with poor internet speeds. We were trying to stream a series of videos, but the embedded player would only get through a few seconds of playback before it choked for several minutes on the next chunk. We’d have liked to let it buffer the full video, but the player supported lookahead for just a handful of seconds.

Hacker hat on, I right-clicked and navigated to Inspect the fabric of reality.

Cool! It looks like the player fetches small chunks of stream data and queues them up. These segments are named predictably, and have a sequential ID scheme to boot. I wonder if we can throw something together to download all the segments on our own schedule?

We can even queue up downloads for multiple videos, so this can run while we sleep.

Now that we’ve got the data that the player is fetching, can we render it into a video? Let’s take a closer look at one of these files.

Another quick search tells us that we can literally just concatenate MPEG-TS files together, and the resulting jumbo will still be understood by players. Groovy.

And with that, we’ve got the full video downloaded locally, and can watch it at our leisure! We started off with a locked-down and inconvenient interface, but using the computer allowed us to rearrange our use of the data source into something that better fit our needs.


Newsletter

Put your email in this funny little box, and I'll send you a message when I post new stuff.