RaffiRincon
Posts: 4
Joined: Tue Dec 22, 2015 10:44 pm

mjpg-streamer: Blank Image and No Video

Postby RaffiRincon » Wed Feb 24, 2016 8:12 am

So I've been trying to get my Raspberry Pi-powered robot to stream video to a remote computer for a few days now as a part of a project, Tank Wars IRL. So far, after a lot of googling and troubleshooting, I finally get something when I go to https://<RPi IP>:8080. The problem is that I'm getting no picture.

Here's the command I run:

Code: Select all

/usr/local/bin/mjpg-streamer -i "/usr/local/lib/input_uvc.so" -o "/usr/local/lib/output_http.so -w /usr/local/www"


When I go to the website, all the text and everything loads just fine, but where there should be a stream, there is a blank spot. Also, where there should be a "static image" there is a blank spot with a little icon of a broken image.

Here's my hardware:
Raspberry Pi 2 Model B
Logitech USB camera (not sure what model)

How do I get the video from the Logitech camera (which works, I've tested it for video) to show up where it's supposed to on the website?
Thanks!
Attachments
Screen Shot 2016-02-24 at 1.50.12 AM.png
Here's a screenshot of what I get
Screen Shot 2016-02-24 at 1.50.12 AM.png (46.72 KiB) Viewed 2908 times
jurmelius
Posts: 85
Joined: Sun Jul 22, 2012 7:00 pm

Re: mjpg-streamer: Blank Image and No Video

Postby jurmelius » Mon Mar 28, 2016 7:29 am

I have the same problem with this new "Jessie" version of rasbian.
With few years back I was able to build mjpg_streamer e.g.

Code: Select all

sudo apt-get install make gcc libv4l-dev libjpeg8-dev subversion imagemagick uvcdynctrl
sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer/ mjpg-streamer
cd mjpg-streamer/
make USE_LIBV4L2=true clean all
sudo make DESTDIR=/usr install
mjpg_streamer -i "/usr/lib/input_uvc.so -d /dev/video0 -n -r 800x600 -f 15 -l auto" -o "/usr/lib/output_http.so -p 8080 -w /usr/local/www -c user:id"


but now with because of "jessie", image is no-go. WebPage works though..
RaffiRincon
Posts: 4
Joined: Tue Dec 22, 2015 10:44 pm

Re: mjpg-streamer: Blank Image and No Video

Postby RaffiRincon » Mon Mar 28, 2016 3:02 pm

Thanks for the reply! I might try this later. I've already finished the project for which I was trying to implement this feature (I just didn't include this feature), but I think it might be useful for other projects.
jurmelius
Posts: 85
Joined: Sun Jul 22, 2012 7:00 pm

Re: mjpg-streamer: Blank Image and No Video

Postby jurmelius » Sun Apr 10, 2016 10:09 am

i have discovered that if you upgrade from the flashed image, thing will fall apart.. will this work with pure flashed jessie?
jurmelius
Posts: 85
Joined: Sun Jul 22, 2012 7:00 pm

Re: mjpg-streamer: Blank Image and No Video

Postby jurmelius » Wed Apr 27, 2016 11:27 am

Well..
Upgrading will destroy the make command... so, I'm using pure jessie 03-19-2016 lite image. Below works actually.

Code: Select all

 
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libv4l-dev libjpeg8-dev -y
sudo apt-get install imagemagick -y
sudo apt-get install subversion -y
sudo apt-get install uvcdynctrl -y
svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer
cd mjpg-streamer
make USE_LIBV4L2=true


but can some one linux-guy help me to get this installed and auto started? so that the libs, www page and executable are installed to "proper place"... What does "sudo make DESTDIR=/usr install" actually do?

This would be the starter

Code: Select all

mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1280x720 -f 4 -l auto -n" -o "output_http.so -p 8080 -w /usr/local/www -c user:id"
jurmelius
Posts: 85
Joined: Sun Jul 22, 2012 7:00 pm

Re: mjpg-streamer: Blank Image and No Video

Postby jurmelius » Fri Apr 29, 2016 6:30 pm

Well.. Had to do this myself then... RPi1 device.

Using "2016-03-18-raspbian-jessie-lite.img" withOUT upgrade

Code: Select all

