QProcess m_Process;
m_Process.setProcessChannelMode(QProcess::MergedChannels);
//拼接命令行字符串
QString cmd_str("");
cmd_str += QApplication::applicationDirPath() + "/ffmpeg.exe";
cmd_str += " -rtsp_transport tcp -y -i";
cmd_str += " ";
cmd_str += "rtsp://192.168.16.166/stream1.sdp";
cmd_str += " -vcodec copy -af asetrate=8000 -acodec aac -b:a 96k";
cmd_str += " -f mp4";
cmd_str += " ";
cmd_str += "tingting.mp4";
//开始录制
m_Process.start(cmd_str);
//停止录制方法,向FFmpeg进程发送“q”指令
if (m_Process.isOpen())
{
m_Process.write("q");
}