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

前端 未结 3 1235
天命终不由人
天命终不由人 2021-01-19 12:59

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 windo

3条回答
  •  -上瘾入骨i
    2021-01-19 13:47

    I would like to complement Adam M-W answer.

    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

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

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

    Using MergedChannels and reading stdOut.

    m_proc->setProcessChannelMode(QProcess::MergedChannels);
    connect (m_proc,SIGNAL(readyReadStandardOutput()),
               this, SLOT(readyRead()));
    
    void ReDirVLC::readyRead(){
        if (!m_proc) return;
        qDebug()<readAllStandardOutput() << endl;
    }
    

    Using SeparateChannels and reading stdError

    m_proc->setProcessChannelMode(QProcess::SeparateChannels);
    connect (m_proc,SIGNAL(readyReadStandardError()),
               this, SLOT(readyRead()));
    
    void ReDirVLC::readyRead(){
        if (!m_proc) return;
        qDebug()<readAllStandardError() << endl;
    }
    

提交回复
热议问题