For others: Settings > Media > Enable Background Audio
--extract-audio
--format bestaudio
--audio-format mp3
> Some people don't want [...] mp3
Under the hood, there's probably an additional lossy conversion. I'm not sure if YouTube converts uploaded videos to specific formats but if they do, then the worst case scenario is:
- original uploaded video uses .ogg audio
- YouTube converts that to opus and puts it into a container format (wbem?)
- You download the video and extract the audio to .m4a using yt-dlp
- and then you convert that to .mp3 using ffmpeg
That's 4 consecutive lossy formats, each one throwing away different data.
Honestly the best thing to do here is use yt-dlp to download whatever format YouTube provides and use ffprobe to find out what audio format is already there. Then do one conversation if required.
Or when you keep using an old mp3 player from the early 2000's.
ytdl-format=bestaudio[ext=m4a]/bestaudio[ext=webm]/bestaudio
vo=null
The advantage is that you're setting this for a utility which can play media directly (e.g., you don't have to separately download and then play content), and that you can set preferences independently for mpv vs. other tools.You can also of course configure your own aliases, shell functions, shell scripts, or config files for various preferred configurations, whether using mpv, ytdl, or other tools.
It's worth noting, though, that ytdl can output video content to stdout, so it is possible to stream video by piping to any player, although mpv's method is much more convenient.
Sometimes it is necessary to download files regardless, though, due to DASH separating audio and video into distinct files. You often need to remux them with a container like MP4, AVI, or Matroska in order to use them locally.
mpv's bonus is convenience, and the fact that it will seamlessly play much of what you throw at it, whether that's local files, network resources, web sites, etc. Much of that majyck is in fact ytdl/yt-download, but having a standard interface is quite handy.
And yes, I've run into streams that need mixing, which ytdl/yt-download can handle; you point it at both the video and audio sources, typically. (I do this infrequently, thankfully).
> Due to a ruling of the Hamburg Regional Court, access to this website is blocked.
What's stopping them? Dunno, (the threat of) police showing up at the door? Shitty pop songs are not worth going to prison for.
Also 144p is somehow so peaceful and relaxing to watch, you don't get distracted with all the shiny colors and intricate details in the video and can just listen and not have your mind focus on some random stuff.
My mom is really into audiobooks and I made telegram bot for her via node-red where she can share youtube links. The links are sent to a fifo where a little daemon (1) downdloads them sequential and saves them into an incoming folder I setup for this special purpose. The bot can either download only audio (for her telegram ID its only audio) or complete videos.
This folder is watched by jellyfin which she can access to download or listen. She loves it and in two years she downloaded way over a TB of audiobooks.
1: https://gist.github.com/entropie/d265e94136b9777cc6b3190189b...
I mainly use this to play membership only videos that don't play in the background even if you have a Youtube Premium.
Every IOS version I pray that they don't patch this "glitch".
youtube-dl (and yt-dlp) has a flag, I believe -G, which gives you the URL(s) for the requested format/quality. I used the command line on my computer and put the link in VLC. On my phone I had this elaborate workaround involving downloading the file to my VPS first over SSH, then downloading it to my phone, until I realized my phone browser can consume the URL directly, so I set up a PHP frontend for `youtube-dl -G -f bestaudio {url}`
It's no longer online and I lost the code, but it was like one line of code.
I mention this because you-get seems to support the same usecase (via --url / -u), so I wanted to let people know how useful this is!
(While it was online I shared it on some forums and got very positive feedback, people used it for audiobooks etc.)
[0] Also playing with screen off saves 80% battery life! YouTube knows these facts and that's why they made background playback (which fetches only audio stream) a paid feature...