当前位置:网站首页>Discussion on streaming media protocol (MPEG2-TS, RTSP, RTP, RTCP, SDP, RTMP, HLS, HDS, HSS, mpeg-dash)

Discussion on streaming media protocol (MPEG2-TS, RTSP, RTP, RTCP, SDP, RTMP, HLS, HDS, HSS, mpeg-dash)

2022-06-27 05:07:00 A wise person

One 、 review

Demand analysis

The problems that streaming media technology needs to solve :

1. Allow the client to start playing the video without downloading the complete file ;

2. Allow the client to start playing the complete content from anywhere ( Not including live video );

3. For live video , Allow clients to watch channel content from any time ;

4. Allow playback under the client's bandwidth conditions and the client's hardware conditions ;

5. Provide relatively stable transmission speed , So that the user can basically play smoothly .

Along with two derivative techniques :

1. Support CDN transmission , To provide service expansion capability and better user access quality .

2. Support the encryption of video content , Avoid copyright content being relied on by others to make profits through reproduction and dissemination

Protocol customization

The design of streaming media network protocol needs attention :

1、 The Protocol shall specify the transmitted audio and video formats , Ensure that the client can easily parse and start playing , And the data redundancy is small

2、 The demand of streaming media determines that the data must be divided into smaller segments for transmission

3、 Rely on TCP Guaranteed delivery mechanism , Or based on UDP But add error correction , How does the client deal with the lack of data

4、 The Protocol shall have a mechanism to help the client obtain video data at a constant or controllable speed

Two 、MPEG2-TS agreement

MPEG2-TS call Transport Stream or TS, yes ISO/IEC standard 13818-1 or ITU-TRec.H.222.0 Standard audio and video transmission protocol specified in , Due to transmission Packet Can be saved to a file without conversion , It can also be regarded as a file format .

TS A stream can be thought of as a series of 188 Byte packet composition ( There may be different lengths in some extensions ) Of “ train ”, baotou Fixed for 4 byte , With 0x47 As Synchronization code start , The key message is PID.

TS A stream consists of one or more PES The code stream is repackaged to obtain , That is, a TS A stream can contain multiple PES flow , An audio PES Package needs to be less than or equal to 64KB, video PES A packet is a frame of video , because TS The payload size of the package is only 184 byte , One PES Packages need to be divided into multiple TS Packets are transmitted .
In addition to data ,TS In the stream, you also need Program Specific Information Information .
 Insert picture description here

·PAT(Program Association Table, Program association table ).

·PMT(Program Map Tables, Program mapping table ).

·CAT(Conditional Access Tables, Conditional access table ).

·NIT(Network Information Table, Network information table ).

·TSDT(Transport Stream Description Table, Transport stream description table ).

The client received a PAT package , You can get TS All programs and listings contained in the stream are good , And different programs for PMT Of PID value , It also provides NIT Of PID.

PMT The table is used to indicate the videos that make up a channel 、 Audio or data , It can be found that PID value , And the program clock PCR Of PID.

So when the client gets PAT and PMT After the package , To understand TS What is included in the stream .

PID It describes TS Contained in the stream PES Stream information , For splicing continuous packages .
 Insert picture description here

3、 ... and 、RTSP agreement 、RTP、RTCP、SDP

RTSP

RTSP Usually with RTP and RTCP Common use of agreement , among RTSP It is a two-way protocol between the server and the client , It is not responsible for transmitting audio and video data , It is used to control multiple audio and video streams .

It's based on TCP Establish a conversation , And HTTP1.1 similar .
 Insert picture description here
 Insert picture description here

 Insert picture description here
 Insert picture description here

 Insert picture description here

One time use RTSP Protocol playback process :

 Insert picture description here

RTSP Build a complete control session with different commands , Simultaneous dependence RTP and RTCP Or other protocols to transmit audio and video data .

