Raspberry Pi 3 as Web Server: Camera Streaming

This is not related to Cayenne, but this is the only forum I have an account to about computers. :confounded: I was trying to stream live PiCamera footage onto the HTML Pi Webserver using Apache. (Therefore all of the files on the website were in /var/www/html.) I was using the instructions from Stream the #RaspberryPi camera module through your browser - Raspberry Pi Pod and micro:bit base, which told me to insert the following command:

raspivid -o - -t 9999999 -w 800 -h 600 --hflip | cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8080}' :demux=h264

I kept getting this error:

[73c02640] mux_ts mux warning: packet with too strange dts (dts=999666745,old=999672162,pcr=999672162)
[73c02640] mux_ts mux warning: packet with too strange dts (dts=999900578,old=999906745,pcr=999906745)
[73c02640] mux_ts mux warning: packet with too strange dts (dts=1000329181,old=1000335296,pcr=1000335296)

The dts kept getting larger, and it seemed to never stop. In the end I decided to quit it and copied the error message with Ctrl-C, which stopped the error completely. Then I got the following text:

[00e558f8] core libvlc debug: exiting
[00e68900] core interface debug: removing module "dummy"
[00e69b50] core interface debug: removing module "hotkeys"
[00fc3af8] core playlist debug: destroying
[00fc3af8] core playlist debug: deactivating the playlist
[00fc3af8] core playlist debug: incoming request - stopping current input
[73c06170] core access debug: object waitpipe triggered
[73e00508] core input debug: control: stopping input
[00fc3af8] core playlist debug: incoming request - stopping current input
[00fc3af8] core playlist debug: finished input
[73c0cc60] core decoder debug: removing module "packetizer_h264"
[73c0cc60] core decoder debug: killing decoder fourcc `h264', 0 PES in FIFO
[73c006f8] core stream output debug: removing a sout input (sout_input:0x72700520)
[73c02640] mux_ts mux debug: removing input pid=68
[73c02640] mux_ts mux debug: new PCR PID is 8191
[73c02640] core mux warning: no more input streams for this mux
[73c064c0] core demux debug: removing module "h264"
[73c06998] core demux packetizer debug: removing module "packetizer_h264"
[73c06400] core stream debug: removing module "record"
[73c06170] core access debug: removing module "filesystem"
[73e00508] core input debug: Program doesn't contain anymore ES
[00fc3af8] core playlist debug: incoming request - stopping current input
[00fc3af8] core playlist debug: dead input
[73c006f8] core stream output debug: destroying useless sout
[73c00960] core stream out debug: destroying chain... (name=standard)
[73c00960] core stream out debug: removing module "stream_out_standard"
[73c02640] core mux debug: removing module "mux_ts"
[73c015f0] core access out debug: removing module "access_output_http"
[73c01e40] core http host debug: HTTP host removed
[73c015f0] access_output_http access out debug: Close
[73c00960] core stream out debug: destroying chain done
[00ee39b0] core audio output debug: removing module "alsa"
[00e68900] core playlist export debug: saving Media Library to file /home/pi/.local/share/vlc/ml.xspf.tmp9222
[00e68900] core playlist export debug: looking for playlist export module matching "export-xspf": 4 candidates
[00e68900] core playlist export debug: using playlist export module "export"
[00e68900] core playlist export debug: removing module "export"`

Any idea what this error is, and is there a better way to broadcast live stream from the Pi? Thank you for all your help!

Tichomir,

I use the OctoPi image for controlling my PrintrBot and it uses MJCPStreamer. Works very well.

Hereā€™s a link to get it installed al a carte:

https://www.raspberrypi.org/forums/viewtopic.php?t=48597

Craig

1 Like

Thanks for all your help! Unfortunately, it did not work for me. :frowning: Installation using wget worked fine, but once I tried to open it it didnā€™t work. I got the following error when using sudo tar -zxvf mjp-streamer.tar.gz, sudo tar -xvzf mjp-streamer.tar.gz and other variations of the command including te original. The error message looked like this:

tar (child): mjp-streamer.tar.gz: Cannot open: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now

I got the same error for all the commands, although it downloaded properly:

pi@raspberrypi:~ $ wget http://lilnetwork.com/download/raspberrypi/mjpg-streamer                                             .tar.gz
--2016-07-07 13:26:31--  http://lilnetwork.com/download/raspberrypi/mjpg-streame                                             r.tar.gz
Resolving lilnetwork.com (lilnetwork.com)... 184.173.23.10
Connecting to lilnetwork.com (lilnetwork.com)|184.173.23.10|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://lilnetwork.com/download/raspberrypi/mjpg-streamer.tar.gz [foll                                             owing]
--2016-07-07 13:26:32--  https://lilnetwork.com/download/raspberrypi/mjpg-stream                                             er.tar.gz
Connecting to lilnetwork.com (lilnetwork.com)|184.173.23.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2895187 (2.8M) [application/x-gzip]
Saving to: ā€˜mjpg-streamer.tar.gzā€™

mjpg-streamer.tar.g 100%[=====================>]   2.76M  1.16MB/s   in 2.4s

2016-07-07 13:26:35 (1.16 MB/s) - ā€˜mjpg-streamer.tar.gzā€™ saved [2895187/2895187]

Thank you for all your help!

When you do the tar and then type mjp, tap the tab key to autocomplete the file name.

