Gstreamer command convert to gst-python

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Gstreamer command convert to gst-python

跳至解决方案
3,059 次查看
thepnimit
Contributor III

Hi NXP team,

We are use gstreamer on IMX8QX for stream multi camera with command pipeline

gst-launch-1.0 -v imxcompositor_g2d name=comp \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=320 sink_0::height=240 \
sink_1::xpos=320 sink_1::ypos=0 sink_1::width=320 sink_1::height=240 \
! v4l2jpegenc ! rtpjpegpay ! udpsink host=192.168.60.255 port=5000 \
v4l2src device=/dev/video3 ! "image/jpeg, width=3264, height=2448" \
! v4l2jpegdec ! imxvideoconvert_g2d \
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_0 \
v4l2src device=/dev/video5 ! "image/jpeg, width=3264, height=2448" \
! v4l2jpegdec ! imxvideoconvert_g2d \
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_1

This's command hasn't problem when run on shell, But when we need to develop in python code

Normally have function 

Gst.parse_launch() for convert command pipeline to variable e.g.
破坏者
import gi
gi.require_version('Gst''1.0')
from gi.repository import GLib, Gst
Gst.init(None)
_pipeline = Gst.parse_launch("""v4l2src device=/dev/video3 ! 
image/jpeg, width=3264, height=2448 ! fakesink""")
 
The problem is we cann't convert top command to pipeline
破坏者
_pipeline = Gst.parse_launch("""imxcompositor_g2d name=comp 
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=320 sink_0::height=240 
sink_1::xpos=320 sink_1::ypos=0 sink_1::width=320 sink_1::height=240 
! v4l2jpegenc ! rtpjpegpay ! udpsink host=192.168.60.255 port=5000 
v4l2src device=/dev/video3 ! "image/jpeg, width=3264, height=2448" 
! v4l2jpegdec ! imxvideoconvert_g2d 
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_0 
v4l2src device=/dev/video5 ! "image/jpeg, width=3264, height=2448" 
! v4l2jpegdec ! imxvideoconvert_g2d 
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_1""")
 

(python:27527): GStreamer-CRITICAL **: 17:32:04.929: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed

(python:27527): GStreamer-CRITICAL **: 17:32:05.081: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
gi.repository.GLib.Error: gst_parse_error: syntax error (0)

 

Do you have suggestion or how to convert pipeline command to python variable or not?

 

Regards

Thepnimit

0 项奖励
回复
1 解答
3,044 次查看
thepnimit
Contributor III

Hi

Thank for suggest

Now we are found solution for streaming, The " (double quote) after source pipeline is main problem when delete, it's work

_pipeline = Gst.parse_launch("""imxcompositor_g2d name=comp 
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=320 sink_0::height=240 
sink_1::xpos=320 sink_1::ypos=0 sink_1::width=320 sink_1::height=240 
! v4l2jpegenc ! rtpjpegpay ! udpsink host=192.168.60.255 port=5000 
v4l2src device=/dev/video3 ! "image/jpeg, width=3264, height=2448" 
! v4l2jpegdec ! imxvideoconvert_g2d 
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_0 
v4l2src device=/dev/video5 ! "image/jpeg, width=3264, height=2448" 
! v4l2jpegdec ! imxvideoconvert_g2d 
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_1""")

 

Thanks

Thepnimit

在原帖中查看解决方案

0 项奖励
回复
2 回复数
3,051 次查看
b36401
NXP Employee
NXP Employee
0 项奖励
回复
3,045 次查看
thepnimit
Contributor III

Hi

Thank for suggest

Now we are found solution for streaming, The " (double quote) after source pipeline is main problem when delete, it's work

_pipeline = Gst.parse_launch("""imxcompositor_g2d name=comp 
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=320 sink_0::height=240 
sink_1::xpos=320 sink_1::ypos=0 sink_1::width=320 sink_1::height=240 
! v4l2jpegenc ! rtpjpegpay ! udpsink host=192.168.60.255 port=5000 
v4l2src device=/dev/video3 ! "image/jpeg, width=3264, height=2448" 
! v4l2jpegdec ! imxvideoconvert_g2d 
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_0 
v4l2src device=/dev/video5 ! "image/jpeg, width=3264, height=2448" 
! v4l2jpegdec ! imxvideoconvert_g2d 
! capsfilter caps="video/x-raw, width=320, height=240, pixel-aspect-ratio=1/1" ! comp.sink_1""")

 

Thanks

Thepnimit

0 项奖励
回复