[LINUX] Until youtube-dl can be used with Synology (DS120j)

Prerequisites

You can access Synology with an ssh connection. You can enter Synology's NAS with Explorer.

Until you use pip install

Install Python 3 from Package Center Introducing Python3 and Pip to Synology I will refer to this site

sudo curl -k https://bootstrap.pypa.io/get-pip.py | sudo python3

Execute. I have never done command line operations in earnest コメント 2020-04-10 225459.png I got stuck on this password entry screen. The cause was that there was no response when I typed the characters, and that the password of the admin group I had imagined was incorrect. After that, change the password of the admin group and enter the password based on the fact that it does not respond even if you type characters in the above image wwコメント 2020-04-10 230053.png success. You can now use pip.

Install youtube-dl with pip

pip install youtube-dl

When I hit -sh: pip: command not found Has been returned. When I checked various things, it was that the path did not pass (that's right) I can't log in to mysql I will refer to this site

vi /etc/profile

Run! A screen like the one above appears, but I didn't know how to add characters. As I investigate, this is called a vi command, so it seems to be edited. Then when I tried to add the path, I realized that I didn't know the absolute path of the folder on the NAS. I managed to find the folder where I installed pip in Explorer. Go to that level with the cd command and get the path with the pwd command! !! Then use the vi command to go where you want to go with the arrow on the keyboard export PATH = $ PATH: The path you just copied! When trying to save E45: readonly option is set (add ! to override) Came out. When I search for an error, it seems that it is an error that occurs when the file is read-only ... :w !sudo tee % I was able to pass the path by typing in the password. Now "pip install youtube-dl" works and you can install it! Since path also went through that folder (I'm sorry I don't know) I tried typing "youtube-dl URL" and it worked!

Big lump with ffmpeg

I used the argument to download the video format using "-f bestvideo [ext = mp4] + bestaudio [ext = m4a]", but now an error occurs. ERROR: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument 5コメント 2020-04-11 000640.png Searching for the error led me to the conclusion that ffmpeg is not the latest version. So I realized that I didn't put ffmpeg on my own. So when I ran "which ffmpeg" to see what (where) ffmpeg was working, it seemed that ffmpeg was installed in the path I was taking from the beginning! I tried DL with the latest version of win10 ffmpeg using the same format ("-f bestvideo [ext = mp4] + bestaudio [ext = m4a]"), and I was able to download it firmly, so ffmpeg is the cause. I understood. But since I touched linux for the first time yesterday, I don't know how to install linux ffmpeg ..... As I researched, I noticed that the latest version (almost) of ffmpeg has been uploaded to Synology's community package! 1コメント 2020-04-10 233947.png 2コメント 2020-04-10 234047.png -^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^ Name: Syno Community (Anything?) Location: http://packages.synocommunity.com/ -^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^ Click the community on the left to search for ffmpeg and install it! !! 6コメント 2020-04-11 001056.png

But when I run which ffmpeg after installation, the location doesn't change ... because the path doesn't go through ... However, I do not know where the ffmpeg installed earlier was installed ... I found out that there is a find command and I can find out where the place where ffmpeg is written can be found! cd / find ./ -name ffmpeg I was able to get a list at! !! Comparing it with the case of uninstalling ffmpeg earlier 3コメント 2020-04-10 235145.png There seems to be ffmpeg here! !! So add the top "/ volume1 / @ appstore" to the path! vi /etc/profile I was able to realize that I had to be careful about the priorities when adding in! !! 4コメント 2020-04-10 235647.png Add path at the arrow! (You have to put a bin like / volume1 / @ appstore / ffmpeg / bin! (I'm glad I installed ffmpeg on windows ...)) And I was able to download the video that had the error! !! !!

From the author

I've spent about 6 hours on this article ... I didn't want people in exactly the same situation to spend such wasted time, so I wrote this article. It was. This is my first article, so I'm sorry I wrote each line in a noisy tone m (_ _) m. I will be careful from the next time ... There are many places I have omitted, so if you have any questions, I would like to help as much as possible, so thank you!

Recommended Posts

Until youtube-dl can be used with Synology (DS120j)
Until torch-geometric can be used only with Windows (or Mac) CPU
File types that can be used with Go
Japanese can be used with Python in Docker environment
Python knowledge notes that can be used with AtCoder
pd.tseries.offsets.DateOffset can be quite slow if not used with caution
SSD 1306 OLED can be used with Raspberry Pi + python (Note)
requirements.txt can be commented out with #
Acoustic signal processing module that can be used with Python-Sounddevice ASIO [Application]
Mathematical optimization that can be used for free work with Python + PuLP
Acoustic signal processing module that can be used with Python-Sounddevice ASIO [Basic]
Until you can use opencv with python
[2015.02.22] Youtube-dl has been updated and can no longer be used in previous versions.
I made a familiar function that can be used in statistics with Python
Functions that can be used in for statements
No module named'distutils.util' cannot be used with get-pip.py
List packages that can be updated with pip
Convert images from FlyCapture SDK to a form that can be used with openCV
[Python] Building an environment for competitive programming with Atom (input () can be used!) [Mac]
[Python] Introduction to web scraping | Summary of methods that can be used with webdriver
File sharing server made with Raspberry Pi that can be used for remote work
Basic algorithms that can be used in competition pros
Color list that can be set with tkinter (memorial)
ANTs image registration that can be used in 5 minutes
[android] When AVD cannot be used with permission denied
Can be used in competition pros! Python standard library
[Django] About users that can be used on template
Limits that can be analyzed at once with MeCab
Until you can do simple image recognition with Jupyter
Introduce PyQt 5 to MacOS (Linux can also be used)
Can be used with AtCoder! A collection of techniques for drawing short code in Python!