A Docker container to automatically record Twitch streams.
This repository hosts the source code for a Docker container that can automatically record livestreams from Twitch as they go live. The main component is from Ancalentari Twitch Stream Recorder.
To run this container and record streams from Twitch, you need to register a dummy app and get a client_id and client_secret. Both is explained in the setup section.
The container needs a few configuration parameters. These are:
USERNAME
- name of the streamer you want to record (Change this accordingly!)
QUALITY
- this uses the streamlink STREAM setting to choose the quality to record.
CLIENT_ID
- you can grab this from here once you register your application (Replace with your own!)
CLIENT_SECRET
- you generate this here as well, for your registered application (Replace with your own!)
AUTH_TOKEN
- optionally your OAuth Token to prevent ad breaks if you're subscribed to the streamer.
only add the string consisting of 30 alphanumerical characters without any quotations
Start the container with the following docker run
command:
docker run -d \
-e USERNAME=your_favourite_streamer \
-e QUALITY=best \
-e CLIENT_ID=your_client_id \
-e CLIENT_SECRET=your_client_secret \
-e AUTH_TOKEN=your_oauth_token_cookie \
-v /path/to/recordings:/opt/recordings \
ghcr.io/stefomat/twitch-stream-recorder:master
The options in this command:
-v /path/to/recordings:/opt/recordings
Map a folder of your choice (left of ":") to a defined location in the container (right of ":"). This is the place where all recordings will be saved to.
ghcr.io/stefomat/twitch-stream-recorder:master
Use the "master" tag for the latest version, that's the GitHub branch from which the Docker images will be built.
You can also run it as a docker-compose
setup.
---
version: "2"
services:
twitch-stream-recorder:
image: ghcr.io/stefomat/twitch-stream-recorder:master
container_name: twitch-stream-recorder
environment:
- USERNAME=your_favourite_streamer
- QUALITY=best
- CLIENT_ID=your_client_id
- CLIENT_SECRET=your_client_secret
- AUTH_TOKEN=your_oauth_token_cookie
volumes:
- /path/to/recordings:/opt/recordings
restart: unless-stopped
Open TODOs for future improvements:
- Switch to alpine based images
- Add "tini" init system
- Allow configuration via env variables
- Run process as non-root user?
- Cross build image for ARM architecture?