[MJPEG] : Jpeg Header -> imxvideoconvert_g2d -> ADOBE

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

[MJPEG] : Jpeg Header -> imxvideoconvert_g2d -> ADOBE

1,383 Views
Siddharth
Contributor I

We are working on MJPEG streaming and for that, we have used the below command to generate the 720p .jpg on iMX8mm:

 

Case 1) 5MP downscale to 720p using imxvideoconvert_g2d:

           gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! 'video/x-raw, width=2592, height=1944, framerate=(fraction)2/1, format=(string)UYVY' ! imxvideoconvert_g2d ! 'video/x-raw, width=720, height=480, framerate=(fraction)2/1'  ! queue ! jpegenc ! filesink location=test_videoscale.jpg

 

But on hexdump -C -n <size> test_videoscale.jpg > videoscale.txt (attached with mail)

 

Note: We have found that the jpeg header is ADOBE instead of JFIF.

 

Case 2) No downscaling without imxvideoconvert_g2d:

        gst-launch-1.0 -v v4l2src device="/dev/video0" num-buffers=1  ! 'video/x-raw, width=(int)720, height=(int)480, format=(string)UYVY' ! jpegenc ! filesink location=/home/root/test_2lane.jpg

 

   On hexdump -C -n <size> test_2lane.jpg  > no_videoscale.txt (attached with mail) also can be found using https://www.onlinehexeditor.com/#

 

   Note: We have found that jpeg header JFIF which is standard.

 

So for MJPEG streaming, we need a JFIF header which is standard for MJPEG streaming(live555) with Case 1 (downscaling)

 

Are there any imxvideoconvert_g2d properties that are changing the header of jpeg?

 

Please let us know if you need more information.

0 Kudos
3 Replies

1,289 Views
Siddharth
Contributor I

We are using below Linux Kernel below:

                Linux imx8mmevk 5.4.24-2.1.0+g0a1506848a7d #1 SMP PREEMPT Mon Dec 6 07:28:20 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

       I have applied the attached patch(0001-Add-UYVY-support-in-imx-g2d-convertor.patch).

       NXP internal team used the BSP 5.10.52_2.1.0 release to test the patch.

      But unable to capture an image on executing the gstreamer as followed :

 

gst-launch-1.0 v4l2src num-buffers=1 ! 'video/x-raw,width=2592,height=1944' ! imxvideoconvert_g2d ! 'video/x-raw,width=720,height=480,format=UYVY' ! jpegenc ! filesink location=output.jpg

Logs:

        Setting pipeline to PAUSED ...

Pipeline is live and does not need PREROLL ...

Setting pipeline to PLAYING ...

New clock: GstSystemClock

g2d_blit_2d: Invalid dst format 26!

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 error (-5)

Execution ended after 0:00:00.412914114

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

Freeing pipeline ...

Please let us know if the given patch can be applied to our kernel version or please provide the patch for our version.

Also, provide the libraries need to transfer to iMx8mm as we flash full image on iMx8mm.

0 Kudos

1,269 Views
joanxie
NXP TechSupport
NXP TechSupport

the error that occurs is caused by the fact the GPU does not support UYVY format for 5.4.24-2.1.0 BSP release. This feature was enabled starting with 5.4.47-2.2.0 BSP release. so pls try the latest bsp

0 Kudos

1,312 Views
joanxie
NXP TechSupport
NXP TechSupport

since you have already got patch from internal team, I will close this case

 

0 Kudos