[MPlayer-users] MPlayer – changing ‘ao=’ codec order in mplayer.conf does not appear to work for per user config?

Tom Evans tevans.uk at googlemail.com
Mon Sep 15 18:51:19 CEST 2014

On Mon, Sep 15, 2014 at 12:52 PM, Jim Cross <jimgcross at gmail.com> wrote:
> Thanks for the details Tom and I agree on all points

You "agree on all points", but still have mplayer being launched from
your web server... this implies to me that you haven't understood what
I was suggesting.

Start mplayer in idle, slave mode with a FIFO to read commands from
(mplayer -slave -idle -input=/path/to/fifo. This is separate from your
web server. Use your python scripts to write commands to the FIFO, eg:

  fp = open(FIFO_LOCATION, 'w')
  fp.write('loadfile "/var/www/clockAudio/UKFemail/09.mp3"')

If you launch mplayer from your python script, your python script has
to hang around the whole time that mplayer is operating. If your
python script is invoked from a web request, this means that your
mplayer process will only exist while the request does. This is why it
is easier to run mplayer from outside the web server.

Having said all that, you have now actually included your mplayer
output, and I'm finding it hard to see what you think is going wrong.
Your version of mplayer is ancient (its 2014 now), and you seem to
have built it against a different version of libavcodec than you are
running it against, but despite all that, and despite the "Cannot find
HOME directory" message, it is playing the MP3 file you told it to, so
what is the problem?

The "Cannot find HOME directory is occurring because you do not have
the environment variable HOME set, which has been said before... using
os.path.expanduser to "verify" that HOME is set in the environment is
erroneous because os.path.expanduser does not rely solely on that
environment variable, if it is not set it will look up the current uid
in /etc/passwd.

After "Starting playback..." there are no more newlines (or not many),
this is the start of mplayer's "status line" output, which is
statistics printed with a line feed "\r" to clear the previous line,
so line buffered IO won't work great after that point as it is one
long line until EOF is reached.

Your code currently seems to stop reading from mplayer's stdout once
"Starting playback is reached"; mplayer still outputs things to
stdout, if the unread amount reaches the size of whatever buffer
python is using, then mplayer will block writing data to stdout and
stop doing anything else until it is unblocked.



More information about the MPlayer-users mailing list