[SOLVED] [Ubuntu, vlcj] Multiple camera streams fails (v4l2)

This forum is about all development around libVLC.
vale4674
Blank Cone
Blank Cone
Posts: 32
Joined: 29 Sep 2011 12:50

[SOLVED] [Ubuntu, vlcj] Multiple camera streams fails (v4l2)

Postby vale4674 » 29 Nov 2011 12:37

I am using vlcj library for my project and finished developing on Windows. Now I am upgrading it for Linux usage. And now I see that libvlc is acting better on Windows that on Linux.

Eg. On windows I can run multiple cameras at once and stream into files (dshow://). Now on Linux I use v4l2:// and only one camera can be streamed at once.
Can I fix this somehow? Is it libvlc issue or Linux issue?
Here is the output that I think comes from VLC:

[0x9a13d8c] v4l2 demux error: VIDIOC_STREAMON failed
[0x9a13d8c] v4l2 demux error: cannot set input (Device or resource busy)
[0x9a9a86c] v4l2 access error: VIDIOC_STREAMON failed
[0x9a9a86c] v4l2 access error: cannot set input (Device or resource busy)
[0x9a584bc] main input error: open of `v4l2:///dev/video1' failed: (null)
[0x9a584bc] main input error: Your input can't be opened
[0x9a584bc] main input error: VLC is unable to open the MRL 'v4l2:///dev/video1'. Check the log for
Last edited by vale4674 on 29 Nov 2011 23:13, edited 1 time in total.

Rémi Denis-Courmont
Developer
Developer
Posts: 15323
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: [Ubuntu, vlcj] Multiple camera streams fails (v4l2)

Postby Rémi Denis-Courmont » 29 Nov 2011 14:36

"Device or resource busy" is an error from the Linux kernel that the device is already being streamed by another program.
Most probably you're trying to stream the same camera multiple times. This is never going to work.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

vale4674
Blank Cone
Blank Cone
Posts: 32
Joined: 29 Sep 2011 12:50

Re: [Ubuntu, vlcj] Multiple camera streams fails (v4l2)

Postby vale4674 » 29 Nov 2011 15:12

"Device or resource busy" is an error from the Linux kernel that the device is already being streamed by another program.
Most probably you're trying to stream the same camera multiple times. This is never going to work.
Hey.
This sure is not the problem because I tried all of this with VLC player application.

I open one VLC instance and Open Capture Device and give to it /dev/video0 and the green light on that camera turns on (indicating that it is opened) and I see stream from that camera in VLC window.

Then I open another VLC instance and give to it /dev/video1 and then on that second camera green light turns on (and stays on until I close that VLC instance) but I don't see anything in VLC window and this messages prints in messages window:

Code: Select all

v4l2 error: cannot set input (Device or resource busy) v4l2 error: cannot set input (Device or resource busy) v4l2 error: cannot set input (Device or resource busy) v4l2 error: cannot set input (Device or resource busy) main error: open of `v4l2:///dev/video1' failed: (null)
If I first start /dev/video1 in one VLC instance and then /dev/video0 in second VLC instance the same thing happens (only the first started camera is streaming).

What could be the cause of this problem? This looks like it is v4l2 problem but I don't think it should be.

Rémi Denis-Courmont
Developer
Developer
Posts: 15323
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: [Ubuntu, vlcj] Multiple camera streams fails (v4l2)

Postby Rémi Denis-Courmont » 29 Nov 2011 15:52

If you don't like my explanation, you're free to invent your own. The fact remains that the kernel returns EBUSY and VLC cannot do anything about that.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

vale4674
Blank Cone
Blank Cone
Posts: 32
Joined: 29 Sep 2011 12:50

Re: [Ubuntu, vlcj] Multiple camera streams fails (v4l2)

Postby vale4674 » 29 Nov 2011 16:11

If you don't like my explanation, you're free to invent your own. The fact remains that the kernel returns EBUSY and VLC cannot do anything about that.
It's not that I don't like yours explanation but for a while I've been on this forum and although I got here very useful informations, every time I felt negative vibe from admin/developers on their answers. I understand that when someone asks some question which requires 2min of googleing, but when the problem is deeper (like mine) and specific then it shouldn't be so.

I explained my scenario step-by-step and basically got the answer, "It doesn't work". I know that myself.

I asked if this is VLC issue or v4l2 issue so I could better diagnose the cause of the problem.

Rémi Denis-Courmont
Developer
Developer
Posts: 15323
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: [Ubuntu, vlcj] Multiple camera streams fails (v4l2)

Postby Rémi Denis-Courmont » 29 Nov 2011 16:52

STREAMON returning EBUSY means another program is already streaming the same video device. You can read the V4L2 documentation for yourself.

And I have no problem opening video0 and video1 simultaneously with VLC 1.1.12 nor HEAD.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

vale4674
Blank Cone
Blank Cone
Posts: 32
Joined: 29 Sep 2011 12:50

Re: [SOLVED] [Ubuntu, vlcj] Multiple camera streams fails (v

Postby vale4674 » 29 Nov 2011 23:14

Solved this, everything is in this post viewtopic.php?f=13&t=74077#p270135.

Who would've known...


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests