Resolution switching method and device of media file and storage medium

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

阅读说明:本技术 一种媒体文件的分辨率切换方法、装置及存储介质 (Resolution switching method and device of media file and storage medium ) 是由 银国徽 于 2018-05-29 设计创作,主要内容包括:本公开提供了一种媒体文件的分辨率切换方法,包括:响应于网页中内嵌播放器所播放媒体文件的分辨率切换事件,清除在所述网页的媒体资源扩展接口中缓存的原分辨率的部分分段媒体文件;其中,所述媒体文件对应有多个分段媒体文件;根据所述媒体文件的播放点以及所述媒体文件,获取接续所述播放点的目标分辨率的分段媒体文件;将所获取的目标分辨率的分段媒体文件发送至所述媒体资源扩展接口,并通过所述媒体资源扩展接口调用所述网页的媒体元素进行播放。本公开实施例还提供一种媒体文件的分辨率切换装置及存储介质。(the present disclosure provides a resolution switching method for a media file, including: responding to a resolution switching event of a media file played by an embedded player in a webpage, and clearing a part of segmented media files with original resolution cached in a media resource expansion interface of the webpage; the media files correspond to a plurality of segmented media files; acquiring a segmented media file with a target resolution ratio continuing the playing point according to the playing point of the media file and the media file; and sending the acquired segmented media file with the target resolution to the media resource expansion interface, and calling the media elements of the webpage for playing through the media resource expansion interface. The embodiment of the disclosure also provides a resolution switching device and a storage medium of the media file.)

1. A method for switching resolution of a media file, comprising:

Responding to a resolution switching event of a media file played by an embedded player in a webpage, and clearing a part of segmented media files with original resolution cached in a media resource expansion interface of the webpage;

The media files correspond to a plurality of segmented media files;

Acquiring a segmented media file with a target resolution ratio continuing the playing point according to the playing point of the media file and the media file;

And sending the acquired segmented media file with the target resolution to the media resource expansion interface, and calling the media elements of the webpage for playing through the media resource expansion interface.

2. the method of claim 1, wherein the clearing the partially segmented media file of the original resolution cached in the media resource extension interface of the web page comprises:

in a cache of the media asset extension interface, retaining a segmented media file comprising the original resolution of the playback point, and,

And clearing the segmented media file of which the playing time does not comprise the original resolution of the playing point.

3. The method of claim 1, further comprising:

after receiving a resolution switching event of the media file, performing overtime detection;

And when the resolution switching event returning to the original resolution is not received within the overtime, the segmented media file of the original resolution cached in the media resource expansion interface of the webpage is cleared.

4. The method of claim 1, further comprising:

when the real-time playing point is in the playing period of the segmented media file with the original resolution which is not cleared and a resolution switching event for returning to the original resolution is received,

and calling the media elements of the webpage to play the cached segmented media files with the original resolution through the media resource expansion interface.

5. the method of claim 1, wherein obtaining the segmented media file of the target resolution succeeding the playback point comprises:

When the media file is in a non-streaming media file format,

Determining two key frames which are continuous with the playing point in the media file with the target resolution ratio based on the media information of the media file with the target resolution ratio;

requesting media data between the two key frames in the media file at the target resolution;

And packaging the requested media data and metadata correspondingly calculated according to the requested media data into a segmented media file container to obtain a segmented media file with a target resolution.

6. The method of claim 5,

When the playing point is reached by means of continuous playing,

the first key frame of the two key frames is: adding the first key frame after the playing end time of the segmented media file of the media source in the media resource expansion interface;

The second key frame of the two key frames is: the second key frame is decoded later than the first key frame.

7. the method of claim 5,

When the play point is reached by jumping,

The first key frame of the two key frames is: a first key frame in the media file with a decoding time before the playing point;

The second key frame of the two key frames is: key frames in the media file that are decoded later than the first key frame.

8. the method of claim 5, further comprising:

when two key frames succeeding the playback point in the media file of the target resolution are determined,

Determining the offset and the capacity of a video frame between the two key frames and the offset and the capacity of an audio frame aligned with the video frame in the media file according to the media information identified from the media file with the target resolution;

determining an offset and a capacity of a target interval according to the determined offset and capacity, wherein the target interval comprises the video frame and the audio frame;

