Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Incorrect buffer size with the OV5640 (CAM500B) on the nanopi neo air

Featured Replies

I've updated to the latest kernel code, rebuilt and I I can now see /dev/video when I call "modprobe ov5640; modprobe vfe_v4l2" after booting into the nanopi. However, when I run the following

 

ffmpeg -re -i /dev/video0 -c:v libx265 -preset ultrafast -x265-params crf=23 -f h264 ./out.mp4 

 

I get the following error error

 

[video4linux2,v4l2 @ 0x1a9a7f0] Dequeued v4l2 buffer contains 40960 bytes, but 38016 were expected. Flags: 0x00000001.

 

 

The video format is yuv420p, 176x144,  so it should be 176*144*1.5 bytes = 38016bytes. However the buffer seems to be slightly larger. 

 

 

I have written a few small c programs of my own and no matter what there seems to be a bit of extra bytes in the buffer. 

 

output of dmesg is attached. 

 

 

dmesg.out

  • Author

I've managed to track this down to this line in videobuf-core.c 

 

b->bytesused = vb->size;

vb->size seems to the the size of the whole buffer, but the actual buffer used is a bit smaller. I was goign to modify this to use 

 

b->bytesused = vb->bytesperline * vb->height;

But after adding a printk to my kernel I can see that bytesperline is 0

 

  • Author

I've also taken a look at vb->bsize, but that has the same value as vb->size as far as I can see, 

  • Author

I've bug a bit further with this. Looks like vb.size gets at in sunxi-vfe/vfe.c in the function buffer prepare.

 

buf->vb.size = dev->buf_byte_size;

dev->buf_byte_size is set from the bsp in vidioc_s_fmt_vid_cap

 

dev->buf_byte_size = bsp_isp_set_size(isp_fmt,&size_settings);

 

 

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.