Methods for improving seek effect of network media files

By building a keyframe list in the streaming media player and using iterative estimation methods, the problem of inaccurate seek operation is solved, and the speed and user experience of streaming media playback are improved.

CN116208820BActive Publication Date: 2025-03-07HANGZHOU ARCVIDEO TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211625734.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-16
Publication Date
2025-03-07
Estimated Expiration
2042-12-16

AI Technical Summary

Technical Problem

The lack of keyframe lists during the search operation result in inaccurate position of the seek, which affects the playback experience, especially if the network quality is poor or the media file format does not support the keyframe list.

Method used

By building a keyframe list and when the user initiates a seek operation, the built keyframe list or iterative estimation method can accurately calculate the seek location, reduce the number of HTTP requests, and improve the seek speed and accuracy.

Benefits of technology

It effectively improves the accuracy and speed of seek operations, reduces network requests and data processing time, and improves the user experience of streaming media playback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116208820B_ABST
    Figure CN116208820B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for improving the seek effect of a network media file, comprising the following steps: a player starts playing, obtains media stream information, and constructs a key frame list; when a user initiates a seek operation, the player records the target time point at which the user stops after dragging a progress bar, and if the cached data of the player already contains the target time point, the start of the play after the seek is realized through the cached data; otherwise, the player estimates the offset position of the target time point in the media file according to the target time point, and uses this as the HTTP request content to request the media data after the offset position from the media server, and the acquisition of the offset position is realized by searching the key frame list constructed by the player or iterative estimation. The present invention can well improve the problem of poor playback experience caused by inaccurate seek by constructing a key frame list and based on a method of bit rate estimation and iterative processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of streaming media playback, and in particular relates to a method for improving the seek effect of a network media file. Background Art

[0002] Streaming Media technology refers to a technology that compresses a series of media data and transmits them in segments in the form of streams on the network, so as to achieve real-time transmission of audio and video for viewing on the network. This technology has greatly improved the previous situation where video viewing must download all or most of the media files to the viewing device, solving the problem of wasting time and occupying device storage space. Usually, users open the streaming media player on the viewing device (computer, tablet, mobile phone, etc.), select the media stream to watch, and then start watching. If users want to skip some video clips while watching the video, they can drag the progress bar of the media player to the position they want to watch. This operation is called seek.

[0003] Media streams come from various encoded and packaged media files stored on media servers, such as MP4, FLV, TS, etc. Due to the characteristics of segmented real-time transmission of streaming media, for each seek operation by the user, the media player must initiate a new HTTP request to the media server to obtain the media data near the seek time point and replay it. The HTTP request is based on the byte offset of the seek time point relative to the total length of the media file. A complete seek operation includes the time from the user dragging the progress bar to the media player obtaining the new media data, decapsulating and decoding it, and resuming playback.

[0004] There are two main factors that affect the user experience of the seek operation: network quality (the better the network, the faster the HTTP request initiated by the seek will obtain the media data after the seek); the accuracy of the seek position, that is, whether the start time point of the media data obtained after the player initiates the seek request is exactly the seek time point the user wants. Usually MP4 will contain a key frame list, that is, it contains the timestamps of all key frames and the offset position corresponding to the timestamp in the MP4 file. The player can obtain the accurate file position corresponding to the seek time point by querying the key frame list. TS files do not have a key frame list, and FLV's key frame list is an option, which may or may not be available. For media files without a key frame list, the seek position is usually calculated based on the ratio of the seek time point to the total length of the media file, and then an offset position is calculated based on the total length of the file to initiate a request to the media server. Therefore, the playback time point after the seek contained in the media data converted based on the average bit rate of the bit stream will have some deviation from the time point the user wants. The greater the bit rate change, the greater the deviation. For situations where it is impossible to seek accurately, current media players such as VLC do not provide time-based seek by default to circumvent this problem, while PotPlayer starts playing only after the entire media stream is downloaded. For situations where the deviation is large, other players may use multiple HTTP requests to approximate the actual time point of the seek, but there is no good way to ensure that the request uses fewer requests and takes less time, which greatly affects the playback experience. Summary of the invention

