This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62A-LP: Capture JPEG image

Part Number: SK-AM62A-LP

Hi Team,

I am using SK-AM62A-LP evm and IMX219 sensor. In that I want to capture jpeg image using v4l2-ctrl. I have tried with below command but not able to capture jpeg image.  



Can you please suggest command for that.

I have checked below command for supported format: In that if IMX219 not support MJPG then how to we get jpeg image ?

Jaimin

  • Hi Jaimin,

    IMX219 sensor does not support MJPEG format, so you can't use MJPG as pixelformat with v4l2-ctl.

    I just connected a usb camera on my AM62A board that supports MJPG and was able to run this:

    v4l2-ctl --device /dev/video-usb-cam0 --set-fmt-video=width=1280,height=720,pixelformat=MJPG --stream-mmap --stream-to=frame.jpg --stream-count=1

    root@am62axx-evm:/opt/edgeai-gst-apps# v4l2-ctl -d /dev/video-usb-cam0 --list-formats-ext
    ioctl: VIDIOC_ENUM_FMT
    	Type: Video Capture
    
    	[0]: 'MJPG' (Motion-JPEG, compressed)
    		Size: Discrete 640x480
    			Interval: Discrete 0.033s (30.000 fps)
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 160x120
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 320x240
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 1920x1080
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 2592x1944
    			Interval: Discrete 0.033s (30.000 fps)
    			Interval: Discrete 0.040s (25.000 fps)
    			Interval: Discrete 0.050s (20.000 fps)
    			Interval: Discrete 0.067s (15.000 fps)
    			Interval: Discrete 0.100s (10.000 fps)
    			Interval: Discrete 0.200s (5.000 fps)
    			Interval: Discrete 0.500s (2.000 fps)
    		Size: Discrete 800x600
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 1024x768
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 1280x720
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 1280x960
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 2048x1536
    			Interval: Discrete 0.050s (20.000 fps)
    		Size: Discrete 640x480
    			Interval: Discrete 0.033s (30.000 fps)
    			Interval: Discrete 0.033s (30.000 fps)
    	[1]: 'YUYV' (YUYV 4:2:2)
    		Size: Discrete 640x480
    			Interval: Discrete 0.033s (30.000 fps)
    		Size: Discrete 1920x1080
    			Interval: Discrete 0.333s (3.000 fps)
    		Size: Discrete 1280x720
    			Interval: Discrete 0.125s (8.000 fps)
    		Size: Discrete 800x600
    			Interval: Discrete 0.050s (20.000 fps)
    		Size: Discrete 960x540
    			Interval: Discrete 0.067s (15.000 fps)
    		Size: Discrete 2592x1944
    			Interval: Discrete 0.500s (2.000 fps)
    		Size: Discrete 1280x960
    			Interval: Discrete 0.125s (8.000 fps)
    		Size: Discrete 2048x1536
    			Interval: Discrete 0.333s (3.000 fps)
    root@am62axx-evm:/opt/edgeai-gst-apps# v4l2-ctl --device /dev/video-usb-cam0 --set-fmt-video=width=1280,height=720,pixelformat=MJPG --stream-mmap --stream-to=frame.jpg --stream-count=1

    Hope this helps.

    Best Regards,

    Suren 

  • Hi Suren,

    Yes I got your point but i want to capture jpeg with IMX219 sensor. so, is there any way for that to capture jpeg using v4l2-ctrl.

    One way in my thought is to set some pipeline for v4l2-ctl which receive the image from image sensor and pass it thorough ISP for YUV conversion and then JPEG hardware encoder convert it to JPEG image. But I did not found the way to set pipeline in this way such that v4l2-ctl can give us image in JPEG format.

    Could you please provide above commands?

    We are able to do it with gstreamer pipeline but in our project we want to capture it using v4l2-ctl. Please help us.

    Thanks.  

  • Hi Jaimin,

    Not sure if v4l2-ctl could give you jpeg data using IMX219.

    It’s a Bayer sensor and you might have to pass that to VPAC for ISP to color convert into NV12 before passing it to JPEG encoding on AM62A.

    Also I found this thread that uses FFMPEG to convert into jpeg see if this helps in your development:

    https://stackoverflow.com › how-t...How to convert raw YUV image to jpg

    Hope this helps

    Best Regards,

    Suren

  • Hi Suren,

    Is it possible to setup pieline through media-ctl command such that bayer data passed to VPAC for NV12 conversion? And then can we get NV12 images from VPAC through v4l2-ctl?

    Our purpose is to get processed images from ISP and want to pass it to application for further processing. For that we are considering to create one application through v4l2 API which perform configuration of sensor and capture processed images from ISP.

    Thanks

  • As, per this link :https://mediawiki.compulab.com/index.php/CM-T3730:_Linux:_Camera#Displaying_captured_images

    using media-ctrl we can set the pipeline to get the processed images from the ISP. So, Can you please help me on that for how to I set media-ctrl pipeline for IMX219 sensor on AM62A34 pltaform to get ISP processed image and get it through v4l2-ctl API.

  • Hi Jaimin,

    Have you looked at our Academy on how to enable CSI-2 sensor.

    https://dev.ti.com/tirex/explore/node?node=A__AYNOpgCjYvXMT9TY2205NQ__AM62A-ACADEMY__WeZ9SsL__LATEST

    Linux->Develop Linux on EVM -> Use Camera sections should give you a lot of informaton.

    Hope this helps.

    Best Regards,

    Suren

  • Hi Suren,

    Thank you for providing above link but we have already go through it and no information available to get ISP processed image through v4l2-ctl command. It is giving commands to capture RAW images from sensor.

    We want to design application on user space which get image data from BSP at lower latency. If we use v4l2-ctl command then It is giving RAW image from sensor and not processed image from ISP.

    Is there any way using we can capture processed image from ISP through v4l2-ctl command?

    OR Is there any application available which demonstrate how user can capture ISP processed image? (We don't want to gstreamer as it have its own latency.)

  • Hi Jaimin,

    I am checking with my SW team internally, please allow me to respond to you on this by mid next week.

    Apologies for the delay.

    Best Regards,

    Suren

  • Hi Jaimin,

    On AM62A, the ISP can only be accessed through either GStreamer or TIOVX, but not v4l2. If you don't want to use GStreamer, you can try directly use TIOVX. Please find some examples of using TIOVX to implement the image pipeline from capture to ISP and then to display: https://github.com/TexasInstruments/edgeai-tiovx-apps/tree/main/tests. Especially, please look at app_tiovx_capture_module_test.c.

    Regards,

    Jianzhong