It should be mjpg-streamerā€¦ not mjp-streamerā€¦

1 Like

Thanks!! That problem was really bothering me. Devilish typosā€¦ :smiling_imp:

Hello again. Sorry about bugging you about my PiCamera, but I donā€™t know who else to ask (I am an amateur when it comes to computers. :expressionless:) When I put in the command sudo bash ./mjpg_streamer.o -i "./input_uvc.so" -o "./output_http.so -w ./www" it had the following error: ./mjpg_streamer.o: ./mjpg_streamer.o: cannot execute binary file. Thank you for all your help, I would be lost without it! :relaxed:

Did you run the make in the right directory?

Also shouldnā€™t need sudo to start it as it is your own binaries in your own directories. Only need sudo if you are installing in system dirs.

1 Like

@kreggly P.S. www is a directory, and so is mjpg_streamer. In the command I mentioned just earlier I replaced mjpg_streamer with mjpg_streamer.o. I donā€™t know how to execute directories, or if that is even possible. :confused:

I ran it like this: pi@raspberrypi:~/mjpg-streamer/mjpg-streamer [command here] Thank you for the tip about sudo! Even if you put it where you donā€™t need it, it does not matter, right?

It can matter. For instance if your script is setting permissions. It will set them as root perhaps and then your lower security may not be able to run them.

1 Like

Thank you & good night! I will look into it tomorrow!

Still have errors executing the final command:
pi@raspberrypi:~/mjpg-streamer/mjpg-streamer $ ./mjpg_streamer MJPG Streamer Version: svn rev: 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

I looked into the problem onto Raspberry Pi forums online, and the first one that came up recommended a file on GitHub. People said this file was a .zip file, but for me mjpg-streamer was a so-called ā€œ1 fileā€ with the extension .1. How do I open it, and would it be any help to my problem?

Link to Forum
https://www.raspberrypi.org/forums/viewtopic.php?t=48597

Link to Github Page

.1 Files

Thank you for all your help!

Error when executing the make command yesterday:

pi@raspberrypi:~/mjpg-streamer/mjpg-streamer $ make
make: svnversion: Command not found
gcc -D'SVN_REV=""' -O2 -DLINUX -D_GNU_SOURCE -Wall    -c -o mjpg_streamer.o mjpg_streamer.c
Assembler messages:
Fatal error: can't create mjpg_streamer.o: Permission denied
<builtin>: recipe for target 'mjpg_streamer.o' failed
make: *** [mjpg_streamer.o] Error 1
pi@raspberrypi:~/mjpg-streamer/mjpg-streamer $ sudo make
make: svnversion: Command not found
gcc -D'SVN_REV=""' -O2 -DLINUX -D_GNU_SOURCE -Wall    -c -o mjpg_streamer.o mjpg_streamer.c
gcc -D'SVN_REV=""' -O2 -DLINUX -D_GNU_SOURCE -Wall    -c -o utils.o utils.c
gcc -D'SVN_REV=""' -O2 -DLINUX -D_GNU_SOURCE -Wall  mjpg_streamer.o utils.o -lpthread -ldl -o mjpg_streamer
chmod 755 mjpg_streamer
make -C plugins/input_uvc all
make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/input_uvc'
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o v4l2uvc.lo v4l2uvc.c
v4l2uvc.c: In function ā€˜init_videoInā€™:
v4l2uvc.c:88:23: warning: variable ā€˜currentHeightā€™ set but not used [-Wunused-but-set-variable]
     int currentWidth, currentHeight = 0;
                       ^
v4l2uvc.c:88:9: warning: variable ā€˜currentWidthā€™ set but not used [-Wunused-but-set-variable]
     int currentWidth, currentHeight = 0;
         ^
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o jpeg_utils.lo jpeg_utils.c
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o dynctrl.lo dynctrl.c
gcc -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o input_uvc.so input_uvc.c v4l2uvc.lo jpeg_utils.lo dynctrl.lo -ljpeg
make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/input_uvc'
cp plugins/input_uvc/input_uvc.so .
make -C plugins/output_file all
make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/output_file'
gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o output_file.so output_file.c
make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/output_file'
cp plugins/output_file/output_file.so .
make -C plugins/output_udp all
make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/output_udp'
gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o output_udp.so output_udp.c
make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/output_udp'
cp plugins/output_udp/output_udp.so .
make -C plugins/output_http all
make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/output_http'
gcc -c -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o httpd.lo httpd.c
gcc -O1 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o output_http.so output_http.c httpd.lo
make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/output_http'
cp plugins/output_http/output_http.so .
make -C plugins/input_testpicture all
make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/input_testpicture'
gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o input_testpicture.so input_testpicture.c
make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/input_testpicture'
cp plugins/input_testpicture/input_testpicture.so .
make -C plugins/input_file all
make[1]: Entering directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/input_file'
gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC  -o input_file.so input_file.c
make[1]: Leaving directory '/home/pi/mjpg-streamer/mjpg-streamer/plugins/input_file'
cp plugins/input_file/input_file.so .

Topic Extended:

This works too. Just follow the procedure.

We donā€™t need to see your log dumps.

If youā€™re getting errors, check what you did, and try again.

I had to re-image a couple times today because other software I was installing didnā€™t do so well upgrading itself, and the recipe to fix everything, was just not readily available.

Cheers,

Craig