Some articles on setting up streaming media (1)

Source: Internet
Author: User
Tags format definition
I. Preface

As more and more friends begin to choose ADSL, cable modem, or fttb + lan as the primary way to access the Internet, the broadband era is approaching, this makes our dream of "Broadband KTV, audio and video chat rooms, online cinemas, and distance education" a reality, and the closely related "streaming media) "It has also become a hot topic for many people to talk about, because" streaming media "is the technical motivation for achieving these broadband applications.

The advent of the Broadband Age also makes netizens no longer satisfied with the fact that they are serving only one service audience. They need to communicate on a larger scale to reflect the value of individual users. Therefore, many friends started to use their computers to build online broadcast and on-demand broadcast sites. They are full of enthusiasm, but it is undeniable that Chinese netizens are inherently technical insufficiency, so that they have encountered many obstacles when building such a site, so they have to give up. How to turn this enthusiasm into motivation under the guidance of technology is exactly what we need to do at home computers. So, today, here, I will show you how to create your own streaming media server.

However, before starting the official establishment of the Streaming Media Server, let's take a look at the basic knowledge of the Streaming Media Server.

Ii. Basic streaming media knowledge

What is streaming media?

Currently, there are two solutions for transmitting audio/video and other multimedia information over the network, namely HTTP or FTP download and stream transmission.

Standard HTTP and FTP protocols are used for HTTP or FTP download. However, due to the huge volume of multimedia information, it usually takes several minutes or hours to download a multimedia file, this results in a video that does not know the content. The download may take longer than the whole video. These downloaded files must be created before being downloaded and placed on the network server. The direct consequence is that the network bandwidth is constantly increasing and people are waiting for less and less download, however, you still cannot watch the live video on the Internet.

During stream transmission, audio, video, animation, and other multimedia information are continuously and in real time transmitted by the Streaming Media Server to the user's computer. It first creates a buffer zone on the user's computer, you do not have to wait until the entire file is downloaded. Instead, you only need to wait several seconds or dozens of seconds to watch the video. When multimedia information is played on the client, the remaining part of the file will be downloaded from the server in the background. If the network connection speed is less than the speed required by the playing multimedia information, the playing program will use the data in a small buffer area previously established to avoid playing interruption and maintain the playing quality.

In addition to sending completed files, streaming transmission can also collect on-site audio and video in real time by collecting servers, push them to the Streaming Media Server, and provide them to users in real time. Therefore, in addition to the multimedia on-demand services such as downloading, streaming media can be used in live broadcast, television broadcasting, emergency reporting, and other fields that require high real-time transmission.

Streaming Media vendors

The market for streaming media is huge, and many excellent vendors in the world join the ranks. At this stage, it is also a perfect place for system integrators to compete. In the general market, there are three main competing companies: Microsoft, RealNetworks, and Apple. The corresponding products are Windows Media, Real Media, and QuickTime. Recently, Nullsoft, a famous Winamp developer, has added video support to its MP3 server, and wants to share it with the streaming media market.

Because Apple's servers and Editing Software generally use Mac as the operating platform, Nullsoft's streaming media servers are immature transactions, so here I will introduce Microsoft and RealNetworks products.

Streaming media transmission protocol

When you watch online movies or TVs, you usually notice that the connections to these files are not starting with HTTP or FTP, but starting with RTSP or MMS. Why? In fact, like HTTP and FTP, these are both network-based data transmission protocols, but they are dedicated to stream media transmission. Next, let's take a look at the main streaming media protocols currently used:

1. RTSP (Real Time Streaming Protocol), a real-time Streaming Media protocol proposed by RealNetworks and Netscape, is now used in RealNetworks Real Media Products;

2. PNM (progressive networks audio), which is also a real-time transmission protocol. It generally uses UDP protocol and occupies port 7070, however, when your server is in the firewall and port 7070 is blocked, and your server sets the smartingnetwork to true, the HTTP protocol is used and the default port 80 is used;

3. MMS (Microsoft Media Server Protocol) is Microsoft's Streaming Media Server protocol. MMS is the default method for connecting to the Windows Media Unicast service.

This article introduces three main protocols. You may also ask, what protocol does apple use for QuickTime? In most cases, QuickTime uses the HTTP protocol, but in fact it is also based on the standard streaming media transmission protocol, which is the standard RTSP protocol, and real uses its own RTSP developed.

In streaming media transmission, the standard protocols are RTP (Real Time Transport Protocol) and RTCP (Real-time transport control protocol) RTSP (Real Time Streaming Protocol) and RSVP (Resource Reserve Protocol) are both researched and developed based on these protocols, we will not discuss it further here.

Streaming media files and publishing formats

With the real-time transmission protocol, we should also be able to think that only small files are suitable for real-time network transmission. What compression algorithm is used for streaming media files?

If you are using a Windows operating system, you can see that when you watch online streaming programs, their suffixes are RM, ASF, and WMV. These are the formats of streaming media. The streaming media file format is specially encoded. It not only adopts a high compression ratio, but also adds a lot of control information, making it suitable for downloading and playing on the network, rather than waiting for the download of a complete file to play.

Common streaming media formats include the following:

