pikvm / ustreamer

µStreamer - Lightweight and fast MJPEG-HTTP streamer
https://pikvm.org
GNU General Public License v3.0
1.67k stars 226 forks source link

Repeated `CAP: Device select() timeout` #284

Open jamincollins opened 1 month ago

jamincollins commented 1 month ago

I have an Arducam 5MP Camera and can't seem to get it streaming reliably under ustreamer.

Device details:

$ v4l2-ctl --list-devices
Arducam 5MP Camera Module: Ardu (usb-0000:c2:00.3-1.2):
    /dev/video0
    /dev/video1
    /dev/media0
$ v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
    Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 800x600
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 1024x768
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 1280x960
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 1600x1200
            Interval: Discrete 0.067s (15.000 fps)
        Size: Discrete 2048x1536
            Interval: Discrete 0.067s (15.000 fps)
        Size: Discrete 2592x1944
            Interval: Discrete 0.067s (15.000 fps)
        Size: Discrete 1920x1080
            Interval: Discrete 0.033s (30.000 fps)
    [1]: 'YUYV' (YUYV 4:2:2)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 800x600
            Interval: Discrete 0.050s (20.000 fps)
        Size: Discrete 1024x768
            Interval: Discrete 0.100s (10.000 fps)
        Size: Discrete 1280x720
            Interval: Discrete 0.100s (10.000 fps)
        Size: Discrete 1280x960
            Interval: Discrete 0.133s (7.500 fps)
        Size: Discrete 1600x1200
            Interval: Discrete 0.133s (7.500 fps)
        Size: Discrete 2048x1536
            Interval: Discrete 0.500s (2.000 fps)
        Size: Discrete 2592x1944
            Interval: Discrete 0.500s (2.000 fps)
        Size: Discrete 1920x1080
            Interval: Discrete 0.200s (5.000 fps)

I can get a consistent stream from it via vlc with the following command:

$ vlc v4l2:///dev/video0:chroma=MJPEG

When trying stream through ustreamer:

