GithubHelp home page GithubHelp logo

Comments (8)

raymanfx avatar raymanfx commented on August 26, 2024

What kind of camera are you using?
Please add the active format and parameters you are using. Also, are you running a release or debug mode build?

from libv4l-rs.

mijoharas avatar mijoharas commented on August 26, 2024

Hey, I'm using a pretty standard laptop webcam (goes up to 720p, and with MJPEG it'll do 30FPS, slightly lower on YUYV).
I've tried both release and debug.
I messed around with a few different formats (and shrinking it right down to eliminate a slow processor or something as an issue).

Here is some output from a couple of frames of stream_capture_mmap:

Using device: /dev/video0

Active format:
width          : 320
height         : 180
fourcc         : YUYV
field          : progressive
stride         : 640
size           : 115200
colorspace     : sRGB
quantization   : default
transfer       : default transfer function

Active parameters:
capabilities : TIME_PER_FRAME
modes        : (empty)
interval     : 1/30 [s]

Buffer
  sequence  : 2
  timestamp : 1665.073533 [s]
  flags     : MAPPED | TIMESTAMP_MONOTONIC | TSTAMP_SRC_SOE
  length    : 115200
Buffer
  sequence  : 3
  timestamp : 1665.205535 [s]
  flags     : MAPPED | TIMESTAMP_MONOTONIC | TSTAMP_SRC_SOE
  length    : 115200

FPS: 7.462410290914528
MB/s: 0.8201908832008339

Also, for info here is the formats supported from v4l2-ctl:

v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'YUYV' (YUYV 4:2:2)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 960x540
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 848x480
			Interval: Discrete 0.050s (20.000 fps)
		Size: Discrete 640x360
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 424x240
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 352x288
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 320x180
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.100s (10.000 fps)
	[1]: 'MJPG' (Motion-JPEG, compressed)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 960x540
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 848x480
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 640x360
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 424x240
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 352x288
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 320x180
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.033s (30.000 fps)

from libv4l-rs.

mijoharas avatar mijoharas commented on August 26, 2024

Also, one thing to note, it seems to be consistently very close to 7.5 FPS. it's not a rough number, and it's never been anything else during my testing. (I can't fully remember what it was when I was testing the other day, but wouldn't be surprised if it was the same).

from libv4l-rs.

raymanfx avatar raymanfx commented on August 26, 2024

I'm afraid I can't reproduce this using my Logitech C922 Pro Stream - I'm getting consistent 30 FPS in MJPG or 20-30 in YUYV. What kind of frame times are you getting when using v4l2-ctl for mmap streaming?

from libv4l-rs.

mijoharas avatar mijoharas commented on August 26, 2024

Oh wow... this is strange...:

time v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=frame.raw --stream-count=100                                                                                                                                                         
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.15 fps, dropped buffers: 1
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.14 fps
<<<<<<<<<<<<<<<<<< 26.12 fps
<<<<<<<<<<< 22.37 fps
<<<<<<<< 19.25 fps

I then Ctrl+C-ed it, and did it again afterwards:

 time v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=frame.raw --stream-count=1000
 <<<<<<<< 7.52 fps, dropped buffers: 1
<<<<<<<< 7.50 fps
<<<<<<< 7.51 fps
<<<<<<< 7.50 fps
<<<<<<<< 7.50 fps
<<<<<<< 7.50 fps

I wonder what could be causing this...

Thanks for your help. I guess I'll close this issue, as it doesn't seem to be to do with this library.

If you have any ideas for places I could look do let me know, but I'll dig into this by myself.

(and thanks for the tip, didn't realise you could stream directly from v4l2-ctl).

from libv4l-rs.

mijoharas avatar mijoharas commented on August 26, 2024

oh wow... I figured it out, that was quick https://stackoverflow.com/questions/46228379/v4l2-framerate-drops

moving to a brighter room sorts it out. Sorry for the distraction!

time v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=frame.raw --stream-count=1000                                                                                                                                             INT ↵  5s    default 🐍  2.6.3   
<<<<<<<< 7.52 fps, dropped buffers: 1
<<<<<<<<<<<<<< 10.83 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 17.17 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 20.36 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 22.29 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 23.59 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 24.50 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 25.20 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 25.73 fps
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 30.08 fps

from libv4l-rs.

mijoharas avatar mijoharas commented on August 26, 2024

that explains why the framerate seems to drop when I code at night 😄

from libv4l-rs.

raymanfx avatar raymanfx commented on August 26, 2024

Oh sorry, I could have saved you some time there :D
Most, if not all, laptop cameras are really garbage products and way too sensitive to changing light conditions.

from libv4l-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.