USB camera image capture

Dear Sir.
I have questions for image capture for TX1.
Now, I test to get capture image by usb 2.0 camera.
But I have problems.

  1. Preview is normal
    gst-launch-1.0 v4l2src device=“dev/video0” ! “video/x-raw, width=1920, height=1080, format=I420” ! xvimagesink -e

  2. Image capture is unnormal !!!
    gst-launch-1.0 v4l2src device=“dev/video0” num-buffers=1 ! “video/x-raw, width=1920, height=1080, format=I420” ! nvjpegenc ! filesink location=test.jpg -e
    ==> jpeg file is very much dark. And it looks like blur.

  3. When I use cheese application
    ==> Preview is normal. But capture images are sometimes normal or mostly green color.

I need normal 1920x1080 capture image for USB 2.0 camera.
Please help me.

Thanks a lot.
NTNman.

The possible is cause the AE/AWB are not converge yet. You can use below command to verify it. You can see the first few frame are black. To avoid the black picture you need to capture after the AE already converge.

gst-launch-1.0 v4l2src device="dev/video0" num-buffers=600 ! "video/x-raw, width=1920, height=1080, format=I420" ! nvjpegenc ! filesink location=test.avi

Hi NTN-hjy,

Have you found the cause and fixed it?
Can above suggestion resolve your issue?

Thanks

Dear Kayccc.

Thanks for your kind help.
I tested by your solution, and I have more test for other method.
Please refer to below comments.

  1. gst-launch-1.0 v4l2src device=“dev/video0” num-buffers=600 ! “video/x-raw, width=1920, height=1080, format=I420” ! nvjpegenc ! filesink location=test.avi
    ==> It’s okay. Video file is normal.
    ==> But, I need capture file(jpg). I don’t know how can I get the capture file.

  2. I use QT5.7 by cross compile in hostPC.
    When I capture through QT example in TX1, jpg file is unnormal. And the picture is same by “cheese” application in TX1.

  3. gst-launch-1.0 nvcamerasrc fpsRange=“30.0 30.0” ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1’ ! nvtee ! nvvidconv flip-method=1 ! ‘video/x-raw(memory:NVMM), format=(string)I420’ ! nvoverlaysink -e
    ==> Preview is normal and good. But I don’t know how can I get the capture file by nvcamerasrc.

Anyway, I want’t to know all method for getting jpg file by USB camera.
Please help me.
I’m thank you for your kind help.
NTN-hjy.

Hi NTNman,
Please try
gst-launch-1.0 v4l2src device=“dev/video0” num-buffers=60 ! “video/x-raw, width=1920, height=1080, format=I420” ! nvjpegenc ! multifilesink location=snapshot-%05d.jpg