Selfβhosted autonomous livestream recorder & media library builder for Twitch (extensible to other platforms). StreamVault watches configured channels, records streams with Streamlink, performs postβprocessing, generates rich metadata/artwork, and serves everything through a modern FastAPI + Vue 3 (PWA) interface.
- Auto detection & start when a streamer goes live (Twitch EventSub)
- Streamlink based capture with quality selection & very long stream segmentation (24h+ safe rollover)
- Robust proxy support (HTTP / HTTPS) with latency + audio sync mitigation
- Graceful recovery: startup recovery scans and failed task requeue logic
- Perβstreamer recording rules, quality, cleanup policies, templates
- Bulk enable/disable & status dashboard
- Automatic category tracking (used for chapters & metadata enrichment)
- Responsive Vue 3 interface installable as PWA
- Realβtime WebSocket updates (recording state, queue progress)
- Background queue monitor & admin health test suite
- Session cookie fixes (2025) ensure stable login + PWA notifications
- Dependencyβdriven async task queue (chapters, remux, validation, thumbnails)
- Multiβformat chapter generation (.vtt/.xml) & automatic episode numbering
- Artwork pipeline with centralized store + local compatibility copies
- Safe metadata paths for Plex / Emby / Jellyfin / Kodi
- NFO generation with artwork (poster, banner, fanart) and chapters
- YearβMonth season structuring (YYYYMM) & episode naming patterns
- Intelligent relative path resolution for artwork under hidden .media directory
- Apprise integration (multiβprovider) + web push (auto VAPID key generation)
- Configurable cleanup: age / size / count across perβstreamer or global policies
- Secure REST API for external automation
- Automatic database migrations at startup (idempotent)
- Image migration & refresh services (legacy layout β new structure)
- Log rotation & pruning
- Graceful shutdown of recording & queue workers
- Docker & Docker Compose
- ~1 GB RAM (2 GB recommended) for core services
- Adequate disk (recordings: 2β8 GB / hr @ 1080p; plan ahead)
- Public HTTPS endpoint (reverse proxy) for Twitch EventSub (TLS mandatory)
Why HTTPS? Twitch requires valid, publicly reachable HTTPS for webhook verification. Use Letβs Encrypt via Traefik, Caddy, Nginx, or a Cloudflare Tunnel.
Clone the repository (recommended) to get versioned updates:
git clone https://github.com/Serph91P/StreamVault.git
cd StreamVault
cp .env.example .env # if provided / else create manually
Or fetch only the Docker assets from the docker/
directory if you prefer a slim deployment layout.
Edit .env
:
TWITCH_APP_ID=your_twitch_client_id
TWITCH_APP_SECRET=your_twitch_client_secret
BASE_URL=https://your-domain.com # Public URL (HTTPS!)
EVENTSUB_SECRET=choose_random_string # Used to verify EventSub payloads
POSTGRES_USER=streamvault
POSTGRES_PASSWORD=strong_password
POSTGRES_DB=streamvault
Optionally add proxy variables (HTTP_PROXY / HTTPS_PROXY) or adjust time zone (TZ). VAPID keys for push are autoβgenerated if not provided.
- Visit Twitch Developer Console
- Click "Create Application"
- Fill in the application details:
- Name: StreamVault (or your preferred name)
- OAuth Redirect URLs:
https://your-domain.com/auth/callback
- Category: Application Integration
- Copy the Client ID and Client Secret
- Add them to your
.env
file
server {
listen 443 ssl http2;
server_name your-domain.com;
ssl_certificate /path/to/your/certificate.crt;
ssl_certificate_key /path/to/your/private.key;
location / {
proxy_pass http://localhost:7000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
docker compose -f docker/docker-compose.yml up -d
docker compose -f docker/docker-compose.yml logs -f app
Visit https://your-domain.com
(through your proxy). Internally the app listens on port 7000.
Storage note: A 4h 1080p stream can exceed 10 GB. Configure cleanup early.
Migrations run automatically at startup (idempotent). No manual scripts are required. Logs clearly show applied / skipped migrations. If a migration partially fails the app continues (degraded) and warnings are emitted. Columns or tables that already exist are skipped silently.
StreamVault offers extensive recording configuration options:
- Output Directory: Where recordings are stored
- Filename Template: Customize file naming with variables like
{streamer}
,{title}
,{date}
- Quality Settings: Choose recording quality (best, worst, 1080p, 720p, etc.)
- Remux to MP4: Automatically convert recordings to MP4 format
Automatic cleanup helps manage storage:
{
"max_age_days": 30,
"max_size_gb": 100,
"max_files": 50,
"enabled": true
}
For users requiring proxy support:
- Configure HTTP/HTTPS proxies in settings
- Automatic audio-sync optimizations for proxy connections
- Enhanced buffering and retry logic for stable recordings
StreamVault provides a comprehensive REST API:
# Streamer Management
GET /api/streamers # Get all streamers
POST /api/streamers # Add a new streamer
PUT /api/streamers/{streamer_id} # Update streamer settings
# Recording Control
POST /api/recording/start/{streamer_id} # Start recording manually
POST /api/recording/stop/{streamer_id} # Stop recording
# Video Management
GET /api/videos # Get all videos
GET /api/videos/stream/{streamer_name}/{filename} # Stream a video
DELETE /api/videos/{video_id} # Delete a video
# Background Queue Management
GET /api/background-queue/stats # Get queue statistics
GET /api/background-queue/active-tasks # Get active tasks
GET /api/background-queue/stream/{stream_id}/tasks # Get tasks for stream
POST /api/background-queue/cancel-stream/{stream_id} # Cancel stream tasks
# Admin & Testing
GET /api/admin/test/health # System health check
POST /api/admin/test/recording-workflow # Test recording workflow
GET /api/admin/test/logs # Get system logs
Interactive OpenAPI docs: https://your-domain.com/docs
- Backend
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
- Frontend (if developing UI separately)
cd app/frontend
npm install
npm run dev
streamvault/
βββ app/
β βββ frontend/ # Vue.js frontend application
β β βββ src/ # Vue.js source code
β β β βββ components/ # Vue components including BackgroundQueueMonitor
β β β βββ composables/ # Vue composables (useBackgroundQueue, useWebSocket)
β β β βββ styles/ # SCSS styles
β β βββ dist/ # Built frontend assets
β βββ api/ # API endpoints
β β βββ background_queue_endpoints.py # Background queue API
β βββ routes/ # FastAPI route handlers
β βββ services/ # Business logic services
β β βββ recording/ # Recording service modules
β β β βββ config_manager.py # Configuration management
β β β βββ process_manager.py # Process management
β β β βββ recording_service.py # Main recording service
β β β βββ notification_manager.py # Notifications
β β βββ background_queue_service.py # Background processing
β β βββ task_dependency_manager.py # Task dependency management
β β βββ recording_task_factory.py # Task chain factory
β β βββ post_processing_task_handlers.py # Task handlers
β β βββ metadata_service.py # Metadata generation
β β βββ thumbnail_service.py # Thumbnail generation
β βββ utils/ # Utility functions
β β βββ ffmpeg_utils.py # FFmpeg operations
β β βββ streamlink_utils.py # Streamlink utilities
β β βββ mp4box_utils.py # MP4Box integration
β βββ models/ # Database models
β βββ schemas/ # Pydantic schemas
β βββ migrations/ # Database migrations
βββ docs/ # Documentation
β βββ admin_test_system.md # Admin system docs
β βββ recording_logging_integration.md # Logging docs
β βββ mp4box_integration.md # MP4Box docs
βββ recordings/ # Default recordings directory
βββ docker-compose.yml # Docker configuration
βββ requirements.txt # Python dependencies
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Recommended (run manually as needed): flake8, black, isort, mypy, bandit, safety. Integrate via preβcommit or CI.
Variable | Description | Default | Required |
---|---|---|---|
TWITCH_APP_ID |
Twitch application client ID | - | Yes |
TWITCH_APP_SECRET |
Twitch application client secret | - | Yes |
BASE_URL |
Application base URL (must be HTTPS with valid certificate) | - | Yes |
EVENTSUB_SECRET |
Secret for Twitch EventSub webhook validation | (Random if omitted) | No |
POSTGRES_USER |
PostgreSQL username | streamvault |
Yes |
POSTGRES_PASSWORD |
PostgreSQL password | - | Yes |
POSTGRES_DB |
PostgreSQL database name | streamvault |
Yes |
Note: Push / Apprise targets are configured through the UI; VAPID keys autoβgenerate on first start if absent.
- app: Main FastAPI application with Vue.js frontend (runs on port 7000)
- db: PostgreSQL database with health checks
- CPU: 2 cores
- RAM: 1GB for application
- Storage: 50GB+ (recordings grow quickly - 2-8GB per hour per stream)
- Network: Stable internet connection
- CPU: 4+ cores
- RAM: 2GB for application
- Storage: 1TB+ SSD (recordings can accumulate very quickly)
- Network: High-speed internet for multiple concurrent recordings
Storage Warning: Stream recordings can grow very large very quickly. A single 4-hour stream in 1080p can be 8-15GB. Plan your storage accordingly and consider implementing cleanup policies.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Wiki: Project Wiki
StreamVault includes a sophisticated background processing system that handles post-recording tasks efficiently:
- Metadata Generation: Extracts stream information and creates NFO files
- Chapter Generation: Creates chapter files from stream events
- MP4 Remux: Converts TS files to MP4 with embedded metadata
- MP4 Validation: Ensures file integrity before cleanup
- Thumbnail Generation: Creates thumbnails from video content
- Intelligent Cleanup: Safely removes temporary files after validation
- Real-time Monitoring: Live task progress tracking in the web interface
- Priority System: Critical tasks (validation) run before optional tasks (thumbnails)
- Retry Logic: Automatic retry for failed tasks with exponential backoff
- Dependency Resolution: Ensures tasks execute in the correct order
- Graceful Shutdown: Properly handles application restarts without data loss
- Plex/Emby/Jellyfin: Automatic NFO file generation with proper metadata
- Chapter Support: Multiple chapter formats (.vtt, .xml) for media players
- Thumbnail Creation: Multiple thumbnail formats for different media servers
- Season Organization: Automatic year-month based season structure
- Background Processing System: Dependency-based task queue β
- Media Server Integration: Plex, Emby, Jellyfin, Kodi support β
- Chapter Support: Automatic chapter generation from stream events β
- Admin Test System: Comprehensive health checks and maintenance β
- Cloud Storage Integration: S3, Google Drive, Dropbox
- Advanced Analytics: Recording statistics and insights
- Stream Highlights: Automatic highlight detection and extraction
- Streamlink - The backbone of our recording functionality
- FastAPI - Modern, fast web framework for APIs
- Vue.js - Progressive JavaScript framework for the frontend
- Twitch API - Stream data and webhooks
- FFmpeg - Video processing and conversion
- MP4Box - Advanced MP4 metadata processing
- PostgreSQL - Robust database system
- Docker - Containerization platform
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 StreamVault Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
StreamVault β Never miss a stream again.