Streaming data transfer

Streaming is a network service that allows you to transmit audio or video data in a continuous (streaming) mode. The content may include television programs, broadcasts of matches and concerts, radio broadcasts, etc. The greatest interest in this service appeared after its widespread use Internet networks. Many web resources for copyright protection do not allow downloading video and audio files, but only viewing and listening to them in streaming mode. In this case, the file itself is not saved on the user side and cannot be replicated. However, for minimal delays during viewing (listening) of a file and maintaining its original quality when viewing, it is necessary to high speed data transfer (several kilobits per second).

To organize a streaming data service, the subscriber's equipment must be able to process the incoming data stream (buffer and correct errors) and send the data to the media player for playback. Thanks to buffering, it is possible to slightly reduce problems with uneven arrival of packets to the terminal equipment. The advantage of streaming data over (Video on demand) or downloading a file is that there is no need for data storage. Thus, in mobile device not required big place for storing media files.

The server, which is the data source, can be located on the site of this operator, or on another network. In addition, the stream may come from the Internet. From the operator's network cellular communication all that is required is to ensure the transmission of the stream with a given quality of service. For the streaming service, the standards initially provide mechanisms that prevent large and high percentages of data loss.

Sound and video files have a large information volume.
To transfer such files via computer networks standard digital formats require high-speed communication lines throughput. High quality digital stereo audio requires a data transfer rate of 1.5 Mbps.
Digital video of the television standard requires a data transfer rate of about 240 Mbit/s to transmit images.
To reduce the volume of audio and video files without any noticeable loss of quality, special methods compression based on the removal of audio or video information not perceivable by humans.

Stream audio and video.
Streaming audio and video technologies have become widespread on the Internet. These technologies transfer audio and video files in parts to a buffer local computer, which makes it possible to stream them even when using a modem connection. Reducing the transmission speed of the channel can lead to temporary audio dropouts or skipped video frames.
Multimedia players are used to listen to streaming audio and watch streaming video. While playing a streaming media file, the user receives information about the data transfer rate and can adjust the playback quality.

There are quite a lot of radio and television stations that broadcast via the Internet. Web cameras are widely popular, installed in various parts of the world (on city streets, in museums, in nature reserves, etc.) and continuously transmitting images.

While creating local network Quite often the question arises: “How to broadcast a video stream to computers on a local network?” It's actually quite simple.

To work, you will need a streaming program: in my opinion, the most convenient is VLC media player. The program is free: you can download it from the official website of the developers.

Streaming video on a local network

So, first you need to make sure that the program is installed on all devices that will receive video broadcast over the local network.

After that, run VLC on the distribution computer and configure it as follows:

Open the transfer settings, press ctrl+s or “Media” - “Transfer”;

On the “Capture Device” tab, select “Capture Mode” - “Screen”;

On the “File” tab, select the file to broadcast and check the “Show additional options” box;

- “Caching” leave 300 ms;

- “Option line” the following script:

:screen-left=0:screen-top=0:screen-height=768:screen-width=1360:screen-fps=20.000000:live-caching=300

Now, in the drop-down list, select “HTTP” - “Add” (before this, you can check the “Play locally” box);

The port can be left as is, and the path to the file, for example, 1.ts;

In the “Settings” section, if necessary, you can turn off the audio, leaving only the picture, turn on subtitles, etc.;

Click “Stream”: if everything is done correctly, the file that was added for broadcast will start;

Now, you need one that will broadcast the video. The easiest way to do this is in " Command line"via the command ipconfig /all: in the table that appears, in the IPv4 address item, the ip will be indicated.

How to broadcast video to a local network?

And to complete the setup to start broadcasting video on the receiving computers, run the program and do the following:

  • - press ctrl+N or “Media” - “Open URL”;
  • - and write down the broadcast path, for example this is http://192.168.x.xxx:8080/1.ts

At this point the settings are completed, you can broadcast any video file to all computers on the local network. In addition, you can create something like your own channel for everyone on the local network.

Streaming video ( Streaming video) are data compression and buffering technologies that enable real-time video transmission over the Internet.
main feature The advantage of streaming video is that when it is transmitted, the user does not have to wait for the file to be completely downloaded in order to view it. Streaming video is sent in a continuous stream as a sequence of compressed packets and plays as it is transmitted to the recipient's computer.
To watch streaming video, the user usually needs a special player that decodes the data and displays the decrypted image on the screen. This player can be integrated into the browser shell or work as a standalone program.
The three most commonly used players are - RealOne Player, Windows Media Player And Quicktime Player .

