This post is part of The movie streaming saga

Towards an acceptable video playing experience

I watch movies and TV shows. Naturally, I have some strong preferences on how to view them:

English subtitles. Most things I watch are in English. Although I’m perfectly comfortable with face-to-face English conversations, I just can’t keep up with English dialogue in movies. I also don’t want to put up with badly translated subs, so English subtitles they must be. This rules out most Vietnamese “netflixes”.

1080p, unless it’s ancient or super rare stuff.

Streamable from tablets. I shouldn’t need to turn on my PC just to catch up on the latest Better Call Saul episode.

In 2020, there sure are a variety of options available, all of which fall short in some ways:

Remote seedbox + Google Drive#

I settled on Netflix and torrented stuff that’s not available there. For the seedbox, I installed Transmission-web on a Ramnode VPS that has 320GB of HDD at $50/year. The network bandwidth is meh but it gets the job done.

Since Transmission supports hooks via external scripts, I set it up so that downloaded torrents get uploaded to my Google Drive using rclone.

Now whenever I find something interesting that’s not on Netflix, I look for a working torrent file and tell my seedbox to get it. Thanks to the web interface I can do it from both my PC and tablet. I don’t have to keep my devices running so it doesn’t matter if the torrent is not well-seeded and takes a long time.

Once the file lands on Google Drive, I can either:

The latter is not ideal.

Enter gflick#

Turns out advanced video players like mpv and vlc can directly stream HTTP videos with full support for seeking and audio / text(a.k.a subtitles) tracks. See, well-formed video container formats will have metadata at the beginning of the file telling where each track lies within the file. The player can download just the metadata first, then the subtitle track, then the actual video track starting from a specific position. This is only possible if the http server supports partial content download via the Range header.

Google Drive does have a “direct link” API in the form of https://www.googleapis.com/drive/v3/files/<fileId>?alt=media, which luckily supports partial download. The bad news is downloading private files requires authentication via a bearer token. The only HTTP authentication scheme that these players support, as far as I know, is Basic auth.

So I wrote gflick, which is practically an HTTP proxy that does Google authentication behind the scene, exposing a plain HTTP streaming endpoint so mpv and the like can use without modification.

Here’s what it looks like in action:

It can run just fine as a local server, but cumbersome and not practical on tablets, so I put it on a publicly accessible server, protected by nginx which does TLS and Basic Auth. As mentioned earlier, good video players can do basic auth out of the box. Gflick also exposes a simple web interface to browse my Google Drives, so now I can browse my drive on any pc/tablet, and watch things with full seek, subtitle/audio track support, right?

Not quite. While desktop versions of these players work fine, their Android versions won’t play it. Now I regret selling my Surface Go! :(

And… that’s where I’m stuck at the moment. Not sure if I should buy one of those Chinese Surface knock-offs or what.

Other failed attempts#

Also both of those required setting up each client device. Not ideal.

Here's every post in The movie streaming saga, in chronological order:

  1. Towards an acceptable video playing experience (you are here)
  2. Streaming videos from Google Drive: a second attempt
  3. The video streaming finale, or why put.io is awesome