VLC命令行/ bash设置音量

10

我可能会感到非常愚蠢,但是我似乎无法通过命令行设置VLC的音量?

vlc file.mp3 --vol 0

我已经阅读了man手册并进行了谷歌搜索,但是我无法让上述方法起作用。我也尝试使用--volume 0、-vol 0、-volume 0(以及在文件名之前放置音量选项)。

无论如何,VLC都会使用其预设音量。在Ubuntu上使用VLC 1.1.5。(我打算在bash脚本中使用这行代码,因此无法使用VLC GUI)/J


更新

我尝试了不同的值。现在我用非常详细的方式运行vlc。以下部分看起来有点可疑(但我不知道如何解释它!):

[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)

目前的 VLC 版本不支持原生方式实现此功能,但您可以通过 Pulse Audio 库或使用 rc 接口 https://github.com/rhaas80/pa_volume 来完成。 - Hayden Thring
4个回答

7

请查看 https://dev59.com/21sW5IYBdhLWcg3wX2Zz#59814633。 - mjs

1

如果有人后来看到这个问题,我必须在音频设置中禁用“保存音频”选项才能使其工作。我还必须使用其他音频设置之一。我的设置为:

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

其他选项为:
--directx-volume=<float [0.000000 .. 2.000000]> 
--waveout-volume=<float [0.000000 .. 2.000000]> 

无法工作... - mjs
请查看 https://dev59.com/21sW5IYBdhLWcg3wX2Zz#59814633。 - mjs
--mmdevice-volume 是我在 Windows 上唯一有效的选项。 - Josh McGee

1

关于Jason Wisely的回答,我在VLC版本3.0.6上使用以下方法成功以35%音量播放了一首歌曲。设备真的很重要,因为对我来说,直接使用directx或waveout都无法正常工作。

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

然而,这有点无关紧要,因为您的系统音量将决定显然的音量。因此,为了控制系统音量,我下载了nircmd并将其放入system32中。nircmd使用65535作为100%音量,因此50%音量为65535 ÷ 2 = 32767.5,并且我将其四舍五入到32767。之后,以下是我在启动VLC时保持一致的14%系统音量和80%VLC音量的方法:

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

不起作用。请参见 https://dev59.com/21sW5IYBdhLWcg3wX2Zz#59814633 - mjs

0

来自文档

  • --volume <integer>设置音频输出级别(介于0和1024之间)。仅适用于本地播放(例如--noaudio)。

您尝试过使用除0以外的其他值吗?从与您尝试过的文件不同的源中获取其他文件呢?

尝试使用非常详细的(-vv)选项,看看它是否告诉您任何信息。


不起作用... - mjs
请查看 https://dev59.com/21sW5IYBdhLWcg3wX2Zz#59814633。 - mjs

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接