Transfer methods
There are two ways to stream video - progressive streaming and real-time streaming. When transmitted serially, the picture quality is always better since the video is played from your hard drive. For this method of video transmission, you can use a standard web server.
However, the disadvantage of the sequential transmission method is that when playing a file, it is impossible to jump from one episode to another. Thus, in order to view any part of the clip, you will need to load it before the desired moment. Therefore, serial video transmission over the Internet is mainly used for short clips.
To transmit real-time video, a special streaming server is required. The video file is stored on this server, and to view it, upload it to HDD no need. The user can start watching the video from any moment without waiting for the file to download. Real-time video transmission is convenient for broadcasting long files.
Streaming servers They provide the ability to control media transmission, however, they are more complex to configure and administer than regular HTTP servers. In addition to special servers, special network protocols are also used, for example, RTSP (Real-Time Streaming Protocol). This protocol is used by Windows Media by default, but is also supported by Real Video.
RTSP is a protocol with the possibility of controlled transmission of video streams on the Internet. The protocol ensures the transfer of information in the form of packets between the server and client. In this case, the recipient can simultaneously play the first data packet, decode the second and receive the third.
The RTP (Real-time transport protocol) detects and compensates for lost packets, ensures the security of content transmission and information recognition. The RTCP (Real-Time Control Protocol) protocol works together with RTP. It is responsible for verifying the identity of sent and received packets, identifying the sender and monitoring network congestion. Formats
There are several main formats for streaming video on the Internet. These are FLV (or Flash Video), Real Media, Windows Media and Quicktime. Until recently, MPEG was widely used along with them, however, recently it has lost much ground.
FLV(Flash Video)
FLV is a file format used to transmit video over the Internet. Files of this format have the extension *.flv and are used by all popular video hosting services such as YouTube, Google Video, RuTube, Tube.BY, Movie, Obivu and others. Although the container format description has been made public, the codecs are protected by patents and remain proprietary. An FLV file is a bitstream that is a variant of the H.263 video standard. Sound in FLV is usually encoded in MP3, and in version 9 Flash Player added support for AAC audio. Files in FLV format can be viewed in most operating systems, since it uses the widely used Adobe Flash and plugins for most browsers, and is also supported by many video playback programs, for example, MPlayer, VLC media player, Media Player Classic) and other programs that work with DirectShow.

Illustration from thesportist.ru website

MPEG
The MPEG format was developed by Moving Picture Experts and until recently was considered the streaming standard. There are several versions of MPEG.
The MPEG-1 format was created back in 1988 and provided VHS quality when recording video to CD-ROM. Although MPEG-1 was designed as a storage format rather than a file transfer format, it provides excellent quality streaming video at high bit rates. The optimal bitrate for this format is 1.5Mb/s for a resolution of 352x240 at 30 frames per second. However, MPEG-1 files are usually too large to be transmitted over the Internet.
MPEG-2 format was developed for broadcasting digital television and over time also began to be used for DVD recording. Its bitrate is even higher than MPEG-1 (between 4 and 9 Mb/s), which allows for high-definition images. Its use as a streaming technology is not very common, as its information transfer speed is very high. To view a file in MPEG-2 format online, you need to have a data transfer rate of about 400 kb/s or higher.
The MPEG-4 format was specifically designed for transmitting data over the Internet and mobile communications. Its optimal bitrate is between 385 and 768 kb/s. MPEG-4 can be used to transmit audio and video streams, while providing high quality encoding with a high degree of compression. However, if at low data rates it provides good quality, it is not suitable for broadband transmission.

RealVideo
RealVideo is a format that was developed for streaming. It is practically not used to transfer data to DVD or CD-ROM due to high hardware requirements. A feature of RealVideo files is that they cannot be edited or re-compressed. This format uses compression techniques that reduce the number of frames in a video and removes unnecessary information from frames. The quality will depend on the amount of detail in the frames and on the dynamics of events. Due to the high level of compression, this format is suitable for users with low connection speeds.

Illustration of the website www.3dnews.ru

QuickTime
This format, developed by Apple, is widely used both on Mac computers, and in Windows environment. QuickTime has a lot in common with the Real Media format. QuickTime file compression rate is 1 MB for 3.75 seconds of video, so the image size can be increased or decreased without loss of quality. This means that a video file with a resolution of 320x240 can be viewed in full screen with the same quality. The QuickTime format is best suited for sequential streaming of video, since the process of downloading the file launches a player that plays the received information.

Illustration from the website rustelcard.ru

Windows Media
Windows Media is a streaming format supported by Microsoft. The company's latest development is Windows Media Video 10. This format outperforms its predecessor by 15-30 percent. Comparison with other streaming formats also speaks only in its favor. So, for example, a video in MPEG-4 format broadcast with a bitrate of 6 Mb/s will look similar to one made using WMV9 at 2 Mb/s. And the quality of video in the WMV9 format, transmitted at a speed of 150 kb/s, is no worse than that in the MPEG-4 format at 300 kb/s.


Illustration of the website 3dnews.ru

Sources used:

1.ci.ru
2. 3dnews.ru
3. rustelcard.ru

First of all, let's define what it is streaming data? This is a transmission method (in this case, video and audio) in which the transport and playback of multimedia data on remote computer carried out almost in real time.

For example, the user's computer is located in a remote segment of the local network (or even in another city). Data, in the form of a series of sequential packets prepared in a special way, is transmitted to the input of his PC, where they are decoded. After which the packets are “assembled” into source material, which is displayed on the user’s monitor in the form of an initial sequence of video or audio.

A striking example of this is Internet streaming, which is now gaining popularity, when an operator broadcasts an image from his camera to the Internet in real time, and from there it is “picked up” by users who have connected to the broadcast. You can also provide streaming of material already saved on your computer (start a network broadcast of a new horror movie or a video clip from your favorite rock band) :) Or organize a live broadcast from a webcam connected to USB port our PC.

The general scheme of this action looks like this:

But first things first! Today we will talk about streaming video. There are special protocols for transmitting streaming data: RTMP, PNM, RTSP, MMS, RTSPU, RTSPT, MMS, MMST, etc. They transform the source data on the fly so that it can be transmitted to the network as a continuous sequence. The use of advanced compression and buffering technologies allows you to view streaming content from anywhere without waiting for it to be fully downloaded to the user’s computer.

I propose to put an end to the theory and look in practice at what video streaming is? And then decide for yourself whether you personally need this technology or not, okay?

Today I want to tell you about one wonderful product: “Unreal Media Server" Honestly, I’m just blown away by this software package! :) I don’t know how things are now on the “fronts” of multimedia streaming, but when I was actively interested in this issue (I tried many solutions), the “adequate” software could be counted on the fingers of one hand. Either the server is fundamentally paid (you won’t try it), then it doesn’t work, then it works, but “crookedly”, the video is transmitted with wild delays and “brakes”, some solutions are frankly difficult to set up, which you don’t want to understand, etc. d.

And then, by chance, I stumbled upon this wonderful solution. The server size is only a few megabytes, the player is 500 kilobytes! Everything works, the video stream plays smoothly and without delay. There are no unnecessary (redundant and underused) functions, intuitive GUI. In short, everywhere you look there are nothing but advantages. I didn’t even find any cons :)

I remember I used the fourth version of this software. Download and install latest version(especially for writing this article - the tenth), I was pleasantly surprised that during this time the project did not acquire a whole “bouquet” of very “necessary” features and “bells and whistles”, very often only imitating the development of the project and unreasonably complicating its commissioning . The size of the distribution remains almost as compact, everything is as intuitive as before, and it works great!

After that, I was convinced: “Unreal Media Server” is worthy of a separate detailed article on our website! :) So, let's go to the website of the developers of this software: umediaserver.net In the upper left corner we will see a link “Products”, click on it. In the list that appears, select “Unreal Media Server”.



Then, in the right side menu, look for the “Download” item.


We get to a page from which we can download the necessary distributions and additional components (plugins) to our computer.



We will be primarily interested in the basic components shown in the photo above:

  • Unreal Media Server is a streaming media server itself
  • Unreal Live Server - a component for organizing live broadcasts from IP or web cameras
  • Streaming Media Player - a player that allows you to watch videos

Pay attention to the size of the software package distribution kits! So, download all three components to your computer:


Let's first install the main module - “UMedia Server”. I will not describe the installation process itself and provide screenshots of it (I just don’t want to bloat the article). It comes down to a few clicks on the “Next” button and is not anything complicated.

After installation is complete, click on the "Start" button in the taskbar and select "All Programs". Among other things, we will see new group“Unreal Streaming”, where all installed components of our complex will be added.


Media Server Configurator allows us to perform basic configuration of the application. This may sound like a joke, but our video streaming server is ready to go and can stream video online! Without any additional configuration! That's why I like him too :)

But we, I hope, want to manage all processes ourselves with a firm hand and understand what is happening? Then let's be patient and look at the main components of the entire video streaming software package. We launch Media Server Configurator and see its main window.



Pay attention to the “File Resources” and “Live broadcasts” sections. The first is responsible for playing over the network files that are already stored in a special folder on the server and ready for streaming (video clips, films, presentations), and the second section is used when organizing “Live” broadcasting from an IP or webcam.

Now we will look at the first option for transferring video that is stored on our computer. Pay attention to the “MediaRoot” folder, which by default is already created on the server (screenshot above). By clicking on it, on the right side of the window we can see the full path to it.

We can go to this address and see there one test.avi file, shown in the photo above. It is in this folder that we will need to “store” all our video files that we want to broadcast over the network.

Now, without further delay, I propose to organize viewing of this test file test.avi on a remote computer. To do this, we will set up a network between our two PCs: on the one where we will install the server components, 32-bit Windows 7 is installed, and our “client” will be the good old Windows XP.

Note: we discussed in detail how to set up a network between two computers in one of our many, so we will not dwell on this.

We will install Streaming Media Player on a computer with XP (the installation is also very simple and does not require additional explanation). As always, we look for the player icon under the “Start” button.



We launch it and try to play the test.avi file on it, located on our first computer. To do this, click on top menu to the “Play” inscription and from the list that appears, select the “Play file” command.


In the window that appears, we will need to indicate basic settings connections. This is logical, because the player “doesn’t know” where our video streaming server is located and what kind of file needs to be played from it? This is what we need to “explain” to him.

In the “Media Server IP address” field we indicate network address server (depending on what IP we assigned to the computer at the stage of setting up the network), in the “Port” field - the value of the port through which interaction will be carried out (usually it is listed here by default, but, just in case, remember its number: 5119 ).


Note: we also looked at what “ports” are and why they are needed, so we will not dwell on this point separately.

Let's continue! “Protocol” options are needed to select the type network protocol, which will be used for data transfer. You can leave the default - TCP (Transmission Control Protocol).

The “File name including virtual folder” field is used to indicate the virtual folder for storing our streaming video files. As we remember, this is the “MediaRoot” folder, which we examined in one of the previous screenshots. Using a slash, we indicate the name and extension of the file that we want to receive (play) from the server and click the “OK” button.

If we did everything correctly, then after a short wait for the player to buffer (the initial accumulation of video frames into the playback buffer for subsequent smooth playback), we will have access to our test.avi file.


As you can see, everything is actually very simple :)

Note: When testing this software package, you can place all its components on one computer. We created a network between two PCs here only to demonstrate how it all works in conditions close to “combat”.

You may ask the obvious question: what video file formats (extensions) are supported by this video streaming server? I will answer with a screenshot, which can be found on the official website of the project:



The photo above on the left lists the file types that can be used both for live broadcast directly from the camera, and for pre-prepared files ready for distribution over the network. The photo on the right shows applications that can “receive” the broadcast video stream.

Let's look at some settings that we can change on our server if we wish. What we can do? We can, for example, change the virtual directory for storing and distributing our content. This is done in the main server window using the “File” menu and the “Nev virtual folder” option (new virtual folder).


A settings window will open. In it we (within the framework of this task) will be interested only in the first fields:

  1. Folder name - name of the new virtual folder (set arbitrarily)
  2. Browse - select a folder to bind the virtual directory (you can create any one). You can specify the full path to an existing one -
    C:\\Program Files\UnrealStreaming\UMediaServer\MediaRoot
  3. Description - description of the folder (optional)


