LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1523|回复: 6

mplayer的音量控制!?

[复制链接]
发表于 2008-12-18 15:25:34 | 显示全部楼层 |阅读模式
我在/etc/rc.local中写上了mplayer,让机子每天开机自动播放音乐。但现在发现这种方式播放音乐的声音很大,100%的!可是登录后,再用mplayer播放音乐时,音量正常(平时的听惯音量)。所以我想能否在/etc/rc.local中加个什么参数,使得mplayer在没有登录的情况下也可以在70%或75%的音量中播放音乐??
谢谢!!
发表于 2008-12-18 21:00:40 | 显示全部楼层
  1. man mplayer
复制代码

参数很复杂,现在不在 Linux 下,你先看看,
  1. -volstep <0-100>
  2.     Set the step size of mixer volume changes in percent of the whole range (default: 3).
复制代码

是不是这个参数?
回复 支持 反对

使用道具 举报

发表于 2008-12-18 21:50:55 | 显示全部楼层
为什么不直接使用alsaconf等设置系统的默认音量,看是master还是PCM部分。
回复 支持 反对

使用道具 举报

发表于 2008-12-19 21:31:29 | 显示全部楼层
我是用usb声卡的,板载声卡故障,但是设备显示正常且不可屏蔽,幸亏有mplayer这个神器存在,让我可以用它强大的命令参数发声。
alsaconf没用的,命令行启动的mplayer貌似不受它控制。

在配置文件 ~/.mplayer/config
那加上
volume=30

就可以了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-21 22:29:57 | 显示全部楼层
回pingz,-volstep <0-100>这一参数像是设置每次调节音量的增加(或减少)量。
回motive,设置volume=30后也没有效果!

还好,现在终于知道怎么回事了!原来使用mplayer播放音乐默认用驱动oss,至于oss怎么不能控制音量就不知道了。使用 -ao alsa参数将驱动改为alsa就OK了。又或者正如motive所说的,在~/.mplayer/config 下加入:ao=alsa就行了!
回复 支持 反对

使用道具 举报

发表于 2008-12-22 01:56:32 | 显示全部楼层
你说的对,应该用  -af volume 。

用法是

  1. mplayer −af volume=10.1:0 media.avi
复制代码

单位是分贝,在默认值上加减音量。



  1. volume[=v[:sc]]
  2.        

  3. Implements software volume control. Use this filter with caution since it can reduce the signal to noise ratio of the sound. In most cases it is best to set the level for the PCM sound to max, leave this filter out and control the output level to your speakers with the master volume control of the mixer. In case your sound card has a digital PCM mixer instead of an analog one, and you hear distortion, use the MASTER mixer instead. If there is an external amplifier connected to the computer (this is almost always the case), the noise level can be minimized by adjusting the master level and the volume knob on the amplifier until the hissing noise in the background is gone.
  4. This filter has a second feature: It measures the overall maximum sound level and prints out that level when MPlayer exits. This volume estimate can be used for setting the sound level in MEncoder such that the maximum dynamic range is utilized.
  5. NOTE: This filter is not reentrant and can therefore only be enabled once for every audio stream.
  6.        

  7. <v>
  8.        

  9. Sets the desired gain in dB for all channels in the stream from −200dB to +60dB, where −200dB mutes the sound completely and +60dB equals a gain of 1000 (default: 0).
  10.        

  11. <sc>
  12.        

  13. Turns soft clipping on (1) or off (0). Soft-clipping can make the sound more smooth if very high volume levels are used. Enable this option if the dynamic range of the loudspeakers is very low.
  14. WARNING: This feature creates distortion and should be considered a last resort.
  15.        

  16. EXAMPLE:
  17.        

  18. mplayer −af volume=10.1:0 media.avi
  19.        

  20. Would amplify the sound by 10.1dB and hard-clip if the sound level is too high.
复制代码


http://www.mplayerhq.hu/DOCS/man ... tml#AUDIO%20FILTERS

复杂啊。
回复 支持 反对

使用道具 举报

发表于 2008-12-22 18:35:13 | 显示全部楼层
Post by songweiwen;1927601
回pingz,-volstep <0-100>这一参数像是设置每次调节音量的增加(或减少)量。
回motive,设置volume=30后也没有效果!

还好,现在终于知道怎么回事了!原来使用mplayer播放音乐默认用驱动oss,至于oss怎么不能控制音量就不知道了。使用 -ao alsa参数将驱动改为alsa就OK了。又或者正如motive所说的,在~/.mplayer/config 下加入:ao=alsa就行了!


是的,oss不行,man里面说了。
你可以自己再编译一遍mplayer,configure的时候指定用alsa。
我以前用ubuntu8.04的时候,apt来的mplayer和我的老本子不太和睦,还是自己编译来得合适。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表