A typical playback process will be established between the client and the server 5 Different Session: All the way RTSP Of Session、 Two ways RTP Of Session( One audio and one video ) And two ways RTCP Session( Corresponding to two routes respectively RTP Session), Occupy 5 Different ports (RTSP The default port of the protocol is 554,RTP And RTCP The port of is from SETUP Command to specify )

RTSP The protocol supports redirection , About to play session redirection , Let other servers provide services . The protocol can also select different transmission channels , For example, based on TCP、UDP And multicast UDP transmission RTP agreement

 Insert picture description here

RTP、RTCP、SDP

RTP yes Real-time Transport Protocol For short

RTP The protocol repackages audio and video data in different encoding and packaging formats , add RTP Head formation RTP package , Send again ,RTP Important information in the header includes Serial number Time stamp Load format etc. .

RTP Provided by agreement Jitter compensation and Data arrives out of order The detection mechanism of .

 Insert picture description here

RTCP namely RTP Control Protocol, The protocol itself does not send data , Instead, collect the statistics of the client , Include Number of bytes transferred Number of transmission packets Number of lost packets Network delay Jitter( shake ) etc. , The server can use this Change the bit rate or Adjust data Sending speed .

Session DescriptionProtocol( Session Description Protocol ) Used for and RTSP as well as SIP And so on .

SDP Also based on text , Foregoing RTSP Agreement DESCRIBE The reply to the command is SDP Format ,SDP The format of is exceptionally simple , By multiple < type >=< value > String composition of , Used to describe Session information , Also used to describe Types and formats of audio and video , The required bandwidth Time range even to the extent that mailing address Encoding parameters etc. .
 Insert picture description here

Allow two-way exchange of information , Use up to 5 Sessions exchange data RTSP Mode streaming media transmission , It's like running on a two-way multi lane road , Undoubtedly, it has solved the traffic problem to a great extent , but “ Cheng Yi Xiao He , Xiao He also defeated ”, The multi Lane occupation of resources may be later RTMP And so on .

Four 、RTMP

RTMP(Real-Time Messaging Protocol, Real time message transfer protocol )

RTMP Not a separate agreement , It is a protocol family composed of multiple related protocols .

1.RTMP, By default TCP port 1935 Clear text protocol for .

2.RTMPS, That is, through TLS/SSL Connected to the transmission RTMP.

3.RTMPE, Use Adobe Private security mechanism encrypts RTMP.

4.RTMPT, Use HTTP Packaged RTMP、RTMPS or RTMPE, It helps to penetrate the firewall .

5.RTMPFP, Use UDP Of RTMP, Allow users to do P2P Connect .

RTMP Is based on TCP Of Reliable transport layer protocol , Only one session is required to communicate with each other , And RTSP The agreement compares , Like a high-speed railway supported by tracks , Although the form is a little heavy , But it's efficient 、 Fast .

Encapsulate audio, video and other data into RTMP Message send out , In the actual transmission, the Message Divided into with Message ID Of Chunk. Every Chunk You can carry one Message. But more often , One Message There will be multiple Chunk bearing , Until the client receives it and restores it .Chunk Stream Is based on RTMP Chunk The logical abstraction of , The client will distinguish different types of data and organize the reception and restoration .
 Insert picture description here BasicHeader Can be extended by one or two bytes [stream id(c)],Chunk Header It contains such as Message Length information .
 Insert picture description here
establish TCP After connection ,RTMP The agreement will require 3 The handshake of the packets represents the establishment of the connection , The client sends a message representing the protocol version number 0x03 Initialize connection , And then send 1536 Bytes ( Include 4 Byte timestamp message 、4 The values are 0 Bytes of and 1528 Randomly generated bytes ), The server will also send 0x03 Version message for 、1536 Byte message , The client and server then send the echo bytes ( The timestamp pairs of our party and the other party and 1528 Random bytes ), And confirm the establishment of the connection after receiving .
 Insert picture description here
