VLC 从命令行/bash 设置音量

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4758137/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 23:19:12  来源:igfitidea点击:

VLC setting volume from command line/bash

bashvolumevlc

提问by Julio

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 的音量?

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

我已经阅读了手册页以及谷歌搜索,但我无法使上述内容起作用。还尝试了 --volume 0, -vol 0, -volume 0 (以及将 volume 选项放在文件名之前)。

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

不管怎样,VLC 都是从它的预设音量开始的。在 Ubuntu 上使用 VLC 1.1.5。(我打算在 bash 脚本中使用该行,因此我不能使用 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!):

我尝试了不同的值。我现在非常详细地运行 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)

采纳答案by RandomSF

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

似乎是一个已知的错误。 音量选项没有任何影响

回答by Jason Wisely

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]> 

回答by IssphitiKOzS

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.

Jason Wisely 的回答之后,我在 VLC 3.0.6 版上使用了以下内容,它可以用 VLC 以 ​​35% 的音量播放歌曲。设备真的很重要,因为 waveout 的 directx 都不适合我。

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 nircmdand 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并将其放入 system32。nircmd使用65535作为100%音量,所以50%音量是65535÷2=32767.5,我四舍五入到32767。之后,下面是我在启动时如何保持14%系统音量和80%VLC音量的一致音量VLC:

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

回答by Paused until further notice.

From the documentation:

文档

  • --volume <integer>sets the level of audio output (between 0 and 1024). Also only applies to local playback (like --noaudio).
  • --volume<integer>设置音频输出的级别(0 到 1024 之间)。也仅适用于本地播放(如 --noaudio)。

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

您是否尝试过使用除 0 之外的任何其他值?其他文件(来自与您尝试过的文件不同的来源)呢?

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

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