Gstreamer command convert to gst-python

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Gstreamer command convert to gst-python

Jump to solution
2,758 Views
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.
Spoiler
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
Spoiler
_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 Kudos
Reply
1 Solution
2,743 Views
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

View solution in original post

0 Kudos
Reply
2 Replies
2,750 Views
b36401
NXP Employee
NXP Employee
0 Kudos
Reply
2,744 Views
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 Kudos
Reply