Skip to content

jenslys/autovod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoVOD

Releases

This script automates downloading and uploading Twitch.TV, Kick.com or YouTube Live streams to a selected upload provider.

Important

This does not download and upload the official Twitch/Kick/YouTube VOD after the stream is finished, but rather uses streamlink to record and upload the stream in realtime. So features like separating different audio track for the VOD are not supported. If that is something you are looking for, you should check out Twitch's manual export to YouTube feature.

Current available upload options:

  • Youtube (Needs no transcoding, so no file is stored on the disc.)
    • Direct Upload
    • Re-stream
  • Rclone - Should work with supported all providers
    • Direct upload (Needs transcoding, so the stream is temporally stored on the disc before uploading)
  • Local
    • Local file (Downloads the stream locally to your machine)

Installation

Automatic Installation

Note Only supports APT or DNF. If you are using a different package manager, you will have to install the required packages manually.

sh -c "$(curl -fsSL https://raw.githubusercontent.com/jenslys/autovod/master/install.sh)"

Manual Installation

Required packages

PM2

apt-get install npm
npm install pm2 -g
pm2 startup

Streamlink

apt-get install python3-pip tar
pip3 install --upgrade streamlink

JQ

apt-get install jq

YoutubeUploader

If you want to upload to YouTube

Instructions
wget https://github.com/porjo/youtubeuploader/releases/download/23.03/youtubeuploader_23.03_Linux_x86_64.tar.gz
tar -xvf youtubeuploader_23.03_Linux_x86_64.tar.gz && rm youtubeuploader_23.03_Linux_x86_64.tar.gz
mv youtubeuploader /usr/local/bin/youtubeuploader

Rclone

If you want to upload to an any of the Rclone providers

Instructions
apt-get install rclone

FFMPEG

If you want to enable the re-encoding or re-streaming feature

Instructions
apt-get install ffmpeg

Kick Plugin

If you want to use kick.com as your source

Instructions
STREAMLINK_LOCATION=$(pip3 show streamlink | grep -E '^Location:' | awk '{print $2}') &&
      PLUGINS_DIR="${STREAMLINK_LOCATION}/streamlink/plugins" &&
      wget --progress=dot:giga -O "${PLUGINS_DIR}/kick.py" "https://raw.githubusercontent.com/nonvegan/streamlink-plugin-kick/master/kick.py"

AutoVOD

git clone https://github.com/jenslys/autovod.git
cd autovod

Sample video

wget -c -O sample.mp4 https://download.samplelib.com/mp4/sample-5s.mp4

Setup

Youtube setup

Instructions

Set up your credentials to allow YouTubeUploader to upload videos to YouTube.

  1. Create an account on Google Developers Console
  2. Create a new project
  3. Enable the YouTube Data API (APIs & Auth -> Library)
  4. Go to the Consent Screen section, setup an external application, fill in your information and add the user/s that are going to be using the app (Channel/s you are uploading videos to). Enable the ".../auth/youtube.upload" scope. Then save.
  5. Go to the Credentials section, click "Create credentials" and select "OAuth client ID", select Application Type 'Web Application'. Add a 'Authorised redirect URI' of http://localhost:8080/oauth2callback
  6. Once created click the download (JSON) button in the list and save it as client_secrets.json
  7. Getting token from YouTube:
    1. Due to recent changes to the Google TOS, if you are running this utility for the first time and want to run it on a Headless server, you have to first run youtubeuploader on your local machine (Somewhere with a web browser)

      youtubeuploader -filename sample.mp4
    2. and then simply copy/move request.token and client_secrets.json to the remote host. Make sure these are placed inside the autovod folder.

Note To be able to upload videos as either "Unlisted or Public" and upload multiple videos a day, you will have to request an API audit from YouTube. Without an audit your videos will be locked as private and you are limited to how many videos you can upload before you reach a quota.

Tips on passing the audit

I have applied for the audit twice (for two separate projects).

  • First time, I was applying because I wanted to archive a particular streamer's streams to YouTube.
  • Second time, I was applying because I needed a higher quota for the testing and development of AutoVOD.

Both times I was accepted fairly easily.

Since this tool isn't very complex, I typed almost the same thing on all fields, along the lines of:

"I am going to upload a certain twitch user VODS to YouTube and need a higher quote because the streamer streams multiple times a week for x amount of hours. The tool is internal, so the only person that is authenticating through it is me. This is using Youtube Data API to upload to videos."

I also linked/referenced this GitHub page (Don't know if that helped my case).

The field that wants you to upload a screen recording of the program; I just screen recorded myself doing the youtubeuplaoder --filename sample.mp4 command. Since that is how we get the token from youtube. You could also record the process starting AutoVOD.

Note It took around 20 days from submission to them accepting the audit.

I am leaving open the GitHub issue regarding this, in case people want to discuss or share their experience: #32

Rclone setup

Instructions

Refer to your provider on how to configure Rclone

https://rclone.org/#providers

Usage

Config file

We will create a dedicated config file for each steamer, in case are monitoring multiple streamers with different settings.

Create config file

Note: Case sensitive, make sure to type the capitalization for the username the same on all inputs and files.

cp default.config StreamerNameHere.config

Edit the config

Edit your newly created config

nano StreamerNameHere.config
Optional additional setup steps
Stream metadata

This currently only works if you are using Twitch.TV

If you want to add stream metadata to your video, you will need to deploy an api wrapper for the Twitch API. You can find the instructions on how to do that here. Once you have the wrapper deployed, you will need to add the url in the API_URL field in the config file and enable the API_CALLS field.

Disable ads
Fetching the OAuth token from

Follow the instructions here to get your OAuth token.

Then add the OAuth token: --twitch-api-header=Authorization=OAuth YOURCODEHERE to the STREAMLINK_OPTIONS field in the config file.

Other options

Other options can be found here

Start AutoVOD

pm2 start AutoVOD.sh --name <Streamer Name Here>
pm2 save

Check status

pm2 status

Check logs

pm2 logs

Using docker

This script can be used inside a docker container. To build a container, first execute all Setup-Steps, then build the image:

docker build --build-arg USERNAME=<Streamer Name Here> -t autovod .

You can now run this container

docker run -d autovod <Streamer Name Here>

Or you can run both commands in one line

./buildRunDocker.sh <Streamer Name Here>

FAQ

I am getting "[Error 32] Broken pipe"

There are multiple reasons this error can occur, check the following

YouTube

  • That you have not reached your YouTube quota limit
  • That your YouTube credential files have not expired
  • You can check these by running youtubeuploader --filename sample.mp4 then checking the output.

Rclone

  • You have configured rclone correctly
  • You have inserted the correct variables inside the config.

Server resource exhaustion

  • Uploading VODs require a lot of bandwidth, check if the upload fails because your provider is limiting or cutting of the upload.
My tokens keep getting revoked
  • Visit the OAuth consent screen and click on the publish button to change from the testing status to the published status.
My video keeps getting marked as private
  • To be able to upload videos as either "Unlisted or Public" and upload multiple videos a day, you will have to request an API audit from YouTube. Without an audit your videos will be locked as private and you are limited to how many videos you can upload before you reach a quota.
I cant upload videos longer then 15 minutes
  • You will need to verify your phone number on youtube to upload videos longer then 15 min
One or more required files are missing

The following files are required for the script to work:

  • nameOfStreamer.config
  • request.token (Only if uploading to YouTube)
  • client_secrets.json (Only if uploading to YouTube)

It should look something like this:

Screenshot

Credit

License

Licensed under the MIT License