【问题标题】:qt create gst-launch processqt 创建 gst-launch 进程
【发布时间】:2014-08-19 09:53:19
【问题描述】:

我正在尝试使用此管道创建 gst-launch 流程:

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);

【问题讨论】:

    标签: c++ qt process gstreamer


    【解决方案1】:

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

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

    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);
    

    我相信这适用于您的情况,但这只是因为没有任何参数包含空格,需要引用。

    如果您想使用包含空格的参数,更好但更乏味的是手动创建参数列表,一次一个字符串:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多