USB Camera Support

Hello Team Toradex,
I have one USB 3.0 camera connect with my device imx8mp than I have start testing for the image with following command.
v4l2-ctl --device=/dev/video4 --stream-mmap=3 --stream-to=rv.jpg --stream-count=1 but it will show my image size only 600k output indicates that the file capture.jpg now has a size of 600 KB, meaning it contains data and is not empty. so can you support me how to test successfully this process?

Regards,
Ravi Vanand

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Ravi,

Thank you for reaching out to us. It seems you are using the v4l2-ctl command to capture an image from your USB 3.0 camera connected to the iMX8MP device. The image size being only 600 KB could be due to several factors, such as the resolution or format settings of the camera.

Here are some steps to help you troubleshoot and potentially resolve this issue:

  1. Check Supported Formats and Resolutions:
    Use the following command to list the supported formats and resolutions of your camera:

    v4l2-ctl --device=/dev/video4 --list-formats-ext
    

    This will show you the available pixel formats and frame sizes. Ensure you are capturing at the desired resolution.

  2. Adjust Capture Settings:
    If the resolution is lower than expected, you can specify a higher resolution using the --set-fmt-video option. For example:

    v4l2-ctl --device=/dev/video4 --set-fmt-video=width=1920,height=1080,pixelformat=YUYV
    

    Replace 1920x1080 and YUYV with your desired resolution and format.

  3. Capture Image Again:
    After setting the desired format and resolution, try capturing the image again with:

    v4l2-ctl --device=/dev/video4 --stream-mmap=3 --stream-to=rv.jpg --stream-count=1
    
  4. Consider Using GStreamer:
    If you need more control over the capture process, consider using GStreamer, which provides a flexible framework for handling video streams. A simple GStreamer pipeline to capture an image might look like this:

    gst-launch-1.0 v4l2src device=/dev/video4 ! videoconvert ! jpegenc ! filesink location=rv.jpg
    

By following these steps, you should be able to adjust the capture settings to achieve the desired image size and quality. If you continue to experience issues, ensure that your camera is functioning correctly and that the necessary drivers are installed.

Best regards,

Toradex AI Assistant

Please, also check if these links can help you solve your problem:

NXP i.MX 8M Plus - Verdin System on Module.

file capture_mjpg.jpg
i get the below result after applying above command
capture_mjpg.jpg: JPEG image data, baseline, precision 8, 640x480, components 3
now how to show the image on toradex display

hello team toradex ,
can you provide a support for the above issue or not?

Video Processing - GStreamer | Toradex Developer Center the above given document i have followed but the given command in that document did not work proper so can please tell me the right way

regards,
Ravi Vanand

Hello Ravi!

Sorry for the late reply.

Regarding your first question:

you might consider following steps 1 to 3 provided by the Toradex AI assistant. You will obtain a raw image, and then you should use ffmpeg (you will need to install this on your computer) to convert it to a real image. As an example:

ffmpeg -f rawvideo -pix_fmt yuyv422 -s 1920x1080 -i rv.jpg -frames:v 1 output.jpg

Finally, the real camera image is on the output.jpg file. This will allow you to check if the camera is working properly.

Regarding your question on how to show the images on Toradex displays, can you provide additional information on which display you are using exactly?

Best regards,

Marcio

hello @marcioalbano.tx ,
I am able to capture the image by following the steps 1 to 3, but after that i am not be able to use ffmeg commands i will try to install ffmeg but it should not work.

Display That i am using is the Toradex Display Capacitive Touch Display 10.1" LVDS | Toradex Developer Center

Regards,
Ravi Vanand

Hi Ravi,

Have you tried to install the ffmpeg package? On Ubuntu/Debian you can use sudo apt install ffmpeg , for example.

Regarding the display, I would assume that you followed all the steps described in this article. Could you please confirm this?

Best regards,

Marcio

Hello @marcioalbano.tx,
I have Tried to install ffmpeg package on ubuntu using sudo apt install ffmpeg but the command is not working in my scene because i am using ubuntu by connecting my card using ssh putty console.

and for the display i have followed the steps that you have mention in that article

Regards,
Ravi Vanand

Hello @marcioalbano.tx,

whenever i apply the command sudo apt install ffmpeg I Get the below Result

login as: torizon
torizon@192.168.0.137’s password:

** WARNING **
THIS DEVICE IS IN ENGINEERING MODE

Check for more info:

torizon@verdin-imx8mp-15132884:~$ ls
Dockerfile digital_io_test.sh imx8mp-verdin-wifi-atdm.dtb test
Downloads docker-compose.yml index.html test.wav
adv7180.ko gstreamer-docker media-ctl-setup
dev2 home setup
torizon@verdin-imx8mp-15132884:~$ sudo apt install ffmpeg
Password:
sudo: apt: command not found

Regards,
Ravi Vanand