Yt-dlp command for those who like it tidy

I knew I wanted to stop playing video .webm and .mp4 video downloads in my music player so I actually RTFM (man yt-dlp) because I wanted to strip video out and collect audio only of my yt-dlp downloads…

So:
yt-dlp -x --audio-format mp3 https://youtu.be/ff0oWESdmH0
-x = strip out video, audio only
--audio-format mp3 means you pick which format (opus, flac, mp3, all the big ones etc) you wanted–I picked mp3

Behold a pale horse:
k2

we made 40MB go right down the toilet! hooray!

When you get to the -x and --audio-format of the man, there are a bunch of granular controls in this area including showing/selecting source quality of the download, etc.

For those of you that already know this, you didn’t need this ‘tutorial.’
For those that downloaded a bunch of mp4s just to listen to, not watch (GUILTY) and are not rocking a 1TB SSD, this might help you.
-x --audio-format mp3 --if I can make a habit of these arguments, I can reclaim a lot of space.
Dig it.

7 Likes

Thank you! I’m not aware of this. All this while I convert it to mp3 online :sweat_smile:

1 Like

Even if you didnt want to read the man pages yourself an assortment of commands/options are listed at the archwiki page

Even more info at the git project;

5 Likes

Stripping out the video is also useful if you cast to audio receivers or smart tvs.

1 Like

bash aliases are your friends :grin:

2 Likes

Also sometimes useful:

  • Check available formats: yt-dlp "URL" -F
  • Download only selected: yt-dlp "URL" -f 270,140 (for example)

(Put the option at the end so you can easily backspace and type selected format numbers.)

1 Like

I suppose ‘Clipgrab’ would work just as well. . . . i.e. ( it allows you to download video’s with music and then selecting just mp3 it will strip the video away in the download process. . . ). My 2-cents worth. . .

Rich :wink:

1 Like

Used that in the past. But now i find yt-dlp -f "bestvideo[height<=1440]+bestaudio" "URL" easier :slight_smile:

4 Likes

I have learned two things from this topic.

  1. yt-dlp - to download mp3 audio
  2. creating aliases - a method to simplify command usage in the terminal.

The outcome:

alias yt-mp3-download='yt-dlp -x --audio-format mp3 --audio-quality 320K -o "~/Music/yt-dl/%(title)s.%(ext)s"'

Thank you all :smiley:

7 Likes

also we are using it to download mp4 video then changing it to audio :slight_smile: . Real glad you found a new tool.

Love these additional variables.

interesting, is that because it is a smaller file?

1 Like

That is only a fraction of it. Stripping out video also strips out needed resources for video. No need to worry about video frame rates/bitrates, Cards, etc or other resources that would also consume the bandwidth of the stream.

3 Likes

ahhhh videos might also come driver,s codecs, etc, and bandwidth baggage so if you are just listening to music it’s insanely inefficient to listen to videos. that makes sense, thank you. apparently I didnt think that one through… :slight_smile:

1 Like

As a result, I no longer need to rely on online MP3 converters or search for and download songs from *bay websites. :innocent:

1 Like

I even had an browser extension that did that but I never do trust those kinds of things these days

1 Like

I’m oldstyle. I prefer to listen to FLAC on my Lyrion Music Server, connected to the livingroom stereo.

So I sometimes buy “mixed boxes” of CDs on the other *bay (with an “e”), rip them using whipper, do my regular processing chain and they end up on my media NAS.

4 Likes

Yeah I converted a large portion of my music to flac. much better quality than mp3 and with the size of drives today space isn’t as much a concern anymore.

1 Like

But you surely wouldn’t convert bad ole MP3 or AAC to FLAC, right? ’Cause you can’t make bad things better :wink:

Totally agree with the cost per gigabyte, so FLAC is really an option.

No when I said convert I meant that I replaced the old mp3’s with Newer Ripped Flac’s. :wink:

4 Likes

That’s one reason, but not an important one.

Speaking from experience with these devices: If you cast a ‘video’ (often a still image w/ music track) to an audio receiver without the video capability, it can get rejected (“audio only”), your PC might want to show the video while the audio is transferred to the receiver, or a couple of similar annoying, unwanted options. Better to eliminate the potential for unwanted behaviour and stream audio only.

If you cast it to an (older) OLED TV, the TV shows the still image and you get burn-in over time. I have a couple of mood music videos with 8 hours length and basically a still image. Example: https://www.youtube.com/watch?v=hIkvQHk_sWM Not good. You also spend a lot of electricity for displaying the image, with audio only, the TV can shut down the video circuitry and use only a fraction of the power.

So, it’s better and also easy enough to strip the video if it’s just a filler.

2 Likes

One question to y’all who convert to mp3: Do you really need it in this format?

Reason I am asking is that YouTube now stores audio either in opus or in m4a format. You can check this with yt-dlp -F <URL> and look in the acodec column. There’s no mp3 on the YT servers, except maybe for very old files.

So downloading with yt-dlp -x --audio-format opus <URL> gives you the audio as YouTube has it, 1:1 bitcopy without another conversion. Any conversion to mp3 makes the quality worse, doesn’t matter if it’s at 320k or 192k.

Which devices out there cannot deal with the opus format?

3 Likes