CN110545459A - method for caching video and related equipment - Google Patents

method for caching video and related equipment Download PDF

Info

Publication number
CN110545459A
CN110545459A CN201810526298.8A CN201810526298A CN110545459A CN 110545459 A CN110545459 A CN 110545459A CN 201810526298 A CN201810526298 A CN 201810526298A CN 110545459 A CN110545459 A CN 110545459A
Authority
CN
China
Prior art keywords
video
target
playing
information
fragmented
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.)
Pending
Application number
CN201810526298.8A
Other languages
Chinese (zh)
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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810526298.8A priority Critical patent/CN110545459A/en
Publication of CN110545459A publication Critical patent/CN110545459A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8455Structuring of content, e.g. decomposing content into time segments involving pointers to the content, e.g. pointers to the I-frames of the video stream
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments

Abstract

The embodiment of the invention provides a method for caching a video and playing equipment, which are used for solving the defect that file contents need to be continuously downloaded because the online video stream is not cached locally when being directly played, and saving network resources. The method provided by the embodiment of the invention comprises the following steps: determining the target video as an online on-demand video according to the address of the target video; acquiring an index file of a target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence; establishing an information index relationship of a plurality of fragmented videos according to the index file, wherein the information index relationship comprises an incidence relationship between the starting time of the first fragmented video and the description information of the first fragmented video; and sequentially caching the plurality of sliced videos according to the playing sequence.

Description

