windows 使用VLC的虚拟界面时如何防止显示控制台

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6001034/
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-15 16:51:26  来源:igfitidea点击:

How to prevent console from being displayed when using VLC's dummy interface

windowsnode.jssubprocessvlcchild-process

提问by Adam M-W

I'm trying to launch VLC in "dummy" mode from a Node.js server script, however using child_process.spawn('vlc',['-I dummy'])produces a new console window for VLC's output when using Windows. Is there a way to prevent this happening and force all stdout though the stdout ReadableStream so no "popup windows" occur?

我正在尝试从 Node.js 服务器脚本以“虚拟”模式启动 VLC,但是child_process.spawn('vlc',['-I dummy'])在使用 Windows 时使用会为 VLC 的输出生成一个新的控制台窗口。有没有办法防止这种情况发生并通过 stdout ReadableStream 强制所有标准输出,因此不会出现“弹出窗口”?

EDIT: This problem had nothing to do with node.js, it was simply the way I was calling it and VLC's behaviour. The solution is below.

编辑:这个问题与 node.js 无关,这只是我调用它的方式和 VLC 的行为。解决方法如下。

Thanks.

谢谢。

回答by Adam M-W

I found a solution for the specific problem:

我找到了针对特定问题的解决方案:

VLC has a command line option to surpress this window --*-quiet where * is the interface.

VLC 有一个命令行选项来抑制这个窗口 --*-quiet 其中 * 是界面。

e.g. For the dummy interface, use

例如对于虚拟接口,使用

child_process.spawn('vlc',['-I dummy','--dummy-quiet'])

For the rc interface, use

对于 rc 接口,使用

child_process.spawn('vlc',['-I rc','--rc-quiet'])

回答by Pau Coma Ramirez

I would like to complement Adam M-W answer.

我想补充 Adam MW 的回答。

VLC has a command line option to suppress this window --*-quiet where * is the interface.

e.g. For the dummy interface, use

child_process.spawn('vlc',['-I dummy','--dummy-quiet']) For the rc interface, use

child_process.spawn('vlc',['-I rc','--rc-quiet'])

answered Jun 13 '11 at 14:12 Adam M-W

VLC 有一个命令行选项来抑制这个窗口 --*-quiet 其中 * 是接口。

例如对于虚拟接口,使用

child_process.spawn(' vlc',[' -I dummy',' --dummy-quiet']) 对于 rc 接口,使用

child_process.spawn(' vlc',[' -I rc',' --rc-quiet'])

2011 年 6 月 13 日 14:12 亚当 MW 回答

at least on my system,VLC now sends its messages to stdError, so this is the channel which needs to be monitored.

至少在我的系统上,VLC 现在将其消息发送到stdError,因此这是需要监视的通道。

My interface is with Qt , QtProcess and these are the options that worked for me.

我的界面是 Qt 、 QtProcess ,这些是对我有用的选项。

Using MergedChannelsand reading stdOut.

使用MergedChannels并读取stdOut

m_proc->setProcessChannelMode(QProcess::MergedChannels);
connect (m_proc,SIGNAL(readyReadStandardOutput()),
           this, SLOT(readyRead()));

void ReDirVLC::readyRead(){
    if (!m_proc) return;
    qDebug()<<m_proc->readAllStandardOutput() << endl;
}

Using SeparateChannelsand reading stdError

使用SeparateChannels并读取stdError

m_proc->setProcessChannelMode(QProcess::SeparateChannels);
connect (m_proc,SIGNAL(readyReadStandardError()),
           this, SLOT(readyRead()));

void ReDirVLC::readyRead(){
    if (!m_proc) return;
    qDebug()<<m_proc->readAllStandardError() << endl;
}

回答by clee

Maybe you could run the process with child_process.spawn('start', ['/b', 'vlc', '-I dummy'])instead?

也许你可以用它child_process.spawn('start', ['/b', 'vlc', '-I dummy'])来运行这个过程?