Coder Social home page Coder Social logo

jprjr / multistreamer Goto Github PK

View Code? Open in Web Editor NEW
320.0 31.0 93.0 1.2 MB

[discontinued] A webapp for publishing video to multiple streaming services at once.

License: MIT License

Lua 93.60% Shell 0.52% CSS 1.76% JavaScript 3.90% Perl 0.14% Makefile 0.08%
lua-nginx openresty streaming streaming-video stream rtmp irc-interface irc video lua-resty

multistreamer's Introduction

Archived

Hi all. I don't enjoy working on this anymore. I'm archiving this repo, you're free to fork it.

Stop emailing me directly.

multistreamer

This is a tool for simulcasting RTMP streams to multiple services:

It allows users to add accounts for their favorite streaming services, and gives an endpoint for them to push video to. Their video stream will be relayed to multiple accounts.

It also allows for updating their stream's metadata (stream title, description, etc) from a single page, instead of logging into multiple services.

It supports integration with Discord via webhooks - it can push your stream's incoming comments/chat messages to a Discord channel, as well as updates when you've started/stopped streaming. There's also a "raw" webhook, if you want to develop your own application that responds to events. See the wiki for details.

Additionally, it provides an IRC interface, where users can read/write comments and messages in a single location. There's also a web interface for viewing and replying to comments, and a chat widget you can embed into OBS (or anything else supporting web-based sources).

Not all services support writing comments/messages from the web or IRC interfaces - please see the wiki for details on which services support which features.

Fun, unintentional side effect: you can use this to push video to your personal Facebook profile, instead of using the phone app. This isn't available via the regular Facebook web interface, as far as I know. :)

Please note: you're responsible for ensuring you're not violating each service's Terms of Service via simulcasting.

Here's some guides on installing/using:

Table of Contents

Requirements

  • OpenResty 1.13.6.1 or greater, with some extra modules:
  • ffmpeg
  • lua 5.1
  • luarocks
  • luajit (included with OpenResty)
  • redis
  • postgresql
  • a POSIX shell (bash, ash, dash, etc)

Note you specifically need OpenResty for this. I no longer support or recommend compiling a custom Nginx with the Lua module, you'll need the OpenResty distribution, which includes Lua modules like lua-resty-websocket, lua-resty-redis, lua-resty-lock, and so on.

Installation

Install with Docker

I have a Docker image available, along with a docker-compose file for quickly getting up and running. Instructions are available here: https://github.com/jprjr/docker-multistreamer

Install OpenResty with setup-openresty

I've written a script for setting up OpenResty and LuaRocks: https://github.com/jprjr/setup-openresty

This is now my preferred way for setting up OpenResty. It automatically installs build pre-requisites for a good number of distros, and installs Lua 5.1.5 in addition to LuaJIT. This allows LuaRocks to build C modules that no longer build against LuaJIT (like cjson).

To install, simply:

git clone https://github.com/jprjr/setup-openresty
cd setup-openresty
sudo ./setup-openresty
  --prefix=/opt/openresty-rtmp \
  --with-rtmp

Alternative: Install OpenResty with RTMP Manually

You'll want to install Lua 5.1.5 as well, so that LuaRocks can build older C modules. I have a patch in this repo for building liblua as a dynamic library, just in case some C module tries to link against liblua for some reason.

sudo apt-get -y install \
  libreadline-dev \
  libncurses5-dev \
  libpcre3-dev \
  libssl-dev \
  perl \
  make \
  build-essential \
  unzip \
  curl \
  git
mkdir openresty-build && cd openresty-build
curl -R -L https://openresty.org/download/openresty-1.13.6.1.tar.gz | tar xz
curl -R -L https://github.com/arut/nginx-rtmp-module/archive/v1.2.1.tar.gz | tar xz
curl -R -L http://luarocks.github.io/luarocks/releases/luarocks-2.4.3.tar.gz | tar xz
curl -R -L https://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz

cd openresty-1.13.6.1
./configure \
  --prefix=/opt/openresty-rtmp \
  --with-pcre-jit \
  --with-ipv6 \
  --add-module=../nginx-rtmp-module-1.2.1
make
sudo make install

cd ../lua-5.1.5
patch -p1 < /path/to/lua-5.1.5.patch # in this repo under misc
sed -e 's,/usr/local,/opt/openresty-rtmp,g' -i src/luaconf.h
make CFLAGS="-fPIC -O2 -Wall -DLUA_USE_LINUX" linux
sudo make INSTALL_TOP="/opt/openresty-rtmp/luajit" TO_LIB="liblua.a liblua.so" install

cd ../luarocks-2.4.3
./configure \
  --prefix=/opt/openresty-rtmp/luajit \
  --with-lua=/opt/openresty-rtmp/luajit
make build
sudo make bootstrap
sudo ln -s /opt/openresty-rtmp/luajit/bin/luarocks /opt/openresty-rtmp/bin/luarocks

Setup database and user in Postgres

Change your user/password/database names to whatever you want.

Editing pg_hba.conf for network access is outside the scope of this README file.

sudo su - postgres
psql
postgres=# create user multistreamer with password 'multistreamer';
postgres=# create database multistreamer with owner multistreamer;
postgres=# \q

Setup Redis

I'm not going to write up instructions for setting up Redis - this is more of a checklist item.

Setup Sockexec

multistreamer uses the lua-resty-exec module for managing ffmpeg processes, which requires a running instance of sockexec. The sockexec repo has instructions for installation - you can either compile from source, or just download a static binary.