In practice , As long as the receiving conditions are met , You can create RTMP Connect , To reduce the number of interactions , Reduce connection setup time , The following sequence can be used : The client sends C0 and C1, Server reply S0、S1 and S2, The client sends C2.

When the handshake is over , The connection will be multiplexed to send one or more Chunk flow ,Chunk The default size is 128 byte , It is up to the client and server to set what they can accept Chunk size ( It can be adjusted dynamically ),Chunk Carrying Message Different types , Its Message Header There are also many , Different fmt Values will be used to identify different Chunk type .

RTMP The protocol defines some special values to represent control messages .
 Insert picture description here
RTMP Also defined Command、Data、Audio、Video、Aggregate、Shared Object And so on , among Command Message as follows
 Insert picture description here
RTMP Protocol support Push and Pull Two modes ,Pull That is, the general client-side basis URL How to play , and Push be based on RTMP Live video of , The handshake sequence is the same as createStream The steps are similar , Used by the client Publish Command, not Play command , Initiate push from client to server .

RTMP The protocol is used for video service , Ad insertion for dynamic rate switching 、 Playlist 、 Fast switching of live channels is relatively weak , So in many solutions , Designed to pass SMILSMIL Format is a format that describes multimedia integration , Commonly used in and RTMP Build streaming media services together with protocols , But the application scope is far from limited to this . Out of band communication with the server . Use SMIL Example of code rate switching .
 Insert picture description here

5、 ... and 、HLS、HDS、HSS

RTSP and RTMP Is a session based streaming protocol ,HLS(Http Live Streaming)、HDS(Http Dynamic Streaming) and Smooth Streaming(HSS) Is based on HTTP The agreement .

HLS

The principle of the protocol is to transfer the multimedia files required for VOD or the live video stream , A file cut into small pieces , Let the client base on HTTP Download , When playing , The client needs to download metadata The information of M3U8 file ( Also called an index file 、Playlist or Manifest file ), according to M3U8 The content of the document , At the same time, according to the network conditions, select the content with different code rates to play .

HLS The following audio and video formats are supported , First of all MPEG2-TS or fMP4( namely Fragmented MP4) Format encapsulated slice file (Segment). secondly , It supports packaged pure audio formats , Include ADTS Head encapsulated AAC frame 、MP3、AC3 and EAC3 Format , Yes, subtitles , It only supports WebVTT Format

An on-demand file M3U8 Examples are as follows
 Insert picture description here
#EXTM3U、#EXT-X-TARGETDURATION Is such as M3U8 Specified in the document tag, This includes the original definition and the extension by apple tag, This on-demand file has a total of 21s, It is divided into 3 individual TS Of Segment.

live M3U8 Examples are as follows
 Insert picture description here In this case , The protocol expects the client to access the server regularly ( for example 7.975s A visit ) To see if there is Segment Continuously updated , and Segment The file names of are also incremented in order .

Multi bit rate video stream Master type M3U8 Example , Describes the high 、 in 、 Audio and video streams with three low bit rates and those containing only audio content AlternativeM3U8 The interview of URL
 Insert picture description here
Multi rate HLS The organizational structure of the flow :
 Insert picture description here
characteristic

HLS A major feature of the agreement is that , The past RTSP、RTMP And so on 、 Multi track audio and video flow easily , And can clearly express 、 Understand and optimize , The information required to be transmitted to the client as specified in the protocol can be transmitted by Master and Alternative Two kinds of M3U8 To express .

In this design , The client assumes the main responsibility of rate control and selection , Each player can choose the appropriate bit rate to play according to its own network speed , And switch to other bit rates when the network environment fluctuates or some files fail to download , Keep playing smoothly , The server is responsible for caching and CDN friendly , There is no need to treat different users differently .

HLS The protocol supports providing audio or video streams of different encoders in the same video stream for the client to choose , In the playback session , The client according to its own needs , Switch the code rate to download and play . The same mechanism can also be used for multilingual support , Provide different audio tracks for different languages . To support multiple bit rates 、 Multilingual or different Codec Handoff , In program production , It shall be ensured that in streams with different bit rates , All video key frames have their timestamps perfectly aligned , Otherwise, the client will not work properly .
 Insert picture description here
