启动录屏录音:
connect(&m_Process, &QProcess::readyReadStandardOutput, [&]() {
qDebug() << "Standard output:" << QString::fromLocal8Bit(m_Process.readAllStandardOutput());
});
connect(&m_Process, &QProcess::readyReadStandardError, [&]() {
QString qstr = QString::fromLocal8Bit(m_Process.readAllStandardError());
qDebug() << "Standard error:" << qstr;
});
connect(&m_Process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [=](int exitCode, QProcess::ExitStatus exitStatus) {
qDebug() << "Process finished with exit code" << exitCode << " " << exitStatus;
});
//转码参数
QStringList arguments;
arguments << "-f" << "gdigrab"
<< "-framerate" << "30"
<< "-i" << "desktop"
<< "-f" << "dshow"
<< "-i" << QString("audio=%1").arg(m_strAudioDeviceName.c_str())
<< qstrFolder;
m_Process.setProcessChannelMode(QProcess::MergedChannels);
m_Process.start("ffmpeg", arguments);
结束录屏、录音:
if (m_Process.isOpen()) {
m_Process.write("q");
}
音频设备名称通过windows c++ 获取当前音频输入设备-CSDN博客 获取