Boltstream Live Video Streaming Website + Backend

Related tags

Video boltstream
Overview

Boltstream

Self-hosted Live Video Streaming Website + Backend

Reference website: https://boltstream.me

This is the result of a series of blog posts that I made here

Join us on Freenode! #boltstream

Features

  • Live stream via RTMP with a stream key to your RTMP ingest server
  • Any number of simultaneous live streams
  • Playback via standard HLS
  • Restrict playback with HLS segment encryption (AES-128)
    • Pay-per-view
    • Pay-per-minute :-)
  • Capture VODs (recordings) of live streams
    • Live-clipping of VODs via nginx-vod-module
  • Timed metadata via WebVTT
    • Synchronized chat room messages
    • Synchronized play-by-play live sports events

Core Components

  • Django
    • Web application
  • nginx
    • Web server
  • nginx-rtmp
    • RTMP ingest
    • Actually, we use a fork that adds a number of features that we use. The original nginx-rtmp hasn't been updated in years.
  • nginx-vod-module
    • HLS VODs
    • Live clipping
  • FFMPEG
    • Various video encoding/packaging

Optional Components

  • SportRadar
    • Realtime sports play-by-play data synchronized to your live streams
  • ACRCloud
    • Audio content recognition (Shazaam for your live streams)

Getting Started

Clone this repo!

There is a Terraform configuration for deploying this infrastructure on DigitalOcean.

First, edit ansible/site.yml and update all the variables like .

You will also need to modify some variables in terraform/terraform.tfvars, and then from within the terraform directory, just run:

$ make apply

At the end of the Terraform deployment (might take 10-15 minutes), you will have a full self-hosted live video streaming platform with your own RTMP ingest and playback endpoints.

Happy Streaming!

Running Locally

If you're interested in running the Django app locallly, then you can do:

# Set up Python virtualenv
$ make venv
$ source venv/bin/activate

# Install Python dependencies
$ make deps

# Apply database migrations (db.sqlite3) and load the initial data
$ make cleandb

# Run the Django development server
$ make run

You can log in with the default user at:

Website Username Password
http://localhost:8000/sign-in boltstream boltstream

Help Wanted!

I put this stack together about a year ago and haven't been able to push much further on it.

Ideally it could be deployed in Docker (I don't know anything about Docker or Kubernetes). The nginx and Django stuff seems like it could be pretty easy to containerize.

Help me package this up! We need more federated live-streaming platforms! It can't just always be Twitch.tv, YouTube, and Facebook!

Comments
  • Cannot create superuser

    Cannot create superuser

    Not sure if I broke something, but i'm having issues registering users.

    ➜ boltstream git:(master) ✗ python3 manage.py createsuperuser Username: Error: This field cannot be blank. Username: admin
    CommandError: “admin” is not a valid UUID. ➜ boltstream git:(master) ✗

    Is there something special missing?

    opened by ling-postfix 3
  • Missing app.env file

    Missing app.env file

    One of the tasks for setup is to copy ansible/roles/app/files/app.env to /.env, however this file has been excluded in gitignore and isn't present in the repo.

    I'm guessing this file interpolates the variables from the terraform config for the app (e.g. database host).

    Can you please provide this file?

    I tried to reverse engineer it, and ended up with the below but I might have missed stuff (in mine I've changed from MariaDB to Postgres):

    SECRET_KEY=debug
    DATABASE_URL=postgresql://{{ database_user }}:{{ database_password }}@{{ database_host }}:{{ database_port }}/{{ database_name }}
    CACHE_URL={{ cache_url }}
    BROKER_URL={{ broker_url }}
    AWS_STORAGE_BUCKET_NAME={{ aws_storage_bucket_name }}
    AWS_S3_CUSTOM_DOMAIN={{ aws_s3_custom_domain }}
    AWS_S3_REGION_NAME={{ aws_s3_region_name }}
    AWS_S3_ENDPOINT_URL={{ aws_s3_endpoint_url }}
    RTMP_SECRET={{ rtmp_secret }}
    RTMP_ENDPOINT={{ rtmp_endpoint }}
    EXPIRE_VIEWER_SECONDS=60
    SESSION_COOKIE_DOMAIN=domain
    CSRF_TRUSTED_ORIGINS=domain
    PORT=8083
    
    opened by 0x62 1
  • Sign-Up

    Sign-Up

    Is there a sign-up? I can't "stream now" on demo or my local installation because it keeps going into a sign-in loop. The superuser admin account doesn't work (loop) and I can't create a regular user (missing sign-up).

    opened by nitrag 1
  • Any plans/thoughts for SuperChat-like feature?

    Any plans/thoughts for SuperChat-like feature?

    Pretty self explanatory. I haven't seen any self-hosted streaming solutions that could take $-contributions from the audience. Do you know of any or have plans on payment gateway connections for boltstream? Thanks! :)

    opened by dm17 1
  • Console Interview

    Console Interview

    Hey Ben!

    Love what you're doing here. I tried to reach out on Twitter and never heard back, so I'm trying here instead.

    I recently started a newsletter about open source software and I like to put an interview with one of the developers in each email if I can get it. Would you be interested in answering a few questions about software development and boltstream?

    opened by sjkelleyjr 0
  • Multiple viewers in sync? 1-5s, 500ms? *10*ms?

    Multiple viewers in sync? 1-5s, 500ms? *10*ms?

    This might be an question with an obvious answer, but over the whole pandemic I’ve been searching for video sharing services with one goal:

    To get the viewers as in-sync as possible.

    Vynchronize has been really decent, as has BigScreen on the Quest. There have been dozens and dozens of potential solutions that have ended up in the nevermind pile just due to not getting this right (even Plex, which was stunning to me).

    One of the bigger issues of course is how wildly latency can vary from server to client. Linear video is uniquely suited to this since you can have a large buffer and just sync periodically (say, at key frames), but it also clearly requires specific thought and work around making that happen.

    Functionality like: -Watching video without echo while also being on a phone call together (or video chat on a separate device) -Pausing the video to talk about it -Rewinding to review (normally less than 60s) -Rewinding to let someone catch up (they lost the video, or had something come up) (5-20 min normally, but could be arbitrarily anywhere in the video)

    Are all things that come up across social usage scenarios like virtual classrooms, study sessions, movie watching, or even business presentations

    opened by Joshfindit 0
  • Fix creating a superuser via the Django CLI and add instructions to run the Django app locally

    Fix creating a superuser via the Django CLI and add instructions to run the Django app locally

    • Fix looking up by natural key when creating a Django superuser
    • Add instructions to the README on how to run the Django app locally
    • Add default initial data with a django superuser (boltstream/boltstream) for testing
    opened by benwilber 0
  • Stream not working

    Stream not working

    Not sure if it's because I'm using the development server but after I create a live stream I get the following message when I try to view test the stream, "The media could not be loaded, either because the server or network failed or because the format is not supported."

    I get the following error in the terminal:

    Internal Server Error: /live/21ec6283-bf66-4763-a2ee-aaa295157552/preview.jpg Traceback (most recent call last): File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/boltstream/venv/lib/python3.8/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback return callback(request, *args, **kwargs) TypeError: fake_view() got an unexpected keyword argument 'uuid' Internal Server Error: /live/21ec6283-bf66-4763-a2ee-aaa295157552/preview.jpg Traceback (most recent call last): File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/boltstream/venv/lib/python3.8/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback return callback(request, *args, **kwargs) TypeError: fake_view() got an unexpected keyword argument 'uuid' [22/Dec/2021 06:57:15] "GET /live/21ec6283-bf66-4763-a2ee-aaa295157552/preview.jpg HTTP/1.1" 500 73221 [22/Dec/2021 06:57:15] "GET /live/21ec6283-bf66-4763-a2ee-aaa295157552/preview.jpg?width=400 HTTP/1.1" 500 73569 Internal Server Error: /live/21ec6283-bf66-4763-a2ee-aaa295157552/preview.mp4 Traceback (most recent call last): File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/boltstream/venv/lib/python3.8/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback return callback(request, *args, **kwargs) TypeError: fake_view() got an unexpected keyword argument 'uuid' [22/Dec/2021 06:57:15] "GET /live/21ec6283-bf66-4763-a2ee-aaa295157552/preview.mp4 HTTP/1.1" 500 73290 Internal Server Error: /channel/21ec6283-bf66-4763-a2ee-aaa295157552 Traceback (most recent call last): File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/boltstream/venv/lib/python3.8/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback return callback(request, *args, **kwargs) TypeError: fake_view() got an unexpected keyword argument 'uuid' [22/Dec/2021 06:57:15] "GET /channel/21ec6283-bf66-4763-a2ee-aaa295157552 HTTP/1.1" 500 72814

    Exception happened during processing of request from ('127.0.0.1', 35144) Traceback (most recent call last): File "/usr/lib/python3.8/socketserver.py", line 683, in process_request_thread self.finish_request(request, client_address) File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python3.8/socketserver.py", line 747, in init self.handle() File "/boltstream/venv/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 174, in handle self.handle_one_request() File "/boltstream/venv/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 182, in handle_one_request self.raw_requestline = self.rfile.readline(65537) File "/usr/lib/python3.8/socket.py", line 669, in readinto return self._sock.recv_into(b) ConnectionResetError: [Errno 104] Connection reset by peer

    Internal Server Error: /live/21ec6283-bf66-4763-a2ee-aaa295157552/master.m3u8 Traceback (most recent call last): File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/boltstream/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/boltstream/venv/lib/python3.8/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback return callback(request, *args, **kwargs) File "/boltstream/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "/boltstream/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch return handler(request, *args, **kwargs) File "/boltstream/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "/boltstream/venv/lib/python3.8/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/boltstream/boltstream/views.py", line 118, in get manifest = make_master_manifest(request, stream) File "/boltstream/boltstream/manifests.py", line 13, in make_master_manifest if stream.info: File "/boltstream/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in get res = instance.dict[self.name] = self.func(instance) File "/boltstream/boltstream/models.py", line 233, in info return fetch_info(self) File "/boltstream/boltstream/control.py", line 28, in fetch_info r = requests.get(url, headers=build_headers()) File "/boltstream/venv/lib/python3.8/site-packages/requests/api.py", line 76, in get return request('get', url, params=params, **kwargs) File "/boltstream/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, **kwargs) File "/boltstream/venv/lib/python3.8/site-packages/requests/sessions.py", line 528, in request prep = self.prepare_request(req) File "/boltstream/venv/lib/python3.8/site-packages/requests/sessions.py", line 456, in prepare_request p.prepare( File "/boltstream/venv/lib/python3.8/site-packages/requests/models.py", line 316, in prepare self.prepare_url(url, params) File "/boltstream/venv/lib/python3.8/site-packages/requests/models.py", line 393, in prepare_url raise InvalidURL("Invalid URL %r: No host supplied" % url) requests.exceptions.InvalidURL: Invalid URL 'http:///stream-info': No host supplied [22/Dec/2021 06:57:15] "GET /live/21ec6283-bf66-4763-a2ee-aaa295157552/master.m3u8 HTTP/1.1" 500 142667

    opened by reggiecloudz 0
  • Remake the installation instructions.

    Remake the installation instructions.

    Hello , Would it be possible to redo the installation tutorial but with the new update. After installation it seems to have a lot of information that have changed or even missing. I also can't run the docker version.

    Thanks :D

    opened by Waffleuncle 0
Owner
Ben Wilber
Ben Wilber
Telegram Video Chat Video Streaming bot 🇱🇰

?? Get SESSION_NAME from below: Pyrogram ?? Preview ✨ Features Music & Video stream support MultiChat support Playlist & Queue support Skip, Pause, Re

DOOZY YEZ 5 Jun 26, 2022
Turn any live video stream or locally stored video into a dataset of interesting samples for ML training, or any other type of analysis.

Sieve Video Data Collection Example Find samples that are interesting within hours of raw video, for free and completely automatically using Sieve API

Sieve 72 Aug 1, 2022
Telegram Music/ Video Streaming Bot Using Pytgcalls

Video Player ?? ᴢᴀɪᴅ ᴠᴄ ᴘʟᴀyᴇʀ ɪꜱ ᴀ ᴛᴇʟᴇɢʀᴀᴍ ᴘʀᴏᴊᴇᴄᴛ ʙᴀꜱᴇᴅ ᴏɴ ᴘʏʀᴏɢʀᴀᴍ ꜰᴏʀ ᴘʟᴀʏ ᴍᴜꜱɪᴄꜱ ɪɴ ᴠᴄ ᴄʜᴀᴛꜱ... ???????? ?????????? ʀᴇQᴜɪʀᴇᴍᴇɴᴛꜱ ?? FFmpeg NodeJ

null 16 Nov 30, 2022
Video stream image stacking -- live version

video stream image stacking v2 -- live version A very simple streamed video image stacking code! Version 2.1 left mouse click to select a small region

Chakravarthy Mathiazhagan 1 Jan 3, 2022
OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality video editing and animation solutions to the world.

OpenShot Video Editor is an award-winning free and open-source video editor for Linux, Mac, and Windows, and is dedicated to delivering high quality v

OpenShot Studios, LLC 3.1k Jan 1, 2023
Your own movie streaming service. Easy to install, easy to use. Download, manage and watch your favorite movies conveniently from your browser or phone. Install it on your server, access it anywhere and enjoy.

Vigilio Your own movie streaming service. Easy to install, easy to use. Download, manage and watch your favorite movies conveniently from your browser

Tugcan Olgun 141 Jan 6, 2023
Python Script for Streaming YouTube Videos in VLC Media Player.

Short Description Use this Simple Script to stream YouTube Video to VLC

Sijey 6 May 27, 2021
pyffstream - A CLI frontend for streaming over SRT and RTMP specializing in sending off files

pyffstream - A CLI frontend for streaming over SRT and RTMP specializing in sending off files

Gregory Beauregard 3 Mar 4, 2022
Streamlink is a CLI utility which pipes video streams from various services into a video player

Streamlink is a CLI utility which pipes video streams from various services into a video player

null 8.2k Dec 26, 2022
MoviePy is a Python library for video editing, can read and write all the most common audio and video formats

MoviePy is a Python library for video editing: cutting, concatenations, title insertions, video compositing (a.k.a. non-linear editing), video processing, and creation of custom effects. See the gallery for some examples of use.

null 10k Jan 8, 2023
A youtube video link or id to video thumbnail python package.

Youtube-Video-Thumbnail A youtube video link or id to video thumbnail python package. Made with Python3

Fayas Noushad 10 Oct 21, 2022
Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images to include in the video.

Text2Video Text2Video's purpose is to help people create videos quickly and easily by simply typing out the video’s script and a description of images

Josh Chen 19 Nov 22, 2022
Filtering user-generated video content(SberZvukTechDays)Filtering user-generated video content(SberZvukTechDays)

Filtering user-generated video content(SberZvukTechDays) Table of contents General info Team members Technologies Setup Result General info This is a

Roman 6 Apr 6, 2022
Extracting frames from video and create video using frames

Extracting frames from video and create video using frames This program uses opencv library to extract the frames from video and create video from ext

null 1 Nov 19, 2021
Play Video & Music on Telegram Group Video Chat

?? DEMONGIRL ?? ʜᴇʟʟᴏ ❤️ ???? Join us ᴠɪᴅᴇᴏ sᴛʀᴇᴀᴍ ɪs ᴀɴ ᴀᴅᴠᴀɴᴄᴇᴅ ᴛᴇʟᴇʀᴀᴍ ʙᴏᴛ ᴛʜᴀᴛ's ᴀʟʟᴏᴡ ʏᴏᴜ ᴛᴏ ᴘʟᴀʏ ᴠɪᴅᴇᴏ & ᴍᴜsɪᴄ ᴏɴ ᴛᴇʟᴇɢʀᴀᴍ ɢʀᴏᴜᴘ ᴠɪᴅᴇᴏ ᴄʜᴀᴛ ?? ɢ

Jonathan 5 Dec 31, 2021
Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Shorts-Tik-Tok-Creator Takes a video as an input and creates a video which is suitable to upload on Youtube Shorts and Tik Tok (1080x1920 resolution).

Arber Hakaj 5 Nov 9, 2022
Video-to-GIF-Converter - A small code snippet that can be used to convert any video to a gif

Video to GIF Converter Project Description: This is a small code snippet that ca

Hassan Shahzad 3 Jun 22, 2022
Video-stream - A telegram video stream bot repo

This is a Telegram Video stream Bot. Binary Tech ?? Features stream videos downl

silentz lk 1 Feb 2, 2022
Terminal-Video-Player - A program that can display video in the terminal using ascii characters

Terminal-Video-Player - A program that can display video in the terminal using ascii characters

null 15 Nov 10, 2022