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:

    ^Cilfs@ilfsZ:~/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
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
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
Boltstream Live Video Streaming Website + Backend

Boltstream Self-hosted Live Video Streaming Website + Backend Reference

Ben Wilber 1.7k Dec 28, 2022
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
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
Telegram Music/ Video Streaming Bot Using Pytgcalls

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

null 16 Nov 30, 2022
A web RTSP play platform based on websocket and tornado, websocket use blob binaryType read as ArrayBuffer

A web RTSP play platform based on websocket and tornado, websocket use blob binaryType read as ArrayBuffer

null 2 Feb 25, 2022
High-performance cross-platform Video Processing Python framework powerpacked with unique trailblazing features :fire:

Releases | Gears | Documentation | Installation | License VidGear is a High-Performance Video Processing Python Library that provides an easy-to-use,

Abhishek Thakur 2.6k Dec 28, 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 1, 2023
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 9, 2022
A platform which give you info about the newest video on a channel

youtube A platform which give you info about the newest video on a channel. This uses web scraping, a better implementation will be to use the API. BR

Custom components for Home Assistant 36 Sep 29, 2022
Vigia-youtube - The YouTube Watch bot is able to monitor channels on Google's video platform

Vigia do YouTube O bot Vigia do YouTube é capaz de monitorar canais na plataform

Alessandro Feitosa Jr 10 Oct 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
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
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
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
Real-time video and audio streams over the network, with Streamlit.

streamlit-webrtc Example You can try out the sample app using the following commands.

Yuichiro Tachibana (Tsuchiya) 648 Jan 1, 2023
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