VLC setting volume from command line/bash [closed]

…衆ロ難τιáo~ 提交于 2021-01-27 02:26:36

问题


With the risk of feeling really really stupid here, but I seem not to be able to set the volume of VLC from command line??

vlc file.mp3 --vol 0

I have read the man pages as well as googled but I can not get the above to work. Also tried --volume 0, -vol 0, -volume 0 (as well as putting the volume option before the file name).

No matter, VLC starts with its preset volume. Using VLC 1.1.5 on Ubuntu. (I intend to use the line in a bash script therefore I can not use the VLC GUI) /J


Update

I have tried different values. I now run vlc with very verbose. This section looks a bit suspicious (but I have no idea how to interpret it!):

[0xb7108d14] main audio output warning: PTS is out of range (-9483), dropping buffer
[0xb7108d14] main audio output warning: PTS is out of range (-35533), dropping buffer
[0x94384ac] mpgatofixed32 audio filter debug: libmad error: bad main_data_begin pointer
[0xb7108d14] pulse audio output debug: Pulse stream started
[0xb7108d14] main audio output warning: output date isn't PTS date, requesting resampling (86708)
Warning: call to rand()
[0xb7108d14] main audio output warning: buffer is 86706 late, triggering upsampling
[0xb7104654] qt4 interface debug: IM: Setting an input
[0xb7108d14] main audio output warning: output date isn't PTS date, requesting resampling (44448)
[0xb7108d14] main audio output warning: audio drift is too big (130928), dropping buffer
[0x94384ac] mpgatofixed32 audio filter debug: libmad error: bad main_data_begin pointer
[0xb7108d14] main audio output debug: audio output is starving (20040), playing silence
[0xb7108d14] main audio output warning: resampling stopped after 16895748 usec (drift: 19049)

回答1:


Seems to be a known bug. Volume option doesn't have any effect




回答2:


For anyone that comes by this later, I had to disable the "Save audio" option under the audio settings for this to work. I also had to use one of the other audio settings. Mine was:

--mmdevice-volume=<float [0.000000 .. 1.250000]> 

Other options are

--directx-volume=<float [0.000000 .. 2.000000]> 
--waveout-volume=<float [0.000000 .. 2.000000]> 



回答3:


From the documentation:

  • --volume <integer> sets the level of audio output (between 0 and 1024). Also only applies to local playback (like --noaudio).

Have you tried using any other values besides 0? What about other files (from a source different from the ones you've tried)?

Try using the very verbose (-vv) option to see if it tells you anything.




回答4:


Further to Jason Wisely's answer, I used the following on VLC version 3.0.6 and it worked to play a song with VLC at 35% volume. The device really matters because neither directx of waveout worked for me.

start "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --mmdevice-volume=0.35 "F:\Beastmode.mp3"

However, it's somewhat moot because your system volume will determine the apparent volume anyway. So to control the system volume I downloaded nircmd and put it into system32. nircmd uses 65535 as 100% volume, so a 50% volume is 65535 ÷ 2 = 32767.5, and I round to 32767. After that, the following is how I keep a consistent volume of 14% system volume and 80% VLC volume when starting VLC:

nircmd.exe setsysvolume 9200 
start "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --mmdevice-volume=0.35 "F:\Beastmode.mp3"


来源:https://stackoverflow.com/questions/4758137/vlc-setting-volume-from-command-line-bash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!