9 ms·
Play audio only on YouTube and save bandwidth
- graderjs 5y agoThe ability to just play music and save bandwidth is a wonderful thing. This is probably a dumb question but why isn't this a Show HN? It kind of should be, right?
- bussierem 5y agoFrom the Show HN rules: > Show HN is for something you've made that other people can play with [...]
- graderjs 5y agoI don't think that's an accurate interpretation of the rules. There have been plenty of Chrome extensions that are Show HNs: https://hn.algolia.com/?q=Chrome.google.com+Show+Hn https://hn.algolia.com/?q=Chrome.google.com+Show+Hn
- thunderarea 5y ago"play" in this case does not imply that the product should be game or something like that but something that the user can interact with. From the Show HN rules: "On topic: things people can run on their computers or hold in their hands. For hardware, you can post a video or detailed article. For books, a sample chapter is ok"
- thunderarea 5y agoYou cannot play with a chapter of a book but it is acceptable. So, the "play" does not used with its exact meaning
- thunderarea 5y agoThanks a lot graderjs. I don't know very well Hacker News. After I made this post I discovered the Show HN. I prepare a post for it. Thanks
- pornel 5y agoCould YouTube automatically omit video stream when the tab is in the background? DOM has visibilitychange/pagehide events.
- londons_explore 5y agoIf anyone in youtube management is aware of these events, they'll use them to make the playback automatically pause when the page is in the background and pop up a big message saying "Buy Youtube Premium to listen to your music while you do other things. First month half price!".
- deleted 5y ago[deleted]
- thunderarea 5y agoHa ha ha. I think that they know them. But in desktop there are many ways to change it with extensions or even browsers other than Chrome. So they don't give it a try
- thunderarea 5y agoIt could. But it does not do it :)
- manwe150 5y agoIf you have ever switched resolutions manually in the browser, you will notice that it takes a while to rebuffer and decode the stream. I would guess it would be hard to do this in a glitch-free way. The YouTube Music app has a button to toggle it, and it exhibits just this lag.
- kevincox 5y agoIIRC the audio is the same for all formats, so this shouldn't be an issue. You just continue playing what you have and stop downloading new video chunks. I think the biggest problem is that when you switch to the tab you would need to wait a bit for the video to appear (or it would need to pause and stutter). That is actually quite a hard problem as well because the player needs to decide how far into the future it should start fetching video.
- thunderarea 5y agoIf you have a slow connection, or you want to hide NSFW content on YouTube there is Music Mode for YouTube™ a Chrome extension that blocks the video and plays only the audio on YouTube and YouTube Music. Additionally, it skips the ads and hides the thumbnails (optional). So, you can convert YouTube into a music player. It helps you a lot to save bandwidth while you work or play games listening to music on the background and also reduce the use of RAM, CPU and GPU since there is no video. Finally, it helps you focus on your work and spend less time on YouTube clicking on clickbait thumbnails. Give it a try!
- rjsw 5y agoThe Android API for YouTube provides access to audio only streams, you can see this if you use yt-dlp with the -F option to list all the available formats for a video.
- thunderarea 5y agoYes of course. But it is not permitted by the API policy
- thunderarea 5y agohttps://developers.google.com/youtube/terms/developer-policies https://developers.google.com/youtube/terms/developer-polici... You and your API Clients must not, and must not encourage, enable, or require others to: ... separate, isolate, or modify the audio or video components of any YouTube audiovisual content made available as part of, or in connection with, YouTube API Services. For example, you must not apply alternate audio tracks to videos;
- hansel_der 5y agoyea, if wishes were horses ... we are talking about files on a public webserver, it's absolutely fair game to download and modify/recombine the bit's in those files however i please.
- 5y ago
- cft 5y agoThis is going to be removed by Google soon: they want you to view the YouTube ads
- chrisseaton 5y agoBut their own app includes an audio-only mode.
- cinntaile 5y agoIf you pay you can get audio only, I don't think you can get it without paying?
- ganzuul 5y agoIt seems you can on Android. Just close the video and start playback from the drop-down notification. I get audio only but I don't remember if I did that before I started paying for YT.
- thunderarea 5y agoNo. This is one of the main features of the Premium YouTube
- Macha 5y agoAs a paid feature.
- vhsdev 5y agoyoutube-dl -x --audio-format mp3 https://youtu.be/k3WkJq478To https://youtu.be/k3WkJq478To
- youngNed 5y agoOh - slight typo in that, try this: youtube-dl -x --audio-format mp3 https://youtu.be/dQw4w9WgXcQ
- Retr0id 5y agoThe transcode to mp3 is lossy. I just use `-f bestaudio` and call it a day.
- brnt 5y agoAren't all formats available on yt lossy transcodes?
- Retr0id 5y agoUsually, but there's no use in adding an extra layer of transcoding (I've never seen yt offer mp3 directly)
- alternatetwo 5y agoIt did once, over 10 years ago (in 2008 or so, with the whole fmt=18 arguments etc), if your total video bitrate was below 320 kbps, it left the audio untouched ... I wonder if those videos from back then are still around and if yes, still have untouched audio. Found one: https://www.youtube.com/watch?v=AavrI7RLU0g https://www.youtube.com/watch?v=AavrI7RLU0g Of course now it only has 96kbps aac, but it did have untouched mp3 audio back then. And another update, I downloaded it back in 2013, where it still had 160kbps mp3 audio! Note after formatting: As you can see from the video FPS, the trick was to keep the video bitrate as low as possible, by using a still image (or pad it with black + silence at the end). I'm not sure anymore if you had to also already use the same video codec as youtube did back then, i.e., if the video stayed untouched too. I never managed to upload a video like this, so I don't exactly know. MediaInfo output: General Complete name : Luke Warner and Mat Lock - Deep Psychosis (Daniel Kandi's Cure mix) (HQ).flv Format : Flash Video File size : 12.7 MiB Duration : 7 min 34 s Overall bit rate mode : Variable Overall bit rate : 234 kb/s httphostheader : r13---sn-4g57knek.c.youtube.com Video Format : Sorenson Spark Codec ID : 2 Duration : 7 min 34 s Bit rate : 69.5 kb/s Width : 480 pixels Height : 360 pixels Display aspect ratio : 4:3 Frame rate mode : Constant Frame rate : 1.044 FPS Bit depth : 8 bits Bits/(Pixel\*Frame) : 0.385 Stream size : 3.76 MiB (30%) Audio Format : MPEG Audio Format version : Version 1 Format profile : Layer 3 Format settings : Joint stereo / MS Stereo Codec ID : 2 Codec ID/Hint : MP3 Duration : 7 min 34 s Bit rate mode : Variable Bit rate : 160 kb/s Channel(s) : 2 channels Sampling rate : 44.1 kHz Compression mode : Lossy Delay relative to video : -131 ms Stream size : 8.68 MiB (68%) Writing library : LAME3.97
- frizlab 5y agoIf only there were service to listen to music only…
- thunderarea 5y agowhy? What is the difference?
- Jaruzel 5y agoI'm not condoning this extension at all, but it has a skip adverts option built in, which means you can play endless hours of ad-free music, for free. Unlike almost all of the other [legal] online music streamers.
- galuggus 5y agoVery nice. Does anyone know how this works? I'm currently embedding a tiny player on a site I just made www.ridd.im
- dotancohen 5y agoYoutube serves the audio and video in separate streams. Presumably this extension just blocks the video stream.
- ajsnigrutin 5y agoYoutube has separate audio and video streams to save on bandwidth (you can find them all by using youtube-dl or yt-dl with the "-F" option)... this probably just downloads the audio stream.
- thunderarea 5y agoYes. The extension block the video URLs and keeps only the audio ones that sets them as source in the video
- mdp2021 5y ago...In case, as a compromise, one could always set the video rate at 144 rows - taking roughly one twentieth (to even one thirtieth) of the bandwidth of a 720 rows - from the original YT interface. (Video at 144p can take as little as 2 kilobytes/second to download (for more static content); typical 720p can easily take 100 kilobytes/second. You can see those values using "-F / --list-formats" on the downloader command.) But surely there is also the ability to stream good ("-f 140", ~128kbit/s m4a) audio piping from downloaders.
- danadam 5y agoThe youtube player keeps using codec 251 for audio (opus, about 120 kbps) until quality 240p. For 144p it switches to codec 250 (opus, about 60 kbps). At least here, on firefox on linux.
- rrll22 5y agoSame, I'm aware of this, but unless you can hear the difference between 120kbps and 60kbps 144p is worth its efficiency
- wishinghand 5y agoUnless it's just speech, most people can. Even then the low level noise can make a podcast tiring to listen to.
- panki27 5y agoInvidious also supports "audio only" mode, either by clicking on a little headset icon or by appending `&listen=1`
- unixhero 5y agoYouTube Vanced does this for me in Android when playing in the background. That is my Spotify basically :)
- thunderarea 5y agoAre you sure that it blocks the video? I think that just plays the video in the background
- jgtrosh 5y agoI assume YouTube Vanced does the same as NewPipe which only fetches the audio in background mode
- thunderarea 5y agoRight. "NewPipe does not use the official YouTube API, but instead scrapes the website for video and meta-data such as likes, dislikes, and views.". So it can do it. If they used the YouTube API this would not permitted.
- mhh__ 5y agoOn my phone at least there is an audible gap if you close the phone with the app playing, which doesn't happen with anything else. My guess is that it's fiddling with something in the background to only fetch audio instead of video.
- thunderarea 5y agosure
- SuperCuber 5y agoI always assumed this was because they are switching from builtin app code to their override for the feature... I tried opening a video and locking immediately and it seems like it saturates the download speed until the video is buffered X seconds to the future. Another piece of evidence against it is that when unlocking, it immmediately shows the video: it would need to buffer if only the audio was loaded
- brnt 5y agoFreetube [1] also let's you default to audio streams. [1] https://freetubeapp.io https://freetubeapp.io
- LordHeini 5y agoThere is a Firefox extension doing the same: https://addons.mozilla.org/en-US/firefox/addon/youtube-audio/ https://addons.mozilla.org/en-US/firefox/addon/youtube-audio...
- thunderarea 5y agoSorry but it does not do the same. It does not block the video. The video is downloaded but it does not used
- LordHeini 5y agoLooking at the plugins source it seems you are right. The video just gets replaced by the plugins text. I am not sure if this would even save much battery if running in a tab.
- thunderarea 5y agoNo. The extension is not fake. It changes the video source with the audio file URL but it does not blocks the video. The video file is downloaded but it is never used. That's what I said
- deleted 5y ago[deleted]
- thunderarea 5y agoYou can check in the dev tools that when you use audio only extension the video files are downloaded normally. So, it does not save so much bandwidth
- thunderarea 5y agoBut it is a good alternative for Firefox since Music Mode for YouTube is currently only for Chrome
- 5y ago
- DarylZero 5y agoNice. FYI for those using Android, NewPipe also supports this.
- naomeux 5y agoThis would be categorized into Show HN
- thunderarea 5y agoNow that I know that there is the Show HN I will post it also there
- asimpson 5y agoI've been working on a small Go program to do this specifically for the lofi hip hop beats youtube stream (file here: https://git.sr.ht/~asimpson/lofibar/tree/exec-ffmpeg/item/main.go https://git.sr.ht/~asimpson/lofibar/tree/exec-ffmpeg/item/ma...). You can pretty easily parse the Youtube page to get the HLS stream and pass that to ffmpeg. No need to even have the overhead of another browser tab then. P.S. also if anyone knows how to statically compile ffmpeg or libvlc into go I'd love to know :)
- lkxijlewlf 5y agoNice. I hadn't seen systray before. That's cool, too.
- NabiDev 5y agohttps://greasyfork.org/en/scripts/372074-youtube-audio-mode https://greasyfork.org/en/scripts/372074-youtube-audio-mode
- thunderarea 5y agoAs it says it does not load the video. But it downloads it. This file is from the Audio only YouTube extension
- thunderarea 5y agoMusic Mode for YouTube is the only browser extension that blocks the video. All the other extensions they don't use the video but the video is downloaded. You can check this in the dev tools and specifically in the network panel where you can see all the files that are downloaded (or not)
- dicknuckle 5y agoI wish there was an app for this in 2010-ish. Would have saved me so much cell data.