Jump to content

Webcam does not work with motion or other software


thelaw

Recommended Posts

Hello everyone,

 

I am kinda of new to the orange, I think it's fantastic, I worked with rasp for while and I think the orange just slashes it.

Pampering the orange aside, I am trying to hook up an old webcam to the Orange pi lite and I running into some issue, my lsusb info is this:

Bus 003 Device 002: ID 1e4e:0100 Cubeternet WebCam

When I start motion, everything works fine, although when I go on the browser a gray screen comes up saying: unable to open video device

 

I have changed the configuration file of /etc/motion/motion.conf and /etc/default/motion as instructed here:

 

http://www.orangepi.org/Docs/Webcams.html

 

 

Plus I have changed the  with my ip and removed the semicolin

netcam_url

I changed so I can connect

localhost:off

I have tried everything on the net to make it work, it just doesn't, I have even changed multiple cameras that I do know for sure work, but nothing, I don't know what I am doing wrong.

 

Update:

 

The webcam seems to run with mplayer

 

Now motion does not even stream anymore, I did not change anything or touched it

 

FIY I think this is obvious I am running armbian

 

 

Thanks

Link to comment
Share on other sites

Hello thelaw,

 

i was playing around with raspberry pi and motion, but i this was not good.

I changed to "mjpg_streamer" with much more success.

 

Now i use mjpg_streamer on three H3 oranges.

 

Try this as root:

apt-get install subversion-tools libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++ imagemagick v4l-utils

svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer mjpg-streamer

cd mjpg-streamer

make
make install


Test:

sudo mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -y -r 640x480 -f 15" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080"

You can view at:

http://yourdevice:8080/?action=stream

 

If you need more information, just ask...

 

 

Markus

Link to comment
Share on other sites

Hello thelaw,

 

i was playing around with raspberry pi and motion, but i this was not good.

I changed to "mjpg_streamer" with much more success.

 

Now i use mjpg_streamer on three H3 oranges.

 

Try this as root:

apt-get install subversion-tools libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++ imagemagick v4l-utils

svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer mjpg-streamer

cd mjpg-streamer

make
make install


Test:

sudo mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -y -r 640x480 -f 15" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080"

You can view at:

http://yourdevice:8080/?action=stream

 

If you need more information, just ask...

 

 

Markus

OH MAN! Thank you so much, it did it! Thank you thank you! I was struggling with this so much!

Link to comment
Share on other sites

If i understand right, you like to password protect the stream?

use this:

	/usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -r 640x480 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080 -c user:pass"

user:pass = username and password.

 

 

I use mjpg_streamer this way:

1. install

2. move to /opt

mv /root/mjpg-streamer /opt/

3. make start/stop skript

sudo nano /etc/init.d/mjpg_streamer

#!/bin/sh
# /etc/init.d/mjpg_streamer

#
# Creation:    04.02.2013
# Last Update: 04.02.2013
#
# Written by Georg Kainzbauer (http://www.gtkdb.de)
#

### BEGIN INIT INFO
# Provides:          mjpg_streamer
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: MJPG-Streamer
# Description:       MJPG-Streamer takes JPGs from Linux-UVC compatible webcams and streams them as M-JPEG via HTTP.
### END INIT INFO

start()
{
  echo "Starting mjpg-streamer..."
#  /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -y -r 640x480 -f 10" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080" >/dev/null 2>&1 &
  /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -r 640x480 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080" >/dev/null 2>&1 &
}

