gstreamer-devel at lists.freedesktop.org

Regine Issan regine.issan at gmail.com
Thu Oct 12 08:26:25 UTC 2023


Hello,

my goal is to
A. use logitech 4k usb camera.
B. capture 4k frames (to get 4k uncomressed representation in memory)
C. save raw data to disk ( 4k, bmp, uncompressed)

my work plan is :
A. Done: check the formats supported by camera
     (using : v4l2-ctl --list-formats-ext --device /dev/video1

     results below)

     seems that only MJPEG has 4k .

A. Done: set v4l2 to capture 4k (4096

*2160,MJPG). B. Done: write & execute c++ app that uses v4l2 c. TODO:
validate i have in-memory raw representation of the image (4096*2160 bytes)
C. TODO: save raw data (uncompressed) as png file

My main questions
A .I set the camera to work with 4096




*2160,MJPG. B. I assume that usb data passes MJPEG data (compressed).
correct ? C. v4l2 captures frames using VIDIOC_DQBUF (70 frames, for
example). for each picture i i get different size ( eg, 460000-52000
bytes). Not 4096*2160*2 bytes .

 C.1 Does that mean that gjet MJPEG buffers (compressed) ?
C.2  how can i get 4k raw image in memory ? (eg, RGB to save at bmp image)
        shouldn't v4l2 have dedicated software encoder ?
        how can i cant 4k raw representation in memory ?

D. how do i save that row data to the disk (eg, bmp) ?
E. why does v4l2 tells that the frame size is 4096 * 2160 * 2 ?
that meas that each pixel has 2 bytes ? ?
(i would expect each pixel to store value between 0 to 255 , in a single
byte)
<https://forums.developer.nvidia.com/t/v4l2-capture-4k-raw-data/269049/1#v4l2-ctl-commands-1>
================================================================
v4l2-ctl commands
0.

   1.
   2. 4l2-ctl --list-formats-ext --device /dev/video2

   ioctl: VIDIOC_ENUM_FMT
   Type: Video Capture

   [0]: 'YUYV' (YUYV 4:2:2)
   ===>YUYV Size: Discrete 640x480
   Interval: Discrete 0.033s (30.000 fps)
   ...
   MJPG 4K Size: Discrete 4096x2160
   Interval: Discrete 0.033s (30.000 fps)
   ...

   [2]: 'NV12' (Y/UV 4:2:
   Size: Discrete 1920x1080
   ...
   3.

   set format ( capture 4096/2160, MJPG frames ).
   v4l2-ctl -d /dev/video2
   --set-fmt-video=width=4096,height=2160,pixelformat=MJPG
   4.

   get format (ensure that set fomat works)
   ==> v4l2-ctl -d /dev/video2 --get-fmt-video

Format Video Capture:
Width/Height : 4096/2160
Pixel Format : ‘MJPG’ (Motion-JPEG)
Field : None
Bytes per Line : 0
Size Image : 17694720 4096*2160*2
Colorspace : sRGB
Transfer Function : Rec. 709
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20231012/f3b10dfe/attachment.htm>


More information about the gstreamer-devel mailing list