MacOS – How to fix freezing mplayer on Mac for music play

macosmplayermusic

I want to play music on a MacBook Air (10.14.6) with mplayer on the command line. But sometimes when I load a page in a browser, the music briefly stops, and then continues. Sometimes even for some seconds. This is very annoying. I want to listen to the music continuously (while using a browser!).

I have tried to run the following command:

sudo nice -n -20 mplayer -shuffle Music/...

Is there anything else I can try?
Maybe there is a better command line tool?

Best Answer

Your browser may be at fault for consuming excessive system resources. Try switching to Safari and don’t run Chrome or Firefox at all for a while and see if the glitches persist or go away.

UPDATE:

Since you’ve confirmed that your browser is at fault, here are a few routes we can take.

  1. Obvious first step: Make sure you’re on the most recent build of Firefox and mplayer in case there have been bug fixes or performance enhancements made. You can also try updating to a more recent macOS for similar reasons. (Big Sur is not recommended, though.)
  2. We can try to do a deep dive and start doing DTrace profiling of Firefox and mplayer, possibly uncovering bugs in one or the other (or in other parts of the OS).
  3. You could try switching to a different music player (e.g., try the default Music.app for a bit and see if it’s better-behaved) in case there’s a specific resource contention between browser and mplayer.
  4. Depending on how much free RAM you have and how big your music library is, you could copy (a part of) your library to a RAM disk and stream from there. This would help if the bottleneck is I/O.