$ ./ustreamer
-- INFO  [543179.118          ] -- Starting PiKVM uStreamer 6.12 ...
-- INFO  [543179.118          ] -- HTTP: Listening HTTP on [127.0.0.1]:8080
-- INFO  [543179.118          ] -- Using V4L2 device: /dev/video0
-- INFO  [543179.118          ] -- HTTP: Starting eventloop ...
-- INFO  [543179.118          ] -- CAP: Using capture type: single-planar
-- INFO  [543179.118          ] -- CAP: Using input channel: 0
-- INFO  [543179.147          ] -- CAP: Using resolution: 640x480
-- INFO  [543179.147          ] -- CAP: Using format: YUYV
-- INFO  [543179.178          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- INFO  [543179.178          ] -- CAP: Using IO method: MMAP
-- INFO  [543179.179          ] -- CAP: Requested 5 device buffers, got 5
-- INFO  [543179.201          ] -- CAP: Capturing started
-- INFO  [543179.201          ] -- Using JPEG quality: 80%
-- INFO  [543179.201          ] -- Creating pool JPEG with 4 workers ...
-- INFO  [543179.201          ] -- Capturing ...
-- ERROR [543182.238          ] -- CAP: Device select() timeout
-- INFO  [543182.334          ] -- Destroying workers pool JPEG ...
-- INFO  [543182.336          ] -- CAP: Capturing stopped
================================================================================
-- INFO  [543182.336          ] -- Using V4L2 device: /dev/video0
-- INFO  [543182.336          ] -- CAP: Using capture type: single-planar
-- INFO  [543182.336          ] -- CAP: Using input channel: 0
-- INFO  [543184.567          ] -- CAP: Using resolution: 640x480
-- INFO  [543184.567          ] -- CAP: Using format: YUYV
-- INFO  [543184.597          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- INFO  [543184.597          ] -- CAP: Using IO method: MMAP
-- INFO  [543184.597          ] -- CAP: Requested 5 device buffers, got 5
-- INFO  [543184.608          ] -- CAP: Capturing started
-- INFO  [543184.608          ] -- Using JPEG quality: 80%
-- INFO  [543184.608          ] -- Creating pool JPEG with 4 workers ...
-- INFO  [543184.609          ] -- Capturing ...
-- ERROR [543187.158          ] -- CAP: Device select() timeout
-- INFO  [543187.258          ] -- Destroying workers pool JPEG ...
-- INFO  [543187.264          ] -- CAP: Capturing stopped
================================================================================
-- INFO  [543187.265          ] -- Using V4L2 device: /dev/video0
-- INFO  [543187.265          ] -- CAP: Using capture type: single-planar
-- INFO  [543187.265          ] -- CAP: Using input channel: 0
-- INFO  [543189.492          ] -- CAP: Using resolution: 640x480
-- INFO  [543189.492          ] -- CAP: Using format: YUYV
-- INFO  [543189.524          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- INFO  [543189.524          ] -- CAP: Using IO method: MMAP
-- INFO  [543189.525          ] -- CAP: Requested 5 device buffers, got 5
-- INFO  [543189.536          ] -- CAP: Capturing started
-- INFO  [543189.536          ] -- Using JPEG quality: 80%
-- INFO  [543189.536          ] -- Creating pool JPEG with 4 workers ...
-- INFO  [543189.537          ] -- Capturing ...
-- ERROR [543193.609          ] -- CAP: Device select() timeout
-- INFO  [543193.658          ] -- Destroying workers pool JPEG ...
-- INFO  [543193.664          ] -- CAP: Capturing stopped
================================================================================
$ ./ustreamer --format MJPEG
-- INFO  [543107.002          ] -- Starting PiKVM uStreamer 6.12 ...
-- INFO  [543107.002          ] -- HTTP: Listening HTTP on [127.0.0.1]:8080
-- INFO  [543107.002          ] -- Using V4L2 device: /dev/video0
-- INFO  [543107.002          ] -- HTTP: Starting eventloop ...
-- INFO  [543107.002          ] -- CAP: Using capture type: single-planar
-- INFO  [543107.002          ] -- CAP: Using input channel: 0
-- INFO  [543107.031          ] -- CAP: Using resolution: 640x480
-- INFO  [543107.032          ] -- CAP: Using format: MJPEG
-- INFO  [543107.062          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- ERROR [543107.063          ] -- CAP: Device doesn't support setting of HW encoding quality parameters
-- INFO  [543107.063          ] -- CAP: Using IO method: MMAP
-- INFO  [543107.063          ] -- CAP: Requested 5 device buffers, got 5
-- INFO  [543107.072          ] -- CAP: Capturing started
-- INFO  [543107.072          ] -- Switching to HW encoder: the input is (M)JPEG ...
-- INFO  [543107.072          ] -- Using JPEG quality: encoder default
-- INFO  [543107.072          ] -- Creating pool JPEG with 1 workers ...
-- INFO  [543107.073          ] -- Capturing ...
-- ERROR [543112.690          ] -- CAP: Device select() timeout
-- INFO  [543112.785          ] -- Destroying workers pool JPEG ...
-- INFO  [543112.801          ] -- CAP: Capturing stopped
================================================================================
-- INFO  [543112.801          ] -- Using V4L2 device: /dev/video0
-- INFO  [543112.801          ] -- CAP: Using capture type: single-planar
-- INFO  [543112.801          ] -- CAP: Using input channel: 0
-- INFO  [543115.028          ] -- CAP: Using resolution: 640x480
-- INFO  [543115.028          ] -- CAP: Using format: MJPEG
-- INFO  [543115.059          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- ERROR [543115.059          ] -- CAP: Device doesn't support setting of HW encoding quality parameters
-- INFO  [543115.059          ] -- CAP: Using IO method: MMAP
-- INFO  [543115.060          ] -- CAP: Requested 5 device buffers, got 5
-- INFO  [543115.072          ] -- CAP: Capturing started
-- INFO  [543115.072          ] -- Switching to HW encoder: the input is (M)JPEG ...
-- INFO  [543115.072          ] -- Using JPEG quality: encoder default
-- INFO  [543115.072          ] -- Creating pool JPEG with 1 workers ...
-- INFO  [543115.073          ] -- Capturing ...
-- ERROR [543117.526          ] -- CAP: Device select() timeout
-- INFO  [543117.627          ] -- Destroying workers pool JPEG ...
-- INFO  [543117.633          ] -- CAP: Capturing stopped
================================================================================

With --debug:

$ ./ustreamer --format MJPEG --debug
-- INFO  [543231.634          ] -- Starting PiKVM uStreamer 6.12 ...
-- DEBUG [543231.634          ] -- Installing SIGINT handler ...
-- DEBUG [543231.634          ] -- Installing SIGTERM handler ...
-- DEBUG [543231.634          ] -- Ignoring SIGPIPE ...
-- DEBUG [543231.634          ] -- HTTP: Binding HTTP to [127.0.0.1]:8080 ...
-- INFO  [543231.634          ] -- HTTP: Listening HTTP on [127.0.0.1]:8080
-- INFO  [543231.634          ] -- HTTP: Starting eventloop ...
-- DEBUG [543231.634          ] -- CAP: Opening capture device ...
-- DEBUG [543231.634          ] -- CAP: Capture device fd=8 opened
-- INFO  [543231.634          ] -- Using V4L2 device: /dev/video0
-- DEBUG [543231.634          ] -- CAP: Querying device capabilities ...
-- INFO  [543231.634          ] -- CAP: Using capture type: single-planar
-- INFO  [543231.634          ] -- CAP: Using input channel: 0
-- DEBUG [543231.635          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [543231.635          ] -- CAP: Probing device format=MJPEG, stride=1280, resolution=640x480 ...
-- DEBUG [543231.651          ] -- HTTP: Repeating exposed ...
-- INFO  [543231.665          ] -- CAP: Using resolution: 640x480
-- INFO  [543231.665          ] -- CAP: Using format: MJPEG
-- DEBUG [543231.665          ] -- CAP: Querying HW FPS ...
-- INFO  [543231.696          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- ERROR [543231.696          ] -- CAP: Device doesn't support setting of HW encoding quality parameters
-- INFO  [543231.696          ] -- CAP: Using IO method: MMAP
-- DEBUG [543231.696          ] -- CAP: Requesting 5 device buffers for MMAP ...
-- INFO  [543231.697          ] -- CAP: Requested 5 device buffers, got 5
-- DEBUG [543231.697          ] -- CAP: Allocating device buffers ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=0 ...
-- DEBUG [543231.697          ] -- CAP: Mapping device buffer=0 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=1 ...
-- DEBUG [543231.697          ] -- CAP: Mapping device buffer=1 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=2 ...
-- DEBUG [543231.697          ] -- CAP: Mapping device buffer=2 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=3 ...
-- DEBUG [543231.697          ] -- CAP: Mapping device buffer=3 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=4 ...
-- DEBUG [543231.697          ] -- CAP: Mapping device buffer=4 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=0 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=1 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=2 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=3 ...
-- DEBUG [543231.697          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=4 ...
-- INFO  [543231.712          ] -- CAP: Capturing started
-- INFO  [543231.712          ] -- Switching to HW encoder: the input is (M)JPEG ...
-- INFO  [543231.712          ] -- Using JPEG quality: encoder default
-- INFO  [543231.712          ] -- Creating pool JPEG with 1 workers ...
-- DEBUG [543231.712          ] -- Hello! I am a worker jw-0 ^_^
-- DEBUG [543231.712          ] -- Worker jw-0 waiting for a new job ...
-- INFO  [543231.713          ] -- Capturing ...
-- DEBUG [543231.713          ] -- CAP: Calling select() on video device ...
-- DEBUG [543232.008          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543232.008          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543232.008          ] -- CAP: Grabbed HW buffer=1: bytesused=88528, grab_ts=543231.928, latency=0.080, skipped=0
-- PERF  [543232.008          ] -- FPS: STREAM-CAPTURED: 0
-- DEBUG [543232.008          ] -- CAP: Calling select() on video device ...
-- VERB  [543232.008          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543232.008          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543232.008          ] -- CAP: HW buffer=1 released
-- DEBUG [543232.660          ] -- HTTP: Repeating exposed ...
-- DEBUG [543232.913          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543232.913          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543232.913          ] -- CAP: Grabbed HW buffer=1: bytesused=88757, grab_ts=543232.828, latency=0.085, skipped=0
-- DEBUG [543232.913          ] -- CAP: Calling select() on video device ...
-- VERB  [543232.913          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543232.918          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543232.918          ] -- CAP: HW buffer=1 released
-- DEBUG [543233.412          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543233.412          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543233.412          ] -- CAP: Grabbed HW buffer=1: bytesused=88611, grab_ts=543233.332, latency=0.080, skipped=0
-- PERF  [543233.412          ] -- FPS: STREAM-CAPTURED: 2
-- VERB  [543233.412          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543233.412          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543233.412          ] -- CAP: HW buffer=1 released
-- DEBUG [543233.412          ] -- CAP: Calling select() on video device ...
-- DEBUG [543233.669          ] -- HTTP: Repeating exposed ...
-- DEBUG [543233.712          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543233.712          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543233.712          ] -- CAP: Grabbed HW buffer=4: bytesused=88600, grab_ts=543233.632, latency=0.080, skipped=0
-- DEBUG [543233.712          ] -- CAP: Calling select() on video device ...
-- VERB  [543233.712          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543233.717          ] -- CAP: Releasing HW buffer=4 ...
-- DEBUG [543233.718          ] -- CAP: HW buffer=4 released
-- DEBUG [543234.676          ] -- HTTP: Repeating exposed ...
-- DEBUG [543234.713          ] -- CAP: Device select() --> 0; has_read=0, has_error=0
-- ERROR [543234.713          ] -- CAP: Device select() timeout
-- INFO  [543234.814          ] -- Destroying workers pool JPEG ...
-- DEBUG [543234.814          ] -- Bye-bye (worker jw-0)
-- DEBUG [543234.814          ] -- CAP: Calling VIDIOC_STREAMOFF ...
-- DEBUG [543234.816          ] -- CAP: Releasing HW buffers ...
-- INFO  [543234.816          ] -- CAP: Capturing stopped
================================================================================
-- DEBUG [543234.817          ] -- CAP: Opening capture device ...
-- DEBUG [543234.817          ] -- CAP: Capture device fd=8 opened
-- INFO  [543234.817          ] -- Using V4L2 device: /dev/video0
-- DEBUG [543234.817          ] -- CAP: Querying device capabilities ...
-- INFO  [543234.817          ] -- CAP: Using capture type: single-planar
-- INFO  [543234.817          ] -- CAP: Using input channel: 0
-- DEBUG [543234.817          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [543234.817          ] -- CAP: Probing device format=MJPEG, stride=1280, resolution=640x480 ...
-- DEBUG [543235.683          ] -- HTTP: Repeating exposed ...
-- DEBUG [543236.690          ] -- HTTP: Repeating exposed ...
-- INFO  [543237.045          ] -- CAP: Using resolution: 640x480
-- INFO  [543237.045          ] -- CAP: Using format: MJPEG
-- DEBUG [543237.045          ] -- CAP: Querying HW FPS ...
-- INFO  [543237.077          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- ERROR [543237.077          ] -- CAP: Device doesn't support setting of HW encoding quality parameters
-- INFO  [543237.077          ] -- CAP: Using IO method: MMAP
-- DEBUG [543237.077          ] -- CAP: Requesting 5 device buffers for MMAP ...
-- INFO  [543237.077          ] -- CAP: Requested 5 device buffers, got 5
-- DEBUG [543237.077          ] -- CAP: Allocating device buffers ...
-- DEBUG [543237.077          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=0 ...
-- DEBUG [543237.077          ] -- CAP: Mapping device buffer=0 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=1 ...
-- DEBUG [543237.078          ] -- CAP: Mapping device buffer=1 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=2 ...
-- DEBUG [543237.078          ] -- CAP: Mapping device buffer=2 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=3 ...
-- DEBUG [543237.078          ] -- CAP: Mapping device buffer=3 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=4 ...
-- DEBUG [543237.078          ] -- CAP: Mapping device buffer=4 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=0 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=1 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=2 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=3 ...
-- DEBUG [543237.078          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=4 ...
-- INFO  [543237.088          ] -- CAP: Capturing started
-- INFO  [543237.088          ] -- Switching to HW encoder: the input is (M)JPEG ...
-- INFO  [543237.088          ] -- Using JPEG quality: encoder default
-- INFO  [543237.088          ] -- Creating pool JPEG with 1 workers ...
-- DEBUG [543237.088          ] -- Hello! I am a worker jw-0 ^_^
-- DEBUG [543237.088          ] -- Worker jw-0 waiting for a new job ...
-- INFO  [543237.089          ] -- Capturing ...
-- DEBUG [543237.089          ] -- CAP: Calling select() on video device ...
-- DEBUG [543237.284          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.284          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.284          ] -- CAP: Grabbed HW buffer=0: bytesused=36950, grab_ts=543237.092, latency=0.192, skipped=0
-- PERF  [543237.284          ] -- FPS: STREAM-CAPTURED: 2
-- DEBUG [543237.284          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.284          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.284          ] -- CAP: Releasing HW buffer=0 ...
-- DEBUG [543237.284          ] -- CAP: HW buffer=0 released
-- DEBUG [543237.332          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.332          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.332          ] -- CAP: Grabbed HW buffer=1: bytesused=88274, grab_ts=543237.284, latency=0.048, skipped=0
-- DEBUG [543237.332          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.332          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.332          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543237.332          ] -- CAP: HW buffer=1 released
-- DEBUG [543237.384          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.384          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.384          ] -- CAP: Grabbed HW buffer=2: bytesused=88422, grab_ts=543237.336, latency=0.048, skipped=0
-- DEBUG [543237.384          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.384          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.389          ] -- CAP: Releasing HW buffer=2 ...
-- DEBUG [543237.389          ] -- CAP: HW buffer=2 released
-- DEBUG [543237.436          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.436          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.436          ] -- CAP: Grabbed HW buffer=3: bytesused=88320, grab_ts=543237.384, latency=0.052, skipped=0
-- DEBUG [543237.436          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.436          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.436          ] -- CAP: Releasing HW buffer=3 ...
-- DEBUG [543237.436          ] -- CAP: HW buffer=3 released
-- DEBUG [543237.484          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.484          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.484          ] -- CAP: Grabbed HW buffer=4: bytesused=88388, grab_ts=543237.436, latency=0.048, skipped=0
-- DEBUG [543237.484          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.484          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.484          ] -- CAP: Releasing HW buffer=4 ...
-- DEBUG [543237.484          ] -- CAP: HW buffer=4 released
-- DEBUG [543237.536          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.536          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.536          ] -- CAP: Grabbed HW buffer=0: bytesused=88348, grab_ts=543237.484, latency=0.052, skipped=0
-- DEBUG [543237.536          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.536          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.536          ] -- CAP: Releasing HW buffer=0 ...
-- DEBUG [543237.536          ] -- CAP: HW buffer=0 released
-- DEBUG [543237.584          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.584          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.584          ] -- CAP: Grabbed HW buffer=1: bytesused=88317, grab_ts=543237.536, latency=0.048, skipped=0
-- DEBUG [543237.584          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.584          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.584          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543237.584          ] -- CAP: HW buffer=1 released
-- DEBUG [543237.636          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.636          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.636          ] -- CAP: Grabbed HW buffer=2: bytesused=88459, grab_ts=543237.584, latency=0.052, skipped=0
-- DEBUG [543237.636          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.636          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.641          ] -- CAP: Releasing HW buffer=2 ...
-- DEBUG [543237.641          ] -- CAP: HW buffer=2 released
-- DEBUG [543237.684          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.684          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.684          ] -- CAP: Grabbed HW buffer=3: bytesused=88308, grab_ts=543237.636, latency=0.048, skipped=0
-- DEBUG [543237.684          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.684          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.684          ] -- CAP: Releasing HW buffer=3 ...
-- DEBUG [543237.684          ] -- CAP: HW buffer=3 released
-- DEBUG [543237.700          ] -- HTTP: Repeating exposed ...
-- DEBUG [543237.736          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.736          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.736          ] -- CAP: Grabbed HW buffer=4: bytesused=88310, grab_ts=543237.684, latency=0.052, skipped=0
-- DEBUG [543237.736          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.736          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.736          ] -- CAP: Releasing HW buffer=4 ...
-- DEBUG [543237.736          ] -- CAP: HW buffer=4 released
-- DEBUG [543237.884          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.884          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.884          ] -- CAP: Grabbed HW buffer=1: bytesused=88393, grab_ts=543237.804, latency=0.080, skipped=0
-- DEBUG [543237.884          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.884          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.889          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543237.889          ] -- CAP: HW buffer=1 released
-- DEBUG [543237.936          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543237.936          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543237.936          ] -- CAP: Grabbed HW buffer=2: bytesused=88439, grab_ts=543237.884, latency=0.052, skipped=0
-- DEBUG [543237.936          ] -- CAP: Calling select() on video device ...
-- VERB  [543237.936          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543237.936          ] -- CAP: Releasing HW buffer=2 ...
-- DEBUG [543237.936          ] -- CAP: HW buffer=2 released
-- DEBUG [543238.236          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543238.236          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543238.236          ] -- CAP: Grabbed HW buffer=0: bytesused=88323, grab_ts=543238.156, latency=0.080, skipped=0
-- PERF  [543238.236          ] -- FPS: STREAM-CAPTURED: 12
-- DEBUG [543238.236          ] -- CAP: Calling select() on video device ...
-- VERB  [543238.236          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543238.236          ] -- CAP: Releasing HW buffer=0 ...
-- DEBUG [543238.236          ] -- CAP: HW buffer=0 released
-- DEBUG [543238.436          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543238.436          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543238.436          ] -- CAP: Grabbed HW buffer=2: bytesused=88409, grab_ts=543238.268, latency=0.168, skipped=0
-- DEBUG [543238.436          ] -- CAP: Calling select() on video device ...
-- VERB  [543238.436          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543238.441          ] -- CAP: Releasing HW buffer=2 ...
-- DEBUG [543238.441          ] -- CAP: HW buffer=2 released
-- DEBUG [543238.488          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543238.488          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543238.488          ] -- CAP: Grabbed HW buffer=3: bytesused=88401, grab_ts=543238.436, latency=0.052, skipped=0
-- DEBUG [543238.488          ] -- CAP: Calling select() on video device ...
-- VERB  [543238.488          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543238.493          ] -- CAP: Releasing HW buffer=3 ...
-- DEBUG [543238.493          ] -- CAP: HW buffer=3 released
-- DEBUG [543238.536          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543238.536          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543238.536          ] -- CAP: Grabbed HW buffer=4: bytesused=88350, grab_ts=543238.488, latency=0.048, skipped=0
-- DEBUG [543238.536          ] -- CAP: Calling select() on video device ...
-- VERB  [543238.536          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543238.536          ] -- CAP: Releasing HW buffer=4 ...
-- DEBUG [543238.536          ] -- CAP: HW buffer=4 released
-- DEBUG [543238.588          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543238.588          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543238.588          ] -- CAP: Grabbed HW buffer=0: bytesused=88387, grab_ts=543238.536, latency=0.052, skipped=0
-- DEBUG [543238.588          ] -- CAP: Calling select() on video device ...
-- VERB  [543238.588          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543238.588          ] -- CAP: Releasing HW buffer=0 ...
-- DEBUG [543238.588          ] -- CAP: HW buffer=0 released
-- DEBUG [543238.706          ] -- HTTP: Repeating exposed ...
-- DEBUG [543239.340          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543239.340          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543239.340          ] -- CAP: Grabbed HW buffer=2: bytesused=88683, grab_ts=543239.260, latency=0.080, skipped=0
-- PERF  [543239.340          ] -- FPS: STREAM-CAPTURED: 5
-- DEBUG [543239.340          ] -- CAP: Calling select() on video device ...
-- VERB  [543239.340          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543239.340          ] -- CAP: Releasing HW buffer=2 ...
-- DEBUG [543239.340          ] -- CAP: HW buffer=2 released
-- DEBUG [543239.716          ] -- HTTP: Repeating exposed ...
-- DEBUG [543239.840          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543239.840          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543239.840          ] -- CAP: Grabbed HW buffer=2: bytesused=90763, grab_ts=543239.792, latency=0.048, skipped=0
-- DEBUG [543239.840          ] -- CAP: Calling select() on video device ...
-- VERB  [543239.840          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543239.840          ] -- CAP: Releasing HW buffer=2 ...
-- DEBUG [543239.840          ] -- CAP: HW buffer=2 released
-- DEBUG [543239.892          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543239.892          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543239.892          ] -- CAP: Grabbed HW buffer=3: bytesused=90779, grab_ts=543239.840, latency=0.052, skipped=0
-- DEBUG [543239.892          ] -- CAP: Calling select() on video device ...
-- VERB  [543239.892          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543239.897          ] -- CAP: Releasing HW buffer=3 ...
-- DEBUG [543239.897          ] -- CAP: HW buffer=3 released
-- DEBUG [543239.940          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543239.940          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543239.940          ] -- CAP: Grabbed HW buffer=4: bytesused=90504, grab_ts=543239.892, latency=0.048, skipped=0
-- DEBUG [543239.940          ] -- CAP: Calling select() on video device ...
-- VERB  [543239.940          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543239.940          ] -- CAP: Releasing HW buffer=4 ...
-- DEBUG [543239.940          ] -- CAP: HW buffer=4 released
-- DEBUG [543240.723          ] -- HTTP: Repeating exposed ...
-- DEBUG [543240.941          ] -- CAP: Device select() --> 0; has_read=0, has_error=0
-- ERROR [543240.941          ] -- CAP: Device select() timeout
-- INFO  [543240.999          ] -- Destroying workers pool JPEG ...
-- DEBUG [543240.999          ] -- Bye-bye (worker jw-0)
-- DEBUG [543240.999          ] -- CAP: Calling VIDIOC_STREAMOFF ...
-- DEBUG [543241.024          ] -- CAP: Releasing HW buffers ...
-- INFO  [543241.024          ] -- CAP: Capturing stopped
================================================================================
-- DEBUG [543241.024          ] -- CAP: Opening capture device ...
-- DEBUG [543241.024          ] -- CAP: Capture device fd=8 opened
-- INFO  [543241.024          ] -- Using V4L2 device: /dev/video0
-- DEBUG [543241.024          ] -- CAP: Querying device capabilities ...
-- INFO  [543241.024          ] -- CAP: Using capture type: single-planar
-- INFO  [543241.024          ] -- CAP: Using input channel: 0
-- DEBUG [543241.024          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [543241.024          ] -- CAP: Probing device format=MJPEG, stride=1280, resolution=640x480 ...
-- DEBUG [543241.729          ] -- HTTP: Repeating exposed ...
-- DEBUG [543242.740          ] -- HTTP: Repeating exposed ...
-- INFO  [543243.251          ] -- CAP: Using resolution: 640x480
-- INFO  [543243.251          ] -- CAP: Using format: MJPEG
-- DEBUG [543243.251          ] -- CAP: Querying HW FPS ...
-- INFO  [543243.282          ] -- CAP: Using HW FPS: 0 -> 30 (coerced)
-- ERROR [543243.282          ] -- CAP: Device doesn't support setting of HW encoding quality parameters
-- INFO  [543243.282          ] -- CAP: Using IO method: MMAP
-- DEBUG [543243.282          ] -- CAP: Requesting 5 device buffers for MMAP ...
-- INFO  [543243.282          ] -- CAP: Requested 5 device buffers, got 5
-- DEBUG [543243.282          ] -- CAP: Allocating device buffers ...
-- DEBUG [543243.282          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=0 ...
-- DEBUG [543243.282          ] -- CAP: Mapping device buffer=0 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=1 ...
-- DEBUG [543243.283          ] -- CAP: Mapping device buffer=1 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=2 ...
-- DEBUG [543243.283          ] -- CAP: Mapping device buffer=2 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=3 ...
-- DEBUG [543243.283          ] -- CAP: Mapping device buffer=3 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=4 ...
-- DEBUG [543243.283          ] -- CAP: Mapping device buffer=4 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=0 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=1 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=2 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=3 ...
-- DEBUG [543243.283          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=4 ...
-- INFO  [543243.296          ] -- CAP: Capturing started
-- INFO  [543243.296          ] -- Switching to HW encoder: the input is (M)JPEG ...
-- INFO  [543243.296          ] -- Using JPEG quality: encoder default
-- INFO  [543243.296          ] -- Creating pool JPEG with 1 workers ...
-- DEBUG [543243.296          ] -- Hello! I am a worker jw-0 ^_^
-- DEBUG [543243.297          ] -- Worker jw-0 waiting for a new job ...
-- INFO  [543243.297          ] -- Capturing ...
-- DEBUG [543243.297          ] -- CAP: Calling select() on video device ...
-- DEBUG [543243.492          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543243.492          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543243.492          ] -- CAP: Grabbed HW buffer=0: bytesused=37507, grab_ts=543243.300, latency=0.192, skipped=0
-- PERF  [543243.492          ] -- FPS: STREAM-CAPTURED: 4
-- DEBUG [543243.492          ] -- CAP: Calling select() on video device ...
-- VERB  [543243.493          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543243.498          ] -- CAP: Releasing HW buffer=0 ...
-- DEBUG [543243.498          ] -- CAP: HW buffer=0 released
-- DEBUG [543243.544          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543243.544          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543243.544          ] -- CAP: Grabbed HW buffer=1: bytesused=88595, grab_ts=543243.492, latency=0.052, skipped=0
-- DEBUG [543243.544          ] -- CAP: Calling select() on video device ...
-- VERB  [543243.544          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543243.549          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543243.549          ] -- CAP: HW buffer=1 released
-- DEBUG [543243.746          ] -- HTTP: Repeating exposed ...
-- DEBUG [543243.992          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [543243.992          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [543243.992          ] -- CAP: Grabbed HW buffer=1: bytesused=88382, grab_ts=543243.912, latency=0.080, skipped=0
-- DEBUG [543243.992          ] -- CAP: Calling select() on video device ...
-- VERB  [543243.992          ] -- JPEG: Passed encoding because nobody is watching
-- DEBUG [543243.998          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [543243.998          ] -- CAP: HW buffer=1 released
-- DEBUG [543244.756          ] -- HTTP: Repeating exposed ...
-- DEBUG [543244.994          ] -- CAP: Device select() --> 0; has_read=0, has_error=0
-- ERROR [543244.994          ] -- CAP: Device select() timeout
-- INFO  [543245.094          ] -- Destroying workers pool JPEG ...
-- DEBUG [543245.094          ] -- Bye-bye (worker jw-0)
-- DEBUG [543245.094          ] -- CAP: Calling VIDIOC_STREAMOFF ...
-- DEBUG [543245.120          ] -- CAP: Releasing HW buffers ...
-- INFO  [543245.120          ] -- CAP: Capturing stopped
================================================================================
mdevaev commented 1 month ago

Is it showing something at least between timeouts?

jamincollins commented 1 month ago

Yes a few frames then the no signal notice. Then this cycle repeats. Also worth noting that the mjpeg format works best. The other seems almost like still frames or very low frame rate even though the device details says it should support 30 fps at 640x480.

mdevaev commented 1 month ago

There may be something wrong with the driver. Try --device-timeout=10.

jamincollins commented 1 month ago

That does not appear to resolve the CAP: Device select() timeout.

Here is a capture from the same camera using VLC, as you can see it has no trouble staying connected and getting decent frame rate for the resolution. This is scaled down from the original 1600x1200 capture.

https://github.com/user-attachments/assets/1b535038-97ce-4b0c-b869-3f6423e4c7a0

mdevaev commented 1 month ago

Did you use device timeout with -m MJPEG?

jamincollins commented 1 month ago

Yes. Both the ustreamer and vlc testing has been done with the same format option of MJPEG.

mdevaev commented 1 month ago

I can't say now what's wrong with it. Could you try mjpg-streamer? uStreamer doesn't do anything weird with camera, but maybe there is some difference.

jamincollins commented 2 weeks ago

No change with mjpg-streamer.

James4Ever0 commented 1 week ago

278 #274

James4Ever0 commented 1 week ago

https://github.com/jacksonliam/mjpg-streamer/issues/182#issuecomment-2336575203

James4Ever0 commented 6 days ago

@jamincollins

Solution: https://github.com/jacksonliam/mjpg-streamer/issues/182#issuecomment-2336583229

mdevaev commented 6 days ago

@jamincollins Please check if this is working.