Best Way to Stream YouTube Audio Only?

dbdjre0143

macrumors 6502
Original poster
Nov 11, 2017
301
315
West Virginia
Frequently, I use YouTube to listen to sermons or podcasts, and when doing so, the video is often tucked behind a window while I do other things. There is no real reason to waste CPU cycles streaming the video when all I actually care about is the audio.

So, what is the best way to stream only the audio? I would prefer not to have to download or convert, as I don't want to store the files locally.

What I've tried:
  1. mps-youtube using "-a". I have a feeling I don't have something configured correctly, or I'm doing something wrong here. When I search then use "1 -a", which from my understanding should play the audio only for the first result, the video opens in mplayer like always.
  2. mplayer from smtube. This works. When I right click and "play audio with", it takes a bit of time at a bunch of CPU (~80% for ~30s on the most recent 30 minute video I used it with), but then the audio starts to play and CPU usage drops to around 8%. This has some issues though. First, there is no window open, so I see no way to control mplayer. Second, with my most recent play, it stopped (I presume crashed) about 25 minutes in. I'm guessing this is indicative of stability issues with this approach, and that is particularly annoying since I have no way to fast-forward back to where I was if I reopen it.
 

dbdjre0143

macrumors 6502
Original poster
Nov 11, 2017
301
315
West Virginia
Have you tried a minimized TenFiveTube (https://forums.macrumors.com/threads/tenfivetube-yet-another-youtube-option.2103937/)?

This seems like a situation where App Nap would be very useful to have, especially with our older machines...
Yes, that is my current approach. It works but still uses quite a bit more CPU than audio-only streaming. Well, I guess I don't usually actually minimize it; it's usually just in the background. Are you proposing that actually minimizing would do something to reduce its CPU usage? I assumed it would continue rendering the video in the background.
 

z970mp

macrumors 68020
Jun 2, 2017
2,062
1,654
ARM Computing
Yes, that is my current approach. It works but still uses quite a bit more CPU than audio-only streaming. Well, I guess I don't usually actually minimize it; it's usually just in the background. Are you proposing that actually minimizing would do something to reduce its CPU usage? I assumed it would continue rendering the video in the background.
Well, when an application is minimized, it turns into a tiny icon in the dock. If the system is smart (which I wouldn't put past older OS X releases), it will stop rendering the video because there's nothing to render to, thus theoretically leaving it audio-only.

Try it and see. Play a video, minimize it, and check Activity Monitor.
 

dbdjre0143

macrumors 6502
Original poster
Nov 11, 2017
301
315
West Virginia
Well, when an application is minimized, it turns into a tiny icon in the dock. If the system is smart (which I wouldn't put past older OS X releases), it will stop rendering the video because there's nothing to render to, thus theoretically leaving it audio-only.

Try it and see. Play a video, minimize it, and check Activity Monitor.
Haha, yep, I went to try it immediately after my first reply. With the window open, it uses about 60-65% of the CPU. Minimized, it uses a pretty static 50%. While an improvement, it is still way more than it should hopefully be for streaming audio-only.
 

z970mp

macrumors 68020
Jun 2, 2017
2,062
1,654
ARM Computing
OK, I just streamed a 720p video on my G5 (using WebKit), and when the window was minimized, CPU usage dropped by around 20%, from almost 100% to 80%.

Combine that with TenFiveTube, a lower resolution, and good system optimization, I think you're golden.

EDIT: Ah well, I've done all I can do. Though keep in mind that streaming anything is not an extensively easy task to do. I wouldn't say you're likely going to get <20%. That said, good luck.
 

dbdjre0143

macrumors 6502
Original poster
Nov 11, 2017
301
315
West Virginia
EDIT: Ah well, I've done all I can do. Though keep in mind that streaming anything is not an extensively easy task to do. I wouldn't say you're likely going to get <20%. That said, good luck.
Well in my initial test with smtube/mplayer, it was only using 8% while streaming, so I'd say that's at least close to the golden ticket if there's a way to control it and it doesn't have reliability issues (my sample size of 1 quitting prematurely isn't high enough to know if that is a consistent issue).
[doublepost=1551288744][/doublepost]Update: After some googling, I figured out that I could pass "-vo null" to mplayer to tell it to start without video output. Setting this as a possible player in smtube yet again works, and now does not have the initial lag/high CPU usage before settling down. The audio starts immediately with very low (~10%) CPU usage. However, it still does not display a window so that I can control it.

Further experimenting, I tried using "Open with" instead of "Open Audio With" on the above option, and interestingly it uses about twice as much CPU, so apparently smtube is doing something to get an audio-only stream when you select an audio option. In that case, it still did not open a window.

If there was just a way to force mplayer to open in a window, this would be solved...
 

z970mp

macrumors 68020
Jun 2, 2017
2,062
1,654
ARM Computing
Well in my initial test with smtube/mplayer, it was only using 8% while streaming, so I'd say that's at least close to the golden ticket if there's a way to control it and it doesn't have reliability issues (my sample size of 1 quitting prematurely isn't high enough to know if that is a consistent issue).
[doublepost=1551288744][/doublepost]Update: After some googling, I figured out that I could pass "-vo null" to mplayer to tell it to start without video output. Setting this as a possible player in smtube yet again works, and now does not have the initial lag/high CPU usage before settling down. The audio starts immediately with very low (~10%) CPU usage. However, it still does not display a window so that I can control it.
Whatever works for you...
 

dbdjre0143

macrumors 6502
Original poster
Nov 11, 2017
301
315
West Virginia
Make an edit to one of the scripts here to choose a Youtube audio format:

https://forums.macrumors.com/threads/new-youtube-player-downloader-even-for-g3.2031523/

The attached will play audio only.
Thanks @Dronecatcher! I still don't see how to control this though? In the terminal window that is open, using the mplayer keyboard shortcuts just tries to type, not control the player. Are you able to control the mplayer audio stream (pause, forward, reverse) once it starts?
[doublepost=1551298229][/doublepost]
I'm working on it....
Woops, sorry. Posted without refreshing so this post wasn't there yet. :)
 

Dronecatcher

macrumors 68040
Jun 17, 2014
3,156
2,615
Lincolnshire, UK
Woops, sorry. Posted without refreshing so this post wasn't there yet. :)
The knack is to load a blank video and play the audio over it - I've generated the empty video as per instructions here but following the playback routine just doesn't work - I miss out the subtitles bit obviously but was going to try this as a starting point - you might want to try yourself:

https://superuser.com/questions/1199846/play-audio-only-file-with-subtitles-possibly-use-some-still-image-as-stub

(set time lower and video size to qcif for a quicker result)
 

Dronecatcher

macrumors 68040
Jun 17, 2014
3,156
2,615
Lincolnshire, UK
Ok - done it, based on my Youtube player/downloader referenced before - archive attached and the script it contains is this:

youtube-dl -o "~/Movies/Youtube/download" -f 140 "$(pbpaste)"
/Applications/mplayer -really-quiet B.mov -audiofile ~/Movies/Youtube/download
rm ~/Movies/Youtube/download
killall Terminal

SO, from the archive put B.mov in your home folder and create the Youtube folder within Movies (or use you own locations and alter script accordingly).
Copy the Youtube clip address in normal way, run the Audio script (shortcut in dock) and a Terminal window will launch, after audio clip (m4a file) is downloaded it will play, playback options are volume (9 and 0), mute/unmute (m) and pause/play (space bar) only. When the audio ends the file will be deleted ready for the next one.
 

Attachments

Lastic

macrumors 6502a
Mar 19, 2016
744
560
North of the HellHole
Yes I saw your post when doing a search but I presume you have used Tigerbrew ?
I'm just trying with Python3.6 to install it , which it does but then I have to look for it deep down in /opt/Library/Frameworks/Python/Versions/3.6/bin/mpsyt and starting it there it throws a lot of Python error for which I'm too tired now.
 

Dronecatcher

macrumors 68040
Jun 17, 2014
3,156
2,615
Lincolnshire, UK
Yes I saw your post when doing a search but I presume you have used Tigerbrew ?
I'm just trying with Python3.6 to install it , which it does but then I have to look for it deep down in /opt/Library/Frameworks/Python/Versions/3.6/bin/mpsyt and starting it there it throws a lot of Python error for which I'm too tired now.
It's been a while but yes, it was problematic, could only get it working after doing a clean Leopard install.
 

Lastic

macrumors 6502a
Mar 19, 2016
744
560
North of the HellHole
@dbdjre0143 @Dronecatcher

I'm looking at porting mps-youtube to Macports but I just wanted to understand how did you guys install it
on Leopard since there is no Macports port nor a Tigerbrew formula ?

  1. Python 2 or Python 3 installed from where ?
  2. pip install mps-youtube ?
  3. downloaded the source and did python setup.py ?
 

Dronecatcher

macrumors 68040
Jun 17, 2014
3,156
2,615
Lincolnshire, UK
@dbdjre0143 @Dronecatcher

I'm looking at porting mps-youtube to Macports but I just wanted to understand how did you guys install it
on Leopard since there is no Macports port nor a Tigerbrew formula ?

  1. Python 2 or Python 3 installed from where ?
  2. pip install mps-youtube ?
  3. downloaded the source and did python setup.py ?
My memory's terrible, can't remember details but used these as reference:

https://forums.macrumors.com/threads/mpsyt-on-tiger.2127274/#post-26241772

https://www.ostechnix.com/mps-youtube-commandline-youtube-player-downloader/

I know I had problems with my existing Leopard and had to start clean.