Tag Archives: yt-dlp

Download muziek videos van YouTube als audio bestanden met yt-dlp [Nederlands]

Als je privacy belangrijk vindt dan gebruik je misschien Invidious of Piped dot video. Al sinds een tijd hebben beide projecten problemen met laden van videos, mogelijk door Google restricties of veranderingen. Maar zelfs al dat (videos niet kunnen laden) gebeurt dan kun je alsnog de videos downloaden met yt-dlp. Nadeel is dan als je alleen de audio wilt dat de video bestanden veel groter zijn dan audio bestanden.

Je kunt het volgende gebruiken om alleen audio bestanden als resultaat te krijgen.

Installeer wel eerst ffmpeg als je die nog niet had geinstalleerd.

Hier een voorbeeld van de syntax voor yt-dlp voor audio only :

yt-dlp_linux -f bestaudio -x --audio-format mp3 --audio-quality 0 "https://yewtu.be/watch?v=2iPBvsIZBNA"

Op deze manier krijg je veel kleinere bestanden, en je kunt het dan bijvoorbeeld op een mp3-speler zonder Internet verbinding gebruiken.

 

Download audio only from YouTube with yt-dlp [English]

If you like some privacy you may have been using Invidious or Piped dot video (I have since years) and you may have seen that lately they both are suffering from Google restrictions or problems showing videos.

However, even if Invidious or Piped dot video fails to load a video you can still download the video. Since I really like to download the audio to put it on the SBC (SingleBoardComputer like ODROID, RaspberryPi and so on) where I’m running pi-hole and regarding music the most import the mpd server software. I think mpd is really cool, I can leave it on, and after a kernel upgrade and a reboot of the SBC it will simply keep on playing music, amazing. When I go to sleep I can turn off the sound speakers, and when waking up turn on the speakers and the music is (still playing and) back like nothing happened. There’s also mpd clients for mobile and desktop so imagine you live in a student house with a common kitchen, you could have mpd running there, and anyone could switch to the appropriate music during lunch together from their mobile phone (granted that the WiFi should be in the same network range as your LAN with mpd). In the future I’d like to write another blog post about how to configure mpd for LAN usage.

The other thing is that I’d like to have audio files on my little mp3 player, to be used without Internet connection.

In the past I’ve always downloaded full videos, and then I made a funny mistake lately.

I wanted to make more space, and convert music video files into music audio files,

and used for example the incorrect :

ffmpeg -i Michael_Brecker-Naima-2003.mp4 Michael_Brecker-Naima-2003.ogg

In this case ffmpeg will “obey” and apparently produce an ogg file but the resulting “audio” file will not be much smaller!

Correct is the following :

ffmpeg -i Michael_Brecker-Naima-2003.mp4 -vn Michael_Brecker-Naima-2003.ogg

The -vn switch makes the difference. The resulting audio file is much smaller.

But such a conversion can take a lot of time unless, I guess, you have fast and powerful hardware.


How to download from YouTube with yt-dlp and go for audio files directly ?

yt-dlp_linux -f bestaudio -x --audio-format mp3 --audio-quality 0 "https://yewtu.be/watch?v=2iPBvsIZBNA"

(Note : In my case I had to choose mp3 because ogg appears not to be supported in this case. Maybe some more software is needed?)

Now if you use this syntax, yt-dlp will choose a video download option which is pretty small, and then I believe ffmpeg (on the fly ?) would convert it into mp3. Doesn’t take really long usually.

Result : smaller files, and audio only for use with mp3 player or mpd.