pikvm / ustreamer

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

Second capture card causes: "Unable to start capturing: No space left on device" #53

Closed vedranius closed 3 years ago

vedranius commented 3 years ago

I have two same capture cards and if I try to stream simultaneously from both cards I get this error: -- ERROR [247.685 stream] -- Unable to start capturing: No space left on device

My code: ./ustreamer --device=/dev/video1 --host=0.0.0.0 --port=12346 -r 1920x1080 -m JPEG -f 30

And second one: ./ustreamer --device=/dev/video3 --host=0.0.0.0 --port=12345 -r 1920x1080 -m JPEG -f 30

SD card is 256GB so there should be enough space.

Tnx!

mdevaev commented 3 years ago

Hello, which capture cards do you use?

vedranius commented 3 years ago

Using these which uses MJPG for encoding. https://www.aliexpress.com/item/4000917130635.html So far, it works great with all of the software I've tested, and with Ustreamer, but only if I run one.

mdevaev commented 3 years ago

So other programs don't work when you try to use two devices at once? I remembered that I was once told about a similar problem, but with cameras. Perhaps this is also your case. If other programs are buggy in the same way, it is a kernel bug. Ustreamer does not have its own drivers and uses the V4L2 API to get the image. If the driver can't handle two cameras, then I can't do anything about it. As for the capture card: yes, it works via the uvcvideo driver, they look like webcams for the OS.

vedranius commented 3 years ago

No, I can use any number of these cards in software Ive tested. This only didnt worked in Ustreamer.

mdevaev commented 3 years ago

Okay. Plz give me an example of the program and startup parameters for two devices.

vedranius commented 3 years ago

For now Ive just tested it with OBS Studio, vMix and Dicaffeine (only supports 1 output right now).

mdevaev commented 3 years ago

And the camera settings were the same? The error you are seeing may be due to insufficient controller bandwidth.

Could you try this? https://github.com/jacksonliam/mjpg-streamer

mdevaev commented 3 years ago

Proof: https://stackoverflow.com/questions/11394712/libv4l2-error-turning-on-stream-no-space-left-on-device

vedranius commented 3 years ago

Proof: https://stackoverflow.com/questions/11394712/libv4l2-error-turning-on-stream-no-space-left-on-device

Yeah! I think that was the case! Tnx! I've tried now MJPG streamer and I've set resolution to 1920x1080 first and that didn't worked out for two devices. Then I've changed it to 1280x720 and that works great ;)

I'll try Ustreamer too later on.

vedranius commented 3 years ago

Moved one device to different USB bus (chip) and now it's fine even at 1920x1080.

vedranius commented 3 years ago

Testing with two same devices on Orange Pi 3 running Armbian and it works great! :) Doing 1920x1080.

./ustreamer --device=/dev/video1 --host=0.0.0.0 --port=12345 -r 1920x1080 -m JPEG -f 30 - an FHD action camera, capture card connected to USB 3.0 ./ustreamer --device=/dev/video3 --host=0.0.0.0 --port=12346 -r 1920x1080 -m JPEG -f 30 - laptop FHD YouTube video, capture card connected to USB 2.0

vedranius commented 3 years ago

@mdevaev If I should open another case, it's fine. But, is there a way to add an audio from capture card too? Tnx!

mdevaev commented 3 years ago

Glad to hear that it works.

MJPG does not contain an audio channel, so this cannot be done using ustreamer. Perhaps in the future I will add the ability to transmit audio in a separate stream. Right now you can use ffmpeg or something like that for audio stream. For video you can keep ustreamer.