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)
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)"
Required packages
apt-get install npm
npm install pm2 -g
pm2 startup
apt-get install python3-pip tar
pip3 install --upgrade streamlink
apt-get install jq
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
If you want to upload to an any of the Rclone providers
Instructions
apt-get install rclone
If you want to enable the re-encoding or re-streaming feature
Instructions
apt-get install ffmpeg
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"
git clone https://github.com/jenslys/autovod.git
cd autovod
wget -c -O sample.mp4 https://download.samplelib.com/mp4/sample-5s.mp4
Instructions
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 -> Library)
- 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 save 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
youtubeuploader
on your local machine (Somewhere with a web browser)youtubeuploader -filename sample.mp4
-
and then simply copy/move
request.token
andclient_secrets.json
to the remote host. Make sure these are placed inside theautovod
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
We will create a dedicated config file for each steamer, in case are monitoring multiple streamers with different settings.
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 your newly created config
nano StreamerNameHere.config
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
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 can be found here
pm2 start AutoVOD.sh --name <Streamer Name Here>
pm2 save
pm2 status
pm2 logs
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>
I am getting "[Error 32] Broken pipe"
There are multiple reasons this error can occur, check the following
- 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.
- You have configured
rclone
correctly - You have inserted the correct variables inside the config.
- 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:
- Original script by arnicel
- YoutubeUploader by porjo
- Streamlink by streamlink
- Icon by xyaia
Licensed under the MIT License