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
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
Automagically synchronize subtitles with video.

FFsubsync Language-agnostic automatic synchronization of subtitles with video, so that subtitles are aligned to the correct starting point within the

Stephen Macke 5.7k Jan 06, 2023
Python and OpenCV-based scene cut/transition detection program & library.

Video Scene Cut Detection and Analysis Tool Latest Release: v0.5.6.1 (October 11, 2021) Main Webpage: py.scenedetect.com Documentation: manual.scenede

Brandon Castellano 1.8k Jan 02, 2023
A simple Python Youtube Wachtime for YTbebot

Simple bot that was development in python 3.7, that automatically watch youtube videos. It can be used to give more views in your channel helping in the spread and increase the followers because your

Rian eka wiratma 1 Dec 05, 2021
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
Automatic video generator for local news

Automatic video generator for local news

Gabriel Monteiro 2 Jan 11, 2022
goal: render videos on eu4's timeline function

Rendering Videos on the EU4 Time Line This repository contains code to create an eu4-savefile that plays back a video in question.

29 Dec 24, 2022
MPV remote controller is a program for remote controlling mpv player with device in your local network through web browser.

MPV remote controller is a program for remote controlling mpv player with device in your local network through web browser.

5 May 26, 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
Simple nightcore song+video maker

nighty nighty is a simple nightcore song maker (+ video) Installation clone the repo wherever you want git clone https://www.github.com/DanyB0/nighty

DanyB0 2 Oct 02, 2022
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
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
In this project, we will be blurring the background in a live video feed

In this project, we will be blurring the background in a live video feed. This can be further integrated into online meetings, streamings etc.

Hassan Shahzad 2 Jan 06, 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
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
Adblocker for movie subtitles.

SubAdBlock Adblocker for movie subtitles. Usage Place "main.py" and "config.conf" in directory with subtitles and run "main.py". It will automatically

Marko ลฝiviฤ‡ 1 Jan 09, 2022
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
KonomiTV: Kind and Optimized Next brOadcast watching systeM Infrastructure for TV

ๅ‚™่€ƒใƒปๆณจๆ„ไบ‹้ … ็พๅœจ ฮฑ ็‰ˆใงใ€ใพใ ๅฎŸ้จ“็š„ใชใƒ—ใƒญใƒ€ใ‚ฏใƒˆใงใ™ใ€‚้€šๅธธๅˆฉ็”จใซใฏ่€ใˆใชใ„ใงใ—ใ‚‡ใ†ใ—ใ€ใ‚ตใƒใƒผใƒˆใ‚‚ใงใใพใ›ใ‚“ใ€‚ ๅฎ‰ๅฎšใ—ใฆใ„ใ‚‹ใจใฏๅˆฐๅบ•่จ€ใ„ใŒใŸใ„ๅ“่ณชใงใ™ใŒใ€ใใ‚Œใงใ‚‚ๆง‹ใ‚ใชใ„ๆ–นใฎใฟๅฐŽๅ…ฅใ—ใฆใใ ใ•ใ„ใ€‚ ไฝฟใ„ๆ–นใชใฉใฎ่ชฌๆ˜Žใ‚‚็”จๆ„ใงใใฆใ„ใชใ„ใŸใ‚ใ€่‡ชๅŠ›ใงใƒˆใƒฉใƒ–ใƒซใซๅฏพๅ‡ฆใงใใ‚‹ใ‚จใƒณใ‚ธใƒ‹ใ‚ขใฎๆ–นไปฅๅค–ใซใฏ็พ็ŠถใŠใ™ใ™ใ‚

tsukumi 244 Dec 31, 2022
A way to run youtube videos in TTY

TTY youtube client its finally here, the one thing literally NO ONE ASKED FOR!! A way to run youtube videos in TTY Dependencies: (pip) yt-search (syst

1 Nov 28, 2021
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