Adjust audio volume level with CLI omxplayer - Raspberry Pi
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:
- 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 dmbels
- with DBUS interface, cmd 'set volume', value
double:XXX
, default 1, range [0:1]
xxx to yyy relation is: XXX = 10 ^ (YYY / 2000)
... according to omxplayer.cpp source code, reverse formula would be: YYY = 2000 * (log XXX)
.
so if we need:
- volume 1%, XXX=0.01 and YYY=-4000
(10^(-4000/2000)=10^-2=0.01
- volume 10%, XXX=0.1 and YYY=-2000
(10^(-2000/2000)=10^-1=0.1
- volume 50%, XXX=0.5 and YYY=-602
(10^(-602/2000))~=0.5
- volume 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%)
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
... both sets sound volume to 50%.
Enable VncServer 6.2.1 ARMv6 experimental capture mode by command line
I found the problem. I wasn't doing it right. I have to change the file in the root user and then restart the serviced. ;)
Edit the config file '/root/.vnc/config.d/vncserver-x11'
adding the following:
CaptureTech=raspi
ExperimentalRaspiCapture=1
ServerPreferredEncoding=JPEG
and then restarted:
sudo systemctl restart vncserver-x11-serviced
Related Topics
How to Sleep 10 Seconds Before Running a Linux Command
Surprise! The Shell Suggests Command Line Switches
Check If All Lines from One File Are Present Somewhere in Another File
Eclipse Doesn't Use The Path Set in .Bashrc
Hidden File .Env Not Copied Using Docker Copy
Command Line Arguments to Docker Run
Bash: Send Sigtstp Signal (Ctrl+Z)
Configure "-Prefix" Option for Cross Compiling
What Does an Asterisk at The End of a Mv Command Do
How to Find The List of Processes Using a Particular Kernel Module
How to Make Sure Only One Instance of a Bash Script Is Running at a Time
How to Measure Mispredictions for a Single Branch on Linux
Time Waste of Execv() and Fork()
Limit Top Command to Only Display Top X Processes on Command Line