Method for caching video and related equipment
Technical Field
The present invention relates to the field of multimedia technologies, and in particular, to a method for caching a video and a related device.
background
In the development process of a PC client of a video website, for an online live video stream, because the live video stream is real-time, a user cannot perform fast forward or fast backward operation on the live video; for an on-demand video stream, since the on-demand video stream may be non-real-time, a user may fast forward or fast rewind the on-demand video stream for a specific time point.
In the prior art, an on-demand video stream adopts a cache strategy similar to that of a live video stream, namely, the video stream is not cached, and the video stream is directly played and pulled from a network for playing. Then, when the user performs fast forward and fast backward operations on the on-demand video stream, the user waits for the completion of buffering of the on-demand video stream and then starts playing.
However, in the prior art, each time the time is located, it is necessary to wait for the video stream to be downloaded, and even if the video stream on demand that the user watches is already played, the video stream still needs to be downloaded again because there is no cache, which causes waste of network resources of the user.
disclosure of Invention
The embodiment of the invention provides a method for caching a video and related equipment, which are used for solving the defect that file contents need to be continuously downloaded because the online video stream is not cached locally when being directly played, and saving network resources.
A first aspect of an embodiment of the present invention provides a method for caching a video, including: determining that the target video is an online on-demand video according to the address of the target video; acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence; establishing an information index relationship of the plurality of sliced videos according to the index file, wherein the information index relationship comprises an association relationship between the starting time of a first sliced video and the description information of the first sliced video, and the description information of the first sliced video at least comprises the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos; and sequentially caching the plurality of sliced videos according to the information index relation.
in a possible design, in a first implementation manner of the first aspect of the embodiment of the present invention, after the establishing an information index relationship of the plurality of sliced videos according to the index file, the method further includes: receiving a first message sent by a user, wherein the first message is used for positioning the playing position of the target video to a target time point; responding to the first message, and determining a target segmented video according to the target time point and the information index relation, wherein the target time point is between the starting time and the ending time of the target segmented video; and when the target fragment video is completely downloaded, playing the target video from the target time point.
In a possible design, in a second implementation manner of the first aspect of the embodiment of the present invention, when the target time slice is not completely downloaded, the method further includes: downloading the target fragment video; playing the target video from the target time point.
in a possible design, in a third implementation manner of the first aspect of the embodiment of the present invention, the determining that the target video is an online on-demand video according to the address of the target video includes: determining the target video to be an online video according to the address of the target video; and when the address of the target video meets a preset condition, determining that the target video is the online on-demand video.
A second aspect of an embodiment of the present invention provides a playback device, including: the determining unit is used for determining the target video as an online video-on-demand according to the address of the target video; the acquisition unit is used for acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence; an establishing unit, configured to establish an information index relationship of the multiple sliced videos according to the index file, where the information index relationship includes an association relationship between a start time of a first sliced video and description information of the first sliced video, and the description information of the first sliced video at least includes the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos; and the caching unit is used for sequentially caching the plurality of sliced videos according to the information index relation.
in a possible design, in a first implementation manner of the second aspect of the embodiment of the present invention, the playback device further includes: the receiving and sending unit is used for receiving a first message sent by a user, wherein the first message is used for positioning the playing position of the target video to a target time point; the determining unit is further configured to determine, in response to the first message, a target segment video according to the target time point and the information index relationship, where the target time point is between a start time and an end time of the target segment video; and the playing unit is used for playing the target video from the target time point when the target fragment video is completely downloaded.
In a possible design, in a second implementation manner of the second aspect of the embodiment of the present invention, when the target time slice is not completely downloaded, the playing device further includes: the downloading unit is used for downloading the target fragment video; the playing unit is further used for playing the target video from the target time point.
In a possible design, in a third implementation manner of the second aspect of the embodiment of the present invention, the determining unit is specifically configured to: determining the target video to be an online video according to the address of the target video; and when the address of the target video meets a preset condition, determining that the target video is the online on-demand video.
A third aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein the processor is configured to implement the steps of the method for caching video according to any one of the above items when executing a computer management program stored in the memory.
a fourth aspect of the present invention provides a computer-readable storage medium having a computer management-like program stored thereon, characterized in that: the computer management like program when executed by a processor implements the steps of the method of caching video as described in any one of the above.
According to the technical scheme, the embodiment of the invention has the following advantages: determining that the target video is an online on-demand video according to the address of the target video; acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence; establishing an information index relationship of the plurality of sliced videos according to the index file, wherein the information index relationship comprises an association relationship between the starting time of a first sliced video and the description information of the first sliced video, and the description information of the first sliced video at least comprises the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos; and sequentially caching the plurality of sliced videos according to the information index relation. In the embodiment of the invention, when the target video is the online on-demand video, the index file of the target video is obtained, the information index relation of a plurality of fragment videos forming the target video is established, and the plurality of fragment videos are sequentially cached according to the playing sequence, so that the defect that the file content needs to be continuously downloaded because the fragment videos are not cached locally when the online video stream is directly played is overcome, and the network resource is saved.
drawings
fig. 1 is a schematic flowchart of a possible method for caching video according to an embodiment of the present invention;
Fig. 2 is a schematic diagram of an embodiment of a possible playback device according to an embodiment of the present invention;
Fig. 3 is a schematic diagram of a hardware structure of a possible playback device according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an embodiment of a possible electronic device according to an embodiment of the present invention;
Fig. 5 is a schematic diagram of an embodiment of a possible computer-readable storage medium according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method for caching a video and playing equipment, which are used for solving the defect that file contents need to be continuously downloaded because the online video stream is not cached locally when being directly played, and saving network resources.
the terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. 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.
referring to fig. 1, fig. 1 is a schematic diagram illustrating a possible video buffering method according to an embodiment of the present invention, where the video buffering method may be based on an audio/video decoding library FFmpeg, which is understood as an open-source computer program for recording, converting digital audio and video, and converting them into streams. The method comprises the following steps:
101. determining the target video as an online on-demand video according to the address of the target video;
It should be noted that the embodiment of the present invention can be applied to a MediaDecoder audio/video decoding module of a playback device, such as a video website client, and the MediaDecoder audio/video decoding module can decode a live video and an on-demand video. When the MediaDecoder audio/video decoding module receives a character string type video address, if the address is an effective address, the MediaDecoder audio/video decoding module decodes a video corresponding to the video address, wherein the video address may be a network address or a local file path, and the details are not limited herein. However, since the video stream caching mechanisms of the live video and the on-demand video are different, before decoding the video, it is necessary to determine whether the video corresponding to the video address is the on-demand video or the live video. When the video corresponding to the video address is an online on-demand video, step 102 is executed.
Therefore, after receiving the address of the target video, the playing device determines that the target video is an online video-on-demand according to the address of the target video. The specific determination method may include the following steps:
Step 1 a: and calling an avformat _ Open _ input function of the FFmpeg through an Open method provided by a MediaDecoder audio and video decoding module, opening an address of a target video, and acquiring a structure with the type of AvFormatContext. If the acquisition is successful, executing the step 1 b;
step 1 b: and calling the fopen function, inputting the address of the target video into the fopen function, and obtaining the return value of the fopen function. If the return value is 0, the target video is an online video; if the return value is not 0, the target video is a local file. After the target video is determined to be the online video, executing the step 1 c;
step 1 c: and when the address of the target video meets the preset condition, determining that the target video is an online on-demand video. Specifically, it is determined whether the name field of the iformat member in the AvFormatContext structure obtained in step 1a is equal to "hls, applethttp", and if so, it indicates that the target video is an online on-demand video stream, that is, an on-demand video that needs to be processed subsequently in the embodiment of the present invention; if not, the target video is an online live video stream, and is not processed in the embodiment of the present invention.
It should be noted that, in practical applications, there are various ways of determining that the target video is an online on-demand video according to the address of the target video, and details are not repeated here.
102. acquiring an index file of a target video;
In this embodiment of the present invention, the target video may be an HTTP Live Streaming (HLS) video stream based on a hypertext transfer protocol (HTTP) protocol. The HLS protocol is a streaming media transmission protocol implemented by Apple Inc (Apple Inc), and can implement live broadcast and on-demand broadcast of streaming media; the HLS video stream is characterized in that a complete video is divided into a playlist stream, m3u8, and N fragmented Transport Stream (TS) small video files, and each TS small video file is a part of the complete video, that is, the N TS small videos constitute the complete video. It should be noted that, in the playlist.m3u8 playing index file, the network addresses of all TS segment videos and the playing time length of each TS segment video are included in the playing sequence. Therefore, for the playlist.m3u8 playing index file, the total duration of the complete video can be calculated. And positioning to specific TS (transport stream) fragment video through a given time when positioning is carried out at a time point.
Therefore, based on such recognition, after determining that the target video is an online on-demand video, an index file of the target video is obtained, wherein the index file includes, in the playing order, network addresses of a plurality of segment videos constituting the target video and a playing time corresponding to each segment video. The method for specifically acquiring the index file of the target video may include the following steps:
step 2 a: initializing an HlsDemuxer class;
in the MediaDecoder audio-video decoding module, the hlsdamuxer class is used to process the on-line on-demand video stream. The entry function of the hlsdamuxer class is also an Open function, and passes the address of the target video to the Open method of the hlsdamuxer.
and step 2 b: creating a cache folder;
The second parameter is the folder path holding the downloaded file when the Open method of the hlsdamuxer class is called. According to the folder path, a boost:: filesystem:: create _ direct method of a boost open source library is called to create a cache folder. The index file of the target video and all the fragmented videos downloaded in the subsequent steps are stored in the cache folder.
and step 2 c: creating a working thread;
a worker thread is created in which all download-related tasks are processed.
step 2 d: downloading an index file of a target video;
and calling a related HTTP downloading method, and downloading the address in the Open method, namely the index file represented by the downloading address of the index file of the target video into the cache folder.
step 2 e: analyzing an index file of a target video;
After downloading the index file of the target video to the cache folder, analyzing the content of the index file to obtain the total playing time of the target video and all the segmented videos. And in the HlsDemuxer class there is a dictionary member of m _ tsFiles, which is a key-value pair structure keyed by the start time of the sliced video and valued by the structure of a TsFileContext. The TsFileContext structure is as follows:
wherein, the url member represents the download address of the fragment video;
status member indicates the downloading status of the video slice, wherein TsFileStatus is defined as follows
wherein None represents an idle state, downloading represents a downloading state, downloaded represents a downloading completed state, and used represents a downloading suspended state.
the index member represents the index of the video slice, starting from 0, the index of the first video slice is 0, and the index of the Nth video slice is N-1;
The startTime member represents the starting time of the video slice, and takes millisecond as a unit;
The duration member represents the playing duration of the fragment video, and the playing duration is in milliseconds;
The localFileName member represents the name of the video in the local folder;
the file member is used for storing the downloaded fragment video data in a local file;
The sizeDownloaded member indicates the size of the downloaded data of the video fragment;
the totalSize member indicates the total file size of the sliced video.
Therefore, the steps 2a to 2e are used for acquiring and analyzing the index file of the target video. It should be noted that, in practical applications, there are other ways to obtain and analyze the index file of the target video, and details are not repeated here.
103. establishing an information index relation of a plurality of fragmented videos according to the index file;
After the index file of the target video is downloaded, establishing an information index relationship of a plurality of fragment videos according to the index file, wherein the information index relationship comprises an association relationship obtained by the starting time of the first fragment video and the description information of the first fragment video. It should be noted that the description information of the first video slice at least includes the following information: the method comprises the following steps of index information of a first sliced video, playing time of the first sliced video and a network address of the first sliced video, wherein the first sliced video is any one of a plurality of sliced videos.
in this embodiment, the manner of establishing the information index relationship may be: when downloading of the index file of the target video is completed, reading all text contents in the index file by lines, if the read text line starts from a "# EXTINF" character string, the character string is followed by the playing time length of the video fragment (the time length is in units of seconds), and the line after the text line is the downloading address of the video fragment. Therefore, according to the index file of the target video, the total playing duration and all TS slice files are obtained, and the manner of establishing the information index relationship is as follows:
step 3 a: initializing variables;
Initializing a startTime variable of 32-bit integer type for recording the start playing time of each video slice, and a tsFileIndex variable of 32-bit integer for recording the index of each video slice and initializing them to 0;
And step 3 b: acquiring each fragment video;
Reading each line content in the index file of the target video, when the line content starts with a character string "# EXTINF", the playing time length of a video fragment is the following of the character string, and then reading the file content of the next line to obtain the download address of the video fragment.
Creating a structure of TsFileContext, assigning a tsFileIndex variable to an index member of the structure, converting the playing time length immediately following the "# EXTINF" multiplied by 1000 into a millisecond unit, storing the millisecond unit into a duration field of the TsFileContext structure, storing a startTime variable into a startTime member of the TsFileContext structure, and storing a download address of a segment video represented by the next line of content immediately following the line into a url member of the TsFileContext structure. And then storing the startTime and the TsFileContext into an m _ tsFiles dictionary in a key-value pair mode to establish an information index relation of the sliced video.
After the above process is completed, adding 1 to tsFileIndex on the original basis, and adding the playing duration of the slice video, i.e. the duration value of the TsFileContext structure, to the startTime variable on the original basis.
And repeating the steps to obtain the next segmented video until the content in the index file of the target video is read.
After the steps in 3 a-3 b are completed, an information index relationship of a plurality of segment videos is established, and all segment videos of the target video are recorded in the m _ tsFiles member, and the total duration of the segment videos is stored in the startTime variable.
104. Sequentially caching a plurality of fragment videos according to the information index relation;
After all the segment videos are acquired through step 103, all the segment videos are sequentially downloaded in the working thread according to the playing sequence in the information index relationship.
105. Receiving a first message sent by a user;
When a user watches the target video and needs to perform fast forward or fast backward operation, a first message sent by the user is received, wherein the first message is used for positioning the playing position of the target video to a target time point.
106. determining a target segmented video according to the target time point and the information index relation;
And responding to the first message, and determining the target time slice according to the target time point and the information index relation. It should be noted that, when the target time point is in units of seconds, the target time point is converted into units of milliseconds to obtain the seekTime, that is, the playback device needs to locate the time point of the seekTime according to the first message.
And then, finding the target time slice in which the seekTime is located in the m _ tsFiles dictionary according to the information index relation, for example, according to a rule that the seekTime is greater than or equal to the initial playing time of the slice video and smaller than the initial playing time of the slice video to accelerate the playing time length, the TsFileContext structure in which the seekTime is located can be located, and the determination of the target slice video is realized. I.e., the seekTime is between the start time and the end time of the target sliced video.
after the target video fragment is determined, namely the TsFileContext structure corresponding to the target video fragment is located, whether the status field of the structure is equal to downloaded is judged. If the target fragmented video is equal to the downloaded video, the target fragmented video is downloaded completely and can be played directly without other processing; if not, indicating that the target video slice is not completely downloaded, then judging whether the status field is equal to the None idle state, if so, immediately downloading the target video slice, and setting the status field to be in the downloading state.
It should be noted that, when the status state in the TsFileContext is equal to download, it indicates that the target segment video is being downloaded, and it is necessary to wait for the target segment video to be played after downloading is completed, so it is necessary to wait until the status member of the TsFileContext is not equal to download, and it is not possible to return until the status member of the TsFileContext is set to download state after the target segment video is downloaded.
107. The target video is played from the target time point.
and after the target segmented video is determined and downloaded, playing the target video from the target time point.
The method for caching the video, provided by the embodiment of the invention, completes the process of caching the on-line on-demand video stream into the local file and positioning to the specific target fragment video according to a certain time point, and solves the defect that the file content needs to be continuously downloaded because the on-line video stream is not cached to the local when being directly played.
With reference to fig. 2, the method for caching a video in the embodiment of the present invention is described above, and a playback device in the embodiment of the present invention is described below, where an embodiment of the playback device in the embodiment of the present invention includes:
A determining unit 201, configured to determine, according to an address of a target video, that the target video is an online on-demand video;
an obtaining unit 202, configured to obtain an index file of the target video, where the index file includes, according to a playing sequence, network addresses of multiple segment videos that constitute the target video and playing durations corresponding to the segment videos;
An establishing unit 203, configured to establish an information index relationship of the multiple sliced videos according to the index file, where the information index relationship includes an association relationship between a start time of a first sliced video and description information of the first sliced video, and the description information of the first sliced video at least includes the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos;
And the caching unit 204 is configured to sequentially cache the plurality of sliced videos according to the information index relationship.
in one possible implementation manner, the playback device further includes:
A transceiving unit 205, configured to receive a first message sent by a user, where the first message is used to locate a playing position of the target video to a target time point;
the determining unit 201 is further configured to, in response to the first message, determine a target segment video according to the target time point and the information index relationship, where the target time point is between a start time and an end time of the target segment video;
And the playing unit 206 is configured to play the target video from the target time point when the target segment video is completely downloaded.
In a possible implementation manner, when the target time slice is not downloaded completely, the playing device further includes:
a downloading unit 207, configured to download the target segment video;
The playing unit 206 is further configured to play the target video from the target time point.
In a possible implementation manner, the determining unit 201 is specifically configured to:
Determining the target video to be an online video according to the address of the target video; and when the address of the target video meets a preset condition, determining that the target video is the online on-demand video.
in the embodiment of the invention, when the target video is the online on-demand video, the index file of the target video is obtained, the information index relation of a plurality of fragment videos forming the target video is established, and the plurality of fragment videos are sequentially cached according to the playing sequence, so that the defect that the file content needs to be continuously downloaded because the fragment videos are not cached locally when the online video stream is directly played is overcome, and the network resource is saved.
fig. 2 above describes the playing device in the embodiment of the present invention from the perspective of a modular functional entity, and the playing device in the embodiment of the present invention is described in detail below from the perspective of hardware processing, referring to fig. 3, an embodiment of the playing device 300 in the embodiment of the present invention includes:
an input device 301, an output device 302, a processor 303 and a memory 304 (wherein the number of the processor 303 may be one or more, and one processor 303 is taken as an example in fig. 3). In some embodiments of the present invention, the input device 301, the output device 302, the processor 303 and the memory 304 may be connected by a bus or other means, wherein the connection by the bus is exemplified in fig. 3.
Wherein, by calling the operation instruction stored in the memory 304, the processor 303 is configured to perform the following steps:
determining that the target video is an online on-demand video according to the address of the target video;
Acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence;
establishing an information index relationship of the plurality of sliced videos according to the index file, wherein the information index relationship comprises an association relationship between the starting time of a first sliced video and the description information of the first sliced video, and the description information of the first sliced video at least comprises the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos; and sequentially caching the plurality of sliced videos according to the information index relation.
optionally, by calling the operation instruction stored in the memory 304, the processor 303 is further configured to perform the following steps: receiving a first message sent by a user, wherein the first message is used for positioning the playing position of the target video to a target time point; responding to the first message, and determining a target segmented video according to the target time point and the information index relation, wherein the target time point is between the starting time and the ending time of the target segmented video; and when the target fragment video is completely downloaded, playing the target video from the target time point.
optionally, when the target time slice is not downloaded completely, the processor 303 is further configured to execute the following steps by calling the operation instruction stored in the memory 304: downloading the target fragment video; playing the target video from the target time point.
Optionally, determining that the target video is an online on-demand video according to the address of the target video includes: determining the target video to be an online video according to the address of the target video; and when the address of the target video meets a preset condition, determining that the target video is the online on-demand video.
Referring to fig. 4, fig. 4 is a schematic view of an embodiment of an electronic device according to an embodiment of the invention.
As shown in fig. 4, an embodiment of the present invention provides an electronic device, which includes a memory 410, a processor 420, and a computer program 411 stored in the memory 420 and running on the processor 420, and when the processor 420 executes the computer program 411, the following steps are implemented:
determining that the target video is an online on-demand video according to the address of the target video; acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence; establishing an information index relationship of the plurality of sliced videos according to the index file, wherein the information index relationship comprises an association relationship between the starting time of a first sliced video and the description information of the first sliced video, and the description information of the first sliced video at least comprises the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos; and sequentially caching the plurality of sliced videos according to the information index relation.
in a specific implementation, when the processor 420 executes the computer program 411, any of the embodiments corresponding to fig. 1 may be implemented.
Since the electronic device described in this embodiment is a device used for implementing one of the playback devices in the embodiments of the present invention, based on the method described in the embodiments of the present invention, those skilled in the art can understand the specific implementation manner of the electronic device of this embodiment and various variations thereof, so that how to implement the method in the embodiments of the present invention by the electronic device is not described in detail herein, and as long as the device used for implementing the method in the embodiments of the present invention by those skilled in the art belongs to the intended scope of the present invention.
referring to fig. 5, fig. 5 is a schematic diagram illustrating an embodiment of a computer-readable storage medium according to the present invention.
as shown in fig. 5, the present embodiment provides a computer-readable storage medium 500 having a computer program 511 stored thereon, the computer program 511 implementing the following steps when executed by a processor:
Determining that the target video is an online on-demand video according to the address of the target video; acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence; establishing an information index relationship of the plurality of sliced videos according to the index file, wherein the information index relationship comprises an association relationship between the starting time of a first sliced video and the description information of the first sliced video, and the description information of the first sliced video at least comprises the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos; and sequentially caching the plurality of sliced videos according to the information index relation.
In a specific implementation, the computer program 511 may implement any of the embodiments corresponding to fig. 1 when executed by a processor.
It should be noted that, in the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to relevant descriptions of other embodiments for parts that are not described in detail in a certain embodiment.
as will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
embodiments of the present invention further provide a computer program product, where the computer program product includes computer software instructions, and when the computer software instructions are executed on a processing device, the processing device executes a flow in the method for designing a wind farm digital platform in the embodiment corresponding to fig. 1.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for caching video, comprising:
Determining that the target video is an online on-demand video according to the address of the target video;
Acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence;
establishing an information index relationship of the plurality of sliced videos according to the index file, wherein the information index relationship comprises an association relationship between the starting time of a first sliced video and the description information of the first sliced video, and the description information of the first sliced video at least comprises the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos;
And sequentially caching the plurality of sliced videos according to the information index relation.
2. The method according to claim 1, wherein after the establishing the information indexing relationship of the plurality of sliced videos according to the index file, the method further comprises:
Receiving a first message sent by a user, wherein the first message is used for positioning the playing position of the target video to a target time point;
Responding to the first message, and determining a target segmented video according to the target time point and the information index relation, wherein the target time point is between the starting time and the ending time of the target segmented video;
And when the target fragment video is completely downloaded, playing the target video from the target time point.
3. the method of claim 2, wherein when the target time slice is not downloaded completely, the method further comprises:
Downloading the target fragment video;
Playing the target video from the target time point.
4. the method of any of claims 1 to 3, wherein the determining that the target video is an online on-demand video according to the address of the target video comprises:
determining the target video to be an online video according to the address of the target video;
And when the address of the target video meets a preset condition, determining that the target video is the online on-demand video.
5. a playback device, comprising:
the determining unit is used for determining the target video as an online video-on-demand according to the address of the target video;
the acquisition unit is used for acquiring an index file of the target video, wherein the index file comprises network addresses of a plurality of segmented videos forming the target video and playing time lengths corresponding to the segmented videos according to a playing sequence;
An establishing unit, configured to establish an information index relationship of the multiple sliced videos according to the index file, where the information index relationship includes an association relationship between a start time of a first sliced video and description information of the first sliced video, and the description information of the first sliced video at least includes the following information: the index information of the first fragmented video, the playing time length of the first fragmented video and the network address of the first fragmented video, wherein the first fragmented video is any one of the plurality of fragmented videos;
And the caching unit is used for sequentially caching the plurality of sliced videos according to the information index relation.
6. the playback device according to claim 5, wherein the playback device further comprises:
The receiving and sending unit is used for receiving a first message sent by a user, wherein the first message is used for positioning the playing position of the target video to a target time point;
the determining unit is further configured to determine, in response to the first message, a target segment video according to the target time point and the information index relationship, where the target time point is between a start time and an end time of the target segment video;
and the playing unit is used for playing the target video from the target time point when the target fragment video is completely downloaded.
7. the playback device of claim 6, wherein when the target time slice is not completely downloaded, the playback device further comprises:
the downloading unit is used for downloading the target fragment video;
The playing unit is further used for playing the target video from the target time point.
8. the playback device of any one of claims 5 to 7, wherein the determination unit is specifically configured to:
determining the target video to be an online video according to the address of the target video; and when the address of the target video meets a preset condition, determining that the target video is the online on-demand video.
9. An electronic device comprising a memory, a processor, wherein the processor is configured to implement the steps of the method for caching video according to any one of claims 1 to 4 when executing a computer management class program stored in the memory.
10. A computer-readable storage medium having stored thereon a computer management-like program, characterized in that: the computer management class program, when executed by a processor, implements the steps of the method of caching video according to any one of claims 1 to 4.
CN201810526298.8A 2018-05-29 2018-05-29 method for caching video and related equipment Pending CN110545459A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810526298.8A CN110545459A (en) 2018-05-29 2018-05-29 method for caching video and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810526298.8A CN110545459A (en) 2018-05-29 2018-05-29 method for caching video and related equipment