[0005] In view of the above problems, the present invention provides a method for improving the seek effect of network media files. By constructing a key frame list and based on a method of bit rate estimation and iterative processing, the problem of poor playback experience caused by inaccurate seek can be well improved.

[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0007] A method for improving the seek effect of a network media file comprises the following steps:

[0008] The player starts playing, obtains media stream information, and builds a key frame list;

[0009] When the user initiates a seek operation, the player records the target time point where the user stops after dragging the progress bar. If the player's cached data already contains the target time point, the cached data is used to start playback after the seek. Otherwise, the player estimates the offset position of the target time point in the media file based on the target time point, uses this as the HTTP request content, and requests the media data after the offset position from the media server. The offset position is obtained by searching the key frame list constructed by the player or iterative estimation.

[0010] In a possible implementation manner, the player starts playing and obtaining the media stream information includes:

[0011] The media player obtains the address of the media stream selected by the user and initiates an HTTP request to the media server;

[0012] The media server responds to the media player, and the response data includes the total length P of the media file file , and start streaming the media file;

[0013] The media player records the total length of the media file, collects the media stream data, decapsulates it to determine the format of the media file, whether there is a key frame list, and whether it contains the total length of the file, that is, the playback length T file ;

[0014] For media files that do not contain a total duration, the media player selects an offset position close to the end of the media file to initiate a new HTTP request to obtain the tail data of the media file. By parsing the tail data, the timestamp of the last audio or video encoding frame of the media file is obtained as the total duration T of the file. file ;

[0015] The media player continuously receives media data from the media server, decapsulates it to obtain audio and video encoding frames with timestamp information, and then sends it to the corresponding audio and video decoder for decoding and playback.

[0016] In a possible implementation manner, constructing the key frame list specifically includes:

[0017] During the decapsulation process, when the media player encounters a video key frame, it generates and maintains a key frame list associated with the media file based on the key frame information. Each item in the key frame list contains three elements {Ti, Pi, Ci}, where Ti is the timestamp corresponding to the key frame of the current table item, Pi is the position offset of the key frame in the media file, and Ci is a Boolean value that identifies the continuity of the table item, that is, whether the key frames corresponding to the current table item and the previous table item in the list are continuous in the media file; the player builds and updates the corresponding key frame list information while playing.

[0018] In a possible implementation, the key frame list further includes: the form item is {T 0 , P 0 , C 0}, {T 1 , P 1, C 1}…{T i, P i, C i}, where C 0, C 1 ...C i Both indicate continuity and have a value of TRUE. After this, the user initiates a seek operation to a location greater than T. i At this moment, the next form item should be {T i+1, P i+1, C i+1}, where C i+1 The value of is FALSE.

[0019] In a possible implementation manner, the step of searching for a key frame list constructed by a player specifically includes:

[0020] For the target seek time point T target First, check whether there is a directly available data item in the ternary key frame list constructed during playback. Specifically, the player traverses the key frame list items and finds the time point T target The two list items closest to each other, {T s , P s , C s}, {T e , P e , C e}, where {T s , P s , C s} is all timestamps less than T target The item with the largest timestamp value in the form; e , P e , C e} are all timestamps greater than T target The item with the smallest timestamp value in the form;

[0021] If C e If TRUE, it means that the two list items are consecutive key frames, and the player uses P s An HTTP request is made to the media server for the offset position. The timestamp of the start key frame contained in the obtained media data is T s According to the continuity of the list items, T s Is the media file and T targetThe closest key frame time, the player quickly decodes it and obtains the closest T target The video frame starts playing after seeking;

[0022] If C e is FALSE, indicating that the two list items are not consecutive key frames. s or T e and T target If the interval is small, it is considered that T s or T e is the distance T target The nearest key frame time, the player in P s or P e Initiate an HTTP request to the media server for the offset position and prepare for playback processing after seek; if the interval is large, use iterative estimation.

[0023] In a possible implementation manner, the iterative estimation specifically includes:

[0024] The player is {T s , P s} as the starting endpoint, {T e , P e} as the end endpoint, and perform subsequent iterations based on the intervals contained in the two endpoints;

[0025] The player sets a threshold T Limit , since the seek operation ultimately requires a time point closest to the target time point T target The timestamp T of the key frame actual For decoding and playback after seek, and T target The video frame corresponding to the moment is not necessarily a key frame, and the actual key frame T actual A certain deviation is allowed, and the deviation threshold is set to T Limit ; If the timestamp value obtained after the iteration is T target If the difference is within this threshold, the iteration ends.

[0026] In one possible implementation, when the player first queries the key frame list built by itself, if the key frame list is less than T target The form item is empty, {T s, P s}The value is the beginning position of the media file, that is, the first video frame in the file, with a timestamp of 0 and an offset of 0;

[0027] If the keyframe list is greater than T target The form item is empty, {T e, P eThe value is the end position of the media file, that is, the last media data frame in the file, and the timestamp is the total duration of the media file T file , the offset position is the total length P of the media file file .

[0028] In a possible implementation manner, the player is configured to s , P s} as the starting endpoint, {T e , P e} as the end endpoint, and subsequent iterations based on the intervals contained in the two endpoints include:

[0029] Make the first HTTP request: In the interval [{T s, P s}, {T e, P e}], the offset position requested by the player to the media server is P 1, The average bit rate of this interval is B 1 =(P e -P s )÷(T e -T s ), and at the same time, B 1 =(P 1 -P s )÷(T target -T s ), so we can get P 1 =B 1 ×(T target -T s )+P s ;

[0030] The media server responds to the player's request and returns the media data. The player processes the returned media data and obtains the start timestamp of the video frame as T 1 , T 1 The earliest key frame information is {T 1k , P 1k}, if ABS(T target –T 1k ) <T Limit , end the iteration and start playing after seek; otherwise start the second HTTP request;

[0031] The second HTTP request process is as follows: There are three sets of data: s, P s}, {T 1k , P 1k}, {T e , P e}, if T targetDistance T s Closer, that is, T e -T target >T target -T s ,{T 1k , P 1k} becomes the new {T e, P e}; On the contrary, {T 1k , P 1k} becomes the new {T s, P s};