Tag function

HLS The protocol defines many different Tag To support various functions . for example EXT-X-DISCONTINUITY It means the following Segment It is not continuous with the previous content , May be Codec There are changes ;EXT-X-I-FRAME-STREAM-INF Can be used in Playlist Define an all by I A stream of frames , Usually used by thumbnail preview ; In the live stream , The embedded shape is as follows #EXT-X-PROGRAM-DATE-TIME:2018-0219T14:54:23.031+08:00 Of Tag The next... Will be indicated Segment The absolute time corresponding to the first frame in , It can be used to measure the delay of live streaming ;EXT-X-DATERANGE Used to specify characteristics over a period of time , for example SCTE-35 Information .

First , In the early HLS Most streams use a fixed length of 10s Of Segment file , However, the startup time and live broadcast delay are not satisfactory , Common nowadays Segment The length is set to 1~6s Unequal , Maintain consistency between different bit rates of the same audio and video stream .

secondly , For convenience TS Analysis of flow ,PSI Package namely PAT/PMT The table should be inserted in Segment The head of , And the key frame of the video should also be placed in Segment The head of , Every Segment The video in consists of a complete GOP Composition is a common practice .

Apple at 2010 The year is coming HLS The agreement is submitted as RFC, It was revised over the years , Add new features , But that's why , Users need to pay attention to the version of the protocol , Older devices or clients may not support some new features , You need to be careful with .

HDS and HSS

And HLS Formulated in the same period , Having similar characteristics ( be based on HTTP、 Support multi bit rate 、 Audio and video file slicing ) The streaming media protocol of is different Adobe To launch the HDS(HTTP Dynamic Streaming) And Microsoft SmoothStreaming, They are associated with MPEG-DASH Together , It's called AdaptiveBitrate Streaming technology ( Rate adaptive streaming media technology ).

HDS from Adobe Their own Flash Media Server Support , Its file format is FLV、F4V and MP4, The index file format is F4M, Support live and time shifted TV .

Multi rate 、 Multi track F4M File example .
 Insert picture description here
Microsoft Smooth Streaming yes IIS Multimedia service extension of the server , Support PIFF Format MP4 file , The suffix is ISMV and ISMA, The index file is ISM or ISMC, It also supports live and time shifted TV

Multi bit rate ISM File example
 Insert picture description here
It is different from the old protocol dominated by the server , With HLS The streaming media protocol represented by gives the client a great deal of freedom , Also on Web The server and CDN It has natural affinity , Make the transmission process more flexible and personalized .

6、 ... and 、MPEG-DASH

MPEG-DASH By MPEG Led the development based on HTTP Adaptive bit rate streaming media technology , On 2011 year 11 International standards will be formed in June , Its standard document is ISO/IEC 23009-1.

be based on HTTP Streaming protocols are popular , Considering the environment , The main reason is HTTP The protocol is firewall friendly , And natural for CDN Distribute in a cache .

Given the need for interoperability , After all, private agreements cannot become the mainstream , operating system 、 Browser support will promote standardization , If we say that various companies have launched HLS、HDS、Smooth And other agreements are replacing centralized shopping with express logistics , that DASH It's like the express company has access to the unified rookie network , Be able to provide services in a unified way .

Details of the agreement

MPEG-DASH And HLS、HDS、Smooth Streaming Similar design concepts , Divide audio and video files or live streams into a series of file slices that can be downloaded and played , Use MPD File description slice information .

MPD There is a timestamp inside 、 code 、 The resolution of the 、 Bit rate and other information , The organization of audio and video content is divided into SegmentBase、SegmentTemplate、SegmentList and SegmentTimeline Other types , On the client side MPD After the file is parsed , Then download the required file slice , Let the player assemble and play .
 Insert picture description here
Here are the differences based on HTTP Streaming media protocol function comparison of
 Insert picture description here
DASH In principle, the protocol can support any coding format , As a guide , Recommended for use with HLS Protocol compatible TS File or ISO-BMFF As a multimedia file format ( namely Fragmented MP4), The file suffixes of the latter are common .mp4、.m4v、.m4a or .m4s.DASH What is used MP4 File extension from Microsoft in 2009 Published in PIFF File extension (ProtectedInteroperable File Format, Here's the picture ), It means SmoothStreaming The agreement can MPEG-DASH The protocol is compatible with each other at the audio and video file level .
 Insert picture description here
DASH The protocol will describe the part of the audio and video stream ( That is, the information on the file header ) Encapsulated in the init File and on MPD Provided in the document URL, The client can download and parse independently at any time , This avoids TS The file is repeatedly inserted PSI Consumption of information , Client download init After the document , You can download the slice file to play ( conversely , The slice will not play due to lack of decoding information ). For audio and video , Different... Are also available init file , Increase the flexibility of the client .

DASH Medium MPD accord with XML Format , The protocol defines a number of tags to help describe , Among them Period Define a continuous audio and video clip , Every Period It contains a collection of various audio and video contents ( Mainly used in multi-resolution 、 Frame rate 、 Bit rate or multilingual , They can switch between each other ) Referred to as AdaptationSet, Every AdaptationSet Containing multiple Representation, That is, an independent audio or video stream , Every Representation Then a series of Multimedia Segment form .

DASH The protocol cannot be switched from... At will during playback Representation Switch , Wait until the initial frame is a key frame Segment. if AdaptationSet Each video stream in is encoded with keyframes aligned , You can switch between different streams .

application

Some modern browsers ( Such as Chrome、Edge、Firefox、Safari etc. ) All right W3C Standard definition of MSE(MediaSource Extension, Media source expansion ) and EME(Encrypted MediaExtensions, Encrypted media extension ) Supported , Put the functions previously provided by plug-ins into the browser , Application Javascript The developed web player only needs to download MPD File and parse , Then send the audio and video files to the browser , It's easy to play .MSE and EME Please refer to W3C Website :

** MSE principle **
 Insert picture description here
ESE principle
 Insert picture description here
In addition to browsers ,Android、Chrome、Roku And other platforms MPEG-DASH Support for . No support for DASH On the platform , You can also migrate browsers (Chromium,Chrome Open source version of ) Add video playback function in the way of .DASH The agreement has taken a big step forward in unifying the chaotic streaming media market , But because of DASH and HLS Are incompatible with each other , It means to support full coverage of various devices , Online video service providers need to prepare MPD and M3U8 Two kinds of Manifest file , To make matters worse , Need to code fMP4 and TS Two different audio and video files , meanwhile , Put aside the costs of R & D and storage ,CDN You will need to store two video files on all edge nodes , That means double the cost .

To avoid the above embarrassing situation , Microsoft 、 Cisco 、 Apple 、Comcast When the company launched CMAF standard (CommonMedia Application Format, General media application format ), This standard unifies the container format of video files , Regardless of HLS, still DASH, Can use the same program content , In scenarios that require encryption protection , It can also be through different DRM The scheme encrypts or decrypts the same file . Besides ,CMAF A new design of log second length slicing and re blocking transmission , Also on the HTTP The most notorious delay problem of the type of streaming media protocol is of great benefit .

Here is CMAF Object model of :
 Insert picture description here

7、 ... and 、 Streaming media server

Just like the concept of logistics center in the logistics system , The streaming media server is responsible for the efficient distribution of content .

Although in recent years based on HTTP Streaming media protocols are popular , Universal HTTP The scheme of attaching streaming media protocol plug-ins to servers is widely used , Encroach on the market share of dedicated streaming media servers supporting multiple protocols , But given GM HTTP Between the server and the dedicated streaming media server I/O、 High concurrency 、 The pursuit of high consistency with low latency and high reliability , It is still very important to fully understand the relevant technologies to build and optimize the streaming media system .

The functions and challenges of streaming media server

Functional requirements include on-demand and live broadcast .

The VOD service needs to convert the audio and video files on the hard disk or other storage devices into a series of packets specified in the streaming media transmission protocol (Packet), Send to different clients .

The live broadcast service needs to be based on IP The Internet , Audio and video streaming import server encapsulated by streaming media protocol , Then it is transformed into streaming media packages that can be received by different devices through the server , Send to each client .

Client support

The server faces a variety of clients , There are... On the computer Chrome、Edge、IE、Firefox、Opera、Safari Other browsers , Also have VLC、QQ Video and sound 、 Storm video and other players , Other devices are based on embedded systems Linux or Symbian、 BlackBerry smartphones , To modern apples or Android equipment , from Roku、FireTV、 Millet box type set-top box to XBox、Play Station、Nintendo Series game console , from Chromecast Class of wireless projection devices to Oculus、Vive、HoloLens Virtual reality 、 Augmented reality device , The audio and video applications on each device are the target service objects .

Protocol support

No matter on demand , Or live , Because different streaming media protocols stipulate different transmission formats , That is to say, different packages are adopted for the same audio and video coding format , So the main work of the server is

1、 Convert file to streaming media protocol

2、 The streaming media protocol is converted into a file

3、 One streaming media protocol is transformed into another

When converting, unpack and package according to the file format and streaming media protocol format ( English is Packetize and De-packetzie)

With H.264 and AAC Audio and video content in , stay transmission It needs to be encapsulated as NAL Format and ADTS、LOAS Format , And then encapsulated in different protocol packages , for example RTP package 、TS Bag, etc , Send or receive in this unit .

Streaming media transmission from server to client , Using the MPEG2-TS、RTSP/RTP、RTMP、HLS、MPEG-DASH Such agreement .

MPEG2-TS The difference from other streaming protocols is , It can only be used for active streaming Push Pattern , Other agreements may take Pull or Push Two different modes .

MPEG2-TS It is mainly applicable to the field of cable TV , Any user receives TV programs continuously by default , Other protocols are designed with more consideration to the transmission connection of streaming media initiated by the client on demand . When the server imports the live stream , Different scenarios can take Pull and Push Two ways .

Application scenarios

The common application location of streaming media server is the origin of video websites , as well as CDN The service includes the origin (Origin)、 Intermediate station (Proxy)、 Edge station (Edge) Nodes at all levels within , Form the core of video distribution .

The streaming media server depends on the deployed location , Can be defined as different roles , Such as Publisher and Subscriber,Publisher I.e. source station or upstream station ,Subscriber I.e. downstream station or edge station , For the live streaming server , The main problem we face is how to Distribute streams to edge nodes reliably and with low latency , On demand services , Requesting a video that does not exist on the edge node will result in a request back to the source , The accessed file fragments will be cached in the edge node for the next access , The particular challenge of the server is how Cache efficiently Use and manage .

Special CDN The service provider needs to transform the server , Realization VirtualHosting function , Its main concept is to One server for virtualization splitting . Due to different customer sizes , Most of the edge services in different regions are only used sporadically , Assign calculations to each customer individually 、 Storage and network resources are not economical , The streaming media server it uses , Sure According to the resource information requested by the user or Cookie Identify which customers they come from , On demand resource allocation and billing within the server ).

