简体   繁体   中英

How to convert this gst-launch command from GStreamer 0.10 to 1.0?

This is to be converted:

gst-launch -v ximagesrc startx=0 starty=0 endx=800 endy=600 ! ffmpegcolorspace ! "video/x-raw-yuv,width=800,height=600,framerate=30/1" ! v4l2sink device=/dev/video0  

I found here that

The "ffmpegcolorspace" element has been replaced with the new "videoconvert" element.

Simply replacing gst-launch with gst-launch-1.0 and ffmpegcolorspace with videoconvert is not sufficient and produces an error:

WARNING: erroneous pipeline: could not link videoconvert0 to v4l2sink0

A simple gst-launch-1.0 videotestsrc ! ximagesink gst-launch-1.0 videotestsrc ! ximagesink works fine, while gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video0 gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video0 produces a different error:

ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data flow error.

Two things, first, GStreamer changed the way they do caps, so video/x-raw-yuv becomes video/x-raw,format=YUV9 (or one of many other formats). So your caps would be wrong under GStreamer 1.0.

Secondly, you can probably trim your pipeline up a bit. I'd guess you could do this:

gst-launch -v ximagesrc startx=0 starty=0 endx=800 endy=600 ! videoconvert ! v4l2sink device=/dev/video0

And if the frame rates don't match between the source and sink you'd have to add videorate:

gst-launch -v ximagesrc startx=0 starty=0 endx=800 endy=600 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! v4l2sink device=/dev/video0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM