Video server to download and host high quality video files for YouTubeCast.
Unfamiliar with YouTubeCast? — Go to youtubecast.com to check it out!
- Download YouTube videos at 1080p and above
- Automatically download new videos on your server when your YouTubeCast feed updates
- Serve videos from your server to your podcast app at full quality via YouTubeCast feed
Prerequisites:
- Ensure Docker is set up and running on your machine (https://docs.docker.com/get-docker)
- Set up a hostname that can be used to access your machine from the internet (can use a static IP address as well)
- Storage space large enough to store many large video files
- CPU strong enough to transcode videos into h264 (required when using quality above 1080p)
To run this application using Docker:
- Create the
docker-compose.yml
file as described below - Run
docker-compose up -d
in the folder where yourdocker-compose.yml
lives - Check the logs using
docker-compose logs -f
to see if there are any errors in your configuration - Add
?videoServer=example.com
to the end of your YouTubeCast feed url (replaceexample.com
with your hostname) - Go to
https://youtubecast.com?setVideoServer=example.com
to save your video server's address in your browser's cookies. All feeds generated from that browser will automatically append?videoServer=example.com
to your feed URLs (replaceexample.com
with your hostname)
services:
youtubecast-videoserver:
image: trevorsharp/youtubecast-videoserver:latest
container_name: youtubecast-videoserver
restart: unless-stopped
ports:
- 80:80
volumes:
- ./content:/content
- ./download:/download
- ./cookies.txt:/app/cookies.txt
- ./log:/var/log
environment:
- 'CONTENT_FOLDER=/content'
- 'DOWNLOAD_FOLDER=/download'
- VIDEO_QUALITY=2160
- VIDEOS_PER_FEED=3
- CLEANUP_INTERVAL=1
- Create a file named
docker-compose.yml
with the contents above - Point the volume for
/content
to the folder where you want your video files to be stored long-term. This could be on an internal disk or on network- or direct-attached storage. - Point the volume for
/download
to the folder where you want your video files to be stored while downloading and transcoding. For better performance, use a folder on an interal disk. Finished files will be moved from download to content after they finish downloading/transcoding. - Add the maximum quality to download based on video height (
2160
,1440
,1080
,720
,480
, or360
) - Add the minimum number of videos to keep downloaded per feed (at least 1)
- Add the interval for how frequently to cleanup old video files (in days / at least 1)
- Optional - Point the file for
/app/cookies.txt
to where you are storing a cookies.txt file (used for members-only content) - Optional - Point the volume for
/var/log
to wherever you want to store additional logs for downloading and transcoding. This is useful when debugging.
If you want to download YouTube content that requires user authentication to download, you will need to add a cookies.txt file to your configuration. One reason for needing this is to download members-only videos. Note that the source of these videos (channel, user, or playlist) still must be either public or unlisted. For members-only videos, I recommend going to the channel's home page and scrolling down to find an auto-generated playlist titled "Members-only videos" which will contain all the videos posted for members of the channel.
To generate this file:
- To get a cookies.txt file, download a browser extension (such as this one for Chrome)
- Log in to YouTube
- With a YouTube tab open, open the cookies.txt extension and click the export/download button
- Rename the downloaded file to
cookies.txt