Fast Video Streaming using Webcam and MJPG-Streamer Rasp-Pi

Hello Semua,

kali ini I’d like to show you how to setup streaming with webcam,

after using motion as webcam server, I dont get satisfied its because the lag / latency.

 

this video streaming’ll be use into my private projects that needed video-streaming.

I found that the MJPG-streamer is the most suitable-non-lag-fast-streaming-video-server ever.

 

ok, just follow these steps ya :-* (centil banget hehe)

1. Install build dependencies

The following command installs the three libraries that MJPG-Streamer uses:

$ sudo apt-get install libjpeg8-dev imagemagick libv4l-dev

2. Add missing videodev.h

The videodev.h header file that MJPG-Streamer needs has been replaced with a videodev2.h. To make MJPG-Streamer happy you have to create a symbolic link:

$ sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

3. Download MJPG-Streamer

The source code for MJPG-Streamer is available at sourceforge.net, but it is tricky to find the direct download link:

$ wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip

4. Unzip the MJPG-Streamer source code

The source code download is a compressed zip file. Put the file in your home directory (or a temporary folder, if you prefer) and run the following to extract the files:

$ unzip mjpg-streamer-code-182.zip

5. Build MJPG-Streamer

MJPG-Streamer comes with several plugins, but only a couple of them are needed to stream video. The command below only builds what’s needed:

$ cd mjpg-streamer-code-182/mjpg-streamer
$ make mjpg_streamer input_file.so input_uvc.so output_http.so

6. Install MJPG-Streamer

The following commands copy all the needed files into system directories:

$ sudo cp mjpg_streamer /usr/local/bin
$ sudo cp output_http.so input_file.so /usr/local/lib/
$ sudo cp -R www /usr/local/www

7. Start the camera

We are almost there. Now it is time to start the camera module:

$ mkdir /tmp/stream
$ mjpg_streamer -i "/usr/local/lib/input_uvc.so -r 320x240 -yuv -f 15" -o "/usr/local/lib/output_http.so -w /usr/local/www"

 

8. Start MJPG-Streamer

The camera is now writing images, so all that is left is to start MJPG-Streamer:

export LD_LIBRARY_PATH=/usr/local/lib/

9. Watch the Stream!

Now you can connect with your web browser and watch the stream live. If you want to watch from within the same Raspberry Pi you can enter http://localhost:8080 in the browser’s address bar. If you want to watch from another computer in your network use http://IP-address:8080.

10. Cleanup

After you verify that everything is working you can remove the source code:

$ cd ../../
$ rm -rf mjpg-streamer-182

Conclusion

untuk pertanyaan silahkan aja contact me at satria.nt@gmail.com

 

happy tryin’

Advertisements
Fast Video Streaming using Webcam and MJPG-Streamer Rasp-Pi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s