mjpg-streamer 2 USB Web Cam

puma
Hi Vladimir,

As I have a working mjpg-streamer in my mini2440 with your kind support to
my queries on the other topic http://www.friendlyarm.net/forum/topic/279

This time I'm trying to add 1 more USB web cam which I bought yesterday. I
tried to plug-it in to my usb hub and it was detected in the system.
However, I noticed that, only 1 usb web cam is working well which is my old
usb web cam (with YUV format) which I bought 6 mos. ago. Anyway, to make
the story short, my new USB web cam has a jpeg format. With these 2
different formats of USB web cam the syntax LD_LIBRARY_PATH="$(pwd)"
./mjpg_streamer -o "output_http.so -w ./www -c UsErNaMe:SeCrEt" -i
"input_uvc.so -y"

only activated YUV format.

BTW, my new usb web cam (jpeg format) is working well using ./start_uvc.sh
when I tested it alone (plugged in my usb hub) without my old usb web cam.

Please advise.

Thanks,
Puma

Vladimir Fonov
Hello,


did you specify the device name for the second camera? Also, you have to
use different port numbers. I.e:

starting the first camera:

LD_LIBRARY_PATH="/home/puma" /home/puma/mjpg_streamer -o "output_http.so -w
/home/puma/www -c UsErNaMe:SeCrEt -p 8080" -i "input_uvc.so -y -d
/dev/video1"

starting the second camera:

LD_LIBRARY_PATH="/home/puma" /home/puma/mjpg_streamer -o "output_http.so -w
/home/puma/www -c UsErNaMe:SeCrEt -p 8090" -i "input_uvc.so -d /dev/video2"


then the first camera will show up on the address http://<your mini 2440's
ip>:8080   and the second at http://<your mini 2440's ip>:8090


Although, probably you should only use jpeg mode (without -y switch) for
both cameras if they support it - mini2440 supports only USB Full Speed
mode (12MBps) and there wouldn't be enough bandwidth for both cameras
otherwise.

Vladimir Fonov
p.s. I would also recommend using powered USB hub.

puma
Hi Vladimir,

I managed to configure 2 USB web cam, but this time I used both with YUV
format. The cam 1 is working well, but the cam 2 didn't work due to "No
space left on the device". Is it because of mini2440 only supports USB full
speed mode (12mbps) in which the other cam doesn't have enough space on it?
Is it what do you expect as shown below? Or it's not?

cam 1:
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: YUV
 i: JPEG Quality......: 80
 format asked unavailable get width 352 height 288
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8080
 o: username:password.: yyyy:xxxx
 o: commands..........: enabled

cam 2:
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video1
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: YUV
 i: JPEG Quality......: 80
 format asked unavailable get width 352 height 288
 o: www-folder-path...: ./www/
 o: HTTP TCP port.....: 8090
 o: username:password.: yyyy:xxxx
 o: commands..........: enabled
uvcvideo: Failed to submit URB 0 (-28).
Unable to start capture: No space left on device
 i: Error grabbing frames
