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="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="400" height="400">quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" 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

Overview

The Latest

user experience with someone on their phone

5 Ways to Improve Your Customers’ User Experience

They say you can’t judge a book by its cover, but just because they say that doesn’t mean it’s true. Consider how often you choose one sort of product over another just because it appeals to you. Then think about how often you’ve stopped using something because, simply put, it

How to Manage Your Finances after Buying a Home

How to Manage Your Finances after Buying a Home

Buying a home is a milestone in the journey of life – it’s one way to invest your money and create lasting memories. Now you know everything about a home purchase, home mortgage, and what is a conventional 97 loan but do you know what’s next after you sign the

Windows Logging is one of the vital aspects of any Windows system administration. However, it is mostly overlooked until the system develops a problem. This is because logs contain important information needed to troubleshoot and resolve system issues.

The Fundamentals of Windows Logging

Windows Logging is one of the vital aspects of any Windows system administration. However, it is mostly overlooked until the system develops a problem. This is because logs contain important information needed to troubleshoot and resolve system issues. Without it, tech experts might find it difficult to track a computer’s

Interstitial Ads: Best Practices for Successful Campaigns

Interstitial Ads: Best Practices for Successful Campaigns

Interstitial Ads: Best Practices for Successful Campaigns Interstitial ads are full-screen advertisements that appear to grasp the attention of on-site prospects, creating opportunities for brands seeking effective ways to communicate their proposition of value. With such an attention-grabbing format and high-impact visuals, it’s no wonder why interstitial advertising is proving

positive contribution tech

Technology’s Positive Contributions to Society

Technology has and continues to improve our lives. From the business world to the world of medicine, and our day-to-day lives, you can’t go a day without interacting with at least one form of technology. While some fear technology may be going too far, there are many ways in which

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

Sitemap