Use v4l2-ctl get raw data wrong

Hello,
I use the jetson Xavier NX and camera IMX219-77 , The resolution is 3280 x 2464 , 10bits, when I use the V4L2-ctl command as below :

sudo v4l2-ctl -d /dev/video0 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw

the raw data I get is only 1,843,200 Bytes ,but the right raw data should be 3280 x 2464 x 2 = 16,163,840 Bytes,

Can you tell me what’s wrong with it ?

hello dailyupper,

you may also try given all support formats to the command-line.
for example,
v4l2-ctl -d /dev/video0 --set-fmt-video=width=3280,height=2464,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw

Hello Jerry,thank you for your reply, I’ve tried this command :

v4l2-ctl -d /dev/video0 --set-fmt-video=width=3280,height=2464,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw ,
and failed to execute it ,
but I found the camera stream 1,843,200 Bytes = 1280 x 720 x 2 , which means the stream resolution lower than 3280 x 2464 when it worked in this mode ,
if any other reasons could cause it ?
Thanks again .

hello dailyupper,

is the mode enabled correctly?
please check sensor capability, $ v4l2-ctl -d /dev/video0 --list-formats-ext

Hello Jerry,the sensor mode is correct, the command result:
v4l2-ctl -d /dev/video0 --list-formats-ext
shows :
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

[0]: 'RG10' (10-bit Bayer RGRG/GBGB)
	Size: Discrete 3280x2464
		Interval: Discrete 0.048s (21.000 fps)
	Size: Discrete 3280x1848
		Interval: Discrete 0.036s (28.000 fps)
	Size: Discrete 1920x1080
		Interval: Discrete 0.033s (30.000 fps)
	Size: Discrete 1640x1232
		Interval: Discrete 0.033s (30.000 fps)
	Size: Discrete 1280x720
		Interval: Discrete 0.017s (60.000 fps)

,
I’ve found 2 interesting things:
1, the command :
" nvgstcapture "
will cause the v4l2-ctl capture command disable. the jetson Xavier NX must shutdown and reboot ,then the problem can be solved;
2, After rebooting,the command :
v4l2-ctl -d /dev/video0 --set-fmt-video=width=3280,height=2464,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test.raw
is OK, but the stream resolution can be set only once as 3280x2464, changing the solution to another like 1920x1080 is failed.
If you know more about it, tell me please.
And thanks for your apply !

hello dailyupper,

may I know what’s your steps in details to change the resolution.

Hello Jerry,
It means that if I use the command firstly ,like:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=3280,height=2464,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test1.raw

then I use another command such as :

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test2.raw

,those two finnal " testx.raw " are same , the “width” and “height” parameters seem unable to change the final raw data .
It puzzles me a lot.

And thank you for your apply !

hello dailyupper,

I cannot reproduce this issue locally.
please check my test approaches…

$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'BG10' (10-bit Bayer BGBG/GRGR)
                Size: Discrete 2592x1944
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 2592x1458
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 1280x720
                        Interval: Discrete 0.008s (120.000 fps)
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=2592,height=1944,pixelformat=BG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test1.raw
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=BG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test2.raw

$ ll test*.raw
-rw-rw-r-- 1 nvidia nvidia 10077696 Apr 17 02:58 test1.raw
-rw-rw-r-- 1 nvidia nvidia  1843200 Apr 17 02:59 test2.raw

is it possible for adding debug prints to check sensor actually using different sensor modes?
BTW, may I also know which camera module you’re using, is it rbpcv2-imx219?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.