If 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!
The 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.
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;
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.
This extension uses the ability that Chrome Extension API gives to block some URLs. So it blocks the video and keeps only the audio since the YouTube serves them in separate files
It 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.
In addition, since I am the creator of this extension I had a similar problem in the past. Chrome Web Store had rejected one version of my extension with the explanation that the adblocker function is irrelevant to the main purpose of the extension. I send them an email explaining that the adblocking function is crucial for my extension because the ads interfere with the extension and cause problems in its function. Google apologized and accepted the extension.
This is what the program policy for the extensions say:
"An extension must have a single purpose that is narrow and easy-to-understand. Do not create an extension that requires users to accept bundles of unrelated functionality. If two pieces of functionality are clearly separate, they should be put into two different extensions, and users should have the ability to install and uninstall them separately."
And thats the answer from Google:
"Hello Developer,
Thank you for reaching out to us. We apologize for the inconvenience caused in this matter. Upon a subsequent review, we found that your item with ID : “abbpaepbpakcpipajigmlpnhlnbennna” to be compliant with our “Single Use” policy. Unfortunately, we cannot approve a submission that has been rejected. Hence, we request you to re-submit your extension on the developer dashboard.
It 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.
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
Use yt-dlp and pass it the SponsorBlock flags to auto skip intro/outro/sponsor/non-music sections. I used to use this to pipe videos into cmus or MPV but now just let a browser with ublock/sponsorblock go in the background
The -x option will do that ONLY if no pure audio stream is available -- for youtube.com, this seems only to happen for live streams. More common on other sites. (Youtube-dl supports many different sites.)
I'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.
Youtube 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.
...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.
The 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.
Right. "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.
On 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.
I 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
There are two extensions in Firefox neither of which blocks the video. Music Mode for YouTube™ is the only extension that blocks the video entirely until now. These two extensions are Youtube Audio (https://addons.mozilla.org/en-US/firefox/addon/youtube-audio...) and Audio Only for YouTube™ (https://addons.mozilla.org/en-US/firefox/addon/audio-only-fo...). The second one is better and the one that recommend. Both have bugs and they do not block the video but they are better from nothing. I plan to create a version of Music Mode for YouTube™ for Firefox but, you know, it is difficult to spend a lot of time for things that you earn nothing.
No. 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
"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"
If 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!".
Ha 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
If 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.
IIRC 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.
Google provides renditions in two codec pairs for most video - vp9 + Opus and h.264 + AAC. Assuming the manifest for audio only keeps you using the same codec family of renditions, this should work just fine (minus, as you said, the player not showing anything until the next video+audio segment is fetched) as long as we're talking VOD content. Live content should also be able to switch from source to audio only with no re-fetch, but live transcoded renditions won't be in line with either rendition, so that'll cause a burp.
I feel like the YouTube Music app is actually changing to a totally different SKU when you switch between video/audio, and not just giving you the audio stream from the video.
I'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/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 :)
Music 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)
94 comments
[ 2.9 ms ] story [ 140 ms ] threadYou 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;
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.
API ... API ... API.
this is the way!
Thank you for reaching out to us. We apologize for the inconvenience caused in this matter. Upon a subsequent review, we found that your item with ID : “abbpaepbpakcpipajigmlpnhlnbennna” to be compliant with our “Single Use” policy. Unfortunately, we cannot approve a submission that has been rejected. Hence, we request you to re-submit your extension on the developer dashboard.
Thanks,
Chrome Web Store Developer Support."
Found one: 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:
251 webm audio only │ 139.66MiB 134k https │ opus 134k 48000Hz medium, webm_dash
and then use ffmpeg to reencode opus to mp3
(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.
On my phone, on mobile data at least, it takes ~5 seconds to display the video again.
[1] https://freetubeapp.io
https://addons.mozilla.org/en-US/firefox/addon/youtube-audio...
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.
FYI for those using Android, NewPipe also supports this.
This is probably a dumb question but why isn't this a Show HN?
It kind of should be, right?
> Show HN is for something you've made that other people can play with [...]
There have been plenty of Chrome extensions that are Show HNs: https://hn.algolia.com/?q=Chrome.google.com+Show+Hn
P.S. also if anyone knows how to statically compile ffmpeg or libvlc into go I'd love to know :)
I hadn't seen systray before. That's cool, too.