To save the settings, click “OK” and see that in the directory “tree” we have a new virtual “storage” for our video files.


Thus, you can create several thematic repositories and distribute video content among them. At any time, you can simply delete or temporarily disable any folder by clicking on it right click mouse and select the “Delete virtual folder” command from the list that appears. virtual folder) or “Disable virtual folder” (disable the virtual folder).

Now, when connecting to a streaming video server, instead of the MediaRoot folder (used by default), we will have to manually specify a new name in the “File name including virtual folder” field: in my case - my_video (the requested test.avi file remains unchanged).


I hope the very concept of streaming video has become more understandable to those of our readers who have not encountered it before? For people who have experience in this matter, getting acquainted with new software, which in itself is also not bad :)

Let's continue! Now let's password-protect access to file playback. For what? I don’t know, but you can use it if necessary :) Let’s turn again to the “File” menu - the “Properties” option.


This serious window will appear:



Note: in any “serious” window, the main thing is to find and concentrate on that part of it that is responsible for the one we need this moment function. The rest should be ignored! :)

In the screenshot above, I want to draw your attention to the places marked in red. First of all, there are two information fields where the port numbers through which the video stream is transmitted are written. I recommend remembering them or just remembering them in right moment where can I see them? :) Port 5119 is for the Unreal player and 5130 is for the Live broadcast server from the camera (we'll talk about this separately).

So, all we need from this window to organize access to the video using a password is the “Add User” button and the “Internal Authentication” switch ( External authentication). Switch, click on “Add User” and see this window:


In the photo above, indicate a custom username to access the video stream and create a password, confirming it twice. We can not change anything else and immediately click “OK”.

Now let’s launch the Unreal player on the remote computer again and try to “catch” streaming video from the server. We will see this prompt to enter your login and password:


We can check the box next to “remember my credentials locally”, then the user connecting again from this computer will not need to enter the password again. After filling out the fields, click “OK” and our video is successfully displayed!

In order to remove a user from the server and cancel password authentication itself, we need to return to the “serious” settings window, select account user and click the “Remove user” button. Don't forget to return the switch to the "Anonymous access" position - anonymous access! Click the “OK” button to save the settings.



I think we’ll have to split our article into two parts, otherwise the “sheet” of text is already too long. That's what we'll do! Moreover, this will be logical: in this (first) part we will look at organizing the broadcast of streaming video from pre-prepared files, and the second part of the article will be devoted to live broadcasting from a camera and working with Unreal Live Server.

Before we take a break, let's try to interact with the video streaming server without the proprietary Unreal player and use the standard Windows media player. Yes, he can do that! :) Launch our player: “Start” - “All programs” - “ Windows Player Media". Select the “File” menu (if there is none, press the “Alt” key on the keyboard) and from the list that appears - “Open URL”.

Note: Windows media player can open (connect) to video streams distributed over the network. This is the function we will use!

In the window that appears, we will need to specify the connection protocol, the address and port of the streaming video server, the path to the virtual folder and the requested file with its extension.



Taking a closer look, we will find that almost all the components of the address are already familiar to us (we came across them in one way or another during the course of this article). The obvious exception here is the “new” transmission protocol MMS(Microsoft Media Server protocol). This is an algorithm for transmitting media content Microsoft. Now it has been replaced by a more progressive RTSP(Real Time Stream Protocol), but mms is retained for backward compatibility.

This is what we will use! So, we indicate the protocol for connecting to the server (mms), its IP address (in our case it is 192.168.1.2), the server port on which it is “waiting” for connection (5119, note that after the IP address the port is indicated with a colon), Next, we register a virtual folder with video files (remember that we changed it to my_video) and finally - the file we requested, indicating the extension supported by the server (test.avi).

Note: If file types (bindings) are not configured in Windows Mediaplayer, you may be prompted to do so. All that is required of us is to click on the “Next” button several times. The media player will do the rest itself :)

Click the “OK” button. If we did everything correctly (oh, this sacramental phrase!), then it will start Windows window media player, in which at the top we will see the percentage of buffering (pre-loading) of the video we requested.


When this value reaches 100% (this will happen fairly quickly), the video will begin to play.


And now, as agreed, let’s move on to the second part of our article, dedicated to live broadcasting using software Unreal Media Server. Click on "continue" at the bottom of the article.