CN107801049B - Real-time video transmission and playing method and device - Google Patents

Real-time video transmission and playing method and device Download PDF

Info

Publication number
CN107801049B
CN107801049B CN201610808192.8A CN201610808192A CN107801049B CN 107801049 B CN107801049 B CN 107801049B CN 201610808192 A CN201610808192 A CN 201610808192A CN 107801049 B CN107801049 B CN 107801049B
Authority
CN
China
Prior art keywords
frame
client
current
data stream
video data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610808192.8A
Other languages
Chinese (zh)
Other versions
CN107801049A (en
Inventor
金玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201610808192.8A priority Critical patent/CN107801049B/en
Publication of CN107801049A publication Critical patent/CN107801049A/en
Application granted granted Critical
Publication of CN107801049B publication Critical patent/CN107801049B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/23406Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving management of server-side video buffer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • H04N21/23113Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion involving housekeeping operations for stored content, e.g. prioritizing content for deletion because of storage space restrictions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/232Content retrieval operation locally within server, e.g. reading video streams from disk arrays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The embodiment of the invention discloses a real-time video transmission and playing method and a device, wherein a server receives a video request sent by a client and then sends a cached current I frame and an obtained current video data stream to the client; the client decodes and plays the data frame before the first I frame in the current data stream according to the current I frame, and the phenomenon of screen blacking cannot occur. That is to say, only the video data of one I frame is cached in the server, and the video data of one GOP does not need to be cached, so that the memory resource occupancy rate of the server is reduced.

Description

Real-time video transmission and playing method and device
Technical Field
The invention relates to the technical field of videos, in particular to a real-time video transmitting and playing method and device.
Background
In some scenes for acquiring video data in real time, such as live broadcasting or monitoring, the server acquires video data streams from the video acquisition device in real time. The user can watch the real-time video through the client of the mobile phone, the tablet computer, the computer and the like.
The specific process can comprise the following steps: the client sends a URL (Uniform Resource Locator) request to the server, and the server establishes connection with the client after verifying that the client is legal. After the connection is established, the server may send the client-requested real-time video data stream to the client.
Video data is generally composed Of a plurality Of GOPs (Group Of pictures), and one GOP includes an I frame (intra Picture frame) and other data frames decoded by the I frame after the I frame. Therefore, when the server sends the real-time video data stream to the client, the server needs to wait until an I frame appears in the video data stream to start data transmission, so that it can be ensured that other data frames after the I frame can be decoded and played normally.
In the above scheme, if the server receives the video request sent by the client after an I frame just flows through the video data stream acquired by the server, under such a situation, the server needs to wait for a long period of time until another I frame appears in the video data stream, that is, after the client sends the video request, the client needs to wait for a long period of time to obtain the feedback of the server, and a black screen phenomenon occurs in the client.
In order to solve the above technical problem, it is a common practice to cache the video data of one GOP in the server. After receiving a video request sent by a client, a server sends video data cached by the server to the client, and then sends the obtained current video data stream. However, by applying the scheme, video data of one GOP needs to be additionally cached in the server, and the memory resource occupancy rate of the server is improved.
Disclosure of Invention
The embodiment of the invention aims to provide a real-time video transmitting and playing method and device, which can reduce the memory resource occupancy rate of a server.
In order to achieve the above object, an embodiment of the present invention discloses a real-time video transmission method, which is applied to a server, and the method includes:
receiving a video request sent by a client;
sending the cached current internal picture I frame to the client;
and sending the obtained current video data stream to the client so that the client decodes and plays the data frame before the first I frame in the current video data stream according to the current I frame.
Optionally, the method may further include:
acquiring a first video data stream;
caching a current I frame in the first video data stream;
when a next I frame of the current I frame appears in the first video data stream, determining the next I frame as a current I frame;
deleting the buffered I frame and returning to the step of buffering the current I frame in the first video data stream.
Optionally, after receiving the video request sent by the client, the method may further include:
judging whether a first time interval between adjacent I frames in a second video data stream requested by the client is greater than a first preset threshold value or not, wherein the first time interval is an interval between moments when the adjacent I frames are acquired;
if yes, executing the step of sending the cached current internal picture I frame to the client;
and if not, when the I frame appears in the second video data stream, sending the second video data stream to the client.
Optionally, in the case that it is determined that the first time interval between adjacent I frames in the second video data stream requested by the client is greater than a first preset threshold, the method may further include:
judging whether a second time interval between a current frame in the second video data stream and a first I frame after the current frame is greater than a second preset threshold value, wherein the second time interval is an interval between the moment when the current frame is acquired and the moment when the first I frame after the current frame is acquired;
if yes, executing the step of sending the cached current internal picture I frame to the client;
and if not, when the I frame appears in the second video data stream, sending the second video data stream to the client.
Optionally, after receiving the video request sent by the client, the method may further include:
judging whether the data in the acquired current video data stream is coded data or not;
if not, encoding the data in the current video data stream;
the sending the cached current internal picture I frame to the client includes:
sending the cached coded current internal picture I frame to the client;
the sending the obtained current video data stream to the client includes:
and sending the encoded current video data stream to the client.
Optionally, the method may further include:
sending video quality information to the client, wherein the video quality information comprises a plurality of video qualities provided by the server;
receiving a selection instruction sent by the client, wherein the selection instruction carries the first video quality selected by the client;
converting a group of pictures (GOP) after the current data frame into a video data stream under the first video quality according to the selection instruction;
and sending the converted video data stream to the client.
In order to achieve the above object, an embodiment of the present invention further discloses a real-time video playing method, which is applied to a client, and the method includes:
sending a video request to a server;
receiving a current I frame and a current video data stream sent by the server;
and decoding and playing the data frame before the first I frame in the current video data stream according to the current I frame.
In order to achieve the above object, an embodiment of the present invention further discloses a real-time video transmission apparatus, which is applied to a server, and the apparatus includes:
the receiving module is used for receiving a video request sent by a client;
the first sending module is used for sending the cached current internal picture I frame to the client;
and the second sending module is used for sending the acquired current video data stream to the client so that the client decodes and plays the data frame before the first I frame in the current video data stream according to the current I frame.
Optionally, the apparatus may further include:
the acquisition module is used for acquiring a first video data stream;
the buffer module is used for buffering the current I frame in the first video data stream;
a determining module, configured to determine, when a next I frame of the current I frame appears in the first video stream, the next I frame as a current I frame;
and the deleting module is used for deleting the cached I frame and triggering the caching module.
Optionally, the apparatus may further include:
the first judging module is used for judging whether a first time interval between adjacent I frames in a second video data stream requested by the client is larger than a first preset threshold value or not, wherein the first time interval is an interval between moments when the adjacent I frames are acquired; if yes, triggering the cache module, and if not, triggering a third sending module;
and the third sending module is used for sending the second video data stream to the client when the I frame appears in the second video data stream.
Optionally, the apparatus may further include:
a second determining module, configured to determine whether a second time interval between a current frame in the second video data stream and a first I frame after the current frame is greater than a second preset threshold, where the second time interval is an interval between a time when the current frame is acquired and a time when the first I frame after the current frame is acquired; if yes, the cache module is triggered, and if not, the third sending module is triggered.
Optionally, the apparatus may further include:
the third judging module is used for judging whether the acquired data in the current video data stream is coded data or not;
the coding module is used for coding the data in the current video data stream when the judgment result of the third judgment module is negative;
the cache module is specifically configured to:
sending the cached coded current internal picture I frame to the client;
the second sending module is specifically configured to:
and sending the encoded current video data stream to the client.
Optionally, the apparatus may further include:
a fourth sending module, configured to send video quality information to the client, where the video quality information includes multiple video qualities provided by the server;
the first receiving module is used for receiving a selection instruction sent by the client, wherein the selection instruction carries the first video quality selected by the client;
the conversion module is used for converting the group of pictures (GOP) after the current data frame into the video data stream under the first video quality according to the selection instruction;
and the fifth sending module is used for sending the converted video data stream to the client.
In order to achieve the above object, an embodiment of the present invention further discloses a real-time video playing device, which is applied to a client, and the device includes:
a sixth sending module, configured to send a video request to the server;
the second receiving module is used for receiving the current I frame and the current video data stream sent by the server;
and the playing module is used for decoding and playing the data frame before the first I frame in the current video data stream according to the current I frame.
By applying the embodiment of the invention, after receiving the video request sent by the client, the server sends the cached current I frame and the obtained current video data stream to the client; the client decodes and plays the data frame before the first I frame in the current data stream according to the current I frame, and the phenomenon of screen blacking cannot occur. That is to say, only the video data of one I frame is cached in the server, and the video data of one GOP does not need to be cached, so that the memory resource occupancy rate of the server is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a real-time video transmission method applied to a server according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a real-time video playing method applied to a client according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a real-time video transmission apparatus applied to a server according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a real-time video playing device applied to a client according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve the above technical problems, embodiments of the present invention provide a real-time video transmitting method and apparatus applied to a server, and a real-time video playing method and apparatus applied to a client.
First, a detailed description will be given of a real-time video transmission method applied to a server according to an embodiment of the present invention.
Fig. 1 is a schematic flowchart of a real-time video transmission method applied to a server according to an embodiment of the present invention, including:
s101: and receiving a video request sent by a client.
Before the server receives the video request sent by the client, the process of signaling interaction such as handshaking, connection establishment, network flow establishment and the like can also be included. It can be simply understood that the client sends the URL request to the server first, where the URL request may be in a format of 'RTMP:// serverp: Port/StreamName', where RTMP indicates that the server and the client are connected by RTMP (Real Time Messaging Protocol), and certainly may also be connected by other protocols, which is not limited herein; port represents the Port ID of the server connected with the client; the StreamName represents the identity of the video data stream requested by the client. After the server passes the verification, the server establishes connection with the client, and allows the client to obtain the video data stream requested by the client from the port.
After the above process, the server can receive the video request sent by the client, and the video request may include the identification information of the video data stream requested by the client.
S102: and sending the cached current internal picture I frame to the client.
In the embodiment, the server acquires the video data stream from the video acquisition device in real time. As the name implies, a video data stream may be understood as video data flowing in real time. It should be noted that, in general, the server does not store the video data stream, but only forwards the video data stream to the client in real time after receiving a video request for the video data stream from the client.
However, in this embodiment, the server caches the current I frame of each acquired video data stream for each acquired video data stream. The I frame is an intra picture frame, the video data is composed of a plurality of GOPs, and one GOP includes one I frame and other data frames decoded by the I frame after the I frame.
For convenience of description, the following description is made with respect to a first video data stream, where the first video data stream is any video data stream acquired by a server.
The server caches a current I frame in the first video data stream, wherein the current I frame is the latest I frame in the first video data stream, and the I frame is the current I frame in a time period from the occurrence time of the I frame to the occurrence time of the next I frame of the I frame in the first video data stream.
When a next I frame of the current I frame appears in the first video stream, determining the next I frame as a current I frame. At this time, the buffered I-frame is deleted and the newly determined current I-frame is buffered. The process is executed circularly, and the latest I frame flowing through the video data stream is ensured to be cached in the server all the time.
After receiving a video request sent by the client, determining a video data stream requested by the client, sending the cached current I frame of the video data stream to the client, and then executing S103. In addition, if the video data stream requested by the client does not exist in the server, the server can send prompt information such as that no resource is found to the client.
S103: and sending the acquired current video data stream to the client.
The video data stream requested by the client is sent to the client in real time, that is, the obtained current video data stream is sent to the client. If other data frames needing to be decoded by means of I frames, such as P (forward prediction) frames or B (bidirectional interpolation) frames, flow through the current data stream, the client decodes and plays the P frames by means of the received current I frames after receiving the P frames, which is described below as an example. If the first I frame appears after a plurality of P frames flow in the current data stream, the client decodes and plays the plurality of P frames depending on the received current I frame for the plurality of P frames. And the video data stream flowing after the first I frame appearing later can be normally decoded and played.
With the embodiment of the invention shown in fig. 1, after receiving a video request sent by a client, a server sends a cached current I frame and an acquired current video data stream to the client; the client decodes and plays the data frame before the first I frame in the current data stream according to the current I frame, and the phenomenon of screen blacking cannot occur. That is to say, only the video data of one I frame is cached in the server, and the video data of one GOP does not need to be cached, so that the memory resource occupancy rate of the server is reduced.
As an embodiment of the present invention, after receiving a video request sent by a client, it may be determined whether a first time interval between adjacent I frames in a second video data stream requested by the client is greater than a first preset threshold, where the first time interval is an interval between times when the adjacent I frames are acquired; if yes, sending the cached current internal picture I frame to the client; and if not, when the I frame appears in the second video data stream, sending the second video data stream to the client.
It will be appreciated that the time interval between adjacent I frames in different video data streams may be different. If the time interval itself is small, in the prior art, the server starts data transmission only when an I frame appears in the video data stream, and even if the time interval between the whole adjacent I frames is equal, the time is short, and the phenomenon of black screen does not appear at the client. In this case, the server may no longer buffer the current I frame, or send the buffered current I frame to the client, but wait until an I frame appears in the video data stream, and send the video data stream to the client.
It should be noted that the first preset threshold may be determined according to an upper limit of a time period that the client can wait.
As an embodiment of the present invention, in a case that it is determined that a first time interval between adjacent I frames in a second video data stream requested by a client is greater than a first preset threshold, it may further be determined whether a second time interval between a current frame in the second video data stream and a first I frame after the current frame is greater than a second preset threshold, where the second time interval is an interval between a time when the current frame is acquired and a time when a first I frame after the current frame is acquired;
if yes, sending the cached current internal picture I frame to the client;
and if not, when the I frame appears in the second video data stream, sending the second video data stream to the client.
It can be understood that, if a current frame flowing through a video data stream is a P frame, and a time interval between the P frame and a next I frame is very small, in the prior art, a server waits for an I frame to appear in the video data stream before starting data transmission, and only waits for a short time, a client does not appear a black screen phenomenon. In this case, the server may no longer send the cached current I frame to the client, but may send the video data stream to the client when an I frame occurs in the video data stream.
It should be noted that the second preset threshold may be determined according to an upper limit of a time period that the client can wait.
In the illustrated embodiment of the present invention, the video data stream obtained by the server from the video capture device may be encoded data or may be uncoded data. If the data is not coded, the server firstly codes the acquired video data stream. Therefore, the buffered current I frame should be an encoded I frame, and the current video data stream sent to the client should also be encoded data.
In the embodiment of the present invention, the server may further send video quality information to the client, where the video quality information may include information about multiple bit rates and resolutions that the server can provide. The client selects appropriate video quality (appropriate bit rate, resolution and the like) according to the received video quality information and by combining with actual conditions of the client, such as network conditions and mobile scenes, the client can also consider the information of the self electric quantity and the like. And the client sends a selection instruction carrying the selected video quality to the server. After receiving the selection instruction, the server converts the video quality of each GOP after the current data frame into the video quality selected by the client, and sends the converted video data stream to the client.
Of course, in the process of decoding and playing the video data stream by the client, if the network condition of the client changes or other conditions that need to adjust the video quality occur, the client may also send a request for adjusting the video quality to the server. The server converts the video data stream into the video quality requested by the client and then sends the video quality requested by the client to the client.
It should be noted that, when the server converts the video quality of the video data, the whole GOP is usually converted, and if the server receives a selection instruction or a request for adjusting the video quality, and a GOP does not yet completely flow through the GOP, the video data stream is adjusted from the next GOP that flows through the GOP after the GOP completely flows through the GOP.
Corresponding to the above transmission method, the present invention further provides a real-time video playing method applied to a client, as shown in fig. 2, including:
s201: a video request is sent to a server.
Before the client sends the video request to the server, the process of signaling interaction such as handshaking, connection establishment, network flow establishment and the like can be further included. It can be simply understood that the client sends a URL request to the server first, where the URL request may be in a format of "RTMP:// serverp: Port/StreamName", where RTMP indicates that the server and the client are connected through RTMP (Real Time Messaging Protocol), serverp: Port indicates a Port identifier of the server to which the client is connected, and StreamName indicates an identifier of a video data stream requested by the client. After the server passes the verification, the server establishes connection with the client, and allows the client to obtain the video data stream requested by the client from the port.
After the above process, the client sends a video request to the server, where the video request may contain identification information of the requested video data stream.
S202: and receiving the current I frame and the current video data stream sent by the server.
In the embodiment, the server acquires the video data stream from the video acquisition device in real time. As the name implies, a video data stream may be understood as video data flowing in real time. It should be noted that, in general, the server does not store the video data stream, but only forwards the video data stream to the client in real time after receiving a video request for the video data stream from the client.
However, in this embodiment, the server caches the current I frame of each acquired video data stream for each acquired video data stream. The I frame is an intra picture frame, the video data is composed of a plurality of GOPs, and one GOP includes one I frame and other data frames decoded by the I frame after the I frame.
After receiving a video request sent by a client, a server determines a video data stream requested by the client, sends a current I frame of the cached video data stream to the client, and then sends the video data stream to the client in real time, that is, sends the acquired current video data stream to the client. The client receives the I frame and the current video data stream.
S203: and decoding and playing the data frame before the first I frame in the current video data stream according to the current I frame.
If other data frames needing to be decoded by means of I frames, such as P (forward prediction) frames or B (bidirectional interpolation) frames, flow through the current data stream, the client decodes and plays the P frames by means of the received current I frames after receiving the P frames, which is described below as an example. If the first I frame appears after a plurality of P frames flow in the current data stream, the client decodes and plays the plurality of P frames depending on the received current I frame for the plurality of P frames. And the video data stream flowing after the first I frame appearing later can be normally decoded and played.
With the embodiment of the invention shown in fig. 2, after receiving a video request sent by a client, a server sends a cached current I frame and an acquired current video data stream to the client; the client decodes and plays the data frame before the first I frame in the current data stream according to the current I frame, and the phenomenon of screen blacking cannot occur. That is to say, only the video data of one I frame is cached in the server, and the video data of one GOP does not need to be cached, so that the memory resource occupancy rate of the server is reduced.
Corresponding to the above method embodiments, the embodiments of the present invention further provide a real-time video transmitting device and a real-time video playing device.
Fig. 3 is a real-time video transmitting apparatus applied to a server according to an embodiment of the present invention, including:
a receiving module 301, configured to receive a video request sent by a client;
a first sending module 302, configured to send the cached current intra-picture I frame to the client;
the second sending module 303 is configured to send the obtained current video data stream to the client, so that the client decodes and plays a data frame before a first I frame in the current video data stream according to the current I frame.
In this embodiment, the method may further include: an acquisition module, a caching module, a determination module, and a deletion module (not shown), wherein,
the acquisition module is used for acquiring a first video data stream;
the buffer module is used for buffering the current I frame in the first video data stream;
a determining module, configured to determine, when a next I frame of the current I frame appears in the first video stream, the next I frame as a current I frame;
and the deleting module is used for deleting the cached I frame and triggering the caching module.
In this embodiment, the method may further include: a first judging module and a third sending module (not shown in the figure), wherein,
the first judging module is used for judging whether a first time interval between adjacent I frames in a second video data stream requested by the client is larger than a first preset threshold value or not, wherein the first time interval is an interval between moments when the adjacent I frames are acquired; if yes, triggering the cache module, and if not, triggering a third sending module;
and the third sending module is used for sending the second video data stream to the client when the I frame appears in the second video data stream.
In this embodiment, the method may further include: a second determining module (not shown in the figure), configured to determine whether a second time interval between a current frame in the second video data stream and a first I frame after the current frame is greater than a second preset threshold, where the second time interval is an interval between a time when the current frame is acquired and a time when the first I frame after the current frame is acquired; if yes, the cache module is triggered, and if not, the third sending module is triggered.
In this embodiment, the method may further include: a third judging module and an encoding module (not shown in the figure), wherein,
the third judging module is used for judging whether the acquired data in the current video data stream is coded data or not;
the coding module is used for coding the data in the current video data stream when the judgment result of the third judgment module is negative;
the cache module may be specifically configured to: sending the cached coded current internal picture I frame to the client;
the second sending module may be specifically configured to: and sending the encoded current video data stream to the client.
In this embodiment, the method may further include: a fourth sending module, a first receiving module, a converting module and a fifth sending module (not shown in the figure), wherein,
a fourth sending module, configured to send video quality information to the client, where the video quality information includes multiple video qualities provided by the server;
the first receiving module is used for receiving a selection instruction sent by the client, wherein the selection instruction carries the first video quality selected by the client;
the conversion module is used for converting the group of pictures (GOP) after the current data frame into the video data stream under the first video quality according to the selection instruction;
and the fifth sending module is used for sending the converted video data stream to the client.
With the embodiment of the present invention shown in fig. 3, after receiving a video request sent by a client, a server sends a cached current I frame and an obtained current video data stream to the client; the client decodes and plays the data frame before the first I frame in the current data stream according to the current I frame, and the phenomenon of screen blacking cannot occur. That is to say, only the video data of one I frame is cached in the server, and the video data of one GOP does not need to be cached, so that the memory resource occupancy rate of the server is reduced.
Fig. 4 is a real-time video playing device applied to a client according to an embodiment of the present invention, which includes:
a sixth sending module 401, configured to send a video request to a server;
a second receiving module 402, configured to receive a current I frame and a current video data stream sent by the server;
a playing module 403, configured to decode and play a data frame before the first I frame in the current video data stream according to the current I frame.
With the embodiment of the present invention shown in fig. 4, after receiving a video request sent by a client, a server sends a cached current I frame and an obtained current video data stream to the client; the client decodes and plays the data frame before the first I frame in the current data stream according to the current I frame, and the phenomenon of screen blacking cannot occur. That is to say, only the video data of one I frame is cached in the server, and the video data of one GOP does not need to be cached, so that the memory resource occupancy rate of the server is reduced.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Those skilled in the art will appreciate that all or part of the steps in the above method embodiments may be implemented by a program to instruct relevant hardware to perform the steps, and the program may be stored in a computer-readable storage medium, which is referred to herein as a storage medium, such as: ROM/RAM, magnetic disk, optical disk, etc.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (11)

1. A real-time video delivery method, applied to a server, the method comprising:
receiving a video request sent by a client;
sending the cached current internal picture I frame to the client;
sending the obtained current video data stream to the client, so that the client decodes and plays a data frame before a first I frame in the current video data stream according to the current I frame;
the method further comprises the following steps:
sending video quality information to the client, wherein the video quality information comprises a plurality of video qualities provided by the server;
receiving a selection instruction sent by the client, wherein the selection instruction carries the first video quality selected by the client;
converting a group of pictures (GOP) after the current data frame into a video data stream under the first video quality according to the selection instruction;
and sending the converted video data stream to the client.
2. The method of claim 1, further comprising:
acquiring a first video data stream;
caching a current I frame in the first video data stream;
when a next I frame of the current I frame appears in the first video data stream, determining the next I frame as a current I frame;
deleting the buffered I frame and returning to the step of buffering the current I frame in the first video data stream.
3. The method according to claim 2, further comprising, after receiving the video request sent by the client:
judging whether a first time interval between adjacent I frames in a second video data stream requested by the client is greater than a first preset threshold value or not, wherein the first time interval is an interval between moments when the adjacent I frames are acquired;
if yes, executing the step of sending the cached current internal picture I frame to the client;
and if not, when the I frame appears in the second video data stream, sending the second video data stream to the client.
4. The method of claim 3, wherein in case that it is determined that the first time interval between adjacent I frames in the second video data stream requested by the client is greater than the first preset threshold, the method further comprises:
judging whether a second time interval between a current frame in the second video data stream and a first I frame after the current frame is greater than a second preset threshold value, wherein the second time interval is an interval between the moment when the current frame is acquired and the moment when the first I frame after the current frame is acquired;
if yes, executing the step of sending the cached current internal picture I frame to the client;
and if not, when the I frame appears in the second video data stream, sending the second video data stream to the client.
5. The method according to claim 1, further comprising, after receiving the video request sent by the client:
judging whether the data in the acquired current video data stream is coded data or not;
if not, encoding the data in the current video data stream;
the sending the cached current internal picture I frame to the client includes:
sending the cached coded current internal picture I frame to the client;
the sending the obtained current video data stream to the client includes:
and sending the encoded current video data stream to the client.
6. A real-time video playing method is applied to a client, and comprises the following steps:
sending a video request to a server;
receiving a current I frame and a current video data stream sent by the server;
decoding and playing the data frame before the first I frame in the current video data stream according to the current I frame;
the method further comprises the following steps:
receiving video quality information sent by the server, wherein the video quality information comprises a plurality of video qualities provided by the server;
sending a selection instruction to the server, wherein the selection instruction carries the first video quality selected by the client, so that the server converts the group of pictures (GOP) after the current data frame into a video data stream under the first video quality according to the selection instruction;
and receiving video stream data sent by the server.
7. A real-time video delivery apparatus, applied to a server, the apparatus comprising:
the receiving module is used for receiving a video request sent by a client;
the first sending module is used for sending the cached current internal picture I frame to the client;
the second sending module is used for sending the acquired current video data stream to the client so that the client decodes and plays a data frame before a first I frame in the current video data stream according to the current I frame;
the device further comprises:
a fourth sending module, configured to send video quality information to the client, where the video quality information includes multiple video qualities provided by the server;
the first receiving module is used for receiving a selection instruction sent by the client, wherein the selection instruction carries the first video quality selected by the client;
the conversion module is used for converting the group of pictures (GOP) after the current data frame into the video data stream under the first video quality according to the selection instruction;
and the fifth sending module is used for sending the converted video data stream to the client.
8. The apparatus of claim 7, further comprising:
the acquisition module is used for acquiring a first video data stream;
the buffer module is used for buffering the current I frame in the first video data stream;
a determining module, configured to determine, when a next I frame of the current I frame appears in the first video stream, the next I frame as a current I frame;
and the deleting module is used for deleting the cached I frame and triggering the caching module.
9. The apparatus of claim 8, further comprising:
the first judging module is used for judging whether a first time interval between adjacent I frames in a second video data stream requested by the client is larger than a first preset threshold value or not, wherein the first time interval is an interval between moments when the adjacent I frames are acquired; if yes, triggering the cache module, and if not, triggering a third sending module;
and the third sending module is used for sending the second video data stream to the client when the I frame appears in the second video data stream.
10. The apparatus of claim 9, further comprising:
a second determining module, configured to determine whether a second time interval between a current frame in the second video data stream and a first I frame after the current frame is greater than a second preset threshold, where the second time interval is an interval between a time when the current frame is acquired and a time when the first I frame after the current frame is acquired; if yes, the cache module is triggered, and if not, the third sending module is triggered.
11. The apparatus of claim 7, further comprising:
the third judging module is used for judging whether the acquired data in the current video data stream is coded data or not;
the coding module is used for coding the data in the current video data stream when the judgment result of the third judgment module is negative;
the cache module is specifically configured to:
sending the cached coded current internal picture I frame to the client;
the second sending module is specifically configured to:
and sending the encoded current video data stream to the client.
CN201610808192.8A 2016-09-05 2016-09-05 Real-time video transmission and playing method and device Active CN107801049B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610808192.8A CN107801049B (en) 2016-09-05 2016-09-05 Real-time video transmission and playing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610808192.8A CN107801049B (en) 2016-09-05 2016-09-05 Real-time video transmission and playing method and device

Publications (2)

Publication Number Publication Date
CN107801049A CN107801049A (en) 2018-03-13
CN107801049B true CN107801049B (en) 2020-01-17

Family

ID=61530887

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610808192.8A Active CN107801049B (en) 2016-09-05 2016-09-05 Real-time video transmission and playing method and device

Country Status (1)

Country Link
CN (1) CN107801049B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108989859A (en) * 2018-08-24 2018-12-11 广东盛利医疗科技有限公司 A kind of surgery demonstration system and method
CN111726657A (en) * 2019-03-18 2020-09-29 北京奇虎科技有限公司 Live video playing processing method and device and server
CN110266706A (en) 2019-06-26 2019-09-20 三星电子(中国)研发中心 A kind of playing method and device of multimedia streaming data
CN110784740A (en) * 2019-11-25 2020-02-11 北京三体云时代科技有限公司 Video processing method, device, server and readable storage medium
CN111010603A (en) * 2019-12-18 2020-04-14 浙江大华技术股份有限公司 Video caching and forwarding processing method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101316357A (en) * 2008-06-30 2008-12-03 华为技术有限公司 Channel switching method, terminal and medium service apparatus
CN101370139A (en) * 2007-08-17 2009-02-18 华为技术有限公司 Method and device for switching channels
CN101686391A (en) * 2008-09-22 2010-03-31 华为技术有限公司 Video coding/decoding method and device as well as video playing method, device and system
CN102223539A (en) * 2011-06-24 2011-10-19 武汉长江通信产业集团股份有限公司 Processing method for splash screen caused by picture coding frame loss

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100770872B1 (en) * 2006-02-17 2007-10-26 삼성전자주식회사 Apparatus and method for receiving data to reduce channel conversion time in a digital multimedia broadcasting system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101370139A (en) * 2007-08-17 2009-02-18 华为技术有限公司 Method and device for switching channels
CN101316357A (en) * 2008-06-30 2008-12-03 华为技术有限公司 Channel switching method, terminal and medium service apparatus
CN101686391A (en) * 2008-09-22 2010-03-31 华为技术有限公司 Video coding/decoding method and device as well as video playing method, device and system
CN102223539A (en) * 2011-06-24 2011-10-19 武汉长江通信产业集团股份有限公司 Processing method for splash screen caused by picture coding frame loss

Also Published As

Publication number Publication date
CN107801049A (en) 2018-03-13

Similar Documents

Publication Publication Date Title
US10368075B2 (en) Clip generation based on multiple encodings of a media stream
US10720188B2 (en) Systems and methods of thumbnail generation
CN107801049B (en) Real-time video transmission and playing method and device
US9351020B2 (en) On the fly transcoding of video on demand content for adaptive streaming
KR101737325B1 (en) Method and apparatus for reducing decreasing of qualitly of experience in a multimedia system
CN108965883B (en) System and method for encoding video content using virtual intra frames
US9113177B2 (en) Methods, apparatuses and computer program products for pausing video streaming content
CN106713913B (en) Video image frame sending method and device and video image frame receiving method and device
US11128897B2 (en) Method for initiating a transmission of a streaming content delivered to a client device and access point for implementing this method
CA2758763C (en) Method and device for fast pushing unicast stream in fast channel change
US10567825B2 (en) Cloud DVR storage
CN112752115B (en) Live broadcast data transmission method, device, equipment and medium
US10834161B2 (en) Dash representations adaptations in network
KR102216622B1 (en) Data buffering method, network device, and storage medium
KR102077752B1 (en) Method and system for playback of motion video
US20190174177A1 (en) Channel Change Method and Apparatus
CN111726657A (en) Live video playing processing method and device and server
CN110519640B (en) Video processing method, encoder, CDN server, decoder, device, and medium
US9516357B2 (en) Recording variable-quality content stream
US9060184B2 (en) Systems and methods for adaptive streaming with augmented video stream transitions using a media server
CN107634928B (en) Code stream data processing method and device
US10531135B2 (en) Network recording apparatus
US20140184734A1 (en) Reception apparatus, reception method, and program thereof, image capturing apparatus, image capturing method, and program thereof, and transmission apparatus, transmission method, and program thereof
US20140201368A1 (en) Method and apparatus for enforcing behavior of dash or other clients
CN117041613A (en) Live video live broadcast pause method based on RTMP, live video live broadcast pause device based on RTMP and live broadcast system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant