Tag Archives: yt-dlp

[lazy admin writings] Backporting a deb package with Debian Linux

More recent yt-dlp versions (direct download ones) are complaining about EJS and warn that the build-in solution in yt-dlp will be deprecated. I wanted to prepare for this future deprecation so I had looked at the options before. The recommended one is Deno but I prefer to install from deb packages as much as possible and Deno could not be found in the Debian packages repositories. Then I had noticed that QuickJS (by the software genius Fabrice Bellard) is in the repositories but only from Debian Trixie and newer. The computer I use yt-dlp has Debian Bookworm and I’m not yet ready or too lazy or some such to make the jump from Bookwork to Trixie now.

What to do ? First I thought about apt-pinning which worked nice many years ago but in more recent years my experience with it was a bit too messy or chaotic. Chaos is fine but not too often 😉 So what then ?

Go Go Gadget! Backporting.

Years ago I had used backporting several times with Debian even for packages with a lot dependencies which meant backporting several other programs and libraries that the package depended on.

With QuickJS I expected things to be easy because Fabrice Bellard is a programmer which appears to avoid bloat and wants to use every bit as efficient as possible.

After a search engine search I quickly found what I needed, this page :

https://debian-handbook.info/browse/stable/debian-packaging.html

Let’s summarize how this backporting was a  success :

I made sure I had compile tools installed.

# apt install build-essential

(# implies sudo or su to temporary have root privileges $ implies regular user)

Then installed the devscripts deb and one of the suggestions (dh-make) which I am not sure that it was actually needed :

# apt install devscripts dh-make

In /etc/apt/sources.list I added one new line (without the #)  :

# deb-src http://deb.debian.org/debian/ trixie main contrib non-free

Then ran # apt update

As regular user :

$ apt source quickjs

After this command had downloaded the source, navigate into the new directory.

$ cd quickjs-2025.04.26/

Now an optional step which you can omit.

$ dch –local +falcot

Then the big moment. I still was not sure whether it needed more dependencies so this could fail.

$ dpkg-buildpackage -us -uc

And the compiling started and finished well.

The result were in the directory above (After compiling it will also mention that)

it resulted among other in two deb files : quickjs_2025.04.26-1_amd64.deb and libquickjs_2025.04.26-1_amd64.deb

The final step of backporting and installing :

# dpkg -i quickjs*deb libquickjs_2025.04.26-1_amd64.deb

That looked good, no errors.

Then the first new step with yt-dlp :

$ yt-dlp_linux –js-runtimes quickjs:/bin/qjs [and YouTube link here]

(Syntax following :  https://github.com/yt-dlp/yt-dlp/wiki/EJS)

And there it was in the yt-dlp output, the final verdict, it worked! :

[youtube] [jsc:quickjs] Solving JS challenges using quickjs

[info] [YT-link part]: Downloading 1 format(s): 135+251

Of course this will be more difficult or even very difficult or almost impossible if the package you’d like to backport has many dependencies but

you never know unless you try! 🙂

 

 

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.