Skip to content

tronajay/stream_station

Repository files navigation

Stream Station

A Django-based live streaming application that loops pre-recorded videos to RTMP destinations like YouTube, Twitch, Facebook, and custom RTMP servers.

Features

  • Multi-Platform Streaming: Stream to YouTube, Twitch, Facebook, or any custom RTMP server
  • Video Playlist Management: Upload and organize videos with drag-and-drop ordering
  • Multi-Stream Support: Run multiple streams simultaneously to different platforms
  • Config-Specific Playlists: Assign different videos to different stream configurations
  • Loop Playback: Videos play continuously in a loop
  • Directory Sync: Drop videos directly into the media folder and sync with one click
  • Real-time Status: Monitor stream status with live updates
  • Session History: Track all streaming sessions with detailed logs

Quick Start

One-Command Setup

git clone <your-repo-url> stream_station
cd stream_station
./setup.sh

The setup script will automatically:

  • Install Python 3.10+ (if not present)
  • Install FFmpeg (if not present)
  • Create virtual environment
  • Install all dependencies
  • Run database migrations
  • Create admin user (optional)
  • Start the development server

Manual Setup

If you prefer manual installation:

# 1. Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# 2. Install dependencies
pip install -r requirements.txt

# 3. Run migrations
python manage.py migrate

# 4. Create admin user
python manage.py createsuperuser

# 5. Start server
python manage.py runserver

Usage

Adding Videos

Option 1: Web Upload

  1. Go to Videos page
  2. Click "Add Video"
  3. Upload your video file

Option 2: Direct Upload (Recommended for large files)

  1. Copy video files to media/videos/ directory
  2. Go to Videos page
  3. Click "Refresh" to sync with database

Creating Stream Configuration

  1. Go to Configurations page
  2. Click "New Configuration"
  3. Fill in:
    • Name: A friendly name for this config
    • Platform: Select your streaming platform
    • RTMP URL: Auto-filled based on platform
    • Stream Key: Your platform's stream key
    • Video Settings: Resolution, FPS, bitrate
    • Playlist Videos: Select which videos to stream (optional)
  4. Save configuration

Starting a Stream

  1. Go to Dashboard
  2. Select a configuration from dropdown
  3. Click "Go Live"
  4. Monitor stream status in real-time

Multi-Stream

You can run multiple streams simultaneously:

  1. Start first stream with one configuration
  2. Select another configuration from dropdown
  3. Click "Go Live" again
  4. Each stream can be stopped individually

Supported Video Formats

  • MP4 (recommended)
  • MKV
  • AVI
  • MOV
  • WebM
  • FLV
  • WMV
  • M4V

Platform RTMP URLs

Platform RTMP URL
YouTube rtmp://a.rtmp.youtube.com/live2
Twitch rtmp://live.twitch.tv/app
Facebook rtmps://live-api-s.facebook.com:443/rtmp/

API Endpoints

Stream Station provides REST API endpoints:

Endpoint Description
GET /api/stream/status/ Get current stream status
POST /api/stream/control/ Start/stop streams
GET /api/ffmpeg/status/ Get FFmpeg installation status
GET /api/videos/ List all videos
GET /api/configs/ List all configurations
GET /api/sessions/ List streaming sessions

Project Structure

stream_station/
├── manage.py
├── setup.sh              # One-click setup script
├── requirements.txt
├── media/
│   ├── videos/          # Video files
│   ├── playlists/       # Generated playlist files
│   └── logs/            # FFmpeg logs
├── stream_station/      # Django project settings
└── streaming/           # Main application
    ├── models.py        # Video, StreamConfig, StreamSession
    ├── views.py         # Web views
    ├── api_views.py     # REST API views
    ├── services/        # FFmpeg service
    └── templates/       # HTML templates

Requirements

  • Python 3.10+
  • FFmpeg
  • Django 5.0+
  • Django REST Framework

Troubleshooting

Stream not visible on YouTube

  • Ensure your video has audio or the stream generates silent audio automatically
  • Check that your stream key is correct
  • Verify YouTube Studio shows "receiving data"

FFmpeg not found

# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt install ffmpeg

# CentOS/RHEL
sudo yum install ffmpeg

Permission denied on setup.sh

chmod +x setup.sh
./setup.sh

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors