Cache mapping method for non-edited short video of mobile phone

文档序号:7771 发布日期:2021-09-17 浏览:60次 中文

1. A cache mapping method for a non-edited short video of a mobile phone is characterized by comprising the following steps:

the method comprises the following steps: generating a mapping file and an index file index of an audio/video file locally, wherein the index file index is used for quickly searching whether data required by editing exists locally;

step two: positioning or playing, when acquiring file data, firstly inquiring whether the file data exists locally, if so, reading the file data from the local for analysis and decoding; if the file data does not exist locally, the file data is acquired through the network for analysis and decoding, and the mapping file and the index file index of the local audio/video file are filled according to the file data acquired through the network.

2. The method of claim 1, wherein the method further comprises: if the non-editing system of the mobile phone is idle, the system can start a background data repair thread to automatically repair the missing data in the mapping file. If the data is completely supplemented, the subsequent editing process does not need to acquire the data from the network.

3. The method of claim 1, wherein the method further comprises: after a certain audio/video file is played once or completely positioned frame by frame, the non-editing system of the mobile phone does not need to take the file data from the network.

4. The cache mapping method for the non-edited short video of the mobile phone according to claim 1, wherein the reading of the file data from the local for parsing and decoding specifically comprises: opening an audio and video file, 1) probe basic information, and opening different decoders according to the basic information; 2) reading a header file, and opening an analyzer and a decoder according to header file information; 3) reading data, analyzing the data, separating the data of different streams [ stream ], judging the validity of the data, and then respectively sending the data to different decoders; 4) in the decoder, the original data is decoded, and the video is rotated, scaled or format converted according to the user's needs.

5. The cache mapping method for the non-edited short video of the mobile phone according to claim 1, wherein the process of filling the mapping file and the index file index of the local audio/video file according to the file data obtained by the network specifically comprises: opening an audio and video file acquired by a network, creating a cache image file with the same size as the audio and video file locally, wherein the data is null, and creating an index file index for marking whether the data exists locally; the method comprises the steps that 32768 bytes of data are read when an audio/video file is read through file data analysis or decoding, index files index are inquired when the data are acquired, and if the same file data exist locally, the index files are read locally; if the same file data does not exist locally, reading through a network, and simultaneously writing the read data into a cache mapping file, wherein the cache mapping file is equal to the source file in position, and simultaneously recording that the data at the position already exists in an index file index;

and idle filling, namely reading file data which does not exist locally through http according to the record of the index file index when the computer is idle, directly filling the read file data into the cache mapping file, and finally marking the data existing locally in the index file index.

Background

With the rapid growth of mobile internet video services, news interviewers in the radio and television industry need to create video services in scenes outside offices, and editing is performed based on a mobile phone non-editing client, media resources in a station need to be accessed through a mobile network in the editing process, the stability of the internet environment in China is not very reliable, the bandwidth is high, the speed is low, the speed is high, the speed is low, and when media files in the station are large or the current network environment is not good, how to efficiently and smoothly edit the network resources is the key point for overcoming the invention.

The conventional cloud material editing method can be used for editing after the whole file is downloaded completely and undamaged, the method can meet practical application, but has high requirements on network environment, particularly the use of a high-definition file, but the efficiency is low, data are acquired on the network, the flow can be multiplied by several times or even dozens of times of the size of the file, the user experience is poor, and the blocking phenomenon is easy to occur in the nonlinear editing process.

Disclosure of Invention

The invention aims to overcome the defects of the prior art and provides a cache mapping method for a non-edited short video of a mobile phone.

The purpose of the invention is realized by the following technical scheme:

a cache mapping method for a non-edited short video of a mobile phone comprises the following steps:

the method comprises the following steps: generating a mapping file and an index file index of an audio/video file locally, wherein the index file index is used for quickly searching whether data required by editing exists locally;

step two: positioning or playing, when acquiring file data, firstly inquiring whether the file data exists locally, if so, reading the file data from the local for analysis and decoding; if the file data does not exist locally, the file data is acquired through the network for analysis and decoding, and the mapping file and the index file index of the local audio/video file are filled according to the file data acquired through the network.

Specifically, the method further comprises: if the non-editing system of the mobile phone is idle, the system can start a background data repair thread to automatically repair the missing data in the mapping file. If the data is completely supplemented, the subsequent editing process does not need to acquire the data from the network.

Specifically, the method further comprises: after a certain audio/video file is played once or completely positioned frame by frame, the non-editing system of the mobile phone does not need to take the file data from the network.

Specifically, the process of reading the file data from the local to perform parsing and decoding includes: opening an audio and video file, 1) probe basic information, and opening different decoders according to the basic information; 2) reading a header file, and opening an analyzer and a decoder according to header file information; 3) reading data, analyzing the data, separating the data of different streams [ stream ], judging the validity of the data, and then respectively sending the data to different decoders; 4) in the decoder, the original data is decoded, and the video is rotated, scaled or format converted according to the user's needs.

Specifically, the process of filling the mapping file and the index file index of the local audio/video file according to the file data acquired by the network specifically includes: opening an audio and video file acquired by a network, creating a cache image file with the same size as the audio and video file locally, wherein the data is null, and creating an index file index for marking whether the data exists locally;

the method comprises the steps that 32768 bytes of data are read when an audio/video file is read through file data analysis or decoding, index files index are inquired when the data are acquired, and if the same file data exist locally, the index files are read locally; if the same file data does not exist locally, reading through a network, and simultaneously writing the read data into a cache mapping file, wherein the cache mapping file is equal to the source file in position, and simultaneously recording that the data at the position already exists in an index file index;

and idle filling, namely reading file data which does not exist locally through http according to the record of the index file index when the computer is idle, directly filling the read file data into the cache mapping file, and finally marking the data existing locally in the index file index.

The invention has the beneficial effects that:

1. the flow consumed by the cache is slightly larger than or equal to the size of the audio/video file, and if the method is not adopted, data needs to be acquired from the network every time any operation is carried out, and the flow can be several times, even dozens of times, larger than the size of the file per se.

2. The reading speed of the local data is several times that of the data read through the Internet, and the pause phenomenon in the non-linear editing process is obviously reduced.

3. The use experience of the user of the non-edited short video is improved.

Drawings

FIG. 1 is a flow chart of the method of the present invention.

Fig. 2 is a data flow diagram of the present invention.

Detailed Description

In order to more clearly understand the technical features, objects, and effects of the present invention, embodiments of the present invention will now be described with reference to the accompanying drawings.

In this embodiment, the existing non-editing system of the mobile phone sometimes needs to edit the audio/video file in an http manner, and the conventional editing process is as follows:

and (1.1) positioning frame by frame, connecting a server file through http, obtaining required data and decoding.

And (1.2) playing, continuously fetching data from the server through http on the basis of positioning frame by frame, and then decoding the playing.

The above editing process has the following problems: in the operation process of nonlinear editing, positioning and playing are carried out quite frequently, http reconnection is needed for each positioning, and data are obtained from a server through http. Obtaining data via http is much slower than traditional network sharing or direct local files, and if slower via the internet, may require additional overhead in network traffic. However, http reconnection is particularly slow, because tcp/ip connection requires 3-way handshaking operations, such editing manner undoubtedly increases the flow consumption and data reading time of editing, and the user experience is not good.

The improvement point of the invention is that a file buffer is added in the decoding program, including the mapping file and the index thereof. As shown in fig. 1 and fig. 2, the improved cache mapping method for the non-edited short video of the mobile phone includes the following steps:

the method comprises the following steps: generating a mapping file and an index file index of an audio/video file locally, wherein the index file index is used for quickly searching whether data required by editing exists locally;

step two: positioning or playing, when acquiring file data, firstly inquiring whether the file data exists locally, if so, reading the file data from the local for analysis and decoding; if the file data does not exist locally, the file data is acquired through the network for analysis and decoding, and the mapping file and the index file index of the local audio/video file are filled according to the file data acquired through the network.

In addition, if the non-editing system of the mobile phone is idle, the system can start a background data repair thread to automatically repair the missing data in the mapping file. If the data is completely supplemented, the subsequent editing process does not need to acquire the data from the network.

After a certain audio/video file is played once or completely positioned frame by frame, the non-editing system of the mobile phone does not need to take the file data from the network.

In the invention, the process of reading the file data from the local to analyze and decode comprises the following steps: and opening an audio and video file, 1.probe basic information, and opening different decoders according to the basic information. 2. Reading the header file, and opening the resolver and the decoder according to the header file information. 3. Reading data, analyzing the data, separating the data of different streams [ stream ], judging the validity of the data, if the data has a deletion, and sending the data to different decoders respectively. 4. In the decoder, the original data is decoded, and the video is rotated if rotation is required, scaled if scaling is required, and converted if conversion into different formats is required, as required. The audio is uniformly converted into PCM with the frequency of 48 Hz, and the like, so that other programs can be called conveniently.

In the invention, the process of filling the mapping file and the index file index of the local audio/video file according to the file data acquired by the network comprises the following steps: the method comprises the steps of opening an online audio and video file for the first time, creating a cache file with the same size locally, wherein the data is null, and creating an index for marking whether the data exists locally. Later, 32768 bytes of data are read when the audio/video file is analyzed or decoded and read, when the data is obtained, an index file is firstly seen [ the file marks whether the data exists locally ], if the file exists locally, the data is read from the local, if the file does not exist locally, the data is read on the network and written into a cache file, the position of the data is equal to that of a source file, meanwhile, the data at the position is recorded in the index to exist, when the data is read again next time, the data cannot be read from the internet, the data is read locally, the local reading is faster, and the network flow is saved more.

And idle filling, namely when the computer is idle, reading the data which does not exist locally through http according to the record of the index, directly filling the cache file, and marking that the data exists locally in the index file.

The foregoing shows and describes the general principles, essential features, and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are described in the specification and illustrated only to illustrate the principle of the present invention, but that various changes and modifications may be made therein without departing from the spirit and scope of the present invention, which fall within the scope of the invention as claimed. The scope of the invention is defined by the appended claims and equivalents thereof.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:基于redis的云回放索引服务方法及系统

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!