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
FLIR/DJI IR Camera Data Parser, Python Version

FLIR/DJI IR Camera Data Parser, Python Version Parser infrared camera data as NumPy data. Usage Clone this respository and cd thermal_parser. Run pip

14 Dec 23, 2022
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
A wrapper around ffmpeg to make it work in a concurrent and memory-buffered fashion.

Media Fixer Have you ever had a film or TV show that your TV wasn't able to play its audio? Well this program is for you. Media Fixer is a program whi

Halit Şimşek 3 May 04, 2022
Program for converting video to GIF

video-to-gif Program for converting video to GIF Install the lib: pip install moviepy Usage: Specify the path to the video file. clip = VideoFileClip(

Artem Mokin 0 Dec 13, 2021
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 06, 2022
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 04, 2022
A Python media index

pyvideo https://pyvideo.org is simply an index of Python-related media records. The raw data being used here comes out of the pyvideo/data repo. Befor

pyvideo 235 Dec 24, 2022
Code for the manim-generated scenes used in 3blue1brown videos

Code for the manim-generated scenes used in 3blue1brown videos

Grant Sanderson 4.1k Jan 09, 2023
iYTDL - Asynchronous Standalone Inline YouTube-DL Module

iYTDL Asynchronous Standalone Inline YouTube-DL Module ⬇️ Installing Install pip3 install iytdl Upgrade pip3 install -U iytdl ⭐️ Features Fully Asynch

iYTDL 46 Dec 24, 2022
A VcVideoPlayer Bot for Telegram made with 💞 By @ThePro_CoderZ

VcVideoPlayer A VcVideoPlayer Bot for Telegram made with 💞 By @Akki_ThePro Heroku Deploy The easiest way to deploy this Bot is via Heroku. License

1 Dec 06, 2021
Docker container to expose a local RTMP, RTSP, and HLS stream for all your Wyze cameras including v3

Docker container to expose a local RTMP, RTSP, and HLS stream for all your Wyze cameras including v3. No Third-party or special firmware required.

1.2k Jan 07, 2023
This will help you study and avoid moving mouse coz u dont need mouse for watching youtube videos

This will help you study and avoid moving mouse coz u dont need mouse for watching youtube videos. Neither u need it for pdfs just use your keyboard

KorryKatti 5 Jan 07, 2022
video streaming userbot (vsu) based on pytgcalls for streaming video trought the telegram video chat group.

VIDEO STREAM USERBOT ✨ an another telegram userbot for streaming video trought the telegram video chat. Environmental Variables 📌 API_ID : Get this v

levina 6 Oct 17, 2021
A tool to fuck a video/audio quality using FFmpeg

Media quality fucker A tool to fuck a video/audio quality using FFmpeg How to use Download the source Download Python Extract FFmpeg Put what you want

Maizena 8 Jan 25, 2022
Wonkey - an open source programming language for the creation of cross-platform video games

Wonkey Programming Language Wonkey is an open source programming language for the creation of cross-platform video games, highly inspired by the “Blit

Wonkey Coders 110 Nov 09, 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
A python youtube search module

A python youtube search module

Fayas Noushad 4 Dec 01, 2021
A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video

Video-subtitle-merger A Simple Telegram Bot By @Tellybots to add Subtitle Files in Video Features Force Sub Button Added Soon Support Media Type Such

6 Dec 31, 2021
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

15 Nov 10, 2022
pygamevideo module helps developer to embed videos into their Pygame display

pygamevideo module helps developer to embed videos into their Pygame display. Audio playback doesn't use pygame.mixer.

Kadir Aksoy 10 Dec 28, 2022