<div dir="ltr"><br><p>Hello,</p>
<p>my goal is to<br>
A. use logitech 4k usb camera.<br>
B. capture 4k frames (to get 4k uncomressed representation in memory)<br>
C. save raw data to disk ( 4k, bmp, uncompressed)</p>
<p>my work plan is :<br>A. Done: check the formats supported by camera <br> (using : v4l2-ctl --list-formats-ext --device /dev/video1<br></p><p> results below)<br></p><p> seems that only MJPEG has 4k .<br></p><p>
A. Done: set v4l2 to capture 4k (4096<em>2160,MJPG).<br>
B. Done: write & execute c++ app that uses v4l2<br>
c. TODO: validate i have in-memory raw representation of the image (4096</em>2160 bytes)<br>
C. TODO: save raw data (uncompressed) as png file</p>
<p>My main questions<br>
A .I set the camera to work with 4096<em>2160,MJPG.<br>
B. I assume that usb data passes MJPEG data (compressed).<br>
correct ?<br>
C. v4l2 captures frames using VIDIOC_DQBUF (70 frames, for example).<br>
for each picture i i get different size ( eg, 460000-52000 bytes).<br>
Not 4096</em>2160*2 bytes .</p>
<pre class="gmail-codeblock-buttons"><div class="gmail-codeblock-button-wrapper" style="right: 0px;"></div></pre><pre class="gmail-codeblock-buttons"><code> 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 ?
</code></pre>
<p>D. how do i save that row data to the disk (eg, bmp) ?<br>
E. why does v4l2 tells that the frame size is 4096 * 2160 * 2 ?<br>
that meas that each pixel has 2 bytes ? ?<br>
(i would expect each pixel to store value between 0 to 255 , in a single byte)</p>
<h1><a name="v4l2-ctl-commands-1" class="gmail-anchor" href="https://forums.developer.nvidia.com/t/v4l2-capture-4k-raw-data/269049/1#v4l2-ctl-commands-1"></a>================================================================<br>
v4l2-ctl commands<br>0. <br></h1>
<ol><li><br>
</li><li>4l2-ctl --list-formats-ext --device /dev/video2<br><br>ioctl: VIDIOC_ENUM_FMT<br> Type: Video Capture<br><br> [0]: 'YUYV' (YUYV 4:2:2)<br>===>YUYV Size: Discrete 640x480<br> Interval: Discrete 0.033s (30.000 fps)<br>...<br>MJPG 4K Size: Discrete 4096x2160<br> Interval: Discrete 0.033s (30.000 fps)<br>...<br><br> [2]: 'NV12' (Y/UV 4:2:<br> Size: Discrete 1920x1080<br>...<br></li><li><p>set format ( capture 4096/2160, MJPG frames ).<br>
v4l2-ctl -d /dev/video2 --set-fmt-video=width=4096,height=2160,pixelformat=MJPG</p>
</li><li>
<p>get format (ensure that set fomat works)<br>
==> v4l2-ctl -d /dev/video2 --get-fmt-video</p>
</li></ol>
<p>Format Video Capture:<br>
Width/Height : 4096/2160<br>
Pixel Format : ‘MJPG’ (Motion-JPEG)<br>
Field : None<br>
Bytes per Line : 0<br>
Size Image : 17694720 4096<em>2160</em>2<br>
Colorspace : sRGB<br>
Transfer Function : Rec. 709</p></div>