Make sure you change sockexec's default timeout value. The default is pretty conservative (60 seconds). I'd recommend making it infinite (ie, sockexec -t0 /tmp/exec.sock).

Setup Authentication Server

multistreamer doesn't handle its own authentication - instead, it will make an authenticated HTTP/HTTPS request to some server and allow/deny user logins based on that.

You can make a really simple htpasswd-based server with nginx:

worker_processes 1;
error_log stderr notice;
pid logs/nginx.pid;
daemon off;

events {
  worker_connections 1024;
}

http {
  access_log off;
  server {
    listen 127.0.0.1:8080;
    root /dev/null;
    location / {
      auth_basic "default";
      auth_basic_user_file "/path/to/htpasswd/file";
      try_files $uri @auth;
    }
    location @auth {
      return 204;
    }
  }
}

I have some some projects for quickly setting up authentication servers:

Clone and setup

Clone this repo somewhere, copy the example config file, and edit it as-needed

git clone https://github.com/jprjr/multistreamer.git
cd multistreamer
cp etc/config.yaml.example /etc/multistreamer/config.yaml
# edit /etc/multistreamer/config.yaml

I've tried to comment config.yaml.example and describe what each setting does as best as I can.

One of the more important items in the config file is the networks section, right now the supported networks are:

  • rtmp - just push video to an RTMP URL
  • facebook
  • mixer
  • twitch
  • youtube

Each module has more details in the wiki.

Install Multistreamer

For either a global install or self-contained install, you'll need libyaml and its development headers installed. On Ubuntu, this is libyaml-dev:

apt-get install libyaml-dev

Global install

/opt/openresty/bin/luarocks install multistreamer

If you used the setup-openresty script from above, you'll find multistreamer at /opt/openresty/bin/multistreamer, else it depends on your particular setup.

Self-contained install

If you install modules to a folder named lua_modules, the bash script (./bin/multistreamer) setup nginx/Lua to only use that folder. So, assuming you're still in the multistreamer folder:

/opt/openresty-rtmp/bin/luarocks install --tree=lua_modules --only-deps multistreamer
# or /opt/openresty-rtmp/bin/luarocks install --tree=lua_modules --only-deps rockspecs/multistreamer-dev-1.rockspec

Using Mac OS? lapis will probably fail to install because luacrypto will fail to build. If you're using Homebrew, you can install luacrypto with:

luarocks --tree=lua_modules install luacrypto OPENSSL_DIR=/usr/local/opt/openssl
luarocks --tree=lua_modules install --only-deps multistreamer

Initialize the database

Multistreamer will automatically create tables.

Customization

Starting with Multistreamer 6.0.0, you can override CSS and images.

Just copy the static folder to local, then edit/replace files as needed.

Usage

Start the server

Once it's been setup, you can start the server with ./bin/multistreamer run

Alternative: run as systemd service

First, create a local user to run multistreamer as:

sudo useradd \
  -d /var/lib/multistreamer -m \
  -r \
  -s /usr/sbin/nologin \
  multistreamer

Then copy misc/multistreamer.service to /etc/systemd/system/multistreamer.service, and edit it as-needed - you'll probably need to change the ExecStart and ExecStartPre lines to point to wherever you cloned the git repo.

Web Usage

The web interface has two fundamental concepts: "Accounts" and "Streams."

A user is able to add Accounts to their profile (like a Twitch account or Facebook Account). The user is also able to create Streams, which generates a stream key for the user.

Once a stream is created and an account added, the user can start associating accounts with streams. An account can be used on as many different streams as the user would like.

Each stream has its own set of metadata, like a title for the broadcast, the game being played, and so on. From one page, the user can setup multiple account's metadata. Each account has their own set of fields, so the user can customize the title, description, and so-on for each service.

It's important to note that updating the web interface does not immediately change anything on the user's streaming services - it's saved for later, when the user starts pushing video.

The user can setup a stream to either start pushing video to their streaming services as soon as an incoming video stream is detected, or to wait until they've had a chance to preview the stream. Either way, multistreamer will update each account as needed just before it starts pushing video out - things like updating the Twitch's broadcast title and game, or make a new Live Video for Facebook.

Once the user stops pushing video, multistreamer will take any needed shutdown/stop actions - like ending the Facebook Live Video.

I highly recommend that users browse the Wiki - I tried to detail each section of the web interface, all the different metadata fields of the different network modules, etc.

IRC Usage

Users can connect to Multistreamer with an IRC client, and view their stream's comments and messages.

The IRC interface supports logging in with SASL PLAIN authentication, as well as by specifying a server password. Both of these methods transmit the password in plain-text, so you should place some kind of SSL terminator in front of Multistreamer, like stunnel or haproxy.

Once a user has logged into the IRC interface, they'll see a list of rooms representing all user's streams on the system. The room names use the format (username)-(streamname)

Whenever a stream goes live, an IRC bot will join the room - this bot represents an actual account being streamed to. It's username will use the format (network-name)-(account-name).

Whenever a new comment/chat/etc comes in, the bot will relay it to the room, with the format (username)-(network-name) (message)

I can post messages/comments to my streams by addressing the bots.

When the stream ends, the bots will leave the room.

Attached is a screenshot of Adium. I'm the user john, and my stream is named Awesome, so I'm in the room #john-awesome

screenshot

Reference

bin/multistreamer usage:

Here's the full list of options for multistreamer:

multistreamer [-l /path/to/lua] [-c /path/to/config.yaml] [-v] <action>
  • -l /path/to/lua - explicitly provide a path to the lua/luajit binary
  • -c /path/to/config.yaml - specify a config file, defaults to /etc/multistreamer/config.yaml
  • -v - prints the current version of multistreamer
  • <action> - can be one of
    • run - launches nginx
    • initdb - initializes the database
    • check - checks the config file, postgres, redis, etc

Migrating from Multistreamer 10 -> 11

In Multistreamer 11, I made changes to (hopefully) make Multistreamer easier to deploy.

  • You can install Multistreamer using LuaRocks
    • You can also do a self-contained install with a single luarocks call
  • config.lua is removed in favor of a YAML config-file
    • You can no longer store multiple environments in a single file, use one file per environment.
    • You can specify a config file with -c /path/to/config.yaml
    • /etc/multistreamer/config.yaml is read in by default
  • Database migrations are automatic

Version 10.2.7 can dump an existing environment's config to YAML, so to migrate:

git checkout 10.2.7
./bin/multistreamer -e (environment) initdb # prep db for auto-migrations
./bin/multistreamer -e (environment) dump_yaml > config.yaml
# checkout config.yaml, make sure everything makes sense
mkdir /etc/multistreamer
cp config.yaml /etc/multistreamer/config.yaml
luarocks --tree=lua_modules install --only-deps rockspecs/multistreamer-dev-1.rockspec
# or use luarocks --tree=lua_modules install --only-deps multistreamer to pull from luarocks

Roadmap

New features I'd like to work on:

  • More networks!

Versioning

This project uses semantic versioning: MAJOR.MINOR.PATCH

A change to the major release number means the user must make a configuration change, running a database migration, etc. Upgrading to a new major release without taking action will result in a failure.

A change to the minor release number means some new feature is available, but the user doesn't necessarily need to take action (though the new feature might be disabled until they make a config change etc).

A change to the patch number means I've made some small bug fix.

All releases will include notes with details on migrating databases, updating the config, and so on.

Licensing

This project is licensed under the MIT license, see the file LICENSE for more details. This license applies to all files, except the following exceptions:

This project includes a copy of Pure.css (static/css/pure-min.css), which is licensed under a BSD-style license. Pure.css license is available as LICENSE-purecss.

This project includes a copy of commonmark.js (static/js/commonmark.min.js), which is licensed under a BSD-style license. The commonmark.js license is available as LICENSE-commonmark-js.

This project includes a copy of clipboard.js (static/js/clipboard.min.js), which is licensed under an MIT-style license. The clipboard.js license is available as LICENSE-clipboard-js.

This project includes a copy of Pixabay's "JavaScript-autoComplete" library (static/css/auto-complete.css and static/js/auto-complete.min.js), which is licensed under an MIT-style license. The license is available as LICENSE-autocomplete-js.

This project includes a copy of balloon.css (static/css/balloon.css), which is licensed under an MIT-style license. The balloon.css licence is available as LICENSE-balloon-css.

This project includes a copy of zenscroll (static/js/zenscroll-min.js), which is public-domain code. The license for zenscroll is availble as LICENSE-zenscroll.

The network modules for Facebook, Twitch, and YouTube include embedded SVG icons from simpleicons.org. These icons are in the public domain see https://github.com/danleech/simple-icons/blob/gh-pages/LICENSE.md. I'll be honest, I'm not sure how trademark law applies here (but I'm sure it does), so I feel obligated to mention that all trademarked images are property of their respective companies.

The network module for Mixer uses an embedded SVG icon from mixer-branding-kit, it is property of Mixer.

multistreamer's People

Contributors

gdhgdhgdh avatar jessicah avatar jprjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multistreamer's Issues

Account info persist into postgre even after user is deleted

hey imba,

stumbled the issue when i had to delete a user, cause of hijacked password, and after creating new user, she tried to add her account in twitch system returned already in use account. Adding same compromised username, the dashboard appeared with her twitch account. While writing this, i'm thinking that this might/should be a security feature but had to delete the stream-key at least from the db. also there are wrong EN translation button/links. will fix them when i find some spare time

best~

Mixer Chatbox bug

When using mixer, some error is also popping up on my chatbox like below once I stopped my stream. I had 2 chat boxes open, and one of them showed it right and other had it with this error.

test1

ffmpeg not running after overriding FFMPEG Arguments

Hello,

I am multistreaming to Twitch and Facebook. I wanted to transcode my stream to Facebook and input all the necessary arguments into the FFMPEG Args field. Everything seems okay after I clicked submit and Go Live, no errors so far. When I checked my stream on my Twitch channel, it states that I'm offline. Checked my Facebook post and it showed it is unavailable or not found. I accessed the terminal to look for running processes using 'top' and ffmpeg is not running. I even tested with default args '-acodec copy -vcodec copy', still the result is consistent.

The stream works/ffmpeg is running when the FFMPEG Args is blank but doesn't after I override the FFMPEG Args. Also, I can't save blank FFMPEG Args after I clicked submit. It just re-input the previous arguments. If I put a space into the field, it saves but ffmpeg is not running as well.

Any ideas? Thanks in advance.

RTMP URL missing prefix

I was supposed to stream today and gather more information about the start/stop problem but I've faced several problems. I will be individually filing an issue for those.

Upon checking, I noticed that even if I have a prefix set, the suggested RTMP URL in the dashboard doesnt contain my prefix. Using it without the prefix doesnt work, I had to go back to my config and add /multistreamer on OBS for me to be able to connect.

Facebook API Change?

Im getting messages like this in my email:

Your app is receiving errors from GET {invalid-id-id}/comments

In the last three hours 100% of the calls to the method GET {invalid-id-id}/comments resulted in errors.

Error Code: 100
Error Description: Invalid parameter
Error Count: 3564

This may be result of a recent change you made to PogzNet Multistreamer, or a failure to comply with a recent breaking change.
For more information about error codes and recovery tactics, please visit our documentation.
If the error rate has not been resolved after 3 days, we'll send you another alert.

You can view this and other Developer Notifications related to your app, in the App Dashboard.

Something I need to be concerned about?

Facebooks New Permission Requests

Due to the GDPR I think, Facebook is adjusting the permissions needed for the app. Is there any list of important permissions we would have to enable for our "multistreamer app" for this?


App Review required by the listed review deadline(s) to retain Live Video API access
 
To retain API access to the following permissions and features you must submit your app for App Review by the listed review deadline(s).

Live Video API

Context: The permissions model developers use to publish video to user timelines, Groups and Pages is changing. Developers must submit their app for App Review before August 2, 2018. Learn More.

Action Required: For Multistreamer to maintain functionality, you will need to request the following permissions based on your needs as part of submitting your app for App Review:

To publish video to a user timeline, you will need to request the Live Video API feature, along with the new publish_video permission.

For Groups access you will need to request the publish_to_groups permission.

For Pages access, you will also need to request the publish_pages, manage_pages and pages_show_list permissions.

Note: The publish_to_groups permission is currently only available in development mode, it is scheduled to be enabled in production at a future date.

Next Steps: Start app review.

Feature Request: Status Indicator

So, it took me some time to re-setup my deployment (damn persistent storage) and once I got everything back up and running, I did a stream yesterday and it was fine but when I streamed today.. In my iPad I only check Facebook and Twitch. Visiting my YouTube page, I noticed that there was no stream.

How hard would it be to have a status indicator in the dashboard on the main page (more on this below) to show that its pushing to YT/FB/Twitch or something.

  • I thought of putting it on the main page since the main page already show a little nice green button that the stream is pushing. Would be nice to have x number of green buttons if its already live on the services/accounts added to that stream.

Irc connect with ii

I'm a little confused on how to connect with a command line irc client. I'm trying to use ii so I can pipe chat from a costume rtmp service. Any advise would be appreciated.

Chatbot

Is it possible to create a chat bot that would respond to simple commands ( Created by ourselves ) . Eg !www return http://sample.website by bot.

Trouble deploying on Debian 8.0 linux container

Hi,

I am having a bit of problem deploying multistreamer here. Unfortunately, on your readme, it doesn't indicate which lua version you need to run this program?

Correction: The readme does mention the program requires lua 5.1 further down.

In Debian 8.0 (jessie), there are 3 different version available: 5.0, 5.1, 5.2, 5.3.

5.1

/usr/bin/lua: error loading module 'posix.ctype' from file '/usr/local/src/multistreamer/lua_modules/lib/lua/5.1/posix.so':
        /usr/local/src/multistreamer/lua_modules/lib/lua/5.1/posix.so: undefined symbol: luaL_fileresult
stack traceback:
        [C]: ?
        [C]: in function 'require'
        ...ltistreamer/lua_modules/share/lua/5.1/posix/init.lua:29: in main chunk
        [C]: in function 'require'
        /usr/local/src/multistreamer/bin/multistreamer.lua:12: in main chunk
        [C]: ?

5.2

/usr/bin/lua: /usr/local/src/multistreamer/bin/multistreamer.lua:12: module 'posix' not found:
        no field package.preload['posix']
        no file '/usr/local/src/multistreamer/lua_modules/share/lua/5.2/posix.lua'
        no file '/usr/local/src/multistreamer/lua_modules/share/lua/5.2/posix/init.lua'
        no file './posix.lua'
        no file '/usr/local/src/multistreamer/lua_modules/lib/lua/5.2/posix.so'
stack traceback:
        [C]: in function 'require'
        /usr/local/src/multistreamer/bin/multistreamer.lua:12: in main chunk
        [C]: in ?

NOTE 1: I've never worked with lua in the past.

NOTE 2: I assumed I had to use luarocks from /opt/openresty/bin/luarocks because I wasn't aware luarocks was already in the repositories.

NOTE 3: LuaRocks from Debian 8.0 repository wants '--tree='

NOTE 4: LuaRocks from Debian 8.0 doesn't install dependencies AFAIK. It just errors out: "Unable to statisfy dependecies". Might be a bug in packaging. See full commands in order below:

luarocks --tree=lua_modules install bit32
luarocks --tree=lua_modules install lua-cjson
luarocks --tree=lua_modules install date
luarocks --tree=lua_modules install luacrypto
luarocks --tree=lua_modules install ansicolors
luarocks --tree=lua_modules install lpeg
luarocks --tree=lua_modules install etlua
luarocks --tree=lua_modules install loadkit
luarocks --tree=lua_modules install luafilesystem
luarocks --tree=lua_modules install mimetypes
luarocks --tree=lua_modules install luasocket
luarocks --tree=lua_modules install luabitop
luarocks --tree=lua_modules install pgmoon
luarocks --tree=lua_modules install netstring
luarocks --tree=lua_modules install lua-resty-exec
luarocks --tree=lua_modules install lua-resty-jit-uuid
luarocks --tree=lua_modules install lua-resty-string
luarocks --tree=lua_modules install lua-resty-http
luarocks --tree=lua_modules install lua-resty-upload
luarocks --tree=lua_modules install lapis
luarocks --tree=lua_modules install etlua
luarocks --tree=lua_modules install luaposix
luarocks --tree=lua_modules install luafilesystem
luarocks --tree=lua_modules install whereami

