Upload videos to be re-encoded and scheduled for streaming
Go to file
2023-05-08 20:41:42 +07:00
web Re-encode on reboot-interruption 2023-05-07 20:41:15 +07:00
_accounts Renames 2022-10-11 07:44:28 +07:00
_countdown Add countdown option 2022-09-18 09:48:53 +07:00
_vars Timestamp to log 2022-10-09 12:24:15 +07:00
.gitignore Add new files and change fps to 30 2023-04-16 11:22:39 +07:00
Caddyfile Renames 2022-10-11 07:44:28 +07:00
convert Add new files and change fps to 30 2023-04-16 11:22:39 +07:00
Dockerfile Renames 2022-10-11 07:44:28 +07:00
encode Re-encode on reboot-interruption 2023-05-07 20:41:15 +07:00
getcron Add new files and change fps to 30 2023-04-16 11:22:39 +07:00
init Documentation for resume after reboot 2023-05-08 20:41:42 +07:00
LICENSE Add LICENSE 2022-08-31 10:26:46 +00:00
README.md Documentation for resume after reboot 2023-05-08 20:41:42 +07:00
stream Renames 2022-10-11 07:44:28 +07:00

streamupload

Upload videos to be re-encoded and scheduled for streaming

Install

Manual

  • Prepare a Linux server, set its timezone to the users' timezone (on deb-based systems: dpkg-reconfigure tzdata). the webserver user (often www-data) has access to the location!).
  • Make sure the packages git php-fpm ffmpeg are installed (on deb-based systems: apt install git php-fpm ffmpeg).
  • Clone repo: git clone https://gitlab.com/pepa65/streamupload.
  • Move the streamupload directory to a place that is accessible to the web server, like: mv streamupload /var/www and cd to that place. Now the output of pwd is the value for $repopath.
  • do mkdir "$repopath/web/streams" and chmod 777 "$repopath/web/streams".
  • Copy _vars to vars, _accounts to accounts and _countdown to countdown and set the variables in vars (webserver, SMTP-server), accounts (usernames, emails and bcrypt-password-hashes) and countdown (if any countdown-files can be used).
  • Make a crontab-entry: "* * * * * $repopath/encode" (replace $repopath!).
  • Make a crontab-entry: "@reboot $repopath/restart" (replace $repopath!).
  • Install the mailer binary by downloading it from the repo at https://https://github.com/pepa65/mailer/releases/latest and moving it to /usr/local/bin and make it executable: chmod +x /usr/local/bin/mailer. If it's not installed, everything (except the emails) will still work.
  • Run a php/webserver on $repopath/web:
    • Get it to restart on reboot.
    • Change the relevant php.ini to allow large file uploads:
      • post_max_size - Upper limit of uploaded video sizes, say 10G.
      • upload_max_filesize - same value as post_max_size.

Webserver

If no webserver has been installed, an easy way to get going is to use Caddy from https://caddyserver.com/download and place the caddy binary in /usr/local/bin and make it executable: chmod +x /usr/local/bin/caddy. Make the config file /root/Caddyfile like:

{
	email $email
}

:80 {
	log {
		output file $repopath/upload.log
	}
	php_fastcgi unix//run/php/php-fpm.sock
	root * $repopath/web
	file_server
}
  • If the server IP has an DNS A record pointing to it, :80 can be replaced by the domainname with the A record, and it will be SSL-encrypted.
  • Replace $email with an email for the SSL-certificates.
  • Replace $repopath in both places (see above in Install).
  • The value of /run/php/php-fpm.sock might need to be adjusted, depending on the system used, it needs to be the unix socket for php.
  • Caddy can be started at boottime by including @reboot /root/Caddy as a line in root's crontab: crontab -e and make the file /root/Caddy with:
#!/usr/bin/env bash

# Make sure internet is reachable
while ! ping -q -c 1 1.1.1.1 &>/dev/null
do sleep 1
done

cd /root
/usr/local/bin/caddy stop &>/dev/null
sleep 1
killall -9 caddy &>/dev/null
/usr/local/bin/caddy start &>/root/caddy.log

and make it executable: chmod +x /root/Caddy.

Docker

After cloning this repo, cd streamupload, and setting the variables in vars and accounts, a docker image can be built from the included Dockerfile by: docker build -t streamupload .. In the case of running on a LAN and not having a DNS A record, start it with: docker run -d -p 8080:80 -v $PWD/web:/var/www/web streamupload. In case of a domainname, replace 8080:80 by 443:443.

Usage

  • Get a streamkey for the target by scheduling a stream (supported are: Restream.io, YouTube.com, Facebook.com).
  • Go to the server's URL in the browser: http://$ipaddress:80 or for docker: http://$ipaddress:80 or in case of a domainname: https://$domainname.
  • Log in with the username and passwors as prepared in accounts.
  • Fill in the form, and click "Schedule Stream".