stop()
{
  echo "Stopping mjpg-streamer..."
  kill -9 $(pidof mjpg_streamer) >/dev/null 2>&1
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    ;;
esac

exit 0

3. make it executable

	sudo chmod 0755 /etc/init.d/mjpg_streamer

4. add to autostart

	update-rc.d mjpg_streamer defaults

5. reboot

 

 

Hint:

If your webcam support "MJPG" you can remove the "-y"-Flag, this will save a lot CPU load. (you can check with "htop")

 

With

	v4l2-ctl --list-formats-ext

all formats and sizes of the connected cam will be listed.

 

 

Hint2:

If you use kernel 4.x.x you have to patch mjpg_streamer, because mjpg don`t work.

 

 

Have fun...

Markus

 

Link to comment
Share on other sites

If i understand right, you like to password protect the stream?

 

use this:

	/usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -r 640x480 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080 -c user:pass"

user:pass = username and password.

 

 

I use mjpg_streamer this way:

 

1. install

 

2. move to /opt

mv /root/mjpg-streamer /opt/

......

 

Have fun...

 

Markus

 

The pass command change does not work, I even tried to modify the file but's it's all encrypted, here is the error message when I put in the command:

 

MJPG Streamer Version: svn rev: 3:172
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 25
 i: Format............: MJPEG
Unable to set format: 1196444237 res: 640x480
 Init v4L2 failed !! exit fatal
 i: init_VideoIn failed
root@orangepilite:~# mjpg_streamer
MJPG Streamer Version: svn rev: 3:172
ERROR: could not find output plugin output_http.so
       Perhaps you want to adjust the search path with:
       # export LD_LIBRARY_PATH=/path/to/plugin/folder
       dlopen: output_http.so: cannot open shared object file: No such file or directory
root@orangepilite:~# /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -r 640x480 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080 -c myusr:mypass"
MJPG Streamer Version: svn rev: 3:172
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 25
 i: Format............: MJPEG
Unable to set format: 1196444237 res: 640x480
 Init v4L2 failed !! exit fatal
 i: init_VideoIn failed

I tried to export it by the way, still the same

 

Btw the script does not work

Link to comment
Share on other sites

Hello thelaw,

ok, run

sudo v4l2-ctl --list-formats-ext

and take a look at the output.

If theres only written:

ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUV 4:2:2 (YUYV)

the camera only support "YUYV" format. Than you have to run the script with "-f"-flag like this:

  /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -f -r 640x480 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080" >/dev/null 2>&1 &

If you can find:

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : MJPEG

everthing is fine without "-f".        
 

 

I read

Unable to set format: 1196444237 res: 640x480
 Init v4L2 failed !! exit fatal
 i: init_VideoIn failed

this means that someting is wrong with the resolution 640x480 on your cam.

You can find the right resolution on the output of "sudo v4l2-ctl --list-formats-ext"
 

 

Try this:

  /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -f -r 320x240 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080" >/dev/null 2>&1 &

What type of cam do you have?

 

I run a Logitech C170 (cheap cam), Microsoft LifeCam HD-3000 and Microsoft LifeCam Cinema with 'MJPG' without problems.

 

 

 

Markus

Link to comment
Share on other sites

Hello thelaw,

 

ok, run

sudo v4l2-ctl --list-formats-ext

and take a look at the output.

 

If theres only written:

ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'YUYV'
        Name        : YUV 4:2:2 (YUYV)

the camera only support "YUYV" format. Than you have to run the script with "-f"-flag like this:

  /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -f -r 640x480 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080" >/dev/null 2>&1 &

If you can find:

        Index       : 1
        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : MJPEG

everthing is fine without "-f".        

 

 

I read

Unable to set format: 1196444237 res: 640x480
 Init v4L2 failed !! exit fatal
 i: init_VideoIn failed

this means that someting is wrong with the resolution 640x480 on your cam.

 

You can find the right resolution on the output of "sudo v4l2-ctl --list-formats-ext"

 

 

Try this:

  /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -f -r 320x240 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080" >/dev/null 2>&1 &

What type of cam do you have?

 

I run a Logitech C170 (cheap cam), Microsoft LifeCam HD-3000 and Microsoft LifeCam Cinema with 'MJPG' without problems.

 

 

 

Markus

I run a cheap chinese "no name" camera, it's a 5megapixels

 

although how do I set the pass it do you have a fix for that? I have tried everything in the last 2 days

Link to comment
Share on other sites

Hi,

sorry, but this way i cannot help you.

Run

  /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so -d /dev/video0 -n -f -r 320x240 -f 25" -o "/usr/local/lib/output_http.so -n -w /usr/local/www -p 8080" 

and copy the contents of the terminal.
Post it here, also the output of:

v4l2-ctl --list-formats-ext
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines