MJPG streaming with a Raspberry Pi and a webcam

22,800

Solution 1

the ps3 camera doesn't seem to support mjpeg, but it does support YUYV format. Try initialising the stream with the -y flag. eg:

mjpg_streamer -i "/usr/lib/input_uvc.so -d /dev/video0 -y  -r 320x240 -f 15" -o "/usr/lib/output_http.so -p 8090 -w ./www"

Solution 2

In my experience, the errors you have listed are related to the dynctrls of the Linux-UVC driver, and not to the image format mjpeg or yuyv.

It appears as though your camera does support the mjpeg format, however, your current camera/driver lacking support for the dynctrls listed (i.e. your camera does not have the ability for pan/tilt/focus/etc., or mjpeg encountered an error when trying to access/set the controls listed), you can disable the dynctrls (and therefore eliminate the errors you recieved by using the -n flag when starting mjpg-streamer.

Something like this:

./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -n" -o "./output_http.so -p 8090"

will start streaming on port 8090 of the raspberry pi's ip address.

To access the stream on your local network, go to xxx.xxx.xxx.xxx:8090/?action=stream or insert <img src="xxx.xxx.xxx.xxx:8090/?action=stream"> into an accessible html page. Replaceing xxx.xxx.xxx.xxx with the LOCAL IP address of your raspberry pi.

To access the stream at a remote location (not on the same local network as the pi), replace xxx.xxx.xxx.xxx with the EXTERNAL IP of the network the raspberry pi resides on (and edit your router settings to forward requests to port 8090 to the raspberry pi's LOCAL IP address).

Share:
22,800
Admin
Author by

Admin

Updated on July 05, 2022

Comments

  • Admin
    Admin almost 2 years

    So I need to have a network camera using a Raspberry pi, and have followed this tutorial. The device is serving the test streaming page, however all of the places where the stream should be embedded are blank. I am using a PS3 eyetoy camera with the Raspbian Wheezy distro. This is the log I receive when starting the server:

    MJPG Streamer Version: svn rev: 3:165
     i: Using V4L2 device.: /dev/video0
     i: Desired Resolution: 640 x 480
     i: Frames Per Second.: 5
     i: Format............: MJPEG
    Adding control for Pan (relative)
    UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
    Adding control for Tilt (relative)
    UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
    Adding control for Pan Reset
    UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
    Adding control for Tilt Reset
    UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
    Adding control for Pan/tilt Reset
    UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
    Adding control for Focus (absolute)
    UVCIOC_CTRL_ADD - Error: Inappropriate ioctl for device
    mapping control for Pan (relative)
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for Tilt (relative)
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for Pan Reset
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for Tilt Reset
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for Pan/tilt Reset
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for Focus (absolute)
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for LED1 Mode
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for LED1 Frequency
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for Disable video processing
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
    mapping control for Raw bits per pixel
    UVCIOC_CTRL_MAP - Error: Inappropriate ioctl for device
     o: www-folder-path...: ./www/
     o: HTTP TCP port.....: 8080
     o: username:password.: disabled
     o: commands..........: enabled
    

    I have not found any explanation of this error, and don't know what problem it could be referring to.