and requesting the media data positioned in the target interval in the media file with the target resolution.

9. the method of claim 5, wherein encapsulating the requested media data and metadata correspondingly computed from the requested media data into a segmented media file container comprises:

Filling data representing the type and compatibility of the segmented media file into a file type container of the segmented media file;

Populating metadata representing a file level of the segmented media file into a metadata container of the segmented media file;

and correspondingly filling the extracted media data and the metadata describing the media data into a media data container and a metadata container at a segmentation level in a segmentation container of the segmented media file.

10. an apparatus for switching a resolution of a media file, comprising:

The clearing unit is used for responding to a resolution switching event of a media file played by an embedded player in a webpage and clearing a part of segmented media files with original resolution cached in a media resource expansion interface of the webpage; the media files correspond to a plurality of segmented media files;

An obtaining unit, configured to obtain, according to a playing point of the media file and the media file, a segmented media file with a target resolution that is subsequent to the playing point;

and the sending unit is used for sending the acquired segmented media file with the target resolution to the media resource expansion interface and calling the media elements of the webpage to play through the media resource expansion interface.

11. The apparatus of claim 10, wherein the clearing unit is configured to reserve a segmented media file including the original resolution of the playback point in a buffer of the media resource extension interface, and,

and clearing the segmented media file of which the playing time does not comprise the original resolution of the playing point.

12. The apparatus of claim 10, further comprising:

the detection unit is used for carrying out overtime detection after receiving the resolution switching event of the media file;

The clearing unit is further configured to clear the segmented media file with the original resolution cached in the media resource extension interface of the web page when the detection unit does not receive the resolution switching event returning to the original resolution within the timeout period.

13. The apparatus of claim 10, further comprising:

A playing unit, for when the real-time playing point is in the playing time interval of the segmented media file with original resolution not cleared and a resolution switching event returning to the original resolution is received,

and calling the media elements of the webpage to play the cached segmented media files with the original resolution through the media resource expansion interface.

14. The apparatus of claim 10,

The obtaining unit is further configured to, when the media file is in a non-streaming media file format,

determining two key frames which are continuous with the playing point in the media file with the target resolution ratio based on the media information of the media file with the target resolution ratio;

requesting media data between the two key frames in the media file at the target resolution;

And packaging the requested media data and metadata correspondingly calculated according to the requested media data into a segmented media file container to obtain a segmented media file with a target resolution.

15. The apparatus of claim 14, wherein when the playback point is reached by continuous playback,

the first key frame of the two key frames is: adding the first key frame after the playing end time of the segmented media file of the media source in the media resource expansion interface;

The second key frame of the two key frames is: the second key frame is decoded later than the first key frame.

16. the apparatus of claim 14, wherein when the playpoint is reached by jumping,

The first key frame of the two key frames is: a first key frame in the media file with a decoding time before the playing point;

the second key frame of the two key frames is: key frames in the media file that are decoded later than the first key frame.

17. The apparatus of claim 14, wherein the obtaining unit is further configured to, when two key frames following the playback point in the media file with the target resolution are determined,

Determining the offset and the capacity of a video frame between the two key frames and the offset and the capacity of an audio frame aligned with the video frame in the media file according to the media information identified from the media file with the target resolution;

determining an offset and a capacity of a target interval according to the determined offset and capacity, wherein the target interval comprises the video frame and the audio frame;

And requesting the media data positioned in the target interval in the media file with the target resolution.

18. The apparatus according to claim 14, wherein the obtaining unit is further configured to fill data indicating the type and compatibility of the segmented media file into a file type container of the segmented media file;

populating metadata representing a file level of the segmented media file into a metadata container of the segmented media file;

And correspondingly filling the extracted media data and the metadata describing the media data into a media data container and a metadata container at a segmentation level in a segmentation container of the segmented media file.

19. An apparatus for switching a resolution of a media file, comprising:

A memory for storing executable instructions;

A processor for implementing the method of resolution switching of a media file according to any of claims 1 to 9 by executing executable instructions stored in the memory.

20. A storage medium having stored therein executable instructions for performing the method of switching resolution of a media file according to any one of claims 1 to 9.

28页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:视频处理方法及装置

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类