to provide more precise information for playing through scripts, there are 3 ways to change sound volume in current version of omxplayer, and values are not so intuitive:在启动命令行上,参数--vol YYY,双毫贝,默认0,范围[-6000:0]通过stdin界面,向omxplayer发送+/-将增加/减少300 dmbels的音量具有DBUS接口,cmd'设置音量',值double:XXX,默认值1,范围[0:1]on starting command line, param --vol YYY, double millibels, default 0, range [-6000:0]by stdin interface, sending +/- to omxplayer will increase/decrease volume for 300 dmbelswith DBUS interface, cmd 'set volume', value double:XXX, default 1, range [0:1] xxx与yyy的关系是:XXX = 10 ^ (YYY / 2000) ...根据 omxplayer.cpp 源代码,反向公式为:YYY = 2000 * (log XXX).xxx to yyy relation is: XXX = 10 ^ (YYY / 2000) ... according to omxplayer.cpp source code, reverse formula would be: YYY = 2000 * (log XXX).所以如果我们需要:体积1%,XXX = 0.01,YYY = -4000 (10^(-4000/2000)=10^-2=0.01体积10%,XXX = 0.1,YYY = -2000 (10^(-2000/2000)=10^-1=0.1体积50%,XXX = 0.5和YYY = -602 (10^(-602/2000))~=0.5音量100%,XXX = 1,YYY = 0 (10^(0/2000)=10^0=1)音量150%,XXX = 1.5,YYY = 352 ...(对于增强测试,正常值为< = 100%)volume 1%, XXX=0.01 and YYY=-4000 (10^(-4000/2000)=10^-2=0.01volume 10%, XXX=0.1 and YYY=-2000 (10^(-2000/2000)=10^-1=0.1volume 50%, XXX=0.5 and YYY=-602 (10^(-602/2000))~=0.5volume 100%, XXX=1 and YYY=0 (10^(0/2000)=10^0=1)volume 150%, XXX=1.5 and YYY=352 ... (for boost test, normal values are <=100%) dbus音量命令的有效bash脚本:working bash script for dbus volume command:export DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/omxplayerdbus.${USER:-root})dbus-send --print-reply --session --reply-timeout=500 \ --dest=org.mpris.MediaPlayer2.omxplayer \ /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set \ string:"org.mpris.MediaPlayer2.Player" \ string:"Volume" double:0.5 # <-- XXX=0.5 (50% sound volume)等于启动时的音量参数:equals to volume parameter at startup:omxplayer --vol -602 mediaFileName.mp4 ...两者都将音量设置为50%.... both sets sound volume to 50%. 这篇关于使用CLI omxplayer调整音频音量-Raspberry Pi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-31 10:17