Skip to content

YouTubeDL Material in Docker on a Synology NAS

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.
UpdateDate
Removed docker compose section as rarely used18/07/2023
changed image to nightly as this receives the most recent bug fixes and improvements04/12/2023
Historic updates now at the end of the guide.

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.

Please note the screenshot shows latest I will change this shortly to nightly

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.

VariableValue
UIDThe UID you obtained in the user setup guide
GIDThe GID you obtained in the user setup guide
USERyoutube
ytdl_use_local_dbtrue
write_ytdl_configtrue
ytdl_port9998
The default downloader can also be changed in the preferences

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
Folder structure as per the screenshot

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/FolderMount 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 UpdatesDate
New guide published05/03/2022
Small amendment made to the environment variables to specify the use of a local database10/05/2022
Updated with DSM7.1 Steps and Screenshots23/06/2022
Changes to ‘latest’ image and update steps09/07/2022
Added new port settings and Docker Bridge Network23/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 amendments09/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
Historic Updates

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.

Published inDockerMedia Management 7.1Synology

59 Comments

  1. Jay Jay

    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)?

    • Dr_Frankenstein Dr_Frankenstein

      Hey – I removed the environment variable, so you can then change it directly in the settings under the Advanced tab.

  2. faranyaseen faranyaseen

    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.

    • Dr_Frankenstein Dr_Frankenstein

      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.

      • kennyw kennyw

        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.

        • Dr_Frankenstein Dr_Frankenstein

          Who is showing as the owner if you check a newly created file in Filestation? As it should be your dockerlimited user.

  3. JT JT

    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

    • Dr_Frankenstein Dr_Frankenstein

      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.

      • Dr_Frankenstein Dr_Frankenstein

        Have you tried using one of the alternative download tools within the settings under Advanced?

        • MW MW

          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.

          • Dr_Frankenstein Dr_Frankenstein

            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.

          • MW MW

            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.

            • Dr_Frankenstein Dr_Frankenstein

              Hey – I am going to remove the default from the compose and guide this will at least stop it changing back post start up.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!