method for caching video and related equipment

文档序号:1784933 发布日期:2019-12-06 浏览:12次 中文

阅读说明:本技术 一种缓存视频的方法以及相关设备 (method for caching video and related equipment ) 是由 杨亮 张文明 陈少杰 于 2018-05-29 设计创作,主要内容包括:本发明实施例提供了一种缓存视频的方法和播放设备,用于解决直接播放在线视频流时,因为没有缓存到本地而引起的需要不断下载文件内容的弊端,节约了网络资源。本发明实施例方法包括:根据目标视频的地址确定目标视频为在线的点播视频;获取目标视频的索引文件,索引文件按播放顺序包括组成目标视频的多个分片视频的网络地址和对应于各分片视频的播放时长;根据索引文件建立多个分片视频的信息索引关系,信息索引关系包括第一分片视频的起始时间和第一分片视频的描述信息的关联关系;按播放顺序依次缓存所述多个分片视频。(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.)

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.

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.

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.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种媒体文件的预加载方法、装置及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类