- Python 64.7%
- C# 21.7%
- HTML 10.1%
- PowerShell 1.6%
- Batchfile 0.7%
- Other 1.2%
- Renamed download flags in ContentDownloader for clarity. - Enhanced FileManager with methods to build upload paths and verify existing files for rclone uploads. - Updated StreamProcessor to return success status for stream processing. - Added rclone smoke test and healthcheck functions to validate configuration and tool availability. - Improved environment variable handling with a utility function. - Updated TwitchArchive to incorporate new rclone verification and processing logic. - Added unit tests for new functionality and refactored existing tests for clarity and coverage. Co-authored-by: Copilot <copilot@github.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| .github/instructions | ||
| bin | ||
| config | ||
| docker | ||
| dotnet | ||
| modules | ||
| .dockerignore | ||
| .env.development | ||
| .env.production | ||
| .gitattributes | ||
| .gitignore | ||
| .python-version | ||
| docker-compose.override.yml | ||
| docker-compose.yml | ||
| dockerrebuild.bat | ||
| dockerstart.bat | ||
| extra.md | ||
| IMPROVEMENTS.md | ||
| install-pyenv-win.ps1 | ||
| loopstart.bat | ||
| only-vod-chat.py | ||
| README.md | ||
| requirements.txt | ||
| run_chat_only.py | ||
| run_tests.ps1 | ||
| start.bat | ||
| start_chat_only.bat | ||
| startmulti - Copy.bat | ||
| startmulti.bat | ||
| test_twitch_archive.py | ||
| test_twitch_archive_simple.py | ||
| twitch-archive.py | ||
| UpgradePlan.md | ||
| UpgradePlan2.md | ||
Twitch Archive
Inspired by https://github.com/EnterGin/Auto-Stream-Recording-Twitch
Git LFS
This repository stores large media files (recorded video and some binaries). Use Git LFS to manage large objects.
Quick setup (Windows):
- Install Git LFS:
git lfs install - Ensure
.gitattributesis committed (this repo includes one). - If you already have large files tracked by normal Git, migrate them:
git lfs install
git lfs track "*.mp4" "*.mkv" "bin/*"
git add .gitattributes
git add -A
git commit -m "Migrate large files to LFS"
git push origin main
Notes:
- Git LFS needs server-side support. If using GitHub, enable Git LFS on the remote and ensure you have sufficient bandwidth/storage quota.
- You can customize tracked patterns in
.gitattributes.
Python script to check, download live stream, VOD, chat and upload them to any cloud storage supported by rclone.
Docker
This repository now includes a Python-only container setup for the archiver. The dotnet subapp is not part of this container flow.
Files:
docker/python.Dockerfile: production image for the Python archiverdocker-compose.yml: deployment-oriented compose filedocker-compose.override.yml: local development and testing override.env.production: production container and app environment template.env.development: development container and app environment templatedockerstart.bat: Windows helper to run the container like the old batch launcher
Container layout
- Mount your external archive folder to
/app/archive - Mount your external config folder to
/app/config - Put your
rclone.conffile at/app/config/rclone.confon the mounted host path - The container exports
RCLONE_CONFIG=/app/config/rclone.conf, so rclone will use that file automatically
Production deployment
- Edit
.env.productionwith your image name, Twitch credentials, bind paths, and default arguments. - Place your streamer JSON files and
rclone.confin the mounted config folder. - Start the container:
docker compose --env-file .env.production up -d
- Follow logs:
docker compose --env-file .env.production logs -f twitch-archive
Development and local testing
The override compose file builds the image locally and mounts the repository for faster iteration.
Start it with:
docker compose --env-file .env.development -f docker-compose.yml -f docker-compose.override.yml up --build
Run a one-off manual test for another streamer:
docker compose --env-file .env.development -f docker-compose.yml -f docker-compose.override.yml run --rm twitch-archive python twitch-archive.py -u hackerling --verbose
Or use the Windows helper:
.\dockerstart.bat vinesauce --verbose
That batch launcher mirrors the old pattern and expands to a compose run command, so you can test any streamer manually.
Healthcheck and smoke tests
- Container healthcheck command:
python twitch-archive.py --healthcheck -u vinesauce - Rclone smoke test command:
python twitch-archive.py -u vinesauce --rclone-smoke-test
The healthcheck verifies config loading plus streamlink, ffmpeg, TwitchDownloaderCLI, and rclone availability. The smoke test writes a tiny file, uploads it with the configured rclone remote, and prints the live rclone output into the container logs.
⚡ FFmpeg 8.0 Enhanced
Now with FFmpeg 8.0+ support featuring hardware acceleration and performance improvements!
- 5-10x faster encoding with NVIDIA, Intel, or AMD GPUs
- Docker-ready with Linux builds
- Configurable options for different scenarios
- 📖 See FFMPEG_SETUP.md for detailed setup instructions
Requirements
- Python 3
- Streamlink
- FFmpeg 8.0+ (see FFMPEG_SETUP.md for platform-specific versions)
Getting started
- Install Python 3.x
- Install Streamlink 5.1.x
- If you want to upload to any cloud storage using rclone, configure rclone.
git clone https://github.com/piero0920/Twitch-Archive.gitcd Twitch-Archivepip install -r requirements.txt- Edit the
.env.sampleand rename it to.env
CLIENT-ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CLIENT-SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OAUTH-PRIVATE-TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # optional to record without ADS or download sub-only VODS
- Copy
config.sample.jsontoconfig.jsonand edit it with your settings (username, quality, paths, etc.) - run
Python twitch-archive.pyor for multiple streamersPython twitch-archive.py -u streamer