Application features

For VOD stream :

Yes HTTP For servers , The file fragments that need to be cached are based on Range Ask for .

It can be assumed that a file is from 3000 To 7000 byte , But it is slightly different from audio and video files , Because of the concept of video key frame , Get or store incomplete GOP Data is meaningless , Therefore, whether the content requested by the user is returned or the audio and video clips are cached locally , Are subject to Close to the requested position GOP Is more efficient , At this time, there should be a corresponding... Of audio and video clips in the cache Timestamp information For indexing .

For live streaming :

Because users can start watching at any time , To save bandwidth and speed up playback startup , The server should be owned by itself Key frames are found in the queue of audio and video streams , Start service from here , Avoid sending incomplete GOP data .

When the user Switch between different channels when , If audio and video Format identical , The streaming media server can use the current connection with the user Connect , from The key frame of the new channel starts to be sent Other methods ( See the picture 4-25), Achieve the best user experience .
 Insert picture description here
Because the transmission of video stream is restricted bandwidth The Internet Transmission stability 、 The client waits for rendering and other restrictions , Slave encoder 、 Origin server 、 Proxy server to edge server , And the player itself , Each link will maintain a cache , this It helps to smooth the whole transmission process , But the price is the player playing There is a delay , In case of live broadcast , It will also lead to the content of the program that happened seconds or even tens of seconds ago . It is usually maintained inside the server Packet queue , It can be resized according to different scenes , In the special scenario of pursuing low delay for live broadcast , The queue can even be cancelled , That is, the server receives any Packet Will handle forwarding immediately .

