5 ms·
For a while I had expensive internet and low bandwidth, but I loved listening to music and lectures on YouTube. At some point I realized that getting only the a
by andai 2y ago
For a while I had expensive internet and low bandwidth, but I loved listening to music and lectures on YouTube. At some point I realized that getting only the audio stream would save me 90% in bandwidth costs. [0]
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...
- 01HNNWZ0MV43FF 2y agoI think it's -x to just rip audio now
- TechDebtDevin 2y agoBrave Mobile browser allows turning on background video audio thus eliminating the need for YouTube Premium and similar subscriptions.
- BiteCode_dev 2y agoNew Pipe X if you need a full client does that as well.
- l3x4ur1n 2y agoI don't know why your comment is downvoted because I use this feature of Brave very often and I also exclusively watch YT in Brave mobile (no ads).
- gaudystead 2y agoFor me, it was as easy as adding a shortcut to the YouTube homepage on Brave that it basically acts like the YouTube app, but with ad blocking built in. It's the only way I watch YT videos on mobile.
- TechDebtDevin 2y agoThere are a lot of people that don't like Brave's business model. But I've never given Brave a dime and turn off their ad network stuff and they've saved me hundreds of dollars on Youtube Premium over the years.
- cocok 2y agoFor Firefox: https://github.com/mozilla/video-bg-play https://github.com/mozilla/video-bg-play
- bonestamp2 2y agoThis works great, thank you. For others: Settings > Media > Enable Background Audio
- ww520 2y agoThat’s the -F option to list all the formats, including the audio streams. Pick the audio format with -f to download the audio. I usually pick the .m4a format and then run it through ffmpeg to convert to mp3.
- KMnO4 2y agoWhat’s the point of converting it to mp3? AAC inside an m4a container usually has better sound quality than similarly compressed mp3, and definitely better than reencoding.
- userbinator 2y agoMP3 is accepted by far more players.
- hollandheese 2y agoBut why not just download the mp3 then?
- Almondsetat 2y agoFrom where?
- raffraffraff 2y agoI think the point here is that you can run `yt-dlp --extract-audio --audio-format mp3` instead of saving as .m4a (a lossy compression) and then covering that to .mp3 (another very different lossy compression). 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.
- Synaesthesia 2y agoBTW if you browse YouTube with Firefox browser on Android you can play back YouTube videos with the screen locked using background player fix extension.
- tirpen 2y agoThat works fine without any extensions at all, so I'm unsure what does the extension even does?
- Liquid_Fire 2y agoYouTube deliberately tries to prevent background playback by using web APIs to detect when the page is no longer visible and pausing the video. The extension prevents YouTube from doing that.
- kevin_thibedeau 2y agoOr just switch FFA to desktop mode.
- 6yyyyyy 2y agoNewPipe can do this very nicely, it even lets you build a playlist of videos.
- wutwutwat 2y agoA service that takes arbitrary user input and then attempts to download/proxy whatever is at the end of that input. Brave soul.
- khimaros 2y agoon Android YTDLnis solves this very nicely. simply share the video URL to the app and it can download whichever format you like https://github.com/deniscerri/ytdlnis https://github.com/deniscerri/ytdlnis
- cquintana92 2y agoOne of my last weekend projects was something similar: convert youtube playlists into podcast-compstible URLs: https://github.com/cquintana92/yt2pc https://github.com/cquintana92/yt2pc
- dredmorbius 2y agompv similarly has this option. I listen to far more videos than I watch. <https://mpv.io/ https://mpv.io/>
- Gormo 2y agoMPV is just passing the stream selection arguments over to youtube-dl/yt-dlp.
- dredmorbius 2y agoSure, and you can set that directly in your mpv config: 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.
- Gormo 2y agoYup, it's pretty great. 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.
- dredmorbius 2y agoAnd yup back at'chya. 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).
- EasyMark 2y agoJust switching tabs will dramatically lower energy usage without using any scripts. I assume the YouTube video player may download and just drop the video information if not showing it, no need to render decrypt the video stream.
- lights0123 2y agoYouTube doesn’t encrypt the media stream other than TLS. Decoding the video can be skipped though.
- hot_gril 2y agoSeems like youtube-dl doesn't work anymore. I had to use a fork yt-dlp. Always makes me nervous hopping from one project to another like that, but seems like it's commonly used at least.
- TowerTall 2y agoI am using the GUI version on windows https://oleksis.github.io/youtube-dl-gui/ https://oleksis.github.io/youtube-dl-gui/
- andai 2y agoYeah, yt-dlp is the successor. I've been using it for years.
- shiroiushi 2y agoyoutube-dl has been dead for many years now; it's a lot like XFree86, where the original project is a zombie with very few real users, but the original maintainers refuse to acknowledge reality and just shutter the thing, so newcomers get confused. Everyone's moved to yt-dlp now.
- RGamma 2y agoThe author(s) got into legal trouble. https://youtube-dl.org https://youtube-dl.org > Due to a ruling of the Hamburg Regional Court, access to this website is blocked. https://openjur.de/u/2466945.html https://openjur.de/u/2466945.html
- shiroiushi 2y agoFor providing a tool that lets people download YT videos? The same should apply to yt-dlp, but that project is hosted on github.com with no apparent problems. What's stopping the youtube-dl people from doing the same and just ignoring this silly court ruling?
- RGamma 2y ago
- soheil 2y agoI often choose 144p for low bandwidth scenarios. It is very similar to a good quality audio-only stream in terms of size, but you get the added benefit of looking at the speaker even if that's a glance every 45 mins. Same for battery life, you save that too. 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.
- dgan 2y agoMe too, i don't enjoy observing people's pimples on the nose
- Karrot_Kream 2y agoWhen I use NNCP [1] on flights to download Youtube videos, the script I wrote to nncp-exec the download accepts a quality friendly name. I have a specific friendly name which gets the lowest quality video and mid-tier audio. These settings usually result in a pretty enjoyable experience and offer plenty of entertainment even on a longer flight. [1]: http://www.nncpgo.org/ http://www.nncpgo.org/
- entropie 2y ago> It's no longer online and I lost the code, but it was like one line of code. 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/d265e94136b9777cc6b3190189b30050 https://gist.github.com/entropie/d265e94136b9777cc6b3190189b...
- doruk101 2y agoYou can glitch out Safari on IOS -by quickly pressing the play button for the video in the now playing interface after switching off from the Safari app- to play the audio of Youtube videos on the background. 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".
- ambiguousninja 2y agoInteresting, I don't use premium but is there a reason membership only videos don't support background audio? Seems like a weird exclusion