本文介绍了MPlayer –在mplayer.conf中更改"ao ="编解码器顺序似乎不适用于每个用户配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引用mplayer.conf:
配置文件是从/etc/mplayer/mplayer.conf
在系统范围内读取的 和〜/.mplayer/config中的每个用户,其中每个用户的设置会覆盖
系统范围的设置,所有这些设置都将被命令行覆盖."

但是,更改音频编解码器的顺序以使"alsa"在用户配置文件中排在第一位似乎无效.

Quoting mplayer.conf:
" Configuration files are read system-wide from /etc/mplayer/mplayer.conf
and per user from ~/.mplayer/config, where per-user settings override
system-wide settings, all of which are overrriden by the command line."

However, changing the order of audio codec so that 'alsa' is first in user config file does not appear to work.

我的偏好是将/etc/mplayer/mplayer.conf文件保持不变,并在〜/.mplayer/config中更改mplayer.conf文件

My preference is to leave the /etc/mplayer/mplayer.conf file as is and make changes to the mplayer.conf file in ~/.mplayer/config

使用以下行:'ao = alsa,pulse,sdl:aalib'仅可在/etc/mplayer conf文件中使用,因此不会被按用户"设置覆盖.

Using the following line: 'ao=alsa,pulse,sdl:aalib' only works in the /etc/mplayer conf file and therefore don't appear to be overridden by the 'per-user' settings.

此外,我也不希望使用'-ao alsa'选项启动mplayer ...

Also, I would prefer not to start mplayer with the '-ao alsa' option either...

是否有任何关于错误"或功能请求"的想法,或者我错过了什么?

Any thoughts on if this is a 'bug' or 'feature request' or have I missed something?

编辑-添加了正在播放mp3的消息,并返回以下警告:"AO:[脉冲]初始化失败:连接被拒绝无法初始化音频驱动程序"pulse"AO:[alsa] 44100Hz 1通道浮点数(每个样本4个字节)视频:无视频开始播放..."

Edit - adding that playing an mp3, the following warning is returned:"AO: [pulse] Init failed: Connection refusedFailed to initialize audio driver 'pulse'AO: [alsa] 44100Hz 1ch floatle (4 bytes per sample)Video: no videoStarting playback..."

已修复
MPlayer查找环境变量"HOME",以确定在何处查找用户mplayer配置文件.默认情况下,诸如lighttpd之类的用于运行反过来又运行mplayer的脚本的应用程序不会设置'HOME'环境变量.有人可能会说,MPlayer仅在查找环境值"HOME"而不是更可靠的机制来确定用户的"home"目录时存在局限性.

FIXED
MPlayer looks for the environment variable 'HOME' to determine where to look for the users mplayer config file.Apps such as lighttpd used to run scripts that in turn run mplayer do not by default set the 'HOME' environment variable.One could argue and say there is a limitation with MPlayer only looking for an environment value 'HOME' rather than a more robust mechanism to determine a users 'home' directory....

使用'env HOME =/var/www'运行MPlayer将帮助MPlayer定位用户的配置文件,而无需编辑/etc/mplayer/mplayer.conf.这也解决了使用sudo运行MPlayer的需要:

Running MPlayer with 'env HOME=/var/www' will help MPlayer locate the users config file without having to edit /etc/mplayer/mplayer.conf. This also fixes the need to run MPlayer with sudo:

作为示例,以下指令在从连接到树莓派上的lightpd Web服务器的远程浏览器调用的python脚本中起作用:playing_mplayer = subprocess.Popen(['env','HOME =/var/www','mplayer','-slave','-nocache','-quiet','-volume','60','- key-fifo-size","2",-input","file =/run/shm/mpcontrol",-playlist"," http://tx.whatson.com/icecast.php?i=magic1054.mp3.m3u '],stdout = subprocess.PIPE, stdin = subprocess.PIPE,stderr = subprocess.STDOUT)

As an example, the following instruction works in a python script called from a remote browser connecting to lightpd web server on a raspberry pi:playing_mplayer=subprocess.Popen(['env', 'HOME=/var/www', 'mplayer', '-slave', '-nocache', '-quiet', '-volume', '60', '-key-fifo-size', '2', '-input', 'file=/run/shm/mpcontrol', '-playlist', 'http://tx.whatson.com/icecast.php?i=magic1054.mp3.m3u' ], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)

推荐答案

在与MPlayer讨论了一些不错的问题之后,我修改了我的案例,因此有了一个附加的答案,但与lighttpd(lighty)有关-并非如此.在标题中,因此如果有人正在寻找解决类似问题的方法,可能会被遗漏.

After discussions with the nice chaps over at MPlayer, I have revised my case and therefore have an additional answer but is related to lighttpd (lighty) - which is not in the title and therefore may get missed if anyone is looking for a solution to a similar issue.

其他答案:
如前所述,MPlayer要求环境变量'HOME'显示'home'目录所在的位置,其中包含子目录'.mplayer'-这是用户MPlayers'config'文件的位置.
事实证明,也可以使用环境变量'MPLAYER_HOME'.
如果使用"MPLAYER_HOME",则将需要完整目录,即"env MPLAYER_HOME =/var/www/.mplayer".

Additional answer:
As mentioned, MPlayer requires the environment variable 'HOME' showing where 'home' directory is, which contains the sub dir '.mplayer' - this being the location of the users MPlayers 'config' file.
It also turns out, the environment variable 'MPLAYER_HOME' can be used instead.
If 'MPLAYER_HOME' is used, the full directory will be required, i.e. 'env MPLAYER_HOME=/var/www/.mplayer'.

所以,回到我的情况,轻松一点.显然,使用"MPLAYER_HOME"变量比使用"HOME"变量更好,后者可以通过Web服务器进行破坏.
将以下两个条目添加到/etc/lighttpd/lighttpd.conf:

So, back to my case and lighty. Obviously better to use 'MPLAYER_HOME' variable rather than 'HOME' which can be compromised via the web server.
Add the following two entries to /etc/lighttpd/lighttpd.conf:

在server.modules部分中添加以下模块:"mod_setenv"

Add the following module to the server.modules section: "mod_setenv"

然后将以下环境变量添加到"CGI"模块:setenv.add-environment =("MPLAYER_HOME" =>"/var/www/.mplayer")
重新启动lighty以读取对配置的添加.现在,"lighty"将传递env var"MPLAYER_HOME",以获取任何运行脚本的指令.仅出于完整性考虑,运行mplayer时,python脚本不再需要为设置'env'选项添加前缀.

And the following env var to the 'CGI' module: setenv.add-environment = ("MPLAYER_HOME" => "/var/www/.mplayer")
Restart lighty to read additions to config. 'lighty' now passes the env var 'MPLAYER_HOME' for any instruction to run scripts.Just for completeness, the python script no longer needs to prefix setting the 'env' option when running mplayer.

这篇关于MPlayer –在mplayer.conf中更改"ao ="编解码器顺序似乎不适用于每个用户配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 21:29