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.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/jenslys/autovod/master/install.sh)"
apt-get install npm
npm install pm2 -g
pm2 startup
apt-get install python3-pip tar
pip3 install --upgrade streamlink
wget https://github.com/porjo/youtubeuploader/releases/download/21.07/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
git clone https://github.com/jenslys/autovod.git
cd autovod
wget -c -O sample.mp4 https://download.samplelib.com/mp4/sample-5s.mp4
Set up your credentials to allow YouTubeUploader to upload videos to YouTube.
- Create an account on Google Developers Console
- Create a new project
- Enable the YouTube Data API (APIs & Auth -> Libary)
- Go to the Consent Screen section, setup an external application, fill in your information and add the users that are going to be using the app (Channels you are uploading videos to). Enable the ".../auth/youtube.upload" scope. Then save.
- 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
- Once created click the download (JSON) button in the list and saving it as
client_secrets.json
- Run
youtubeuploader -headlessAuth -filename sample.mp4
- Copy-and-paste the URL displayed and open that in your browser.
- Copy the resulting authorization code and paste it into the
youtubeuploader
prompt: "Enter authorization code here:" - 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.
This is the name of the Twitch user whose broadcast will be automatically uploaded to YouTube.
export TWITCH_USER=username
pm2 start AutoVOD.sh --name $TWITCH_USER
pm2 save
pm2 status
- Original script by arnicel
- YoutubeUploader by porjo
- Streamlink by streamlink
- Icon by octaviotti