sudo apt-get update
sudo apt-get install build-essential libjpeg8-dev imagemagick libv4l-dev git cmake uvcdynctrl -y
sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental/
mkdir build
cd build
cmake ..
make
sudo make install
sudo cp -R ~/mjpg-streamer/mjpg-streamer-experimental/www /usr/local/www
sudo nano /etc/init.d/mjpg_streamkick.sh
sudo chmod 755 /etc/init.d/mjpg_streamkick.sh
sudo nano /etc/rc.local
#Add this to before EXIT /etc/init.d/mjpg_streamkick.sh start


paste this to streamkick.sh

Code: Select all

### BEGIN INIT INFO
# Provides:          dovecot
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: dovecot
# Description:       dovecot pop & imap daemon
### END INIT INFO

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

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting mjpg_streamkick script"
    export LD_LIBRARY_PATH=/usr/local/lib/mjpg-streamer
   uvcdynctrl -d video0 --set="Focus, Auto" 0
    mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1280x720 -n -q 98" -o "output_http.so -p 8080-c user:pass" &
    ;;
  stop)
    echo "Stopping webcam script"
    killall mjpg_streamer
    ;;
  *)
    echo "Usage: /etc/init.d/mjpg_streamkick {start|stop}"
    exit 1
    ;;
esac

exit 0


Now the system is autostart. manual are

Code: Select all

sudo /etc/init.d/mjpg_streamkick.sh start
sudo /etc/init.d/mjpg_streamkick.sh stop

The camera is Microsoft LifeCam HD-5000.
MJPEG is found

Code: Select all

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

JPEG is found

Code: Select all

http://ip:8080/?action=snapshot
jeroen94704
Posts: 2
Joined: Wed Sep 12, 2012 2:34 pm

Re: mjpg-streamer: Blank Image and No Video

Postby jeroen94704 » Sun Jun 12, 2016 7:15 pm

@RaffiRincon: Did you ever get this working? I have the exact same problem you describe, both with standard images and with self-rolled ones. None of the solutions I found online fix this for me.

Regards,

Jeroen
jurmelius
Posts: 85
Joined: Sun Jul 22, 2012 7:00 pm

Re: mjpg-streamer: Blank Image and No Video

Postby jurmelius » Tue Jun 21, 2016 6:16 pm

This works, like a charm ;)
User avatar
jwillis84
Posts: 1
Joined: Wed May 24, 2017 2:33 am
Location: College Station, Texas, US
Contact:

Re: mjpg-streamer: Blank Image and No Video

Postby jwillis84 » Wed May 24, 2017 3:12 am

This worked really well with a Pi ZeroW and a Logitech C615 usb webcam.

YUY2 is full bandwidth video and slow to travel over USB, if your USB is also being used for networking.. like with a USB to Ethernet port, then bandwidth available is even smaller.

Motion JPEG that is preprocessed by the camera and is rendered into a smaller bytestream by the webcam and then sent to the Pi ZeroW over USB 2.0 and its much faster.. practically realtime.. although the client used to watch the video can introduce delay. Pixel Desktop says total workload of the entire operating system is about 20-30% while its streaming.

1. Static Picture client worked
2. Stream in browser client on Firefox and Chrome worked (fast)
3. Java client launched from applet by browser (fast)
4. VideoLAN client (rendered the output smoothest and best, no artifacting, but cache delays the image a few seconds)
5. Control has some css or othr button image problems, and not all, but cruical UVC camera controls do work live.

The username/password protection feature did work.

The script for managing the startup also worked (but has a typo, and left out an important variable).

In [ /etc/init.d/mjpg_streamkick.sh ] startup string should be:

mjpg_streamer -i "input_uvc.so -d /dev/video0 -r 1280x720 -n -q 98" -o "output_http.so -p 8080 -c user:pass -w /usr/local/www" &

there was a "typo" that joined and did not separate the -p 8080-c user into (two) like this: -p 8080 -c user

the path to the webserver content variable was left off and when it started the status said "disabled" and all the webserver pages were not accessible

this should be appended:

pass -w /usr/local/www"

I am typing this response from Tuesday, May 23, 2017 and I'm running Noobs with Pixel desktop version Jessie 4 from April 2017

The hardware being used is:

1. Pi ZeroW
2. MACBOOK USB Multi-function Lan Adapter model 5109 year 2012
3. OTG microUSB to USB2 Type A adapter with microUSB pass through charging power connector (to power PiZeroW)
4. Logitech C610 webcam with 1/4-20 quarter twenty tripod mount adapter

Image

Image

bottom line this may be old, but it does work.

it effectively splits the job of image rendering and streaming between the webcam and the pi and lets each focus on doing what it does best.