C++ qt创建gst启动过程

C++ qt创建gst启动过程,c++,qt,process,gstreamer,C++,Qt,Process,Gstreamer,我正在尝试使用以下管道创建gst启动流程: gst-launch -ve videotestsrc ! 'video/x-raw-yuv,width=640,height=480,framerate=15/1,format=(fourcc)I420' ! queue ! mfw_vpuencoder codec-type=2 ! queue ! avimux name=mux ! filesink location=sd/Video/1.avi 我尝试使用qprocess来运行此管道。但最后我

我正在尝试使用以下管道创建gst启动流程:

gst-launch -ve videotestsrc ! 'video/x-raw-yuv,width=640,height=480,framerate=15/1,format=(fourcc)I420' ! queue ! mfw_vpuencoder codec-type=2 ! queue ! avimux name=mux ! filesink location=sd/Video/1.avi
我尝试使用qprocess来运行此管道。但最后我失败了。我尝试运行gst launch的一些尝试如下:

process->start("gst-launch -ve videotestsrc ! 'video/x-raw-yuv,width=640,height=480,framerate=15/1,format=(fourcc)I420' ! queue ! mfw_vpuencoder codec-type=2 ! queue ! avimux name=mux ! filesink location=sd/Video/1.avi");

QStringList args = QString("-ve videotestsrc ! 'video/x-raw-yuv,width=640,height=480,framerate=15/1,format=(fourcc)I420' ! queue ! mfw_vpuencoder codec-type=2 ! queue ! avimux name=mux ! filesink location=sd/Video/1.avi").split(" ");
process->start("gst-launch", args);

当shell调用时,引号(和双引号)用于将多个单词合并到单个参数中,但引号也会被丢弃。在参数中包含引号可能会导致错误

因此,这将更接近(我已经删除了
字符):

我相信这在您的情况下会起作用,但是这只是因为没有一个参数包含空格,需要引用空格

更好但更繁琐的方法是手动创建参数列表,如果要使用包含空格的参数,则每次创建一个字符串:

QStringList args;
args << "-ve" << "videotestsrc" << "!" << "video/x-raw-yuv,width=640,height=480,framerate=15/1,format=(fourcc)I420" << etc.
QStringList参数;
args
QStringList args;
args << "-ve" << "videotestsrc" << "!" << "video/x-raw-yuv,width=640,height=480,framerate=15/1,format=(fourcc)I420" << etc.