Publications (1)

Publication Number Publication Date
CN110545459A true CN110545459A (en) 2019-12-06

Family

ID=68700921

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810526298.8A Pending CN110545459A (en) 2018-05-29 2018-05-29 method for caching video and related equipment

Country Status (1)

Country Link
CN (1) CN110545459A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130238740A1 (en) * 2012-03-06 2013-09-12 Adobe Systems Incorporated Caching of Fragmented Streaming Media
CN104918108A (en) * 2015-06-09 2015-09-16 烽火通信科技股份有限公司 Video accurate positioning device and method based on HLS (HTTP Live Streaming) protocol
CN105208463A (en) * 2015-08-31 2015-12-30 北京暴风科技股份有限公司 Method and system for carrying out frame determination for m3u8 file
CN105208440A (en) * 2015-09-22 2015-12-30 北京暴风科技股份有限公司 Online playing method and system for MP4-format video
US20160227258A1 (en) * 2013-09-13 2016-08-04 Tencent Technology (Shenzhen) Company Limited Method for playing back live video and device
CN106303577A (en) * 2015-06-08 2017-01-04 广州市动景计算机科技有限公司 Download the method and device of Streaming Media
CN106550263A (en) * 2015-09-16 2017-03-29 深圳市腾讯计算机系统有限公司 Media playing method and device
CN106559677A (en) * 2015-09-30 2017-04-05 华为技术有限公司 The method and device of terminal, caching server and acquisition video slicing
CN106791988A (en) * 2016-11-23 2017-05-31 青岛海信电器股份有限公司 Multi-medium data carousel method and terminal
CN107071548A (en) * 2017-04-20 2017-08-18 北京搜狐新媒体信息技术有限公司 A kind of method for processing video frequency and system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130238740A1 (en) * 2012-03-06 2013-09-12 Adobe Systems Incorporated Caching of Fragmented Streaming Media
US20160227258A1 (en) * 2013-09-13 2016-08-04 Tencent Technology (Shenzhen) Company Limited Method for playing back live video and device
CN106303577A (en) * 2015-06-08 2017-01-04 广州市动景计算机科技有限公司 Download the method and device of Streaming Media
CN104918108A (en) * 2015-06-09 2015-09-16 烽火通信科技股份有限公司 Video accurate positioning device and method based on HLS (HTTP Live Streaming) protocol
CN105208463A (en) * 2015-08-31 2015-12-30 北京暴风科技股份有限公司 Method and system for carrying out frame determination for m3u8 file
CN106550263A (en) * 2015-09-16 2017-03-29 深圳市腾讯计算机系统有限公司 Media playing method and device
CN105208440A (en) * 2015-09-22 2015-12-30 北京暴风科技股份有限公司 Online playing method and system for MP4-format video
CN106559677A (en) * 2015-09-30 2017-04-05 华为技术有限公司 The method and device of terminal, caching server and acquisition video slicing
CN106791988A (en) * 2016-11-23 2017-05-31 青岛海信电器股份有限公司 Multi-medium data carousel method and terminal
CN107071548A (en) * 2017-04-20 2017-08-18 北京搜狐新媒体信息技术有限公司 A kind of method for processing video frequency and system

