Video Surveillance: Configuring the Server

In the first part of the tutorial, you learned how to create a web camera stream on your PC.

Now we need to read the stream and accept it at the remote location. This task can also be done in Java (using Apache Tomcat and Java Server Pages), but since PHP is a more popular solution for building websites, I’ll explain how to solve this problem using PHP.

Displaying the Video Using VLC

Before we start working with the code, I would like to point out that if you just want to watch the video on a remote location (without using storage, secure login etc.), you could do that with using VLC media player only. Just open the program, click File > Open network stream, paste the port and IP address there, and click play.

Displaying the Video on a Web Page

The code used to display a web camera stream on a remote location (i.e. web page) depends on the video format. For example, if the video stream format was .swf, we would have to use the Flash player code; if the stream was .wmv format, we would use Windows media player. Let’s start with the flash video format:

codebase=",0,29,0" width="400" height="400">quality="high" pluginspage="" type="application/x-shockwave-flash">

The only thing you need to change for this code to work is the video name (myvideo.swf). In this case, just use the IP address of the stream. Note that we use two HTML tags (object and embed) for maximum browser compatibility. Also have in mind that the code will not work without having the right player installed (flash player in this case).

Windows Media Video (.wmv)

The following code displays a windows media video on a web page:


QuickTime (.mov)

To show a QuickTime video on a web page, use this code:

MPEG-4 Video (.mp4)

MPEG-4 videos are also opened with QuickTime, but the HTML code is different:

Displaying the Video from PHP

One of the possible problems with previous streaming methods is that anyone who knows to view the HTML source of a web page can see your stream’s address. This can be solved by showing a video stream directly from PHP.

First, you need to check php.ini file and find “allow_url_fopen” option. It should be set to “1”, in order to allow PHP file functions to open external URLs. After that, create a PHP page with the following code:

The code is pretty self-explanatory. The only things that need to be changed are the path to the stream (IP address in this case) and Content-type header. Content-type is different for each video format and can be seen here.

In the third part of this tutorial, you will learn how to display the received data.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

©2023 Copyright DevX - All Rights Reserved. Registration or use of this site constitutes acceptance of our Terms of Service and Privacy Policy.