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

Jim Cross jimgcross at gmail.com
Mon Sep 15 21:25:03 CEST 2014


I appreciate your time, efforts and patience in helping me with this issue.

The script and output were a small test to show how MPlayer is not able to
determine the home directory for lighttpd user www-data.

The problem or issue(s) (or bug) with this I believe is, MPlayer can not
find the users config file. This can be resolved by editing the
/etc/mplayer/mplayer.conf file to point to a config file (not ideal). The
second issue this appears to have, is with the fifio - mplayer does not
read the fifo (data stays in fifo and mplayer does not change volume for
example ) unless I run mplayer with sudo, then it appears to work OK.
Currenty, I use the following fifo:

-input file=/run/shm/mpcontrol

Even setting the perms so anyone can change the fifo as follows, doesn't
work:
'sudo chmod 777 /run/shm/mpcontrol'

Checking:
$ ls -al /run/shm/mpcontrol
prwxrwxrwx 1 www-data www-data 0 Sep 13 11:15 /run/shm/mpcontrol

I have tried changing owner of fifo to pi:pi and root:root with the same
response, i.e. does not read fifo unless mplayer is run with 'sudo'.


On Mon, Sep 15, 2014 at 5:51 PM, Tom Evans <tevans.uk at googlemail.com> wrote:

> 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"')
>   fp.close()
>
> 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.
>
> Cheers
>
> Tom
> _______________________________________________
> MPlayer-users mailing list
> MPlayer-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users
>


More information about the MPlayer-users mailing list