Similar Documents

Publication Publication Date Title
US10200723B2 (en) Converting live streaming content to video-on-demand streaming content
CN108924630B (en) Method for displaying cache progress and playing device
CN109474854B (en) Video playing method, playlist generating method and related equipment
CN102111685B (en) Acceleration method, equipment and system for network video loading
CN111277869B (en) Video playing method, device, equipment and storage medium
CN108833968B (en) Method for caching video and related equipment
CN106658226B (en) Playing method and device
CN103648019A (en) Video downloading method and device based on HLS protocol
CN111510770B (en) Method and device for switching definition, computer equipment and readable storage medium
CN108769830B (en) Method for caching video and related equipment
WO2016207735A1 (en) A system and methods thereof for auto-playing video content on mobile devices
CN103702176A (en) HLS (http live streaming) protocol-based video downloading method and device
WO2017130035A1 (en) A system and methods thereof for auto-playing video content on mobile devices
CN111510789A (en) Video playing method, system, computer equipment and computer readable storage medium
CN104572964A (en) Zip file unzipping method and device
EP2882199B1 (en) Method and apparatus for prefetching content in a data stream
CN111031117B (en) Multimedia file downloading method and related device
CN110545459A (en) method for caching video and related equipment
US10491648B2 (en) Server-side interstitial content insertion
CN114417055A (en) Video playing method and device, computer equipment and storage medium
CN112218118A (en) Audio and video clipping method and device
CN113079386A (en) Video online playing method and device, electronic equipment and storage medium
CN104023278B (en) Streaming medium data processing method and electronic equipment
CN113301374A (en) Live broadcast audio and video processing method and device, client and server
CN101945032A (en) File downloading method and device in point to point network

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20191206