Media File Format extension (video/audio) media type and name
ASF Advanced Streaming Format. (Microsoft ).
Rm real video/audio file (progressive networks ).
RA real audio file (progressive networks ).
RP real pix file (progressive networks ).
RT real text file (progressive networks ).
SWF Shock Wave flash (Macromedia ).
MoV QuickTime (Apple format)
Viv vivo movie file (vivo software ).

There is also a WMV Format, short for Windows Media video, which is slightly different from ASF files. wmv generally uses window media video/audio format, the ASF video section generally uses Microsoft mpg4 V (3/2/1 ?), The audio part is Windows Media Audio v2/1. However, many production software have not separated them, so you can directly change the suffix to convert them into the other format.

The created streaming media files must be published on the network to be used by others. Therefore, the compressed streaming media files must be arranged in a specific way, and the format of the streaming media files must be changed to the streaming media publishing format. Common publishing formats include the following:

Expanded media types and names in streaming media publishing format

ASF Advanced Streaming Format.
SMIL synchronised Multimedia Integration Language.
Ram file.
Rpm embedded RAM file.
Asx asf Stream Redirector/ASF stream Steering Gear File
XML eXtensible Markup Language

MPEG-4 and streaming media

Speaking of streaming media can not but mention MPEG-4. MPEG-4 is one of the focuses of the current discussion, only because it can achieve the approximate quality of video and audio effect under the large compression ratio, this is why many friends think the MPEG-4 format is definitely clearer than RM. But in fact this is not the case, MPEG-4 is just a video encoding technology, its clarity also varies greatly according to the bit rate selected during compression (the MPEG-4 format file we see is usually generated for kbps compression, of course, high quality), and, MPEG-4 also has a variety of compression standards, such as Microsoft's ASF video part is based on the MPEG-4 of discrete cosine transform (DCT), and DivX free MPEG-4 version (beginning to crack the Microsoft format ). Microsoft uses Windows Media Audio v2/1 and DivX uses MP3 or higher quality ac3. In contrast, the real or apple format uses self-developed encoding, in the same bit rate, especially low bit rate, not necessarily worse than the MPEG-4, the RM format with a high bit rate is still clear and human-friendly, so we will say that the concept of RM format definition difference should be changed later :), at least the conditions should be added. In addition, the real video 9 in the latest Helix producer adopts the VP5 compression format for encoding, which is much better than DivX!

However, the Streaming Media Server began to close to the MPEG-4 format is an indisputable fact, real's latest Helix began to support MP4 format file service, and RealOne Player is only the installation of a plug-in to achieve the MPEG-4 format of playback.

On-demand broadcast

Before setting up a Streaming Media Server, we must understand the knowledge of on-demand streaming and broadcasting.

Vod is an active connection between the client and the server. In the VOD connection, you can select a content item to initialize the client connection, A client receives a media stream from the server (this connection is unique and cannot be occupied by other users) and can start, stop, back, fast forward, or pause a media stream, the client has control over the stream, just like watching a video disk. In this way, because each client connects to the server, the server needs to establish a connection for each user, which requires a large amount of server resources and network bandwidth.

Broadcast refers to the passive receiving of streams by users. In the broadcast process, the client receives a stream but does not control the flow. the user cannot pause, fast forward, or backward the stream. The data sending methods used by the broadcast include unicast and broadcast. When unicast transmission is used, the server needs to copy multiple copies of the data packet and send them to the users who need it in multiple point-to-point ways. Broadcast Transmission is used, A separate copy of the data packet will be sent to all users on the network. Regardless of whether the user needs it or not, the above two transmission modes will waste network bandwidth and server resources, therefore, multicast technology is introduced.

Multicast absorbs the strengths of the two sending methods, overcomes the weaknesses of the two sending methods, and sends a separate copy of the data packet to the customers who need it, multicast does not copy multiple copies of data packets to the network, nor send data packets to customers who do not need them. This ensures that multimedia applications on the network occupy the minimum bandwidth of the network. However, multicast not only requires server support, but also supports multicast routers and the entire network structure.

Unicast and Multicast)

We have learned some concepts about unicast and multicast, which is one of the focuses of streaming media. In my understanding, on-demand broadcast and broadcast are a group of concepts, and they interact with the client media. unicast and multicast are another group of concepts, they are the transmission methods of streaming media data on the server and on the network.

For unicast transmission, a separate data channel must be established between the client and the Media Server. Each packet sent from one server can only be transmitted to one client, each user must send a separate query to the Media Server, and the server must send the requested data packet copy to each user. This huge redundancy will cause heavy load on servers and network bandwidth, and the response may take a long time, or even cause service failure. Unicast can be used for VOD and broadcast.

When multicast is sent, the server sends a set of streaming media data requested by the customer to a vro supporting Multicast technology. Then, the vro copies the data packets to multiple channels according to the route table at a time, then send it to the user. At this time, the Media Server only needs to send an information package. All clients sending requests share the same information package and the information can be sent to clients with any address. clients without requests will not receive the information package, the total amount of information packets transmitted over the network is not as large as that transmitted over the broadcast, which greatly improves the utilization of servers and network lines. However, multicast also has its own characteristics. First, you must start a vro that supports multicast technology. In addition, generally, it can only be used for broadcast, because on-demand broadcast may cause user control problems.

Well, if you say so much, you may be tired of me, so let's start our journey of setting up a Streaming Media Server.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.