Last updated on 4 December 2023
Please note if you are using DSM7.2 or higher you should use the Container Manager version of this guide from the menu.
This guide has reached the end of its updates as most people are now on the latest DSM update - This guide is correct as of 08/12/2023 however no further updates will be added.
Update | Date |
---|---|
Removed docker compose section as rarely used | 18/07/2023 |
changed image to nightly as this receives the most recent bug fixes and improvements | 04/12/2023 |
What is YouTubeDL Material?
YouTubeDL Material is nice web front end for YoutubeDL, This is a tool that is used to download video from YouTube and many other sites. This is useful for if you want copies of videos to watch locally offline or if you like to hoard entire channels!
Let’s Begin
In this guide I am going to take you through the steps to get YoutubeDL Material up and running in Docker on your Synology NAS
In order for you to successfully use this guide please complete the two steps below first.
Downloading the Container
Open up Docker within DSM and navigate to the ‘Registry’ tab and search for ‘tzahi12345’ in the keyword box.
Within the results right click and download the top result ‘, When it asks which version number to download select ‘nightly‘ as this has the most recent updates for this container.
Setting up the container
Now we have downloaded the image and got hold of our user IDs we can move onto the next stage.
Go back into Docker and click on the ‘Image’ tab, in the list of your containers select the image, and click on ‘Launch’
The first screen will ask how you want to set up the Docker network, we are going to use the ‘bridge’ network allowing us to amend ports later.
General Settings
Next you will be greeted with the General Settings screen, this is where you can start specifying some of your preferences.
You can change the name of the container to anything you like, and you may want to enable Auto Restart as this will ensure the container starts automatically if you reboot your NAS.
You will also notice a Configure capabilities button — don’t change anything in here!
Next up we are going to click on the ‘Advanced Settings’ button, this will take you to a new window with a number of tabs which we are going to work through.
Environment
Next we are going to set up a couple of environment variables that docker will use to allow the container access to our files and folders.
Click the Add button, and fill in the following details as per the table/screenshot, you will need to do one at a time.
Variable | Value |
---|---|
UID | The UID you obtained in the user setup guide |
GID | The GID you obtained in the user setup guide |
USER | youtube |
ytdl_use_local_db | true |
write_ytdl_config | true |
ytdl_port | 9998 |
Links/Execution Commands
You do not need to set up anything on these tabs.
Press ‘Save’ to go back to the initial setup screen, then press ‘Next’
Port Settings
On this screen we are going to specify port 9998 to access YouTubeDL, this is in line with the Environment Variable set earlier. You will need to change BOTH the Local Port and the Container Port (we don’t normally do this)
Volume Settings
Where you store your downloaded videos can be changed based on your own preferences, I am basing this guide on the overall media setup and folder structure from our other guides.
Create a ‘youtube’ folder in /data/media and then add 4 subfolders
- audio
- subscriptions
- users
- video
We can now move onto the volume tab in which we will be specifying the directories where YoutubeDL will store its configuration files and where the video downloads will be stored.
Click on Add Folder, click on the ‘docker’ share and create a new sub-folder called ‘youtubedl’ click on this folder and click ‘select’
We now need to repeat this process adding the folders below one at a time. Your path settings should look like the table/screenshot below.
File/Folder | Mount path |
---|---|
/docker/youtubedl | /app/appdata |
/data/media/youtube/subscriptions | /app/subscriptions |
/data/media/youtube/users | /app/users |
/data/media/youtube/audio | /app/audio |
/data/media/youtube/video | /app/video |
Click Next to move to the final screen.
Summary
You have now completed the setup of the container.
You will be shown an overall summary of the settings we have specified, this is a good time to double-check everything is correct. Finally, click on Done and the container should start to boot.
You should now be able to access the web interface via the IP of your NAS followed by the port 9998
e.g. 192.168.0.40:9998
You can use the main screen to download individual videos by pasting the URL and selecting the quality, or if you want to add subscriptions to specific channels use the menu on the left.
I recommend going into the advanced settings and amending the downloader to ‘yt-dlp’ if you have any issues pulling videos.
Historic Updates | Date |
---|---|
New guide published | 05/03/2022 |
Small amendment made to the environment variables to specify the use of a local database | 10/05/2022 |
Updated with DSM7.1 Steps and Screenshots | 23/06/2022 |
Changes to ‘latest’ image and update steps | 09/07/2022 |
Added new port settings and Docker Bridge Network | 23/07/2022 |
Fixed a rogue old image for the ports section use ports 9998 on both sides! | 08/09/2022 |
Removed the default downloader so you can select one from the settings after startup. | 26/01/2023 |
Compose version number removed and small wording amendments | 09/04/2023 |
Amended the path to save the compose file – this is for security, so the container has no access to the file contents. | 14/04/2023 |
Looking for some help, join our Discord community
If you are struggling with any steps in the guides or looking to branch out into other containers join our Discord community!
Buy me a beverage!
If you have found my site useful please consider pinging me a tip as it helps cover the cost of running things or just lets me stay hydrated. Plus 10% goes to the devs of the apps I do guides for every year.
Is it possible to use docker with LDAP users? How would I get the PID/GID for an LDAP user (instead of a local one)?
I have not used LDAP but have you checked to see if a user appears via SSH, I am making the broad assumption that each user would be mapped to an internal UID/GID.
https://kb.synology.com/en-sg/DSM/help/DSM/AdminCenter/file_directory_service_ldap?version=6
I did check using the id command in SSH but it couldn’t find them. I also found that url you linked but couldn’t get my head around it so thought I would be lazy and ask lol
I will have to take a deeper look into this. It seems it may be a manual setting for LDAP.
Thanks and keep up the Amazon work!
Sorry that should have said amazing!
I am getting the same errors.
How would I go about changing ytdl_default_downloader variable from the container?
Hey – I removed the environment variable, so you can then change it directly in the settings under the Advanced tab.
Hi Can you set this something up for my synlogy, Would like to download Youtube playlist videos to my synlogy server happy to reasonable cost. Would appreciate it.
Seems like youtube-dl isn’t maintained anymore and folks are using yt-dlp but I don’t see a docker version for it. There are forks of it for docker but no instructions on setting up: https://github.com/jauderho/dockerfiles/tree/main/yt-dlp
Hey – This overall package is still working correctly and being maintained, you have a choice of three downloaders, youtube-dl, youtube-dlc and yt-dlp – in the environment variables you can specify one on startup (in this case yt=dlp) and can also change them on the fly in the settings.
Hey Dock, it’s working fine on my DS220 running DSM 7.1. I am having one problem. Ive mounted folders pointing to an external drive to the ones created for YouTube-DL Material. The folders and audio files it has created seem to be read only. I cant delete them no matter what I try. Tried deleting the folders/files from within File Station. Tried deleting them from the external drive itself. Tried moding them to 755 using SH and using rmdir /* and no luck. How can I delete these folders and files being created by YouTube-DL Material? Just want to be able to reclaim the space after moving the downloaded audio files to another drive.
Who is showing as the owner if you check a newly created file in Filestation? As it should be your dockerlimited user.
I followed your instructions and it looks like there’s an error while downloading:
I updated the UID and GID variables to the docker user I created, however I left the USER variable default as “youtube”. Not sure if that’s what this error is related to, but here is the error message when attempting to download a YouTube video:
Error while retrieving info on video with URL https://www.youtube.com/watch?v=T5SYu8tyKjM with the following message: Error: Command failed with exit code 2: node_modules/youtube-dl/bin/youtube-dl -o video/%(title)s.mp4 –write-info-json -f bestvideo+bestaudio –merge-output-format mp4 –write-thumbnail –no-clean-info-json -j –no-simulate –dump-json http://www.youtube.com/watch?v=T5SYu8tyKjM Usage: youtube-dl [OPTIONS] URL [URL…] youtube-dl: error: no such option: –no-clean-info-json
Hey, can you double-check that in the advanced settings yp-dlp is set.
This is not an error I have come across, your settings should be good even if you left YouTube as the user, the only time you would change that is in a multiuser system. I tested the same URL which worked correctly.
Also check the UID/GID and they are the correct way around e.g UID is 1234 and GID is 100 but if the app is running it is likely these are OK.
yp-dlp is properly set in the advanced settings, not sure what else I may be missing
OK just checked the open bug reports
https://github.com/Tzahi12345/YoutubeDL-Material/issues/753
Try using youtube-dl instead on dlp
Different error now, I also don’t have any default.json file in the appdata folder, wondering if I should create one from the link you shared:
Error while retrieving info on video with URL https://www.youtube.com/watch?v=xxx with the following message: Error: Command failed with exit code 1: node_modules/youtube-dl/bin/youtube-dl -o video/%(title)s.mp4 –write-info-json –print-json -f bestvideo+bestaudio –merge-output-format mp4 –write-thumbnail –dump-json http://www.youtube.com/watch?v=xxx WARNING: Unable to download webpage: ERROR: Unable to download API page: (caused by URLError(gaierror(-3, ‘Temporary failure in name resolution’)))
Getting the exact same error. Did you ever find a solution?
Have you tried using one of the alternative download tools within the settings under Advanced?
I have. When I try both youtube-dl and youtube-dlc it hangs on “Getting info” stage. I’m able to pause under Actions and it lets me delete, but it also shows a ‘processing’ animation around the pause action, as if it’s waiting for something to happen so it can change it to a ‘play’ action.
I just did a test on a 30 mins video. Mine does the same thing it just sits at getting info for the whole time but within DSM I can see it is downloading the video by looking at the network traffic. It then completes. Looking at the GitHub the Dev has been putting updates on the back burner – I am looking at doing a Tube-Archivist guide soon. I tend to use this to grab individual videos and then Tubesync for subs currently.
Groovy. I found an issue noting this behavior and it got a reply from Tzahi12345 just two weeks ago. I tried his solution of a server restart and that didn’t fix it. I’ll drop my own experiences in there to see if it gains traction. Very interested in Tube-Archivist & Tubesync. Thank you, Doctor!
https://github.com/Tzahi12345/YoutubeDL-Material/issues/753
Oh, nice one, so a quick restart after changing the downloader!
Nice one – Tubesync already done 🙂
https://drfrankenstein.co.uk/2022/03/11/tubesync-in-docker-on-a-synology-nas/
Got past the error and got it working. Restarting the server didn’t fix it, so on a hunch I removed the ytdl_default_downloader variable from the container, fired it up, changed the downloader to youtube_dl, saved, changed it back to yt-dlp, saved, tested and it worked. Don’t know 100% if removing the variable was the actual fix. If anyone runs into this issue, this may be helpful.
Hey – I am going to remove the default from the compose and guide this will at least stop it changing back post start up.