I opted for https://github.com/jprjr/htpasswd-auth-server, see requiste luarocks below:

NOTE: I am not sure if I should open a seperate issue for htpasswd-auth-server

luarocks --tree=lua_modules install lecho
luarocks --tree=lua_modules install bit32
luarocks --tree=lua_modules install luaposix
luarocks --tree=lua_modules install etlua
luarocks --tree=lua_modules install luafilesystem
luarocks --tree=lua_modules install lbase64

Note 1: htpasswd-auth-server failed to run here, see jprjr/htpasswd-auth-server#1

Note 2: In hindsight, htpasswd-auth-server seems like a overkill and I went with nginx instead. Although creating a username and password combo for htpasswd was useful with htpasswd-auth-server.

Your sample systemd unit service has a syntax error:

systemd[1]: [/etc/systemd/system/multistreamer.service:2] Unknown lvalue 'description' in section 'Unit'

Description needs to start with a capital 'D'. Additionally, multistreamer errors out with:

Error: auth_endpoint not set in config

With the following command:

./bin/multistreamer -e prod run

However, this seem to work:

./bin/multistreamer -e production run

What is the real difference between development and production?

Lastly, is this significant:

Jun 25 16:45:57 rtmp multistreamer[4228]: 2017/06/25 16:45:57 [error] 4244#0: stream [lua] init_worker_by_lua:10: running irc thread, context: ngx.timer
Jun 25 16:45:57 rtmp multistreamer[4228]: 2017/06/25 16:45:57 [error] 4243#0: stream [lua] init_worker_by_lua:10: running irc thread, context: ngx.timer

PS. Took me 3 to 4 hours to set this up, before I even check if it can actually stream. :D

EDIT: It's running, I created a 'Stream', extracted the Stream URL and Stream Key and attempted to stream with OBS.

deepinscreenshot20170625140603

Wireshark TCP dump:

deepinscreenshot20170625140720

Where can I view the logs in regards to why it's failing for rtmp? There is nothing userful in my /var/log/syslog minus the regular HTTP and lua traffic?

EDIT: My config.lua:

local config = require('lapis.config').config

