This script lets you automatically record and upload broadcasts from Twitch and upload it directly to YouTube. Broadcasts are downloaded in the best quality available, no transcoding, and sent directly to YouTube, meaning no video is stored on the disk and the stream is directly sent back to YouTube.
The script checks every minute if the selected streamer is live, if the streamer is; it starts immediately sending/uploading the stream to YouTube. After the stream is finished, the video gets processed by YouTube and made public.
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/22.03/youtubeuploader_22.03_Linux_x86_64.tar.gz
tar -xvf youtubeuploader_22.03_Linux_x86_64.tar.gz && rm youtubeuploader_22.03_Linux_x86_64.tar.gz
mv youtubeuploader_22.03_Linux_x86_64 /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 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.
- 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
- Getting token from YouTube:
-
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 the tool on your local machine (Somewhere with a web browser)
youtubeuploader -filename sample.mp4
-
and then simply copy the token file along with
youtubeuploader
andclient_secrets.json
to the remote host.
-
Note 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 xyaia