Streaming media server because of its streaming service characteristics , It puts forward very high requirements for reliability , After all, users occasionally fail to access web pages , Just refresh and retry to get the service , But the failure in the middle of the video playback has a much greater impact on the user experience , Live broadcast users may want to continue watching just missed clips , On demand users expect that the viewing progress can be automatically restored .

More rigorous server testing will construct various simulated applications , experience 7 Days or longer playback test , Overwrite timestamp overflow , Use cases such as frequent play . The requirement that the live broadcast service is still required to be 24x7 and uninterrupted in the high concurrency environment , The server should support hot backup , The feasible way is to pre configure multiple redundant live streams , The server is responsible for judging and switching , The following figure shows a schematic diagram of a live stream redundancy backup scheme .
 Insert picture description here

Extension technology

advertising

Whether on demand or live , Dynamic insertion of advertising is a common demand , According to the advertisement The crowd is different , Its inserted The location is different .

For the live broadcast service :

for example , If an advertisement is expected to be delivered to all users like a TV channel , First of all, it is suitable for The encoding side is directly programmed into the live stream , The second choice is The live source server of the website On , Replace Some of the original program GOP, At this time, such as advertising length and replaced GOP Different , Consider re coding the ads , Discard some frames , For the whole live program Timeline Adjustment, etc .

If you want to put different advertisements for different people , Especially the delivery based on geographical location , It can be put into Streaming media server of edge station on .

For on demand services :

For on demand services , It is feasible to embed the advertising content directly before the actual content

After or some two GOP Between , At this time, it needs to be adjusted by the server Timeline[ illustrations ], Ensure the continuity of playback . Due to the technical complexity of embedding advertisements in existing audio and video programs , A more practical approach is to provide the player with a playlist containing advertisements and actual programs , take Timline Adjustment of Let the client complete .

Recording screen

Another common requirement for live broadcast services , The user selects to record a certain segment , For later aftertaste . Developing this feature on a streaming media server is a common choice , among , It is not necessary to encode the audio and video stream just like the video capture equipment , contrary , Because no matter video or audio , Defined by each streaming media protocol Packet Both contain timestamp information , For the video, there is the start and end information of each frame and whether it is a key frame , It's easy to collect and convert them into video files .

other

Traditional streaming media server , In addition to basic purposes , It also carries many additional functions , For example, server file browsing , Simple CMS( Content management system ), Loop Playback , Connect via playback 、 Duration 、 The success rate 、 Traffic and storage occupancy statistics for billing, etc . Because a separate streaming media server is responsible for the distribution of audio and video content , It needs to provide a complete API, Make video websites 、 Content import 、 Content management system 、 Advertising services 、 Scheduling system 、 User interaction system 、 journal 、 Billing and other modules can adopt fine-grained control .

原网站

版权声明
本文为[A wise person]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/178/202206270432554506.html