s3c2410-ohci s3c2410-ohci: leak ed ffc68200 (#82) state 2

Thanks,
Puma

Vladimir Fonov
Hello,

it means that there is not enough bandwidth. Maybe try to set low fps (i.e
-fps 5) ?

puma
Hi Vladimir,

The fps was already set to 5 as shown above. BTW, I tried to simulate the
problem using my IBM laptop with 2 USB hosts in which my 2 USB web cam was
connected separately, but the same problem "No space left on device" still
exist. Any hint that caused this problem both on mini2440 and on my IBM
laptop? Does MJPG-Streamer can only support 1 USB cam? Please advise.

Thanks,
Puma

puma
Hi Vladimir,

I got the solution for using 2 usb web cams on mini2440. basically, the
problem on "No space left on device" will happen if both camera are using
the same format (e.g., YUV). I configured my mini2440 by using video0 for
YUV and video1 for MJPEG formats. For now, my mini2440 works with 2 usb
cams.

Thanks,
Puma

worthing
Hi puma:
  I have the same question with you ,but the format of usb cams is both
JPEG.Please advise.

Thanks,

  worthing

puma
Hi worthing,

Cams with the same format won't work for 2 usb cam. Only 1 usb cam will
work.

Thanks,
Puma

worthing
My program can run,but if the size of JPEG  is large, the usb disconnect
automatically.  Tips are as follows:

zc3xx: probe 2wr ov vga 0x0000                                             
    
gspca: usb_submit_urb alt 6 err -28                                        
    
s3c2410-ohci s3c2410-ohci: leak ed ffcbe080 (#81) state 2                  
    
zc3xx: probe 2wr ov vga 0x0000                                             
    
gspca: usb_submit_urb alt 5 err -28                                        
    
s3c2410-ohci s3c2410-ohci: leak ed ffcbe240 (#81) state 2                  
    
zc3xx: probe 2wr ov vga 0x0000                                             
    
gspca: usb_submit_urb alt 4 err -28                                        
    
s3c2410-ohci s3c2410-ohci: leak ed ffcbe280 (#81) state 2                  
    
zc3xx: probe 2wr ov vga 0x0000

Andy
I just read that I only can run one process with the same format - hm - is
there ANY way to have two sources with the same format on one machine or is
there a workaround?

At the end I need the jpg from two cams on the client and i get them with
an own written java-program which probably can do a conversion if I run the
processes in different formats.
Or can I do a conversion using another tool on the server?

Any creative ideas are welcome ;-)

The command looks as follows:

mjpg_streamer -i "input_uvc.so -d /dev/video0 -f 5 -r 1920x1080" -o
"output_http.so -w ./ -p 8081" &

Kind regards
Andy

TungPham
Maybe when you plug usb-hub, it works at usb1.1 speed :)
I have same issue when plug usb keyboard, usb webcam. Some character is
missing when i use both of them.

Here is i read from wikipedia: http://en.wikipedia.org/wiki/USB_hub
To allow high-speed devices to operate in their fastest mode all hubs
between the devices and the computer must be high speed. High-speed devices
should fall back to full-speed when plugged in to a full-speed hub (or
connected to an older full-speed computer port)

Anyway, try to check your usb-hub speed( hight-speed USB2.0 or full-speed
USB1.0)

Andy
Probably I don't understand you.
I think that an USB hub can't solve the problem.

I have two cams - and I need two mjpg_streamer processes running and there
is a limitation ...

lfgh
No space left on device, can be solve plugin the second cam over a
different usb "bus",check it with lsusb command. two webcam canīt be work
over the same usb 1.1 "bus".

chethan
/MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: YUV
 i: JPEG Quality......: 80
Unable to map buffer: Invalid argument
 Init v4L2 failed !! exit fatal 
 i: init_VideoIn failed
[1] + Done(127)                  AT S7=45 S0=0 L1 V1 X4


how to solve this error, please, help as soon as possible

chethan R
could anyone tell me how to write html code to view streams of 2 cameras in
a single webpage. plz reply as soon as possible. thanks in advance

srinivas
Hi Vladimir,
i am srinivas,how you managed two webcams stream at a time.
I have connected two webcam to ubuntu 12.04.

Chris L
I know this is a few months old but in case anyone is still wondering ...

I managed to get 2 webcams streaming both as MJPG format. There are several
forums saying it can't be done. It can.

You have to specify both webcams in 2 separate lines within a script (just
Google "livestream.sh"). Each line must include the "-d" switch to specify
which webcam, in my case these are "/dev/video0" and "/dev/video1". Also,
each webcam must be assigned its own port. In my case it is "8080" and
"8090".

I have my resolution quite low, and left the frame rate and quality to
default. But it works fine, stutter free and no delay.

mjpg_streamer -i "/usr/lib/input_uvc.so -n -r 640x320 -d /dev/video0" -o
"/usr/lib/output_http.so -p 8080 -w ./www"
mjpg_streamer -i "/usr/lib/input_uvc.so -n -r 640x320 -d /dev/video1" -o
"/usr/lib/output_http.so -p 8090 -w ./www"

Hope this helps someone.

Cheers
Chris.

hariom pandya
hello,

   i want to use 4 USB Web cam is it possible if yes please suggest me how?