Video playback method, device, server, system and storage medium
Through the communication connection between the server and the CDN side and the client, the historical video data sharding address of the CDN side is obtained and stored, which solves the connection difficulty problem caused by the differences in the interface of the CDN side, and improves the user experience through real-time playback of video clips.
Patent Information
- Application Number
- CN202210073990.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-21
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-01-21
AI Technical Summary
Due to the differences in interfaces between the CDN side, the connection between the server and the CDN side is difficult and the interface is low, and the existing video playback methods cannot quickly view the video clips of interest, which makes the user experience poor.
Through the communication connection between the server and the CDN terminal and the client, the shard address of the historical video data stored on the CDN terminal is obtained according to the preset period and stored in the address list. After receiving the playback request from the client, select the target fragment address from the address list, obtain the corresponding video clip playback address, and send it to the client, so that it can obtain and play the target video clip from the CDN side.
It realizes a unified interface, reduces the difficulty of connection, improves the scalability, and improves the convenience of video playback through real-time playback of video clips, optimizing the user experience.
Smart Images

Figure CN114401430B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video technology, and in particular to a video playback method, device, server, system and storage medium. Background Art
[0002] With the emergence of live broadcast platforms, live video broadcasting has brought users real-time social experience and diverse entertainment. For example, users can watch the game events they are interested in through the live broadcast platform. In order to avoid users missing the wonderful moments, CDN (Content Delivery Network) can be used to record the live video for real-time playback. Due to the interface differences of CDN, it is difficult to connect the server and CDN, and the interface scalability is low. Summary of the invention
[0003] In view of this, an object of the present invention is to provide a video playback method, device, server, system and storage medium.
[0004] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0005] In a first aspect, the present invention provides a video playback method, which is applied to a server, wherein the server is communicatively connected to a CDN end, the server is communicatively connected to a client, and the CDN end is communicatively connected to the client; the method comprises:
[0006] According to a preset period, based on the historical video data stored on the CDN end, a fragment address is obtained and stored in an address list; the historical video data represents the video data that has been played in the live video stream, and the fragment address corresponds to the video segment in the historical video data;
[0007] Upon receiving the playback request sent by the client, selecting a target shard address from the address list according to the playback request;
[0008] According to the target segment address, obtaining a playback address of a target video segment corresponding to the target segment address;
[0009] The playback address is sent to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it.
[0010] In an optional implementation manner, the segment address includes a start timestamp and an end timestamp of a corresponding video segment; and the step of selecting a target segment address from the address list according to the playback request includes:
[0011] Obtaining a time offset in the playback request, where the time offset represents a time difference between a start frame of a target video segment and a current frame of the live video stream;
[0012] Calculate the time corresponding to the start frame according to the time offset and the current time;
[0013] The target slice address is selected from the address list according to the time corresponding to the start frame; the time corresponding to the start frame belongs between the start timestamp and the end timestamp of the target slice address.
[0014] In an optional implementation manner, the server pre-stores the source station address of the CDN end and multiple acceleration domain names corresponding thereto; the step of obtaining the playback address of the target video segment corresponding to the target segment address according to the target segment address comprises:
[0015] Obtaining the source site address of the CDN end according to the target shard address;
[0016] Selecting a target acceleration domain name that meets preset conditions from multiple acceleration domain names corresponding to the source site address of the CDN end;
[0017] According to the target acceleration domain name, a playback address of a target video segment corresponding to the target segment address is obtained.
[0018] In an optional implementation manner, the historical video data is obtained in the following manner:
[0019] Pushing the live video stream to the CDN end, so that the CDN end sends a pending confirmation request to the server whether to record the live video stream;
[0020] Upon receiving the request to be confirmed, generating a confirmation recording message and sending it to the CDN end;
[0021] Upon receiving the video acquisition request sent by the CDN, transcoding the live video stream to obtain transcoded video data;
[0022] The transcoded video data is pushed to the CDN end, so that the CDN end performs format conversion on the transcoded video data to obtain the historical video data.
[0023] In an optional implementation manner, the step of generating a confirmation recording message and sending it to the CDN end upon receiving the request to be confirmed includes:
[0024] Upon receiving the request to be confirmed, obtaining a playback bit rate level of the live video stream;
[0025] A recording confirmation message including the playback bit rate level is generated and sent to the CDN end.
[0026] In an optional implementation manner, upon receiving the video acquisition request sent by the CDN end, the step of transcoding the live video stream to obtain transcoded video data includes:
[0027] Upon receiving the video acquisition request sent by the CDN, a target link is acquired; the target link is used to transcode the live video stream in the viewing request sent by the client;
[0028] The live video stream is transcoded through the target link to obtain transcoded video data.
[0029] In a second aspect, the present invention provides a video playback device, which is applied to a server, wherein the server is connected to a CDN end for communication, the server is connected to a client end for communication, and the CDN end is connected to the client end for communication; the device comprises:
[0030] A storage module, configured to obtain, according to a preset period, the fragment addresses based on the historical video data stored in the CDN end and store them in an address list; the historical video data represents the video data played in the live video stream, and the fragment addresses correspond to the video segments in the historical video data;
[0031] an acquisition module, configured to, upon receiving a playback request sent by the client, select a target segment address from the address list according to the playback request; and obtain, according to the target segment address, a playback address of a target video segment corresponding to the target segment address;
[0032] The sending module is used to send the playback address to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it.
[0033] In a third aspect, the present invention provides a video playback system, the system comprising a server, a CDN end and a client, the server is communicatively connected to the CDN end, the server is communicatively connected to the client, and the CDN end is communicatively connected to the client;
[0034] The server is used to execute the video playback method described in any one of the aforementioned implementation modes;
[0035] The CDN end is used to store historical video data, where the historical video data represents the video data that has been played in the live video stream;
[0036] The client is used to send a playback request to the server, and obtain and play the target video segment from the CDN end according to the playback address.
[0037] In a fourth aspect, the present invention provides a server, comprising a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any one of the aforementioned embodiments is implemented.
[0038] In a fifth aspect, the present invention provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in any one of the aforementioned embodiments is implemented.
[0039] The video playback method, device, server, system and storage medium provided by the embodiment of the present invention are respectively connected to the CDN end and the client through the server, and the CDN end is connected to the client through the server. The server obtains the fragment address and stores it in the address list according to the video data that has been played in the live video stream stored by the CDN end, that is, the historical video data, according to the preset period. The fragment address corresponds to the video segment in the historical video data; then, after receiving the playback request sent by the client, the target fragment address is selected from the address list according to the playback request; then, according to the target fragment address, the playback address of the target video segment corresponding to the target fragment address is obtained; finally, the playback address is sent to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it. By obtaining the address of the video segment from each CDN end and storing it to realize a unified interface, the connection difficulty is reduced and the scalability is improved. At the same time, the real-time playback of the live video is realized based on the video segment, which improves the convenience of video playback and optimizes the user experience.
[0040] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 A schematic diagram of a video playback system provided by an embodiment of the present invention is shown;
[0043] Figure 2 A block diagram of an electronic device provided by an embodiment of the present invention is shown;
[0044] Figure 3 A schematic diagram of a flow chart of a video playback method provided by an embodiment of the present invention is shown;
[0045] Figure 4 Another schematic diagram of a flow chart of a video playback method provided by an embodiment of the present invention is shown;
[0046] Figure 5 Another schematic diagram of a flow chart of a video playback method provided by an embodiment of the present invention is shown;
[0047] Figure 6 Another schematic diagram of a flow chart of a video playback method provided by an embodiment of the present invention is shown;
[0048] Figure 7 A functional module diagram of a video playback device provided by an embodiment of the present invention is shown.
[0049] Icons: 100 - server; 102 - CDN end; 104 - client; 110 - bus; 120 - processor; 130 - memory; 170 - communication interface; 300 - video playback device; 310 - storage module; 330 - acquisition module; 350 - sending module. DETAILED DESCRIPTION
[0050] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0051] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0052] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0053] With the emergence of live broadcast platforms, live video broadcasting has brought users real-time social experience and diverse entertainment. For example, users can watch the game events they are interested in through the live broadcast platform. In order to prevent users from missing the wonderful moments, CDN (Content Delivery Network) can be used to record live video for real-time playback. Due to the interface differences of the CDN end, the connection between the server and the CDN end is difficult and the interface scalability is low. In addition, the current video playback usually sends all the video data stored on the CDN end to the client, which is not convenient for users to watch the video again and cannot quickly view the video clips of interest. Furthermore, an embodiment of the present invention provides a video playback method to solve the above problems.
[0054] Please refer to Figure 1 , is a schematic diagram of a video playback system provided by an embodiment of the present invention. The system includes a server 100, a CDN terminal 102, and a client 104. The server 100 is connected to the CDN terminal 102 and the client 104 in communication, and the CDN terminal 102 is connected to the client 104 in communication. Both the CDN terminal 102 and the client 104 can be multiple.
[0055] The server 100 may be an independent server or a server cluster composed of multiple servers.
[0056] The CDN end 102 is an intelligent virtual network built on the existing network, which relies on edge servers deployed in various places to achieve data storage and distribution. Different manufacturers provide different CDN ends, and their interfaces for connecting to servers are also different.
[0057] The client 104 may be a smart phone, a personal computer, a tablet computer, a wearable device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiment of the present invention does not impose any limitation on this.
[0058] The server 100 may be a server that provides a live video stream, and the client 104 may install a live video related application (Application, APP for short).
[0059] Please refer to Figure 2 , is a block diagram of an electronic device provided by an embodiment of the present invention. The electronic device includes a bus 110 , a processor 120 , a memory 130 , and a communication interface 170 .
[0060] The bus 110 may be a circuit that connects the above elements to each other and transfers communications (eg, control messages) between the above elements.
[0061] The processor 120 may receive commands from the other elements described above (eg, the memory 130 , the communication interface 170 , etc.) through the bus 110 , may interpret the received commands, and may perform calculations or data processing according to the interpreted commands.
[0062] The processor 120 may be an integrated circuit chip with signal processing capabilities. The processor 120 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0063] The memory 130 may store commands or data received from the processor 120 or other elements (eg, the communication interface 170 , etc.) or commands or data generated by the processor 120 or other elements.
[0064] The memory 130 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), or an electrically erasable programmable read-only memory (EEPROM).
[0065] The communication interface 170 may be used to communicate signaling or data with other node devices.
[0066] It should be noted that Figure 2 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Figure 2 More or fewer components as shown, or with Figure 2 Different configurations shown. Figure 2 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0067] Understandably, Figure 2 The electronic device shown in the figure can be used to implement the above Figure 1In order to realize the corresponding functions of the client 104, the electronic device may also include other modules, such as: radio frequency circuit, I / O interface, battery, touch screen, microphone / speaker, etc. This is not limited here.
[0068] The above-mentioned server 100 will be used as the execution subject to execute each step in each method provided in the embodiment of the present invention and achieve corresponding technical effects.
[0069] See also Figure 3 , Figure 3 It is a flowchart of a video playback method provided by an embodiment of the present invention.
[0070] Step S202, according to a preset period, based on the historical video data stored on the CDN end, obtain the segment address and store it in the address list;
[0071] The historical video data represents the video data that has been played in the live video stream, and the segment address corresponds to the video segment in the historical video data;
[0072] The server pushes the live video stream to the CDN end, and the CDN end can perform real-time video recording, that is, store the video data played in the live video stream in real time, that is, historical video data. The historical video data includes multiple video clips.
[0073] In this embodiment, during the process of real-time storage of historical video data on the CDN side, the server will obtain the addresses corresponding to the new video segments stored therein, i.e., the segment addresses, from the CDN sides provided by different manufacturers at a preset period, and cache the segment addresses in the address list. The address list can be understood as an index file for obtaining video segments.
[0074] For example, the preset period can be set to 5 seconds, or can be set according to actual application, which is not limited in the embodiment of the present invention. The address list can use an m3u8 file, which is a text file that can record relevant information of the video clips, such as the order, duration, start timestamp and end timestamp of the video clips.
[0075] It is understandable that the server obtains and stores the addresses of video clips from various CDN terminals, unifies the interface for obtaining video addresses, and can connect to CDN terminals provided by different manufacturers to achieve interface adaptation, reduce connection difficulty, and improve scalability.
[0076] Step S204, upon receiving the playback request sent by the client, selecting a target shard address from the address list according to the playback request;
[0077] In this embodiment, when a user wants to review a previous video clip while watching a live video through a client, the user can perform interactive operations on the live video interface to trigger the client to send a playback request to the server.
[0078] Optionally, the user can also perform playback operation such as clicking the playback button in the live video interface, enter the playback video interface, perform interactive operation in the playback video interface, and trigger the client to send a playback request to the server. The server receives the playback request sent by the client, and selects the target segment address from the address list such as the m3u8 file according to the playback information in the playback request such as the identification of the live video stream, the time of the target video segment, etc. The target segment address corresponds to the target video segment, and the target video can be understood as the segment to be played back that the user wants to watch.
[0079] Step S206, according to the target segment address, obtaining the playback address of the target video segment corresponding to the target segment address;
[0080] In this embodiment, after obtaining the target segment address, the CDN end storing the target video segment corresponding to the target segment address can be determined according to the target segment address. The source site address of each CDN end is pre-stored in the server, and the playback address of the target video segment can be obtained according to the source site address of the CDN end storing the target video segment.
[0081] The source site address on the CDN side refers to the address of the core server in the CDN network, namely the source site. Each node in the CDN network needs to obtain files from the source site for content distribution.
[0082] Step S208: sending the playback address to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it.
[0083] In this embodiment, the server sends the playback address to the client, and the client can obtain the target video segment from the CDN according to the playback address, and then play the target video segment to perform video playback. The video segment in this embodiment can be a media file in TS (Transport Stream) format, which is characterized in that any segment in the video stream can be independently decoded.
[0084] It is understandable that based on the video clips, real-time playback of the live video can be achieved, so that users can quickly review the video clips that have been played, which improves the convenience of video playback and optimizes the user experience.
[0085] It can be seen that based on the above steps, the server is connected to the CDN end and the client end in communication, and the CDN end is connected to the client end in communication. The server obtains the shard address and stores it in the address list according to the video data that has been played in the live video stream stored in the CDN end, that is, the historical video data, according to the preset period. The shard address corresponds to the video segment in the historical video data; then, after receiving the playback request sent by the client, the target shard address is selected from the address list according to the playback request; then, according to the target shard address, the playback address of the target video segment corresponding to the target shard address is obtained; finally, the playback address is sent to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it. By obtaining the address of the video segment from each CDN end and storing it to realize a unified interface, the connection difficulty is reduced and the scalability is improved. At the same time, the real-time playback of the live video is realized based on the video segment, which improves the convenience of video playback and optimizes the user experience.
[0086] Optionally, the segment address may include the start timestamp and the end timestamp of the corresponding video segment, and thus the embodiment of the present invention provides a possible implementation method for the above step S204. Figure 4 , wherein step S204 includes the following steps:
[0087] Step S204-1, obtaining the time offset in the playback request;
[0088] The time offset represents the time difference between the start frame of the target video segment and the current frame of the live video stream;
[0089] In this embodiment, the client can calculate the time difference between the start frame and the current frame of the live video stream according to the user's interactive operation in the live video interface or the playback video interface, that is, obtain the time offset, and send a playback request including the time offset to the server. The server receives the playback request sent by the client and obtains the time offset therein.
[0090] For example, when watching a live video of a game event, if the user wants to replay the video clip 5 minutes before the current moment, he can drag the play mark in the play progress area of the live video interface to the position 5 minutes before. The video frame corresponding to this position is the starting frame, which means that the video is replayed from this starting frame, and the time offset is 5 minutes before. The client sends a playback request including the time offset to the server, and the server obtains the time offset in the playback request, which is 5 minutes before.
[0091] Optionally, the user can also enter the playback video interface by clicking the playback button in the live video interface, and drag the play mark to the previous 5 minutes in the play progress area of the playback video interface to trigger the client to calculate the time offset and send the playback request including the time offset to the server.
[0092] It should be noted that in the embodiment of the present invention, the user can drag the play mark in the play progress area to any position of the played video.
[0093] In order to facilitate users to quickly obtain the video clips of interest, multiple recommendation tags can be set in the play progress area. The user drags the play mark to the position of the recommendation tag to play back the recommended wonderful video clips.
[0094] Step S204-3, calculating the time corresponding to the start frame according to the time offset and the current time;
[0095] In this embodiment, the server calculates the time corresponding to the start frame according to the time offset and the current time recorded by the server. The time corresponding to the start frame can be understood as the absolute time of the start frame. The absolute time representation can be XX hours XX minutes XX seconds.
[0096] Step S204-5, selecting a target slice address from the address list according to the time corresponding to the start frame;
[0097] The time corresponding to the start frame belongs between the start timestamp and the end timestamp of the target slice address.
[0098] In this embodiment, the slice address includes the start timestamp and the end timestamp of the corresponding video segment, and the target slice address can be selected from the address list according to the time corresponding to the start frame, and the time corresponding to the start frame belongs to the start timestamp and the end timestamp of the target slice address. The target video segment corresponding to the target slice address includes the start frame, that is, the target video segment is played back from the start frame.
[0099] It can be seen that the time corresponding to the start frame is determined by obtaining the time offset in the playback request, so as to select the target segment address from the address list. Thus, the time consistency between the client and the server is ensured based on the time offset, so that the start frame of the playback request is consistent with the video frame determined by the server to start playback, thereby ensuring the accuracy of the real-time playback video picture.
[0100] Optionally, the source station address of the CDN end can be directly used as the playback address. However, if many clients directly obtain the target video clip from the CDN end according to the source station address, the operating pressure of the source station will increase. Therefore, the embodiment of the present invention provides a possible implementation method for the above step S206, please refer to Figure 5 , wherein step S206 includes the following steps:
[0101] Step S206-1, obtaining the source site address of the CDN end according to the target shard address;
[0102] In this embodiment, the server may pre-store multiple acceleration domain names corresponding to the source site address of the CDN end. The acceleration domain name may be understood as the access address corresponding to each node in the CDN network.
[0103] According to the obtained target segment address, the source site address of the CDN end storing the target video segment is obtained. If there are multiple CDN ends storing the target video segment, you can select one at random, or you can select according to actual needs, such as selecting a CDN end with lower cost and higher quality.
[0104] Step S206-3, selecting a target acceleration domain name that meets preset conditions from multiple acceleration domain names corresponding to the source site address of the CDN end;
[0105] The preset condition may be the highest quality level. For example, the quality of the acceleration domain name may be evaluated through evaluation parameters of the acceleration domain name for playing videos, such as the freeze rate and the black screen rate, to obtain the quality level of the acceleration domain name, and the acceleration domain name with the highest current quality level may be selected as the target acceleration domain name.
[0106] The preset condition may also be the shortest distance. For example, based on the geographical location of the client, the access address corresponding to the node with the shortest distance to the client may be selected to obtain the target acceleration domain name.
[0107] It should be noted that the preset conditions can be designed according to actual needs and are not limited in the implementation of the present invention.
[0108] Step S206-5: Obtain the playback address of the target video segment corresponding to the target segment address according to the target acceleration domain name.
[0109] In this embodiment, after replacing the source site address of the CDN end with the target acceleration domain name, the playback address of the target video segment can be obtained based on the target acceleration domain name, the identifier of the live video stream, and the time corresponding to the starting frame. The time corresponding to the starting frame can be represented by an address list, the current time and the time offset.
[0110] It can be seen that the source site address of the CDN end is obtained through the target fragment address, and the target acceleration domain name that meets the preset conditions is selected from multiple acceleration domain names to obtain the playback address of the target video segment. The source site address is replaced according to the acceleration domain name, thereby reducing the operating pressure of the source site and ensuring the stability of real-time playback of live video.
[0111] In the above example, the CDN end stores historical video data. Currently, video recording is usually performed by each manufacturer's CDN end to locally transcode and store the acquired live video stream, but this will lead to waste of transcoding resources and high costs. Therefore, the embodiment of the present invention provides a possible implementation method. Please refer to Figure 6 , the following will introduce the implementation method of storing historical video data on the CDN side in conjunction with this figure.
[0112] Step S212a, the server pushes the live video stream to the CDN end;
[0113] Step S212b, the CDN sends a confirmation request to the server regarding whether to record the live video stream;
[0114] In this embodiment, the server pushes the live video stream to the CDN end, triggering the CDN end to send a pending request to the server whether to record the live video stream. Optionally, after receiving the live video stream, the CDN end can distribute it, that is, send it to the client, so that the user can watch the live video in real time.
[0115] Step S214a, upon receiving the request to be confirmed, the server generates a recording confirmation message and sends it to the CDN end;
[0116] Step S214b, the CDN receives the recording confirmation message and sends a video acquisition request to the server;
[0117] In this embodiment, after receiving the confirmation request sent by the CDN, the server generates a confirmation recording message and then sends it to the CDN. It can be understood that the server notifies the CDN through the confirmation recording message that the live video stream needs to be recorded in real time.
[0118] The CDN receives the recording confirmation message and sends a video acquisition request to the server, that is, requests the server to obtain the video data of the live video stream.
[0119] Step S216: After receiving the video acquisition request sent by the CDN, the server transcodes the live video stream to obtain transcoded video data;
[0120] In this embodiment, after receiving the video acquisition request sent by the CDN, the server transcodes the live video stream to obtain transcoded video data, and the transcoded video data is in flv format.
[0121] Step S218a, the server pushes the transcoded video data to the CDN end;
[0122] Step S218b: The CDN performs format conversion on the transcoded video data to obtain historical video data.
[0123] In this embodiment, the server pushes the transcoded video data to the CDN end. After receiving the transcoded video data, the CDN end converts the format of the transcoded video data, that is, converts the flv format to the hls format, and stores the video data in the hls format locally to obtain historical video data.
[0124] It is understandable that if the CDN end distributes live video streams, the video data in flv format can be directly distributed to the client. If the CDN end records and stores live video streams, the video data needs to be converted into a format that is convenient for local storage.
[0125] It can be understood that in the embodiment of the present invention, the live video stream is uniformly transcoded, and the transcoded video data is pushed to each CDN end, so that the CDN end does not need to transcode the live video stream separately, thereby saving transcoding resources, reducing costs and improving video recording efficiency.
[0126] Step S220, the CDN sends a video recording success message to the server;
[0127] In this embodiment, after the CDN successfully stores the historical video data, it sends a video recording success message to the server to notify the server that the recording is successful.
[0128] It can be seen that through the above steps, the service pushes the live video stream to the CDN end, and the CDN end sends a pending confirmation request to the server on whether to record the live video stream; then the server receives the pending confirmation request, generates a confirmation recording message and sends it to the CDN end, and the CDN end receives the confirmation recording message and sends a request to obtain the video to the server; then the server receives the request to obtain the video sent by the CDN end, transcodes the live video stream, obtains the transcoded video data and sends it to the CDN end, and the CDN end converts the format of the transcoded video data to obtain historical video data. Through unified transcoding, transcoding resources are saved and costs are reduced. At the same time, the historical video data is stored in the CDN end to realize the real-time recording and storage of the live video, thereby providing data support for the implementation and playback of the live video, so that users can quickly play back the video clips of interest.
[0129] Optionally, in order to improve the user experience, the user can select the video playback bit rate, i.e., the definition, when watching the video again. Further, the embodiment of the present invention provides a possible implementation method for the above step S214a, wherein step S214a includes the following steps:
[0130] Step S214a-1, upon receiving the request to be confirmed, obtaining the playback bit rate level of the live video stream;
[0131] Step S214a-3, generating a recording confirmation message including the playback bit rate level and sending it to the CDN end.
[0132] In this embodiment, after receiving the request to be confirmed, the server can obtain the current playback bit rate level of the live video stream watched by users in the live broadcast room according to the live broadcast room of the live video stream, such as 360p for smooth playback, 480p for standard definition, 720p for high definition, and 1080p for ultra-high definition; then generate a confirmation recording message including the playback bit rate level and send it to the CDN end.
[0133] The CDN receives the recording confirmation information, obtains the playback bit rate level, and records and stores the live video data of different playback bit rate levels. It can be understood that the live video data of different playback bit rate levels will be stored in different video files.
[0134] When the client sends a playback request, the playback request may include a bitrate parameter, that is, the video definition selected by the user. The server will feed back the bitrate parameter to the CDN end, so that the CDN end can obtain a video clip from a video file consistent with the bitrate parameter and send it to the client. Thus, by recording video data of multiple playback bitrate levels when recording a video, it is convenient for the user to select the definition of the playback video, thereby optimizing the user experience.
[0135] Optionally, for the above step S216, an embodiment of the present invention provides a possible implementation method, and step S216 includes the following steps:
[0136] Step S216-1, upon receiving a video acquisition request sent by the CDN, a target link is acquired; wherein the target link is used to transcode the live video stream in the viewing request sent by the client;
[0137] Step S216-3, transcode the live video stream through the target link to obtain transcoded video data.
[0138] It is understandable that when a user watches live video in real time through a client, the client will send a viewing request to the server, and the server will also push the converted video data to the CDN end, which will be distributed to the client through the CDN end.
[0139] In this embodiment, after receiving the video acquisition request sent by the CDN, the server can aggregate the video acquisition request and the viewing request sent by the client, and use the same link to transcode the live video stream. That is, obtain the target link, which is used to transcode the live video stream in the viewing request sent by the client, and use the target link to transcode the live video stream to obtain the converted video data.
[0140] The server pushes the transcoded video data to the CDN end, and the CDN end converts the format of the transcoded video data and stores it to achieve video recording. The CDN end can also distribute the transcoded video data to the client to achieve video distribution.
[0141] It can be seen that the target link is usually used to transcode the live video stream in the video acquisition request sent by the CDN end, so that the same transcoding link can be used for video recording and video distribution, thereby further saving transcoding resources, improving video transcoding efficiency and reducing costs.
[0142] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing a video playback device is given below. Figure 7 , Figure 7 This is a functional module diagram of a video playback device 300 provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the video playback device 300 provided in this embodiment are the same as those of the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments. The video playback device 300 includes:
[0143] The storage module 310 is used to obtain the fragment address and store it in the address list according to the historical video data stored in the CDN end according to the preset period; the historical video data represents the video data played in the live video stream, and the fragment address corresponds to the video segment in the historical video data;
[0144] The acquisition module 330 is used to, upon receiving a playback request sent by the client, select a target segment address from the address list according to the playback request; and obtain a playback address of a target video segment corresponding to the target segment address according to the target segment address;
[0145] The sending module 350 is used to send the playback address to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it.
[0146] Optionally, the acquisition module 330 is also used to: obtain the time offset in the playback request, the time offset represents the time difference between the start frame of the target video segment and the current frame of the live video stream; calculate the time corresponding to the start frame according to the time offset and the current time; select the target segment address from the address list according to the time corresponding to the start frame; the time corresponding to the start frame belongs between the start timestamp and the end timestamp of the target segment address.
[0147] Optionally, the acquisition module 330 is also used to: obtain the source site address of the CDN end according to the target segment address; select a target acceleration domain name that meets preset conditions from multiple acceleration domain names corresponding to the source site address of the CDN end; and obtain the playback address of the target video segment corresponding to the target segment address according to the target acceleration domain name.
[0148] Optionally, the storage module 310 is also used to: push the live video stream to the CDN end, so that the CDN end sends a pending confirmation request to the server regarding whether to record the live video stream; upon receiving the pending confirmation request, generate a confirmation recording message and send it to the CDN end; upon receiving a video acquisition request sent by the CDN end, transcode the live video stream to obtain transcoded video data; push the transcoded video data to the CDN end, so that the CDN end converts the format of the transcoded video data to obtain historical video data.
[0149] Optionally, the storage module 310 is further used to: upon receiving a request to be confirmed, obtain the playback bit rate level of the live video stream; generate a confirmation recording message including the playback bit rate level and send it to the CDN end.
[0150] Optionally, the storage module 310 is also used to: obtain a target link upon receiving a video acquisition request sent by the CDN; the target link is used to transcode the live video stream in the viewing request sent by the client; and transcode the live video stream through the target link to obtain transcoded video data.
[0151] The embodiment of the present invention further provides a video playback system, comprising a server, a CDN end and a client, wherein the server is communicatively connected to the CDN end, the server is communicatively connected to the client, and the CDN end is communicatively connected to the client;
[0152] The server is used to execute the video playback method in the above embodiment;
[0153] The CDN end is used to store historical video data, which refers to the video data that has been played in the live video stream;
[0154] The client is used to send a playback request to the server, and obtain the target video segment from the CDN end according to the playback address and play it.
[0155] The embodiment of the present invention further provides a server, including a processor 120 and a memory 130. The memory 130 stores a computer program. When the processor executes the computer program, the video playback method disclosed in the above embodiment is implemented.
[0156] The embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by the processor 120, the video playback method disclosed in the embodiment of the present invention is implemented.
[0157] In summary, the video playback method, device, system, server and storage medium provided by the embodiments of the present invention. The server is connected to the CDN end and the client end in communication respectively, and the CDN end is connected to the client end in communication. The server obtains the fragment address and stores it in the address list according to the video data that has been played in the live video stream stored in the CDN end, that is, the historical video data, according to the preset period. The fragment address corresponds to the video segment in the historical video data; then, after receiving the playback request sent by the client, the target fragment address is selected from the address list according to the playback request; then, according to the target fragment address, the playback address of the target video segment corresponding to the target fragment address is obtained; finally, the playback address is sent to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it. By obtaining the address of the video segment from each CDN end and storing it to realize a unified interface, the connection difficulty is reduced and the scalability is improved. At the same time, the real-time playback of the live video is realized based on the video segment, which improves the convenience of video playback and optimizes the user experience. And the live video stream is uniformly transcoded, which saves transcoding resources, improves transcoding efficiency and reduces costs.
[0158] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0159] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0160] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0161] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A video playback method, characterized in that: Applied to a server, the server is connected to a CDN end, the server is connected to a client end, the CDN end is connected to the client end, and the server pre-stores the source site address of the CDN end and multiple acceleration domain names corresponding thereto; the method comprises: According to a preset period, based on the historical video data stored on the CDN end, a fragment address is obtained and stored in an address list; the historical video data represents the video data that has been played in the live video stream, and the fragment address corresponds to the video segment in the historical video data; Upon receiving the playback request sent by the client, selecting a target shard address from the address list according to the playback request; Obtaining the source site address of the CDN end according to the target shard address; From the multiple acceleration domain names corresponding to the source site address of the CDN end, select the acceleration domain name with the highest quality level as the target acceleration domain name; wherein the quality level of the acceleration domain name is obtained by evaluating the freeze rate and black screen rate of video playback; According to the target acceleration domain name, obtaining a playback address of a target video segment corresponding to the target segment address; Sending the playback address to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it; The historical video data is obtained in the following manner: Pushing the live video stream to the CDN end, so that the CDN end sends a pending confirmation request to the server whether to record the live video stream; Upon receiving the request to be confirmed, generating a confirmation recording message and sending it to the CDN end; Upon receiving the video acquisition request sent by the CDN, transcoding the live video stream to obtain transcoded video data; The transcoded video data is pushed to the CDN end, so that the CDN end performs format conversion on the transcoded video data to obtain the historical video data.
2. The method according to claim 1, characterized in that The segment address includes a start timestamp and an end timestamp of a corresponding video segment; the step of selecting a target segment address from the address list according to the playback request includes: Obtaining a time offset in the playback request, where the time offset represents a time difference between a start frame of a target video segment and a current frame of the live video stream; Calculate the time corresponding to the start frame according to the time offset and the current time; The target slice address is selected from the address list according to the time corresponding to the start frame; the time corresponding to the start frame belongs between the start timestamp and the end timestamp of the target slice address.
3. The method according to claim 1, characterized in that The step of generating a confirmation recording message and sending it to the CDN end upon receiving the request to be confirmed includes: Upon receiving the request to be confirmed, obtaining a playback bit rate level of the live video stream; Generate a recording confirmation message including the playback bit rate level and send it to the CDN end.
4. The method according to claim 1, characterized in that: The step of transcoding the live video stream upon receiving the video acquisition request sent by the CDN end to obtain transcoded video data includes: Upon receiving the video acquisition request sent by the CDN, a target link is acquired; the target link is used to transcode the live video stream in the viewing request sent by the client; The live video stream is transcoded through the target link to obtain transcoded video data.
5. A video playback device, characterized in that: Applied to a server, the server is connected to a CDN end, the server is connected to a client end, the CDN end is connected to the client end, and the server pre-stores the source site address of the CDN end and multiple acceleration domain names corresponding thereto; the device comprises: A storage module, configured to obtain, according to a preset period, the fragment addresses based on the historical video data stored in the CDN end and store them in an address list; the historical video data represents the video data played in the live video stream, and the fragment addresses correspond to the video segments in the historical video data; The acquisition module is used to, upon receiving the playback request sent by the client, select a target segment address from the address list according to the playback request; obtain the source site address of the CDN end according to the target segment address; select the acceleration domain name with the highest quality level as the target acceleration domain name from the multiple acceleration domain names corresponding to the source site address of the CDN end; wherein the quality level of the acceleration domain name is obtained based on the evaluation of the freeze rate and black screen rate of the video playback; obtain the playback address of the target video segment corresponding to the target segment address according to the target acceleration domain name; A sending module, used to send the playback address to the client, so that the client obtains the target video segment from the CDN end according to the playback address and plays it; The historical video data is obtained in the following manner: Pushing the live video stream to the CDN end, so that the CDN end sends a pending confirmation request to the server whether to record the live video stream; Upon receiving the request to be confirmed, generating a confirmation recording message and sending it to the CDN end; Upon receiving the video acquisition request sent by the CDN, transcoding the live video stream to obtain transcoded video data; The transcoded video data is pushed to the CDN end, so that the CDN end performs format conversion on the transcoded video data to obtain the historical video data.
6. A video playback system, characterized in that: The system comprises a server, a CDN end and a client, wherein the server is connected to the CDN end for communication, the server is connected to the client end for communication, and the CDN end is connected to the client end for communication; The server is used to execute the video playback method according to any one of claims 1 to 4; The CDN end is used to store historical video data, where the historical video data represents the video data that has been played in the live video stream; The client is used to send a playback request to the server, and obtain and play the target video segment from the CDN end according to the playback address.
7. A server, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
8. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
System for video playback using server generated manifest
CN108702537A
Data processing method and device
CN110958279A