How to output h264 files using the imxcompositor_g2d element of gstreamer on i.MX8X

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

How to output h264 files using the imxcompositor_g2d element of gstreamer on i.MX8X

1,139 Views
toshinariagata
Contributor III

I want to output the h264 files using the imxcompositor_g2d element of gstreamer on i.MX8X.
Also, I want to minimize CPU usage as much as possible.

I can output it with the following command, but the CPU usage will be 100%.

gst-launch-1.0 -v imxcompositor_g2d name=comp \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=720 sink_0::height=480 \
sink_1::xpos=0 sink_1::ypos=480 sink_1::width=720 sink_1::height=480 \
sink_2::xpos=720 sink_2::ypos=0 sink_2::width=720 sink_2::height=480 \
sink_3::xpos=720 sink_3::ypos=480 sink_3::width=720 sink_3::height=480 ! \
videoconvert ! 'video/x-raw,format=(string)NV12,width=1440,height=960' ! queue ! v4l2h264enc ! filesink location=test.mp4 \
v4l2src device=/dev/video0 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_0 \
v4l2src device=/dev/video1 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_1 \
v4l2src device=/dev/video2 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_2 \
v4l2src device=/dev/video3 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_3

The reason why I use the videoconvert element

  • The sink's format of the v4l2h264enc element is NV12 only.
  • The src's format of the imxcompositor_g2d element does not have NV12.
  • I need to convert the format.

I used the imxvideoconvert_g2d element, but I got an error.

gst-launch-1.0 -v imxcompositor_g2d name=comp \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=720 sink_0::height=480 \
sink_1::xpos=0 sink_1::ypos=480 sink_1::width=720 sink_1::height=480 \
sink_2::xpos=720 sink_2::ypos=0 sink_2::width=720 sink_2::height=480 \
sink_3::xpos=720 sink_3::ypos=480 sink_3::width=720 sink_3::height=480 ! \
queue ! imxvideoconvert_g2d ! queue ! v4l2h264enc ! avimux ! filesink location=cam_comp.avi \
v4l2src device=/dev/video0 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_0 \
v4l2src device=/dev/video1 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_1 \
v4l2src device=/dev/video2 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_2 \
v4l2src device=/dev/video3 ! 'video/x-raw,format=(string)NV12,width=720,height=480,framerate=(fraction)30/1' ! comp.sink_3

ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../../../../git/libs/gst/base/gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)

 

0 Kudos
5 Replies

1,121 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

I will test your command and give you feedback

0 Kudos

1,097 Views
toshinariagata
Contributor III

Hi. @Zhiming_Liu 

I would appreciate it if you would update me on this matter.

0 Kudos

1,084 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi

I didn't reproduce this issue as the EVK can't insert 4 cameras

0 Kudos

1,080 Views
toshinariagata
Contributor III

Hi. @Zhiming_Liu 

Thank you for your reply.

 

I hope someone updates this matter.

0 Kudos

1,117 Views
toshinariagata
Contributor III

Hi. @Zhiming_Liu 

Thank you for testing. I'm looking forward to your feedback.


I use L5.4.70-2.3.0.
I get the four cameras images from using ISL79987.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/ISL79987-and-adv7180-de-interlace-driver...

0 Kudos