Jump to content
  • 0

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


dmorse
 Share

Question

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

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

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

 

Link to comment
Share on other sites

Search Before Posting!

  • 0

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);

 

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...