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
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
LL-HLS implementation written in Python3

biim mpegts stream to Apple Low Latency HLS Feature mpegts demuxing in pure python3 (using asyncio) mpegts stream to fragmented ts use piping from ffm

もにょ~ん 15 Jan 03, 2023
Converts Betaflight blackbox gyro to MP4 GoPro Meta data so it can be used with ReelSteady GO

Here are a bunch of scripts that I created some time ago as a proof of concept that Betaflight blackbox gyro data can be converted to GoPro Metadata F

108 Oct 05, 2022
Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding

Av1an A cross-platform framework to streamline encoding Easy, Fast, Efficient and Feature Rich An easy way to start using AV1 / HEVC / H264 / VP9 / VP

Zen 947 Jan 01, 2023
Automatic video generator for local news

Automatic video generator for local news

Gabriel Monteiro 2 Jan 11, 2022
基于BililiveRecorder 的集群录播客户端

高度自动化的录播服务端! 一、项目介绍 1、介绍 这是NGlive的录播服务器集群的客户端部分实现代码,它可以自动化的进行录制-压制-上传-通知,同时流程高度可自定义,并且可以任意受中心服务器的调度,有一定的错误修复能力。可以保证长期稳定的运行。 2、基本功能 这个客户端集 录制、转码压制、上传为一

NGWORKS 7 Jul 10, 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

8.2k Dec 26, 2022
This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player

deovr-plugin This plugin generates json files used by deovr allowing you to play 2d and 3d video's using the player. Deovr looks for an index file /de

10 Sep 29, 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
This is an example of building a video Question-Answer system using Jina.

example-video-search This is an example of building a video Question-Answer system using Jina. The index data is subtitle files of YouTube videos. Aft

Jina AI 9 Oct 18, 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
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
Program to play videos with props in Apex Legends

R5Fresh A video player for the Apex Legends mod R5Reloaded

9 Nov 13, 2022
camKapture is an open source application that allows users to access their webcam device and take pictures or create videos.

camKapture is an open source application that allows users to access their webcam device and take pictures or create videos.

manoj 1 Jun 21, 2022
This program is to make a video based on Deep Dream

This program is to make a video based on Deep Dream. The program is modified from DeepDreamAnim and DeepDreamVideo with additional functions for bleding two frames based on the optical flows. It also

Aertist 23 Jan 22, 2022
This application makes a webrtc video call with jitsi meet signaling

gstreamer-jitsi-meet This application makes a webrtc video call with jitsi meet signaling. Other end can be any jitsi meet app or web app. It doesn't

Linh 7 Apr 26, 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 03, 2022
Playing videos through S3 buckets (Wasabi, AWS, etc.) through client-side VideoJS player

Playing videos through S3 buckets (Wasabi, AWS, etc.) through client-side VideoJS player without incurring ingress/egree traffic on EC2 Instance.

Syed Umar Arfeen 8 Mar 28, 2022
Rune - a video miniplayer made with Python.

Rune - a video miniplayer made with Python.

1 Dec 13, 2021
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