config({'development','production'}, {
  -- name of the cookie used to store session data
  session_name = 'multistreamer',

  -- key for encrypting session data
  secret = '*************',

  -- whether to log queries and requests
  logging = {
      queries = true,
      requests = true,
  },

  -- if deploying somewhere other than the root of a domain,
  -- set this to your prefix (ie, '/multistreamer')
  http_prefix = '',

  -- set an rtmp prefix
  -- note: this can only be a single string,
  -- no slashes etc
  -- defaults to 'multistreamer' if unset
  rtmp_prefix = 'multistreamer',

  -- path to your nginx+lua+rtmp binary
  nginx = '/opt/openresty-rtmp/bin/openresty',

  -- path to psql
  psql = '/usr/bin/psql',

  -- path to ffmpeg
  ffmpeg = '/usr/bin/ffmpeg',

  -- set your logging level
  log_level = 'debug',

  -- setup your external urls (without prefixes)
public_http_url = 'http://rtmp.lhprojects.int',
  public_rtmp_url = 'rtmp://rtmp.lhprojects.int:1935',

  -- setup your private (loopback) urls (without prefixes)
  private_http_url = 'http://127.0.0.1:8081',
  private_rtmp_url = 'rtmp://127.0.0.1:1935',

  -- setup your public IRC hostname, for the web
  -- interface
  public_irc_hostname = 'example.com',
  -- setup your public IRC port, to report in the
  -- web interface
  public_irc_port = '7000',
  -- set to true if you've setup an SSL terminator in front
  -- of multistreamer
  public_irc_ssl = true,


  -- configure streaming networks/services
  -- you'll need to register a new app with each
  -- service and insert keys/ids in here

  -- 'rtmp' just stores RTMP urls and has no config,
  networks = {
    -- twitch = {
    --   client_id = 'client_id',
    --   client_secret = 'client_secret',
    --   ingest_server = 'rtmp://somewhere', -- see https://bashtech.net/twitch/ingest.php
                                             -- for a list of endpoints
    -- },
    -- facebook = {
    --   app_id = 'app_id',
    --   app_secret = 'app_secret',
    -- },
    -- youtube = {
    --   client_id = 'client_id',
    --   client_secret = 'client_secret',
    --   country = 'us', -- 2-character country code, used for listing available categories
    -- },
    rtmp = true,
  },

  -- postgres connection settings
  postgres = {
    host = '127.0.0.1',
    user = 'multistreamer',
    password = 'multistreamer',
    database = 'multistreamer'
  },

  -- nginx http "listen" directive, see
  -- http://nginx.org/en/docs/http/ngx_http_core_module.html#listen
  http_listen = '10.0.0.12:8081',

  -- nginx rtmp "listen" directive, see
  -- https://github.com/arut/nginx-rtmp-module/wiki/Directives#listen
  rtmp_listen = '1935',

  -- nginx irc "listen" directive, see
  -- https://nginx.org/en/docs/stream/ngx_stream_core_module.html#listen
  irc_listen = '6667',

  -- set the IRC hostname reported by the server
  irc_hostname = 'rtmp.lhprojects.int',

  -- should users be automatically brought into chat rooms when
  -- their streams go live? (default false)
  -- this is handy for clients like Adium, Pidgin, etc that don't
  -- have a great IRC interface
  irc_force_join = false,

  -- number of worker processes
  worker_processes = 1,

  -- http auth endpoint
  -- multistreamer will make an HTTP request with the 'Authorization'
  -- header to this URL when a user logs in
  -- see http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
  -- see https://github.com/jprjr/ldap-auth-server for an LDAP implementation
  auth_endpoint = 'http://127.0.0.1:8080/',

  -- redis host
  redis_host = '127.0.0.1:6379',

  -- prefix for redis keys
  redis_prefix = 'multistreamer/',

  -- path to trusted ssl certificate store
  ssl_trusted_certificate = '/etc/ssl/certs/ca-certificates.crt',

  -- dns resolver
  dns_resolver = '8.8.8.8',

  -- maximum ssl verify depth
  ssl_verify_depth = 5,

  -- sizes for shared dictionaries (see https://github.com/openresty/lua-nginx-module#lua_shared_dict)
  lua_shared_dict_streams_size = '10m',
  lua_shared_dict_writers_size = '10m',

  -- specify the run directory to hold temp files etc,
  -- defaults to $HOME/.multistreamer if not set
  -- work_dir = '/path/to/some/folder',

  -- set the path to sockexec's socket
  -- see https://github.com/jprjr/sockexec for installation details
  sockexec_path = '/tmp/exec.sock',

})

Delays in YouTube

Upon doing a stream just a couple of hours ago, I noticed something odd. I use OBS to push my stream to Multistreamer which then pushes to Facebook, YouTube and Twitch. Making sure that my stream session was good, I checked the videos for Facebook, which showed the complete video; Twitch also showed the complete video in the archives and upon checking YouTube, it ended abruptly, around 30 seconds before I actually ended the stream.

My procedure of ending the stream is via OBS. What I did after ending the OBS stream, I noticed that Multistreamer still has the Go Live! button still grayed out and refreshed the page accordingly for me to check and make sure that Go Live! and Stop Pushing are both disabled.

My hypothesis is that while OBS sent a signal to stop the stream, there might be some left over data that Multistreamer needs to send to YouTube, but since I hit the refresh button, it stopped abruptly.

FB video length: 42:24 https://www.facebook.com/1549289731752927/videos/2067338696614692/
Twitch video length: 42:08 https://www.twitch.tv/videos/235516506
YouTube video length: 40:28 https://www.youtube.com/watch?v=yzLOhz6Mznk

What is the correct process to properly end a stream?

Auto push turned on, OBS is failing to connect

Probably related to #49 , I tend to setup my multistreamer to automatically stream when it gets a feed from OBS, when im using this setting, OBS is complaining about my secret or my RTMP URL (which is, from my previous posts, already corrected).

My hunch is that OBS is not smart enough to know that theres probably a different problem with multistreamer. Probably if a return code is returned to OBS to display another error (like stream cant start or something) would be more intuitive than blaming on the RTMP url or keys that is obviously correct.

Chat stopped showing messages

Easy as that. Stopped showing Twitch messages but YT messages were shown. Kinda weird. This happened in the middle of a stream. F5 the chat window don't fixed this.

I'm using docker so don't know what to do to get logs and such.

new twitch module

Hey man,

so far so good. again there are issues with the twitch module. there are two cases:

with option "Require Preview before going live" switch off:
ffmpeg processes are keep spawning, like it doesn't check if there is any current process running. stopping stream doesn't kill those ffmpegs

with option "Require Preview before going live" switch on:
it spawns only one process of ffmpeg, but then again, upon stream is stopped the process is keep running.

test it on CenOS 7.4 and Ubuntu 16.04, with both 'tactics' - with installer and by hand.
Hope you'll have time to look into this.

ps. would kindly ask you to point me where exactly is the function of creating the stream key, want to add username to the stream key, because currently testing and developing rtmp stat module.

More of a question than an issue

So did I understand correctly that I need to create a Facebook App so I could have a key and a secret to use it with multistreamer? If I want to stream to an existing Facebook Page, would it be possible?

Im using Nvidia GeForce Experience to stream to my Facebook Page and Restream.io to stream to YouTube and Twitch. I just want to use one to make management easier. I came across your page but I am not sure if I would be able to do what I want with this.

Missing closing fieldset tag

in file "/opt/multistreamer/multistreamer/lib/multistreamer/views/stream-permissions.etlua"

after line 36 the form is missing a closing fieldset tag

<option value="1" <% if other_user.metadata_level == 1 then %>selected<% end %>>View Metadata</option>
<option value="2" <% if other_user.metadata_level == 2 then %>selected<% end %>>Edit Metadata</option>
</select>
</div>
</fieldset>   <-- this needs to be added

<% end %>

other wise if you are sharing multiple accounts the bowser will embed a fieldset inside a fieldset making the markup look crazy

Support for ARM Processors

Tried deploying this to my Raspberry Pi and didnt work.

The results were promising and I think all other components worked fine except for multistreamer itself. I have filed an issue on the docker repo install for multistreamer regarding the errors I found.

Multistreamer cant resume when OBS disconnects

I was getting timestamps for more information on the start/end discrepancies between Multistreamer and all the services and halfway through playing/streaming my OBS just gave out an alert that I was disconnected and its trying to reconnect.

All the while I thought that its just gonna be a hiccup and everything would continue on as it should. As I completed my stream, I noticed that the OBS disconnect cut the stream altogether. Is it by design? Or should Multistreamer be at least able to recover on things like this like a network hiccup or some quick OBS failure?

Previously in one service im using, even if OBS disconnects, there would just be a gap on the stream but would still continue on when OBS resumes the stream/reconnects.

To help out further, here are the start timestamps of the videos and services.

YT: Started 23:51:31 (lasted for 00:15:38)
FB: Started 23:51:14 (lasted for 00:16:02)
Twitch: Started 23:51:30 (lasted for 00:15:46)

Please note that these timestamps are GMT +8. I have gathered the logs but unforunately its in UTC.

I wish I could do the math but I would need to sleep. So the logs in question should be around 15:51 UTC at the very least.

20180319 Multistreamer Logs.zip

Feature request for night mode UI

Just wondering if its possible to have a dark/night mode for the Multistreamer UI? If theres any way you can point me to which files are edited along with a template file with test data, I think I can do so myself.

I think majority of the people here are using this for streaming gaming, I tend to use my other PC to monitor/start the stream and the glare of the light UI is overpowering my other screen. (yes, I know I can just turn off the monitor, but surely there is a better way.)

Twitch hook fails to auth against Kraken

helo,

it seems that the Twitch made some changes to their API lately, because the connector fails once the user restarts the stream. Other connectors works just fine, starting stopping only breaks the twitch authentication. The following scenarios were tried:

  1. New/old dev account - also resetting the secret ID doesn't work
  2. Full and fresh install of multistream as well as different browser (tried: FireFox, IE10, Edge, Opera, Chrome, even in incognito mode)
  3. Pushing the rtmp with only FB/YT enabled works, and once Twitch is turned on, it returns 'no client id specified'
  4. Tried describing the auth return URL to either https/http - the result is the same
  5. Checked everything db/nginx relations, configs etc.

Will kindly assist in any tests, or deployments.

BR

Facebook App Needs to be Live

I just noticed something. I've properly configured my Facebook, Twitch and YouTube keys and secrets and everything was going well. 'Til I tried visiting my pages as incognito and found that Twitch and YouTube shows the stream/videos as is but Facebook, well its a bit sketchy.

As an admin of my own page, I see my live/previous streams without any problems. I always wondered about the question mark but did not bother with it.

Wat

So I went on with my life and streamed with Multistreamer some more. I checked in incognito my public FB page and lo and behold, nothing was friggin there. I've been streaming with Multistreamer since January and the last post was December, probably using NVidia or Restream.

Old

Then I did an experiment, I created a Privacy Policy page and published and made my app live. There it goes, I saw every Multistream post even in incognito. Even a random guy in some remote corner of the world, stumbles upon my FB page, he can see the full glory of my noobidity.

Live

TLDR; please include in the FB guide that the app needs to go live. That involves a Privacy Policy link being published and flipping the app switch to live. Then again, you will still have that question mark even if its live, but check your page in incognito to make sure its published publicly in FB.

Facebook stream suddenly stopped

I had a stream configured to push to fb, yt and twitch.. after an hour or so the fb stream stopped but the two was still going. Any logs i can collect to help with this investigation?

Stop puller doesn't kill ffmpeg process

Steps to reproduce:

  1. Create a new stream with custom ffmepg arguments
  2. Head over to Edit Metadata and start puller
  3. Wait a few minutes and click Stop puller

While the page refreshes and appears that the ffmpeg puller has stopped. The stream preview is still showing content and the ffmpeg processes are still running. At this point, you are no longer able to stop the ffmpeg process through the Web UI, only launch a new ffmpeg process.

Error message when adding a Facebook Account

Since I realized that theres a new build, I redeployed Multistreamer again and deleted all my accounts and readded them. When adding FB, I got an error but upon checking I saw that FB was added (probably because I already previously authorized this app)

Error

/home/multistreamer/lib/multistreamer/networks/facebook.lua:155: attempt to index local 'event_info' (a boolean value)

Traceback

stack traceback:
	/home/multistreamer/lib/multistreamer/networks/facebook.lua:155: in function 'refresh_targets'
	/home/multistreamer/lib/multistreamer/networks/facebook.lua:286: in function 'register_oauth'
	/home/multistreamer/lib/multistreamer/webapp.lua:1180: in function 'handler'
	...streamer/lua_modules/share/lua/5.1/lapis/application.lua:130: in function 'resolve'
	...streamer/lua_modules/share/lua/5.1/lapis/application.lua:161: in function <...streamer/lua_modules/share/lua/5.1/lapis/application.lua:159>
	[C]: in function 'xpcall'
	...streamer/lua_modules/share/lua/5.1/lapis/application.lua:159: in function 'dispatch'
	.../multistreamer/lua_modules/share/lua/5.1/lapis/nginx.lua:215: in function 'serve'
	content_by_lua(nginx.conf:69):2: in function <content_by_lua(nginx.conf:69):1>

Version or Build Number

Hi, I typically just relaunch my container with the option to force pull a new image. But just for sanity, is it possible to add the current version number of Multistreamer lets say, on the login page? This would make it easier for me to identify that I indeed got the new version.

Instructions for Deploying to ARM Based Machines

Hi, I filed an issue in the Docker repo of Multistreamer but it seems that its a bit complicated to do an automated build to with ARM. So I'm writing this to ask if theres any specific instructions to install/build this in an ARM based machine such as a Raspberry Pi?

Im having trouble with keeping my Multistreamer deployment stable in my ESXi machine since I occasionally shut it down during weekends (I use it for work) and at times when booting the VM where Multistreamer is installed, everything goes to utter crap (ie. not working, not pushing streams, etc).

I'd rather have my extra RPi forever turned on for Multistreamer purposes than have a power hungry dedicated x86 machine for this. I've also observed that Multistreamer works pretty well resource wise so I think an RPi3 would have enough power to handle streaming for 1 or 2 accounts.

Returning path from networks

hello.

in the last 3-4 weeks i'm receiving complains from my friends, that they are getting error once the complete the steps of authorizing mutlistreamer from Youtube. i was able to reproduce the error, but sometimes, the authorization just completes fine.

https://gyazo.com/015f47fde63709e25667aab481b8d1fb

This is the exact error returned from multistreamer, and below is the debug messages from multistreamer (will cut most of the information because of keys and privacy)

https://gyazo.com/fa115d7eaf574a9e135c8186c6827ab7

if any of you guys, have an insight on this, please let me know.

Trouble Installing On Ubuntu 16.04

When i'm trying to add a user i get this error

./bin/htpasswd-auth-server -l /opt/openresty-rtmp/luajit/bin/luajit add /opt/openresty-rtmp/luajit/bin/luajit: /root/htpasswd-auth-server/bin/htpasswd-auth-server.lua:62: module 'lecho' not found: no field package.preload['lecho'] no file './lib/lecho.lua' no file '/root/htpasswd-auth-server/lua_modules/share/lua/5.1/lecho.lua' no file '/root/htpasswd-auth-server/lua_modules/share/lua/5.1/lecho/init.lua' no file './lecho.lua' no file '/root/htpasswd-auth-server/lua_modules/lib/lua/5.1/lecho.so' stack traceback: [C]: in function 'require' /root/htpasswd-auth-server/bin/htpasswd-auth-server.lua:62: in main chunk [C]: at 0x004047d0

User delete button typo

When attempting to delete a user from the /users page identified a typo in the button

image

should be a quick fix in line 9 in the following file "/opt/postgres-auth-server/lib/postgres-auth-server/views/deleteuser.etlua"
<button type="submit" class="pure-button pure-button-primary">Delte User</button>

[feature request] chat widget timeout and avatars

it would be really nice to have a chat widget url option to specify how long given chat message is visible, so that it's not obstructing space if nobody is chatting and there are only few old chat messages. alternatively there could be unix timestamp attached as message attribute, so that can be handled by some external javascript.

the second attribute that could be attached (and displayed if certain flag is switched) is user avatar if it was provided by upstream API.

Feature request to clone/copy stream details

I've started to create multiple streams rather than editing the stream information manually everytime. I would just opt to create streams in Multistreamer and different profile in OBS and switch accordingly depending on the game im playing.

If its possible, I would like to request the option to clone a stream (which accounts are active, all the information, etc.) since that would make everything easier by just cloning and doing minor edits than putting all values again over and over.

Another way to approach this is to use templates (like how Switchboard Live Cloud does it) so its easier to switch what type you're streaming with a single configuration for RTMP/keys.

Request: stream key + username

Hello,

would like to kindly ask JprJR to add the username to the stream key, no matter with additional function or replace current one (ideally to have a tick box for attach the username to the stream key). Asking this only for easily monitor through the RTMP stats functions of the Nginx module, and because lately don't have a minute spare time, to additionally edit your code. Will greatly appreciate your effort.

thanks in advance

Preview Live stream

Hi. Amazing work with multistreamer. Tested it and its great! Just one thing.

The live stream preview does not load any video (even if play button is clicked) while the video streams properly to all services. I just get the same html5 video container like below.

test

PS: Will be using multistreamer from now on. Will give you feedback regularly. Good work.

ffmpeg persistent after stream stops

Hey JR,
unfortunately i'm facing the issue with persistent ffmpeg processes, even when the stream is stopped. using "Stop pushing" also can't terminate the processes running. tried both ways - with "require preview" switched on and off - again same results. tomorrow will try again 2 fresh installations but on both ubuntu/centos result is the same.

Proxy settings.

I there a way to overlap your web interface with an existing nginx configuration?....

For some reason I can't seem to get the docker IMG to get to the login screen... I've followed the video tutorial and even typed the same settings you have for the nginx proxy with no avail. Would you be able to assist? Maybe I have missed something

Error message when starting the stream

After I was able to figure out the correct RTMP, I tried (settings currently in preview before streaming) to start my stream and got the following message:

Failed to start pusher: {"error":"Bad Request","status":400,"message":"No client id specified"}

Cosmetic bug in the readme/instructions

Hi,

On the install section for OpenResty:

...
cd ../luarocks-2.4.2
./configure \
  --prefix=/opt/openresty-rtmp \
  --with-lua=/opt/openresty-rtmp/luajit \
  --lua-suffix=jit \
  --with-lua-include=/opt/openresty-rtmp/luajit/include/luajit-2.1

No make build, make install, or make bootstrap? I am surprised I missed this on the first go around. :/

https Redirect

Facebook is now strictly implementing strict https for oauth redirect URIs. so things like http://<hostname>:8081/auth/facebook wouldnt work anymore.

Possible to create an https redirect to the http endpoint rather than manually setting up SSL with this?

Another option is to support adding of certs via the environment variables.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.