/autovod

Script to automatically upload Twitch VODS in realtime to Youtube. With no video stored on the disk.

Primary LanguageShell

AutoVOD

Releases

This script was created to record broadcasts from Twitch and upload it to YouTube. Broadcasts are downloaded in the best quality, no transcoding, and sent directly to YouTube, meaning no video is stored on the disk and the stream is directly sent back to YouTube.

Installation

PM2

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

Streamlink

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

YouTubeUploader

wget https://github.com/porjo/youtubeuploader/releases/latest/download/youtubeuploader_linux_amd64.tar.gz
tar -xvf youtubeuploader_linux_amd64.tar.gz && rm youtubeuploader_linux_amd64.tar.gz
mv youtubeuploader_linux_amd64 /usr/local/bin/youtubeuploader

AutoVOD

git clone "https://github.com/jenlys/AutoVOD.git"
cd AutoVOD

Sample video

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

Setup

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 -> Libary)
  4. Go to the Consent Screen section, setup an external application, fill in your information, 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'; once created click the download (JSON) button in the list and saving it as client_secrets.json
  6. Run youtubeuploader -headlessAuth -filename sample.mp4
  7. Copy-and-paste the URL displayed and open that in your browser.
  8. Copy the resulting authorization code and paste it into the youtubeuploader prompt: "Enter authorization code here:"
  9. If everything goes correctly, it will upload the sample video to the provided YouTube channel.

NOTICE: To be able to upload videos as either "Unlisted or Public", you will have to request an API audit from YouTube for your project. Without an audit your videos will be locked as private.

Usage

Define the Twitch Username

This is the name of the Twitch user whose broadcast will be automatically uploaded to YouTube.

export TWITCH_USER=username

Start AutoVOD

pm2 start AutoVOD.sh --name $TWITCH_USER
pm2 save

Check status

pm2 status

Credit