How to crop video on gstreamer pipeline imx8 with DMA usage?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to crop video on gstreamer pipeline imx8 with DMA usage?

2,213件の閲覧回数
Anton_K
Contributor III

Hello, I need to crop the video capture on the sides. For example I can capture video and display it on the screen by this gstreamer pipeline:

XDG_RUNTIME_DIR=/run/user/0 GST_DEBUG=3 gst-launch-1.0 -vvv v4l2src device=/dev/video1 io-mode=dmabuf ! video/x-raw,format=NV12,framerate=30/1,width=1920,height=1080 ! v4l2h264enc output-io-mode=dmabuf-import ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! waylandsink

So, I can see videocrop plugin to crop the video, so I'm trying to do this:

XDG_RUNTIME_DIR=/run/user/0 GST_DEBUG=3 gst-launch-1.0 -vvv v4l2src device=/dev/video1 io-mode=dmabuf ! video/x-raw,format=NV12,framerate=30/1,width=1920,height=1080 ! videoscale ! videocrop top=180 bottom=180 right=320 left=320 ! v4l2h264enc output-io-mode=dmabuf-import ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! waylandsink

And got the following errors on log (attached file)

Can anyone help, how can I crop the videocapture simultaneously with DMA usage?
My setup is yocto Kirkstone build for IMX8. Board VAR-SOM-MX8
Thanks in advance. Waiting for response

0 件の賞賛
5 返答(返信)

2,157件の閲覧回数
brian14
NXP TechSupport
NXP TechSupport

Hi @Anton_K

To effectively use the videocrop Gstreamer plugin on the iMX8 you can refer to the iMX Linux User Guide section 7.3.17 Video Conversion.

i.MX Linux User's Guide (nxp.com)

It seems you are missing the plugin imxvideoconvert_g2d videocrop-meta-enable=true.

Please try and tell me if this works,

Have a great day!

0 件の賞賛

2,137件の閲覧回数
Anton_K
Contributor III

Thanks for your reply. Still no success with the following pipeline:

XDG_RUNTIME_DIR=/run/user/0 GST_DEBUG=3 gst-launch-1.0 -vvv v4l2src device=/dev/video1 io-mode=dmabuf extra-controls=\"controls,vertical_flip=1\" ! video/x-raw,format=NV12,framerate=30/1,width=1920,height=1080 ! videocrop top=360 right=640 ! imxvideoconvert_g2d videocrop-meta-enable=true ! v4l2h264enc output-io-mode=dmabuf-import ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! waylandsink

logs attached in file

0 件の賞賛

2,109件の閲覧回数
brian14
NXP TechSupport
NXP TechSupport

Hi @Anton_K

Thank you for your reply.

I noticed that you are using a Variscite SOM, and due to you using their BSP and it seems is a software problem I think you can have a best support contacting Variscite.

Have a great day!

2,190件の閲覧回数
malik_cisse
Senior Contributor I

Hi Anton,

The cropping topic is not related to the DMA topic afaik.
Here is how to crop. The cropping setting gets transfered via metadata to G2D GPU accelerator imxvideoconvert_g2d where actual cropping occurs. No need to use videoscale.
gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,width=3840,height=2160 ! videocrop top=0 left=120 right=120 bottom=0 ! imxvideoconvert_g2d rotation=3 ! video/x-raw, width=480, height=800 ! kmssink can-scale=false sync=false
I Hope this helps,

0 件の賞賛

2,186件の閲覧回数
Anton_K
Contributor III

Anyway thanks for your help and time.
I have to use v4l2h264enc codec, therefore even without video cropping imxvideoconvert_g2d can't accept my caps on this pipeline:

GST_DEBUG=3 XDG_RUNTIME_DIR=/run/user/0 gst-launch-1.0 -vvv v4l2src device=/dev/video1 io-mode=dmabuf ! video/x-raw,format=NV12,framerate=30/1,width=1280,height=720 ! imxvideoconvert_g2d ! v4l2h264enc output-io-mode=dmabuf-import ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! waylandsink

 I also got error on negotiation and the warnings on the attached file

0 件の賞賛