Skip to content

Instantly share code, notes, and snippets.

@dowodenum
Last active May 15, 2022 08:19
Show Gist options
  • Save dowodenum/176b045d982391a9a25d85166c3a9ed1 to your computer and use it in GitHub Desktop.
Save dowodenum/176b045d982391a9a25d85166c3a9ed1 to your computer and use it in GitHub Desktop.
Streamlink on GrapheneOS (Android 12) via Termux, Liveproxy, MPV
Adapted from a reddit post: https://www.reddit.com/r/Streamlink/comments/cfno18/guide_streamlink_on_android_termux_vlc/
Prerequisites (below F-Droid links, but you can also install it from Gulagle Play Store)
* [Termux](https://f-droid.org/en/packages/com.termux/
* [MPV](https://f-droid.org/en/packages/is.xyz.mpv/)
* or [VLC](https://www.f-droid.org/en/packages/org.videolan.vlc/)
* For step 6: some kind of GUI text editor (ACode?), or use nano
After installing Termux and its API addon, we can proceed installing the packages required through Termux's own package manager.
# 1) Update repositories
$ pkg update
# 2) Install required packages
$ pkg install clang python libxlm2 libxslt nano
# 3) Install and build streamlink
$ pip install streamlink
# 4) Install and build liveproxy
$ pip install liveproxy
# 5) Create a folder on your phone, i.e., /emulated/0/Streams
# 6) Create .m3u files for each stream, the contents of which are as follows:
http://127.0.0.1:53422/base64/STREAMLINK-COMMANDS/
Where "STREAMLINK-COMMANDS" is a base64-encoded string - contents of which are as follows:
streamlink https://twitch.tv/BobRoss best
You can use a site like https://www.base64encode.org to encode to base64.
For the above example, the URL would be: http://127.0.0.1:53422/base64/c3RyZWFtbGluayBodHRwczovL3R3aXRjaC50di9Cb2JSb3NzIGJlc3Q/
Do this for each stream, in a separate .m3u file - will make it convenient to launch them.
# 7) In Termux, edit ~/.profile:
nano ~/.profile
# 8) Add an alias to start liveproxy on port 53422:
alias lp="liveproxy --port 53422"
Then Ctrl+S, Ctrl+X to save and exit.
# 9) "exit" and reopen Termux, then start Liveproxy:
lp
# 10) Switch over to VLC or MPV, browse to your Streams folder, and tap on a .m3u file!
Steps 1-8 are all initial setup, while steps 9 and 10 are all that are needed for repeated viewing.
Watching a new stream is somewhat tedious, given the base64 URL that Liveproxy expects...
This can probably be alleviated with some bash functions to generate the .m3u file for you. Let's call that homework!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment