A self-hosted streaming platform with Discord authentication, auto-recording and more!

Overview

Overpass

Overpass makes it easy to host your own live streaming server with features such as authentication via Discord, stream playback in your web browser, and an easy way to archive your streams for your users to rewatch!

Overpass also lets you run a private instance for a users on a single Discord server. Simply add the server ID of your Discord server to the configuration file and Overpass will take care of the rest.

Powered by nginx-rtmp.

Dependencies

Getting Started

Creating the Discord app for Overpass

Navigate to Discord's Developer Portal.

  • Select "New Application" in the top left corner
  • Choose a name for your application
  • Select the "OAuth2" tab
  • Find the "Client Information" section of the page, and copy your "Client ID" and your "Client Secret" and save these for use in the configuration file
  • Click "Add redirect" and type in a URI like so:

https://overpass.dev/auth/callback - replacing overpass.dev with your domain name.

Note: If you wish to develop on Overpass, you will have to add http://localhost:5000/auth/callback to your list of redirect URIs.

Install

Docker Usage

There is a Docker image for Overpass, which you can either build yourself with the Dockerfile, or download from the Docker Hub.

This image is pre-configured to run Overpass in production mode with Gunicorn, so if you wish to develop on Overpass, you may need to change docker/startup.sh to execute flask run, and modifying the route to Overpass' API in the nginx configuration.

Continue reading if you wish to run Overpass on bare-metal, otherwise, you can use the example Docker Compose file.

Creating a config file

Note: If you are using Docker, set these values as environment variables. See the example Docker Compose file. You will not have to create the .env file.

Generate a secret key

Run python -c "import os; print(os.urandom(16))" and copy the output after the byte symbol into OVERPASS_SECRET_KEY

Create an empty .env file, in the projects' root directory which contains the following:

DISCORD_CLIENT_ID =
DISCORD_CLIENT_SECRET = ""
DISCORD_REDIRECT_URI = ""
DISCORD_GUILD_ID = (if you want to restrict access to the tool to users from a certain guild ID - set one here)


OVERPASS_SECRET_KEY = "your generated key here"

HLS_PATH = ""
REC_PATH = ""
RTMP_SERVER = (IP address and port of your RTMP server - as a string)

Example config

DISCORD_CLIENT_ID = 31040105101013151
DISCORD_CLIENT_SECRET = "1251XXXXXXXXXXXXXXXXXXXXX"
DISCORD_REDIRECT_URI = "https://overpass.dev/auth/callback"
DISCORD_GUILD_ID = 05105010105619519

OVERPASS_SECRET_KEY = "#\x1an\x1an\x1an\x1an\x1an"

HLS_PATH = "/storage/overpass/hls"
REC_PATH = "/storage/overpass/archive"

RTMP_SERVER = "overpass.dev:1935/live"

Streaming server setup

  • Create the directories you defined in HLS_PATH and REC_PATH and make sure to give www-data write permissions to said folder.

Make sure the user the Overpass is running as also has read and write access to the same folders.

Remember to change the on_publish and on_done URIs, record_path and hls_path variables to match your environment

Edit your nginx.conf file to contain the following information.

rtmp {
    server {
        listen 1935;
        on_publish http://127.0.0.1:5000/api/rtmp/connect;
        on_done http://127.0.0.1:5000/api/rtmp/done;

        application live {
            deny play all;
            live on;
            record all;
            record_path /storage/overpass/archive;
            record_append on;

            hls on;
            hls_path /storage/overpass/hls;
            hls_fragment 2;
            hls_playlist_length 10;
            exec_record_done bash -c "/usr/bin/ffmpeg -i $path -acodec copy -vcodec copy -movflags +faststart /your/recording/path/$basename.mp4 && rm $path";
         }
    }
}

Running the application

  • Run flask init-db to initialize the database.

Development mode

  • Run flask run

Deploying to production

In the same folder as Overpass, while in a virtual environment, run the following command:

gunicorn -w 10 app:app --timeout 600 --log-level=debug --access-logformat "%({X-Real-IP}i)s %(l)s %(t)s %(b)s '%(f)s' '%(a)s'" --access-logfile '-'

NGINX setup

location / {
    proxy_pass http://127.0.0.1:8000;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
}

Screenshots

Homepage Web Player Archive Profile Page

Comments
  • Docker image for linux/amd64?

    Docker image for linux/amd64?

    Hi, I was curious if it'd be possible to get a docker image built for linux/amd64?

    I've been interested in running this project for a few days and finally got around to attempting to get it running only to find out Docker images intended for armv7 cannot be ran on amd64 platforms.

    I'm not experienced with Docker by any means so maybe im missing something super obvious so im kind of stuck unless I attempt to build manually.

    Thanks and I hope to see this project grow.

    opened by pxdn1 20
  • Internal Server Error after Manual Setup.

    Internal Server Error after Manual Setup.

    Getting this after Discord Auth:

    Screenshot_2021-12-18_13-33-48

    This is in the terminal:

    ^[email protected]:~/overpass$ flask run
     * Environment: production
       WARNING: This is a development server. Do not use it in a production deployment.
       Use a production WSGI server instead.
     * Debug mode: off
     * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
    127.0.0.1 - - [18/Dec/2021 13:34:25] "GET / HTTP/1.1" 200 -
    127.0.0.1 - - [18/Dec/2021 13:34:27] "GET /auth/login/ HTTP/1.1" 302 -
    127.0.0.1 - - [18/Dec/2021 13:34:30] "GET /auth/callback?code=fnL7Nt63FT7glFebNGksKvDdk7eMhh&state=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJfX3N0YXRlX3NlY3JldF8iOiIycTA1OURKejNhQjFzUkp0Z2pGNm1OeFc1ZFRRb3oifQ.clrqRbaC1UR1UUaX5G6z4V3aNzKKeD0Yzl589Y2OPeg HTTP/1.1" 308 -
    Exception on /auth/callback/ [GET]
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2447, in wsgi_app
        response = self.full_dispatch_request()
      File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1952, in full_dispatch_request
        rv = self.handle_user_exception(e)
      File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1821, in handle_user_exception
        reraise(exc_type, exc_value, tb)
      File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise
        raise value
      File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1950, in full_dispatch_request
        rv = self.dispatch_request()
      File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1936, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
      File "/home/ilfs/overpass/overpass/routes/auth.py", line 47, in callback
        discord.callback()
      File "/usr/local/lib/python3.8/dist-packages/flask_discord/client.py", line 157, in callback
        token = self._fetch_token(state)
      File "/usr/local/lib/python3.8/dist-packages/flask_discord/_http.py", line 93, in _fetch_token
        return discord.fetch_token(
      File "/usr/local/lib/python3.8/dist-packages/requests_oauthlib/oauth2_session.py", line 239, in fetch_token
        self._client.parse_request_uri_response(
      File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/clients/web_application.py", line 203, in parse_request_uri_response
        response = parse_authorization_code_response(uri, state=state)
      File "/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/parameters.py", line 268, in parse_authorization_code_response
        raise MismatchingStateError()
    oauthlib.oauth2.rfc6749.errors.MismatchingStateError: (mismatching_state) CSRF Warning! State not equal in request and response.
    127.0.0.1 - - [18/Dec/2021 13:34:30] "GET /auth/callback/?code=fnL7Nt63FT7glFebNGksKvDdk7eMhh&state=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJfX3N0YXRlX3NlY3JldF8iOiIycTA1OURKejNhQjFzUkp0Z2pGNm1OeFc1ZFRRb3oifQ.clrqRbaC1UR1UUaX5G6z4V3aNzKKeD0Yzl589Y2OPeg HTTP/1.1" 500 -
    

    Here is the .env file

    Screenshot_2021-12-18_13-37-59

    Any idea how to resolve this.

    bug 
    opened by ilovefreesw 3
  • Look for a better solution to update playlist file

    Look for a better solution to update playlist file

    The way Overpass updates a stream's playlist file right now, will not scale well in the future.

    Upon receiving a GET request for a playlist file, we re-write the playlist file to make sure we're on track with the playlist file generated by nginx.

    https://github.com/GOATS2K/overpass/blob/master/overpass/hls.py#L32

    However, this also means that this function runs on every single request, which is way more frequently than it would ever have to.

    long term goal 
    opened by GOATS2K 1
  • Add unit tests to code base

    Add unit tests to code base

    I wanted to more leave this as a discussion, but I think some unit tests would make your code base much easier to ensure that a change doesn't break everything.

    opened by natehalsey 0
  • Version 0.2.4: The big documentation update!

    Version 0.2.4: The big documentation update!

    05c0b99 refactor(README): add more detailed instructions on setup 09fb52b refactor(watch/watch-template): document functions and re-use video element instead of re-creating a new one in the stream page 56ed285 refactor(stream-utils): document functions, and use environment variable in rewrite_stream_playlist 8ce66e1 refactor(hls): change stream serving function, to not include path names - as this is already used in the HLS_DIR environment variable 29211bb cleanup(utils): remove unused util file 3a6ee68 refactor(stream-api): document functions, remove un-used JSON parser in stream generation function b99e5ea refactor(rtmp-server-api): document functions, implement private ip verification 394c7ef refactor(manage): document function aed2d07 refactor(template-watch): remove duplicate video instance 3a15f1e refactor(archive): remove redundant return when the archive is empty 3e35433 refactor(index): document function, remove redundant return when there are no livestreams going fadbf53 refactor(hls): document function, fix incorrect info in docstring bdac9a7 refactor(db): create individual functions for querying single and multiple database items, document functions 912d7e6 refactor(init): document create app function 81e378b refactor(archive): document functions and use more accurate variable names 790012d refactor(auth): document functions and remove unused endpoint

    opened by GOATS2K 0
  • Version 0.2.2

    Version 0.2.2

    9aee599 feat(player): center play button and add playback speed dropdown for archived streams b78712f fix(watch/archive): fix bug where unlisted and archived streams would only work for the original streamer

    opened by GOATS2K 0
  • HLS: Re-write playlist generator

    HLS: Re-write playlist generator

    The current playlist re-writing function is quite inefficient as it runs on every GET /hls/<unique_id>/index.m3u8, instead of updating whenever the last chunk is out of date. This doesn't scale well with many concurrent viewers.

    enhancement 
    opened by GOATS2K 0
Releases(v0.2.6)
  • v0.2.6(Sep 11, 2022)

    It turns out the old Dockerfile was completely broken and didn't even launch properly.

    This has now been fixed, sorry for a lack of updates recently. Maybe one day, I'll get my ass in gear and get to that re-write.

    fe3bcd6 (HEAD -> master, origin/master, origin/HEAD) fix(compose-example): add database volume
    f730354 fix(dockerfile): perform permission fix in startup script
    c9cfb25 fix(dockerfile): move docker env variables into dockerfile
    037b559 feat(docker compose example): add new env variable
    0eadfd6 fix(docker): fix build and database persistence issues
    03623a1 fix(dockerfile): add permission fix and fix build bug caused by relative copy
    6a7aadf fix(readme): add relative link to example docker-compose file
    
    Source code(tar.gz)
    Source code(zip)
  • v0.2.5(Dec 15, 2021)

    46e53ed - (HEAD -> master, origin/master, origin/HEAD) feat(readme): cleanup + docker instructions (3 minutes ago) 04486cd - fix(dockerfile): run init-db only when no database exists (13 days ago) b501497 - feat(pyproject): bump to 0.2.5 (13 days ago) 56deb61 - fix(config): do not override environment variables if .env file doesn't exist (13 days ago) 32e0cdf - fix(docker): create startup file to start nginx (13 days ago) d8bae27 - fix(init-db): add switch to ensure that dockerfile can run migration (13 days ago) 6c61ee2 - chore: update gitignore and lockfile (13 days ago) 005df16 - feat(docker): setup docker stuff (13 days ago) 0818d04 - (origin/dev) feat(hls/stream-utils): re-write playlist in memory, closing issue #15 (5 months ago) 8f197ac - chore: update dependencies (7 months ago) ccc48a2 - refactor: move routes into separate modules, for better structure (7 months ago)

    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Apr 17, 2021)

    05c0b99 refactor(README): add more detailed instructions on setup 09fb52b refactor(watch/watch-template): document functions and re-use video element instead of re-creating a new one in the stream page 56ed285 refactor(stream-utils): document functions, and use environment variable in rewrite_stream_playlist 8ce66e1 refactor(hls): change stream serving function, to not include path names - as this is already used in the HLS_DIR environment variable 29211bb cleanup(utils): remove unused util file 3a6ee68 refactor(stream-api): document functions, remove un-used JSON parser in stream generation function b99e5ea refactor(rtmp-server-api): document functions, implement private ip verification 394c7ef refactor(manage): document function aed2d07 refactor(template-watch): remove duplicate video instance 3a15f1e refactor(archive): remove redundant return when the archive is empty 3e35433 refactor(index): document function, remove redundant return when there are no livestreams going fadbf53 refactor(hls): document function, fix incorrect info in docstring bdac9a7 refactor(db): create individual functions for querying single and multiple database items, document functions 912d7e6 refactor(init): document create app function 81e378b refactor(archive): document functions and use more accurate variable names 790012d refactor(auth): document functions and remove unused endpoint

    Source code(tar.gz)
    Source code(zip)
  • v0.2.3(Feb 12, 2021)

  • v0.2.2(Feb 2, 2021)

    Feature - Player: center play button and add playback speed dropdown for archived streams Fix - watch/archive: fix bug where unlisted and archived streams would only work for the original streamer

    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Jan 22, 2021)

  • v0.2.0(Jan 22, 2021)

  • v0.1.1(Jan 19, 2021)

  • v0.1(Jan 18, 2021)

    This is the first version of Overpass.

    Here are some of the limitations that will be fixed in the next release:

    • Discord guild ID for verification purposes is hardcoded
    • The configuration set up is less than ideal - there are no separate configuration classes for a dev environment
    • The login text is hardcoded
    • The stream's playlist file is being generated when it's being requested, which probably doesn't scale up very well
    • The elements after the header on the website require some margin tweaks for aesthetical purposes
    Source code(tar.gz)
    Source code(zip)
Owner
John Patrick Glattetre
🌊
John Patrick Glattetre
Video Object Segmentation(VOS) From Zero to HeroVideo Object Segmentation(VOS) From Zero to Hero

Video Object Segmentation(VOS) From Zero to Hero! Goal 1:train a two layers cnn model for vos. Finish! see model.py FFNet for more diteal.(2021.9.30)

1 Oct 22, 2021
Cvplayer - A simple video player written in python using ffpyplayer and OpenCV

Video Player cvplayer is a minimal wrapper around the ffpyplayer.MediaPlayer cla

ADI 7 Dec 19, 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 01, 2022
Python bindings for FFmpeg - with complex filtering support

ffmpeg-python: Python bindings for FFmpeg Overview There are tons of Python FFmpeg wrappers out there but they seem to lack complex filter support. ff

Karl Kroening 7.7k Jan 03, 2023
Telegram Video Stream

Video Stream An Advanced VC Video Player created for playing video in the voice chats of Telegram Groups And Channel Configs TOKEN - Get bot token fro

mr_lokaman 46 Dec 25, 2022
Video stream recording dockerized server using python/ffmpeg.

Stream Recording Server Video stream recording dockerized server using python/ffmpeg. Usage Configuration Prepare .env file, check .env.example for th

GR 2 Jan 14, 2022
Python script for extracting audio from video files and creating Mel spectrograms

video2spectrogram About This package is meant to automate the process of extracting audio files from videos and saving the plots computed from these a

Alexandros Stergiou 1 Oct 28, 2021
Python retagging utility for mkv files using mkvmerge.

pyretag A python script to retag mkv files. Setting Up pip install pyfiglet pip install rich Move the mkv files to input folder.

25 Dec 04, 2022
A Python extension that provides bindings to WebRTC M92

This project follows the W3C specification with some modifications and additions to make it work better with Python applications, with useful APIs like programmatic audio and video.

Il'ya 104 Dec 26, 2022
Stream-Cli application that allow you to play your favorite movies from the terminal

Stream-Cli application that allow you to play your favorite movies from the terminal

redouane 380 Jan 08, 2023
Add filters (background blur, etc) to your webcam on Linux.

Add filters (background blur, etc) to your webcam on Linux.

Jashandeep Sohi 480 Dec 14, 2022
Convert lecture videos to slides in one line. Takes an input of a directory containing your lecture videos and outputs a directory containing .PDF files containing the slides of each lecture.

Convert lecture videos to slides in one line. Takes an input of a directory containing your lecture videos and outputs a directory containing .PDF files containing the slides of each lecture.

Sidharth Anand 12 Sep 10, 2022
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 09, 2022
A Advanced Anime Theme VC Video Player created for playing vidio in the voice chats of Telegram Groups

Yui Vidio Player A Advanced Anime Theme VC Video Player created for playing vidio in the voice chats of Telegram Groups Demo Setting up Add this Bot t

Achu biju 32 Sep 16, 2021
Stream music with ffmpeg and python

youtube-stream Stream music with ffmpeg and python original Usage set the KEY in stream.sh run server.py run stream.sh (You can use Git bash or WSL in

Giyoung Ryu 14 Nov 17, 2021
DICexport is a GUI (PyQt5) to export digital image correlation videos

DIC Video Exporter DICexport is a GUI (PyQt5) to export digital image correlation videos. It offers the flexibility to choose a selected range of a vi

Chaoyi Zhu 0 Jun 23, 2022
Become a virtual character with just your webcam!

Become a virtual character with just your webcam!

Rich 300 Jan 03, 2023
Synchronize Two Cameras in Real Time using Multiprocessing

Synchronize Two Cameras in Real Time using Multiprocessing In progress ... 📁 Project Structure 📚 Install Libraries for this Project (requirements.tx

Eduardo Carvalho Nunes 2 Oct 31, 2021
Boltstream Live Video Streaming Website + Backend

Boltstream Self-hosted Live Video Streaming Website + Backend Reference

Ben Wilber 1.7k Dec 28, 2022
Add the dislike count back to my YouTube videos via a comment containing that information.

YouTube Dislikes Forrest Knight Python Version 3.0+ Only use if you know what the code actually does. I'm not responsible for your use of this code in

Forrest Knight 155 Dec 19, 2022