[0032] The selection is based on the fact that the smaller the estimated time interval, the closer the average bitrate is to the target time instant bitrate, and the closer the timestamp obtained after the HTTP request is to the target value desired by seek. s, P s}, {T e, P e Repeat the operation of the first HTTP request in the interval; the data returned by the new HTTP request is {T 2k , P 2k}, if ABS(T target –T 2k ) <T Limit , end the iteration and start playing after seek; otherwise start the next HTTP request;

[0033] By analogy, the Nth HTTP request process is as follows: There are three sets of data: {T s, P s}, {T (n-1)k , P (n-1)k}, {T e, P e};{T (n-1)k , P (n-1)k} is the result of the N-1th request.

[0034] If T target Distance T s Closer, that is, T e -T target >T target -T s ,{T (n-1)k , P (n-1)k} becomes the new {T e, P e};

[0035] On the contrary, {T (n-1)k , P (n-1)k} becomes the new {T s , P s};

[0036] In the updated [{T s , P s}, {T e , P e Repeat the operation of the first HTTP request in the interval; the data returned by the new HTTP request is {T nk , P nk},

[0037] Subsequent iterations are repeated in this way until a new timestamp is obtained that satisfies the threshold T Limit requirements.

[0038] In a possible implementation, the method further includes: updating the key frame list, and obtaining {T 1k , P 1k}, {T 2k , P 2k}, {T (n-1)k , P (n-1)k}, {T nk , P nk} is synchronously added to the key frame list maintained by the player as reference information for subsequent seek operations.

[0039] The present invention has the following beneficial effects:

[0040] (1) Establish and maintain a list of key frames associated with the media file. The timestamps and position information of the key frames collected during the playback or seek process are added to the list. The more key frame information collected, the more help it will have on the accuracy and speed of subsequent seeks.

[0041] (2) For scenes with short playback time and no effective key frame information for reference, a relatively accurate seek time point can be obtained through multiple iterative estimation methods. The iterative estimation is based on the most suitable time interval near the target seek time point, which can effectively reduce the number of iterations, that is, the number of HTTP requests to reduce the corresponding network requests and data processing time. In addition, the key frame information obtained during the iteration process is synchronously added to the key frame list, which can provide a better reference for subsequent seek operation time optimization.

[0042] (3) By searching the key frame list constructed by the player or iteratively estimating, the bit rate changes in a large time range can be smoothed out, effectively improving the problem of inaccurate seek and poor playback experience caused by the lack of key frame lists in media file formats such as TS and FLV. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1The present invention is a flowchart of a method for improving the seek effect of a network media file according to an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The following will be combined with the 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 part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] See also Figure 1 , which is a flowchart of a method for improving the seek effect of a network media file according to an embodiment of the present invention, comprises the following steps:

[0046] S10, the player starts playing, obtains media stream information, and builds a key frame list;

[0047] S20, when the user initiates a seek operation, the player records the target time point where the user stops after dragging the progress bar. If the cached data of the player already contains the target time point, the start of playback after the seek is achieved through the cached data; otherwise, the player estimates the offset position of the target time point in the media file based on the target time point, uses this as the HTTP request content, and requests the media data after the offset position from the media server. The offset position is obtained by searching the key frame list constructed by the player or iterative estimation.

[0048] In one embodiment of the present invention, the player starts playing and obtains the media stream information specifically including:

[0049] The media player obtains the address of the media stream selected by the user and initiates an HTTP request to the media server;

[0050] The media server responds to the media player, and the response data includes the total length P of the media file file , and start streaming the media file;

[0051] The media player records the total length of the media file, collects the media stream data, decapsulates it to determine the format of the media file, whether there is a key frame list, and whether it contains the total length of the file, that is, the playback length T file ;

[0052] For media files that do not contain a total duration, the media player selects an offset position close to the end of the file to initiate a new HTTP request to obtain the tail data of the media file. By parsing the tail data, the timestamp of the last audio or video encoding frame of the media file is obtained as the total duration T of the file. file ;

[0053] The media player continuously receives media data from the media server, decapsulates it to obtain audio and video encoding frames with timestamp information, and then sends it to the corresponding audio and video decoder for decoding and playback.

[0054] In one embodiment of the present invention, the process of constructing a key frame list is as follows:

[0055] During the decapsulation process, when the media player encounters a video key frame, it generates and maintains a key frame list information associated with the media file based on the key frame information. Each item in the list contains three elements {T i, P i, C i}, T i is the timestamp corresponding to the key frame of the current entry, P i is the position offset of the key frame in the media file, C i It is a Boolean value that identifies the continuity of the form item, that is, whether the key frames corresponding to the current form item and the previous form item in the list are continuous in the media file;

[0056] During the normal playback of the media stream, all the key frame information obtained by parsing {T i, P i , C i} should be added to the key frame list in sequence. For example, when playing continuously, the key frame information form item is as follows {T 0 , P 0 , C 0}, {T 1 , P 1 , C 1}…{T i , P i, C i}, where C 0, C 1 ...C i After that, the user initiates a seek operation to a location greater than T. i At this moment, the next form item should be {T i+1, P i+1, C i+1}, where C i+1 The value of is FALSE.

[0057] Similarly, the player builds and updates the corresponding key frame list information while playing.

[0058] In one embodiment of the present invention, searching for a key frame list constructed by a player specifically includes:

[0059] For the target time point T of the target seek targetFirst, check whether there is a directly available data item in the ternary key frame list constructed during playback. Specifically, the player traverses the key frame list items and finds the time point T target The two list items closest to each other, {T s , P s , C s}, {T e , P e , C e}, where {T s , P s , C s} is all timestamps less than T target The item with the largest timestamp value in the form; e , P e , C e} are all timestamps greater than T target The item with the smallest timestamp value in the form;

[0060] If C e If TRUE, it means that the two list items are consecutive key frames, and the player uses P s An HTTP request is made to the media server for the offset position. The timestamp of the start key frame contained in the obtained media data is T s According to the continuity of the list items, T s Is the media file and T target The closest key frame time, the player quickly decodes it and obtains the closest T target The video frame starts playing after seeking;

[0061] If C e is FALSE, indicating that the two list items are not consecutive key frames. s or T e and T target If the interval is small, the judgment of the interval is related to the GOP value encoded in the bitstream itself, but GOP is not a fixed value, it can be 1 second or 10 seconds. For example, if it is within 5 seconds, Ts or Te is considered to be the key frame time closest to Ttarget, and the player initiates an HTTP request to the media server with Ps or Pe as the offset position to prepare for the playback process after seek; if the interval is large, such as greater than 5 seconds, iterative estimation is used.

[0062] Furthermore, in one embodiment of the present invention, the iterative estimation specifically includes:

[0063] It is known that the player queries and obtains the key frame list containing T target The two form items of {T s , P s, C s}, {T e , P e , C e}. Among them, {T s , P s , C s} is all form items with timestamps less than T target The item with the largest value; {T e , P e , C e} is all timestamps greater than T target The item with the smallest value.

[0064] The player is {T s , P s} as the starting endpoint, {T e , P e} as the end endpoint, and perform subsequent iterations based on the intervals contained in the two endpoints;

[0065] The player sets a threshold T Limit , since the seek operation ultimately requires a time point closest to the target time point T target The timestamp T of the key frame actual For decoding and playback after seek, and T target The video frame corresponding to the moment is not necessarily a key frame, and the actual key frame T actual A certain deviation is allowed, and the deviation threshold is set to T Limit ; If the timestamp value obtained after the iteration is T target If the difference is within this threshold, the iteration ends.

[0066] In one embodiment of the present invention, when the key frame list built by the player is queried at the earliest, if the key frame list is less than T target The form item is empty, {T s , P s}The value is the beginning position of the media file, that is, the first video frame in the file, with a timestamp of 0 and an offset of 0;

[0067] If the keyframe list is greater than T target The form item is empty, {T e , P e The value is the end position of the media file, that is, the last media data frame in the file, and the timestamp is the total duration of the media file T file , the offset position is the total length P of the media file file .

[0068] In one embodiment of the present invention, in order to obtain the final T target The timestamp T of the key frame actual, which may require one or more HTTP requests. The player uses {T s , P s} as the starting endpoint, {T e , P e} as the end endpoint, and subsequent iterations based on the intervals contained in the two endpoints include:

[0069] Make the first HTTP request: In the interval [{T s , P s}, {T e , P e}], the offset position requested by the player to the media server is P 1 The average bit rate of this interval is B 1 =(P e -P s )÷(T e -T s ), and at the same time, B 1 =(P 1 -P s )÷(T target -T s ), so we can get P 1 =B 1 ×(T target -T s )+P s ;

[0070] The media server responds to the player's request and returns the media data. The player processes the returned media data and obtains the start timestamp of the video frame as T 1 , T 1 The earliest key frame information is {T 1k , P 1k}, if ABS(T target –T 1k ) <T Limit , end the iteration and start playing after seek; otherwise start the second HTTP request;

[0071] The second HTTP request process is as follows: There are three sets of data: s , P s}, {T 1k , P 1k}, {T e, P e}, if T target Distance T s Closer, that is, T e -T target >T target -T s ,{T 1k , P1k} becomes the new {T e, P e}; On the contrary, {T 1k , P 1k} becomes the new {T s, P s};

[0072] The selection is based on the fact that the smaller the estimated time interval, the closer the average bitrate is to the target time instant bitrate, and the closer the timestamp obtained after the HTTP request is to the target value desired by seek. s , P s}, {T e , P e Repeat the operation of the first HTTP request in the interval; the data returned by the new HTTP request is {T 2k , P 2k}, if ABS(T target –T 2k ) <T Limit , end the iteration and start playing after seek; otherwise start the next HTTP request;

[0073] By analogy, the Nth HTTP request process is as follows: There are three sets of data: {T s , P s}, {T (n-1)k , P (n-1)k}, {T e, P e};{T (n-1)k , P (n-1)k} is the result of the N-1th request.

[0074] If T target Distance T s Closer, that is, T e -T target >T target -T s ,{T (n-1)k , P (n-1)k} becomes the new {T e, P e};

[0075] On the contrary, {T (n-1)k , P (n-1)k} becomes the new {T s, P s};

[0076] In the updated [{T s , P s}, {T e , P eRepeat the operation of the first HTTP request in the interval; the data returned by the new HTTP request is {T nk , P nk},

[0077] Subsequent iterations are repeated in this way until a new timestamp is obtained that satisfies the threshold T Limit requirements.

[0078] In one embodiment of the present invention, the method further comprises: updating the key frame list, and obtaining {T 1k , P 1k}, {T 2k , P 2k}, {T (n-1)k , P (n-1)k}, {T nk , P nk} is synchronously added to the key frame list maintained by the player as reference information for subsequent seek operations.

[0079] A specific application example is the seek operation based on the playback cache. The existing streaming media server O provides HTTP media streaming services, which includes a media stream S in the file format of TS. There is also a player P. P requests the streaming media server O to play the media stream S. O responds and sends back the media data of S from the beginning. After the initial parsing, P obtains the basic information of S, that is, the media file format is TS, the total file length is 100M, and the total file length is 100 minutes. P processes and starts to play the media data corresponding to S. During the playback process, it creates and maintains the key frame list information corresponding to S, as shown in Table 1. When P plays the media stream S to 45 seconds and the playback cache is 57 seconds, the user initiates a seek operation, and the target time point is 55 seconds. P queries the playback cache data, which contains 55 seconds of audio and video data, that is, decoding starts from index number 18 and key frame time 54 seconds, and rendering and playback starts from 55 seconds, and the seek operation ends.

[0080] Table 1 Key frame list information based on playback cache query

[0081] Index Number Timestamp (milliseconds) Offset location (KB) Continuity 0 0 0 TRUE 1 3000 1000 TRUE 2 6000 2000 TRUE 3 9000 3000 TRUE … … … … 15 45000 15000 TRUE 16 48000 16000 TRUE 17 51000 17000 TRUE 18 54000 18000 TRUE 19 57000 19000 TRUE

[0082] A specific application example is the seek operation based on the key frame list. The existing streaming media server O provides HTTP media streaming services, which includes a media stream S in the file format of TS, and a player P. P requests the streaming media server O to play the media stream S. O responds and sends back the media data of S from the beginning. After the initial parsing, P obtains the basic information of S, that is, the media file format is TS, the total file length is 100M, and the total file length is 100 minutes. P processes and starts to play the media data corresponding to S. During the playback process, it creates and maintains the key frame list information corresponding to S, as shown in Table 2. When P plays the media stream S for 30 minutes and the playback buffer is 30 minutes and 3 seconds, the user initiates a seek operation, and the target time point is 50 seconds. P first checks the playback buffer data. The current playback time of 30 minutes is much greater than the target time, and the query is unsuccessful. P queries the existing key frame list information and finds the table entries with index numbers 16 and 17, respectively. The corresponding key frame frame timestamps are 48 seconds and 51 seconds, respectively, including the target seek time of 50 seconds, and the table entries 16 and 17 are continuous key frame table entries, so the query is successful. P selects the offset position corresponding to the index 16 table entry and initiates an HTTP request to the media server O. O returns the media data starting from the key frame 48 seconds. P receives and processes the media data, starts decoding from the key frame 48 seconds, and starts rendering and playing from 50 seconds. The Seek operation ends.

[0083] Table 2 Key frame list information based on key frame list query

[0084] Index Number Timestamp (milliseconds) Offset location (KB) Continuity 0 0 0 TRUE 1 3000 1000 TRUE 2 6000 2000 TRUE 3 9000 3000 TRUE … … … … 15 45000 15000 TRUE 16 48000 16000 TRUE 17 51000 17000 TRUE … … … … 60 180000 60000 TRUE 61 183000 61000 TRUE

[0085] A specific application example is a seek operation based on iterative calculation. The existing streaming media server O provides HTTP media streaming services, which includes a media stream S in the file format of TS, and a player P. P requests the streaming media server O to play the media stream S, and O responds and sends back the media data of S from the beginning. After the initial parsing, P obtains the basic information of S, that is, the media file format is TS, the total file length is 364199804 bytes, and the total file length is 2656.827 seconds. P has just started playing, and the user initiates a seek operation, and the target time point is 780 seconds; when the seek is triggered, the current playback cache does not meet the seek condition; the current self-built key frame table is empty. P chooses to use an iterative algorithm to estimate the seek position of 780 seconds. The execution process refers to Table 3; a total of two HTTP requests are executed to obtain the media data required after the seek. Table 3 also shows the seek operation of the third-party player in the prior art. The principle of estimating the seek position is: obtain the real timestamp through the last HTTP request, calculate the time difference between the timestamp and the target time, and then convert the time difference into the number of bytes relative to the media file as the byte increment for the next HTTP request step. It can be seen from the table data that the HTTP request is executed four times in total, which is much less efficient.

[0086] Table 3 Information table based on iterative algorithm

[0087]

[0088] Through the above-implemented method for improving the seek effect of network media files, for media files that do not provide a key frame list, a key frame list is constructed and based on a method of bit rate estimation and iteration, which can effectively improve the problem of poor playback experience caused by inaccurate seek.

[0089] It should be understood that the exemplary embodiments described herein are illustrative rather than restrictive. Although one or more embodiments of the present invention have been described in conjunction with the accompanying drawings, it should be understood by those skilled in the art that various changes in form and detail may be made without departing from the spirit and scope of the present invention as defined by the appended claims.

Claims

1. A method for improving the seek effect of a network media file, characterized in that: The following steps are involved: The player starts playing, obtains media stream information, and builds a key frame list; When the user initiates a seek operation, the player records the target time point where the user stops after dragging the progress bar. If the player's cached data already contains the target time point, the player starts playing after the seek operation using the cached data. Otherwise, the player estimates the offset position of the target time point in the media file based on the target time point, and uses this as the HTTP request content to request the media data after the offset position from the media server. The offset position is obtained by searching the key frame list constructed by the player or iterative estimation. The player starts playing and obtains media stream information including: The media player obtains the address of the media stream selected by the user and initiates an HTTP request to the media server; The media server responds to the media player, and the response data includes the total length P of the media file file , and start streaming the media file; The media player records the total length of the media file, collects the media stream data, decapsulates it to determine the format of the media file, whether there is a key frame list, and whether it contains the total length of the file, that is, the playback length T file ; For media files that do not contain a total duration, the media player selects an offset position close to the end of the media file to initiate a new HTTP request to obtain the tail data of the media file. By parsing the tail data, the timestamp of the last audio or video encoding frame of the media file is obtained as the total duration T of the file. file ; The media player continuously receives media data from the media server, decapsulates it to obtain audio and video encoded frames with timestamp information, and then sends it to the corresponding audio and video decoder for decoding and playback; The key frame list construction specifically includes: During the decapsulation process, when the media player encounters a video key frame, it generates and maintains a key frame list associated with the media file based on the key frame information, where each item in the key frame list contains three elements {Ti, Pi, Ci}, where Ti is the timestamp corresponding to the key frame of the current item, Pi is the position offset of the key frame in the media file, and Ci is a Boolean value that identifies the continuity of the item, that is, whether the key frames corresponding to the current item and the previous item in the list are continuous in the media file; the player builds and updates the corresponding key frame list information while playing; Further comprising: the form item of the keyframe list is {T 0, P 0, C0}, {T 1, P 1, C1}…{T i, P i, C i }, where C 0, C1...C i Both indicate continuity and have a value of TRUE. After this, the user initiates a seek operation to a location greater than T. i At this moment, the next form item should be {T i+1, P i+1, C i+1 }, where C i+1 The value of is FALSE; The key frame list constructed by the search player specifically includes: For the target time point T of the target seek target First, check whether there is a directly available data item in the ternary key frame list constructed during playback. Specifically, the player traverses the key frame list items and finds the time point T target The two list items closest to each other, {T s , P s , C s }, {T e , P e , C e }, where {T s , P s , C s } is all timestamps less than T target The item with the largest timestamp value in the form; e , P e , C e } is all timestamps greater than T target The item with the smallest timestamp value in the form; If C e If TRUE, it means that the two list items are consecutive key frames, and the player uses P s An HTTP request is made to the media server for the offset position. The timestamp of the start key frame contained in the obtained media data is T s According to the continuity of the list items, T s Is the media file and T target The closest key frame time, the player quickly decodes it and obtains the closest T target The video frame starts playing after seeking; If C e is FALSE, indicating that the two list items are not consecutive key frames. s or T e and T target If the interval is small, it is considered that T s or T e is the distance T target The nearest key frame time, the player in P s or P e Initiate HTTP request to media server for offset position and prepare for playback after seek; if the interval is large, use iterative estimation; The iterative estimation specifically includes: The player is {T s , P s } as the starting endpoint, {T e , P e } as the end endpoint, and perform subsequent iterations based on the intervals contained in the two endpoints; The player sets a threshold T Limit , since the seek operation ultimately requires a time point closest to the target time point T target The timestamp T of the key frame actual For decoding and playback after seek, and T target The video frame corresponding to the moment is not necessarily a key frame, and the actual key frame T actual A certain deviation is allowed, and the deviation threshold is set to T Limit ; If the timestamp value obtained after the iteration is T target If the difference is within this threshold, the iteration ends.

2. The method for improving the seek effect of network media files according to claim 1, characterized in that: When querying the key frame list built by the player at the earliest, if the key frame list is less than T target The form item is empty, {T s, P s }The value is the beginning position of the media file, that is, the first video frame in the file, with a timestamp of 0 and an offset of 0; If the keyframe list is greater than T target The form item is empty, {T e, P e The value is the end position of the media file, that is, the last media data frame in the file, and the timestamp is the total duration of the media file T file , the offset position is the total length P of the media file file .

3. The method for improving the seek effect of network media files according to claim 1, characterized in that: The player is s , P s } as the starting endpoint, {T e , P e } as the end endpoint, and subsequent iterations based on the intervals contained in the two endpoints include: Make the first HTTP request: In the interval [{T s, P s }, {T e, P e }], the offset position requested by the player to the media server is P 1, The average code rate of this interval is B1=(P e -P s )÷(T e -T s ), at the same time, B1=(P1-P s )÷(T target -T s ), so we can get P1=B1×(T target -T s )+P s ; The media server responds to the player's request and returns the media data. After the player processes the returned media data, it obtains the start timestamp of the video frame as T1. The earliest key frame information after T1 is {T 1k , P 1k }, if ABS(T target –T 1k ) <T Limit , end the iteration and start playing after seek; otherwise, start the second HTTP request; The second HTTP request process is as follows: There are three sets of data: s, P s }, {T 1k , P 1k }, {T e, P e }, if T target Distance T s Closer, that is, T e -T target >T target -T s ,{T 1k , P 1k } becomes the new {T e, P e }; On the contrary, {T 1k , P 1k } becomes the new {T s, P s }; The selection is based on the fact that the smaller the estimated time interval, the closer the average bitrate is to the target time instant bitrate, and the closer the timestamp obtained after the HTTP request is to the target value desired by seek. s, P s }, {T e, P e Repeat the operation of the first HTTP request in the interval; the data returned by the new HTTP request is {T 2k , P 2k }, if ABS(T target –T 2k ) <T Limit , end the iteration and start playing after seek; otherwise start the next HTTP request; By analogy, the Nth HTTP request process is as follows: There are three sets of data: {T s, P s }, {T (n-1)k , P (n-1)k }, {T e, P e };{T (n-1)k , P (n-1)k } is the result of the N-1th request. If T target Distance T s Closer, that is, T e -T target >T target -T s ,{T (n-1)k , P (n-1)k } becomes the new {T e, P e }; On the contrary, {T (n-1)k , P (n-1)k } becomes the new {T s, P s }; In the updated [{T s, P s }, {T e, P e Repeat the operation of the first HTTP request in the interval; the data returned by the new HTTP request is {T nk , P nk }, Subsequent iterations are repeated in this way until a new timestamp is obtained that satisfies the threshold T Limit requirements.

4. The method for improving the seek effect of network media files as claimed in claim 3, characterized in that: Further including: Update the key frame list, and obtain {T 1k , P 1k }, {T 2k , P 2k }, {T (n-1)k , P (n-1)k }, {T nk , P nk } is synchronously added to the key frame list maintained by the player as reference information for subsequent seek operations.

Citation Information

Patent Citations

  • Method, device and system for playing streaming media contents

    CN102131106A

  • Video seek method and device, terminal and computer readable storage medium

    CN109862423A