Skip to content

YouTubeDL Material in Docker on a Synology NAS

UpdateDate
New guide published05/03/2022
Small amendment made to the environment variables to specify the use of a local database – the next revision of the guide will use a mongo database10/05/2022

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!

Lets 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 second of the two preceding guides.

Step 2: Setting up a restricted Docker user

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’

You will be greeted with the initial setup screen, feel free to rename the container if you want, then click on the ‘Advanced Settings’ button.

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.

On the first tab enable ‘Auto Restart’ this will ensure YoutubeDL Material will automatically start up whenever you reboot your NAS.

Volumes / Mounts

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’ folder and create a new sub-folder called ‘youtubedl’ select this folder and click ‘select’

Now add ‘/app/appdata’ to the ‘Mount path’ box

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

Network

We are not going to be specifying specific ports for YoutubeDL to use as we want to keep things simple, tick the ‘Use the same network as Docker Host’

You do not need to set up anything on this tab.

Environment Variables

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_default_downloaderyt-dlp
ytdl_use_local_dbtrue
The default downloader can also be changed in the preferences

Almost Done

You have now completed the setup of the container.

Click on Apply to move back to the initial settings screen and then click next, 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 17442

e.g 192.168.0.40:17442

You can use the main screen to download individual videos by pasting the URLand selecting the quality, or if you want to add subscriptions to specific channels use the menu on the left.

Docker Compose

You can use the below code saved as youtubedl.yml in the ‘/docker/youtubedl’ share to do a much quicker setup than via the Synology UI. You will need to set up the folders as per the Volumes/Mounts section first. Ensure you change the variables to your own.

version: "3.8"
services:
  youtubedl-material:
    image: tzahi12345/youtubedl-material:nightly
    container_name: youtubedl-material
    environment:
      - UID=YOUR_UID
      - GID=YOUR_GID
      - USER=youtube
      - ytdl_default_downloader=yt-dlp
      - ytdl_use_local_db=true
    volumes:
      - /volume1/data/media/youtube/users:/app/users:rw
      - /volume1/data/media/youtube/subscriptions:/app/subscriptions:rw
      - /volume1/data/media/youtube/audio:/app/audio:rw
      - /volume1/data/media/youtube/video:/app/video:rw
      - /volume1/docker/youtubedl:/app/appdata:rw
    network_mode: host
    restart: unless-stopped
sudo docker-compose -f /volume1/docker/youtubedl/youtubedl.yml up -d


Throw me some bits or buy me a coffee?

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running the site, you can even buy me a coffee 🙂

Buy Me A Coffee
Doge / Ethereum / Bitcoin
Published inDocker

6 Comments

  1. Gareth Blades Gareth Blades

    2022-04-02T18:51:48.864Z INFO: Cannot find config file. Creating one with default values…
    2022-04-02T18:51:48.897Z INFO: Beginning migration: 4.1->4.2+
    2022-04-02T18:51:48.906Z ERROR: EACCES: permission denied, scandir ‘audio/’
    2022-04-02T18:51:48.906Z ERROR: Migration failed: 4.1->4.2+
    2022-04-02T18:51:48.907Z INFO: Beginning migration: 4.2->4.3+
    2022-04-02T18:51:48.918Z INFO: 4.2->4.3+ migration complete!
    2022-04-02T18:51:49.293Z INFO: Found new update for youtube-dl. Updating binary…
    2022-04-02T18:51:50.763Z INFO: YoutubeDL-Material v4.2 started on PORT 17442
    2022-04-02T19:00:26.259Z ERROR: ERROR: Cannot write metadata to JSON file video/CNCF Kubernetes and Cloud Native Associate Certification Course (KCNA) – Pass the Exam!.info.json

    I setup the mounts as per your guide

    • Dr_Frankenstein Dr_Frankenstein

      Hey, it looks like it is failing to get permission to write to your folders, double check you set the UID and GID correctly as it can be easy to put them the wrong way around.

      • Gareth Blades Gareth Blades

        Yes they are set correctly. These are the detail I got and I set the uid and gid details the same.
        uid=1026(gblades) gid=100(users) groups=100(users),101(administrators)
        I have a calibre server running as the same user without issues. The only difference is the YouTube docker image is set to access a volume outside of /docker but I can’t imagine that would be an issue

        • Dr_Frankenstein Dr_Frankenstein

          Sorry I completely missed your reply, make sure the user has write permissions. If that fails try deleting the YouTubedl image and re downloading it just in case there is an issue with it.

      • Gareth Blades Gareth Blades

        I’m using NASInternal/Media/youtube/audio as one of the paths as an example. No spaces in any names. I don’t think capitals would be an issue but I remember reading something about it. Probably just to avoid issues with case sensitivity in Linux compared to windows.
        I’ll have a play and setup new file paths to see if I can get it working on Monday. Thanks

        • TL TL

          To solve your problem, don’t use any path outside docker directory.

Leave a Reply

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!