Skip to content
ggbce edited this page Feb 11, 2018 · 10 revisions

This page contain some samples to explain how to use mjpg-streamer

Using a front web page with "output_http.so" output

If you want to add some design to your HTTP stream. First you need to start your application with these options:

cd /usr/local/bin ./mjpg_streamer -i "input_uvc.so -d /dev/video0" -o "output_http.so -w /var/www/mysite"

The input may be different, just a basic sample. With "-w" option you specify a folder where you will put your HTML code. From this folder, you will can't create sub-folders, the internal Web server doesn't support folder browsing. it's a flat system only.

So, you can to create an initial page named "index.html" if you want that client side doesn't need to type an URL like http://your_server_name/?action=stream or http://your_server_name/mypage.html, just type the server name and obtain the main page !

Inside the "index.html" page, you will be able to add almost "basic" HTML code... anything that will be processing by the client side (browser) including many JavaScript capabilities. The internal Web server is not a high performance server like Apache that support PHP, WebDAV or plugins like that. The goal is to give a presentation, browsing or selection page.

Using a text editor, you will be able to create your "index.html" page like this:

<html>
<head>
<title>My webcam</title>
</head>
<body>
<p>My webcam stream !</p>
<p>
<iframe src="/?action=stream" style="border:none;" width="640" height="480"></iframe>
</p>
</body>
</html>

TIP: If you have multiple inputs, you can create a master page then link sub pages where the user will be able to select a specific stream !

Clone this wiki locally