CN102264004B - Method and device for preventing deficiency of key frame from causing seek incapability - Google Patents

Method and device for preventing deficiency of key frame from causing seek incapability Download PDF

Info

Publication number
CN102264004B
CN102264004B CN201110223980.8A CN201110223980A CN102264004B CN 102264004 B CN102264004 B CN 102264004B CN 201110223980 A CN201110223980 A CN 201110223980A CN 102264004 B CN102264004 B CN 102264004B
Authority
CN
China
Prior art keywords
seek
time point
key frame
frame
data
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.)
Expired - Fee Related
Application number
CN201110223980.8A
Other languages
Chinese (zh)
Other versions
CN102264004A (en
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.)
TCL Corp
Original Assignee
TCL Corp
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 TCL Corp filed Critical TCL Corp
Priority to CN201110223980.8A priority Critical patent/CN102264004B/en
Publication of CN102264004A publication Critical patent/CN102264004A/en
Application granted granted Critical
Publication of CN102264004B publication Critical patent/CN102264004B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a method and a device for preventing the deficiency of a key frame from causing seek incapability. The method comprises the following steps of: when a seek operation is performed on the frame data of a media audio and video file, acquiring a previous key frame of a sought time point according to the sought time point; starting reading a file stream from the position of the previous key frame, and transmitting the read file stream to a decoder for decoding; judging whether a time point of the decoded frame data reaches the sought time point or not, and if the time point of the decoded frame data is judged to be before the sought time point, discarding the frame data; and if the time point of the decoded frame data is judged to reach the sought time point, playing and displaying the decoded data. Therefore, the problem that a certain time point cannot be accurately sought and positioned when a certain audio and video file is played can be solved.

Description

A kind of method and device that prevents key frame disappearance and can not seek
Technical field
The present invention relates to media file process field, in particular a kind of method and device that prevents key frame disappearance and can not seek.
Background technology
At present there are the media files such as a lot of AVI, MKV market, is doing seek(redirect) in operation, be all according to key frame location, according to the incidental file location information of key frame, carry out seek location.In the time of due to coding, (key frame is equivalent to the original painting in 2 D animation to some audio-video document key frames, refer to residing that frame of key operations in role or object of which movement or variation) fewer, cause when doing seek operation, can not be well according to the step (stepping) of a second a second, carry out seek, but middle have similar several seconds, tens seconds float even, in the time of seek, can not navigate to accurately user and want to determine the video pictures of seeing.
According to the reason of key frame position location data, be: in MPEG(Moving Pictures Experts Group/Motin Pictures Experts Group, dynamic image expert group) coding process in, partial video frame sequence is collapsed into I frame; Partial shrinkage becomes P frame; Also have Partial shrinkage to become B frame.Wherein, I frame is by removing as far as possible image space redundant information, to carry out the in-frame encoding picture of compressed transmission data amount, and the reference point as random access, is key frame; P frame is by the coded image that in abundant reduction image sequence, the time redundancy information of coded frame is carried out compressed transmission data amount above, by the P frame before it or the prediction of I frame, is also predictive frame; B frame be both considered and sequence of source images before coded frame, also take the coded image that the time redundancy information between coded frame is carried out compressed transmission data amount after sequence of source images into account, be also bi-directional predicted frames.
In the time of decoder decoded data, must have key frame, if there is no key frame, only have P, B frame, decoder can not decode data.
Therefore, prior art has yet to be improved and developed.
Summary of the invention
The technical problem to be solved in the present invention is, for the above-mentioned defect of prior art, provides a kind of method and device that prevents key frame disappearance and can not seek, and it solves some audio-video document while playing, and accurately seek navigates to problem sometime.
The technical scheme that technical solution problem of the present invention adopts is as follows:
A method that prevents key frame disappearance and can not seek, wherein, comprising:
A, the frame data of media audio-video document are carried out to seek when operation, according to seek to time point obtain the front key frame of this seek time point;
B, from this, the position of key frame starts file reading stream, and the document flow that this is read sends decoder decoding to;
C, judge whether the time point of decoded frame data arrives the time point of seek, by synchronizing thread, carry out data synchronous, before the time point of the time point of judging decoded frame data at seek, these frame data are abandoned;
D, when judging the time point of decoded frame data and arrive the time point of seek, decoded data are play to demonstration;
Wherein, described step B specifically comprises:
B1, according to the front key frame that gets, obtain the positional information of this front key frame;
B2, according to the positional information of this front key frame, read the document flow that from then on position starts, and the document flow that this is read sends decoder decoding to;
Decoder carries out continuous decoding to the document flow reading;
Because the positional information of front key frame is not the positional information of the seek time point play of actual needs, thus the document flow that the past key frame positional information is started sends decoder to decode after, decoded data are not shown at once.
The described method that prevents key frame disappearance and can not seek, described key frame is for affect the frame data of picture image parameter, and described front key frame is before the position on time shaft is positioned at seek time point and approaches the key frame of seek time point most.
The described method that prevents key frame disappearance and can not seek, is characterized in that, described audio-video document is avi file or MKV file.
The described method that prevents key frame disappearance and can not seek, wherein, described step C also comprises: by synchronizing thread, carry out data synchronous, before the time point of the time point of judging decoded frame data at seek, by synchronizing thread, these frame data are abandoned.
The described method that prevents key frame disappearance and can not seek, wherein, described key frame is for affecting the frame data of picture image parameter; Described front key frame is before the position on time shaft is positioned at seek time point and approaches the key frame of seek time point most.
A device that prevents key frame disappearance and can not seek, wherein, comprising:
Front key frame acquisition module, for the frame data of media audio-video document being carried out seek when operation, according to seek to time point obtain the front key frame of this seek time point;
Read and delivery module, for the position of key frame from this, start file reading stream, and the document flow that this is read sends decoder decoding to;
Judge module, for judging whether the time point of decoded frame data arrives the time point of seek, before the time point of the time point of judging decoded frame data at seek, abandons these frame data;
Playing module, for when judging the time point of the time point arrival seek of decoded frame data, plays demonstration by decoded data;
Wherein, described in, read with delivery module and comprise:
Positional information extraction unit, for according to the front key frame getting, obtains the positional information of this front key frame;
Reading unit, for according to the positional information of this front key frame, reads the document flow that from then on position starts;
Delivery unit, sends decoder decoding to for the document flow that this is read;
Decoder carries out continuous decoding to the document flow reading;
Described judge module comprises:
Lock unit, synchronous for carry out data by synchronizing thread, before the time point of the time point of judging decoded frame data at seek, by synchronizing thread, these frame data are abandoned;
Because the positional information of front key frame is not the positional information of the seek time point play of actual needs, thus the document flow that the past key frame positional information is started sends decoder to decode after, decoded data are not shown at once.
The described device that prevents key frame disappearance and can not seek, described key frame is for affecting the frame data of picture image parameter; Front key frame is before the position on time shaft is positioned at seek time point and approaches the key frame of seek time point most.
The described device that prevents key frame disappearance and can not seek, described audio-video document is avi file or MKV file.
Method and the device that prevents key frame disappearance and can not seek provided by the present invention, owing to having adopted according to the file of seek position, key frame location, first according to the time point of wanting seek to arrive, navigate to the front key frame that approaches this time point most, obtain the document location at this key frame place, according to this positional information, play.Because positional information is now not the positional information of actual that time point that will play, so after the data of the beginning of this positional information being sent to decoder decoding, decoded data are not shown at once, but it is synchronous by synchronizing thread, to carry out data, according to the time point of wanting seek, carry out synchronously, if these frame data are before wanting the time point of seek, directly decoded data are abandoned, until these frame data are time points of wanting seek location, now decoded data are shown, can navigate to the audio frequency and video time point that will play at seek accurately, it can navigate to accurately the video pictures of user's redirect in seek operation.
Accompanying drawing explanation
Fig. 1 is that the present invention prevents key frame disappearance and the flow chart of a kind of embodiment of method that can not seek.
Fig. 2 is that the present invention prevents key frame disappearance and the theory diagram of a kind of embodiment of device that can not seek.
Fig. 3 is that the present invention prevents key frame disappearance and reading and the inner theory diagram of delivery module in can not the device of seek.
Embodiment
A kind of method and device that prevents key frame disappearance and can not seek provided by the present invention, for making object of the present invention, technical scheme and advantage clearer, clear and definite, referring to accompanying drawing, developing simultaneously, the present invention is described in more detail for embodiment.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
A kind of method that prevents key frame disappearance and can not seek that the embodiment of the present invention provides, as shown in Figure 1, mainly comprises the following steps:
Step S110, the frame data of media audio-video document are carried out to seek when operation, according to seek to time point obtain the front key frame of this seek time point.This step is specially: the frame data of media audio-video document being carried out to seek when operation, first obtain seek time point, then according to seek time point obtain be positioned at seek time point before and approach the key frame of seek time point most.During playing audio-video document, user can operate by seek (skip operation) broadcast point is jumped to the optional position that user likes.Wherein, key frame is for affecting the frame data of picture image parameter, and front key frame is before the position on time shaft is positioned at seek time point and approaches the key frame of seek time point most.Audio-video document is as AVI(Audio Video Interleaved, Audio Video Interleaved form) file or MKV file, MKV is not a kind of compressed format, but a kind of media file of Matroska, Matroska is a kind of new multimedia encapsulation format, also claims multimedia container (Multimedia Container).
Step S120, from this, the position of key frame starts file reading stream, and the document flow that this is read sends decoder decoding to.
This step is specially: according to the front key frame getting, obtain the positional information of this front key frame; According to the positional information of this front key frame, read the document flow that from then on position starts, and the document flow that this is read sends decoder to, decoder carries out continuous decoding to the document flow reading.Then enter step S130.
Step S130, judge whether the time point of decoded frame data arrives the time point of seek, before the time point of the time point of judging decoded frame data at seek, these frame data are abandoned;
For example, by synchronizing thread, carry out data synchronous, before the time point of the time point of judging decoded frame data at seek, by synchronizing thread, these frame data are abandoned.
In the present embodiment by obtaining the document location at the front key frame place of seek time point, because the positional information of front key frame is not the positional information of the seek time point play of actual needs, so the document flow that the past key frame positional information is started sends decoder to decode after, decoded data are not shown at once, but it is synchronous by synchronizing thread, to carry out data, according to the time point of wanting seek, carry out synchronously, if these frame data, before seek time point, directly abandon decoded data.Then continue to decode, until the time point of the frame data of decoding arrives seek time point, enter step S140.
Step S140, when judging the time point of decoded frame data and arrive the time point of seek, decoded data are play to demonstration.Until decoded frame data are time points of wanting seek location, now decoded data are carried out to normal broadcasting and show.
Therefore the embodiment of the present invention a kind of prevents key frame disappearance and method that can not seek, it can accurately navigate to the audio frequency and video time point that will play by seek.
Based on above-described embodiment, the embodiment of the present invention also provides a kind of device that prevents key frame disappearance and can not seek, as shown in Figure 2, mainly comprises:
Front key frame acquisition module 210, for the frame data of media audio-video document being carried out seek when operation, according to seek to time point obtain the front key frame of this seek time point; Specifically as described in above-mentioned steps S110.Wherein, described seek is operating as skip operation.
Read and delivery module 220, for the position of key frame from this, start file reading stream, and the document flow that this is read sends decoder 250 decodings to; Specifically as described in above-mentioned steps S120.
Judge module 230, for judging whether the time point of decoded frame data arrives the time point of seek, before the time point of the time point of judging decoded frame data at seek, abandons these frame data; Specifically as described in above-mentioned steps S130.
Playing module 240, for when judging the time point of the time point arrival seek of decoded frame data, plays demonstration by decoded data, specifically as described in above-mentioned steps S140.
Decoder 250, carries out continuous decoding for the document flow to read.
Wherein, as shown in Figure 3, read with delivery module 220 and comprise:
Positional information extraction unit 221, for according to the front key frame getting, obtains the positional information of this front key frame;
Reading unit 222, for according to the positional information of this front key frame, reads the document flow that from then on position starts;
Delivery unit 223, sends decoder 250 decodings to for the document flow that this is read.
Wherein, described judge module 230 comprises: lock unit, and synchronous for carry out data by synchronizing thread, before the time point of the time point of judging decoded frame data at seek, by synchronizing thread, these frame data are abandoned.
In sum, method and the device that prevents key frame disappearance and can not seek provided by the present invention, owing to having adopted according to the file of seek position, key frame location, first according to the time point of wanting seek to arrive, navigate to the front key frame that approaches this time point most, obtain the document location at this key frame place, according to this positional information, play.Because positional information is now not the positional information of actual that time point that will play, so after the data of the beginning of this positional information being sent to decoder decoding, decoded data are not shown at once, but it is synchronous by synchronizing thread, to carry out data, according to the time point of wanting seek, carry out synchronously, if these frame data are before wanting the time point of seek, directly decoded data are abandoned, until these frame data are time points of wanting seek location, now decoded data are shown, can navigate to the audio frequency and video time point that will play at seek accurately.
Should be understood that, application of the present invention is not limited to above-mentioned giving an example, and for those of ordinary skills, can be improved according to the above description or convert, and all these improvement and conversion all should belong to the protection range of claims of the present invention.

Claims (6)

1. a method that prevents key frame disappearance and can not seek, is characterized in that, comprising:
A, the frame data of media audio-video document are carried out to seek when operation, according to seek to time point obtain the front key frame of this seek time point;
B, from this, the position of key frame starts file reading stream, and the document flow that this is read sends decoder decoding to;
C, judge whether the time point of decoded frame data arrives the time point of seek, by synchronizing thread, carry out data synchronous, before the time point of the time point of judging decoded frame data at seek, these frame data are abandoned;
D, when judging the time point of decoded frame data and arrive the time point of seek, decoded data are play to demonstration;
Wherein, described step B specifically comprises:
B1, according to the front key frame that gets, obtain the positional information of this front key frame;
B2, according to the positional information of this front key frame, read the document flow that from then on position starts, and the document flow that this is read sends decoder decoding to;
Decoder carries out continuous decoding to the document flow reading;
Because the positional information of front key frame is not the positional information of the seek time point play of actual needs, thus the document flow that the past key frame positional information is started sends decoder to decode after, decoded data are not shown at once.
2. the method that prevents according to claim 1 key frame disappearance and can not seek, it is characterized in that, described key frame is for affecting the frame data of picture image parameter, and described front key frame is before the position on time shaft is positioned at seek time point and approaches the key frame of seek time point most.
3. the method that prevents according to claim 1 key frame disappearance and can not seek, is characterized in that, described audio-video document is avi file or MKV file.
4. a device that prevents key frame disappearance and can not seek, is characterized in that, comprising:
Front key frame acquisition module, for the frame data of media audio-video document being carried out seek when operation, according to seek to time point obtain the front key frame of this seek time point;
Read and delivery module, for the position of key frame from this, start file reading stream, and the document flow that this is read sends decoder decoding to;
Judge module, for judging whether the time point of decoded frame data arrives the time point of seek, before the time point of the time point of judging decoded frame data at seek, abandons these frame data;
Playing module, for when judging the time point of the time point arrival seek of decoded frame data, plays demonstration by decoded data;
Wherein, described in, read with delivery module and comprise:
Positional information extraction unit, for according to the front key frame getting, obtains the positional information of this front key frame;
Reading unit, for according to the positional information of this front key frame, reads the document flow that from then on position starts;
Delivery unit, sends decoder decoding to for the document flow that this is read;
Decoder carries out continuous decoding to the document flow reading;
Described judge module comprises:
Lock unit, synchronous for carry out data by synchronizing thread, before the time point of the time point of judging decoded frame data at seek, by synchronizing thread, these frame data are abandoned;
Because the positional information of front key frame is not the positional information of the seek time point play of actual needs, thus the document flow that the past key frame positional information is started sends decoder to decode after, decoded data are not shown at once.
5. the device that prevents according to claim 4 key frame disappearance and can not seek, is characterized in that, described key frame is for affecting the frame data of picture image parameter; Described front key frame is before the position on time shaft is positioned at seek time point and approaches the key frame of seek time point most.
6. the device that prevents according to claim 4 key frame disappearance and can not seek, is characterized in that, described audio-video document is avi file or MKV file.
CN201110223980.8A 2011-08-05 2011-08-05 Method and device for preventing deficiency of key frame from causing seek incapability Expired - Fee Related CN102264004B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110223980.8A CN102264004B (en) 2011-08-05 2011-08-05 Method and device for preventing deficiency of key frame from causing seek incapability

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110223980.8A CN102264004B (en) 2011-08-05 2011-08-05 Method and device for preventing deficiency of key frame from causing seek incapability

Publications (2)

Publication Number Publication Date
CN102264004A CN102264004A (en) 2011-11-30
CN102264004B true CN102264004B (en) 2014-11-12

Family

ID=45010430

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110223980.8A Expired - Fee Related CN102264004B (en) 2011-08-05 2011-08-05 Method and device for preventing deficiency of key frame from causing seek incapability

Country Status (1)

Country Link
CN (1) CN102264004B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104918120B (en) * 2014-03-12 2019-03-29 联想(北京)有限公司 A kind of playback progress adjusting method and electronic equipment
CN104661083A (en) * 2015-02-06 2015-05-27 南京传唱软件科技有限公司 Video playing method and system as well as stream media playing method, device and system
CN104735463A (en) * 2015-03-26 2015-06-24 南京传唱软件科技有限公司 Streaming media transmission method and system
CN104918136B (en) * 2015-05-28 2018-08-31 北京奇艺世纪科技有限公司 Video locating method and device
CN105208463B (en) * 2015-08-31 2017-12-15 暴风集团股份有限公司 The method and system of frame determination is carried out for m3u8 files
CN105187895B (en) * 2015-09-17 2019-03-12 暴风集团股份有限公司 For the hardware-accelerated data cache method and system for playing video of mobile platform
CN111436004B (en) * 2019-01-11 2023-02-21 腾讯科技(深圳)有限公司 Video playing method, device and equipment and computer readable storage medium
KR102654716B1 (en) * 2019-02-11 2024-04-04 한화비전 주식회사 Method and Apparatus for playing back video in accordance with requested video playback time
CN110022489B (en) * 2019-05-30 2021-12-24 腾讯音乐娱乐科技(深圳)有限公司 Video playing method, device and storage medium
CN110099238A (en) * 2019-05-31 2019-08-06 杭州涂鸦信息技术有限公司 A kind of packaging method of video requency frame data, intelligent terminal and storage device
CN111918121B (en) * 2020-06-23 2022-02-18 南斗六星系统集成有限公司 Accurate editing method for streaming media file
CN112822522B (en) * 2020-12-31 2023-03-21 北京梧桐车联科技有限责任公司 Video playing method, device, equipment and storage medium
CN113726778A (en) * 2021-08-30 2021-11-30 咪咕视讯科技有限公司 Streaming media seek method, device, computing equipment and computer storage medium
CN114786065A (en) * 2022-03-29 2022-07-22 广州埋堆堆科技有限公司 FFmpeg-based HLS video playing progress accurate switching method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008236390A (en) * 2007-03-20 2008-10-02 Asv:Kk Video seek control method in video reproduction system
CN101483757A (en) * 2009-01-09 2009-07-15 深圳市同洲电子股份有限公司 Skipping method, system and server for network interactive play-on-demand
CN101540881A (en) * 2008-03-19 2009-09-23 华为技术有限公司 Method, device and system for realizing positioning playing of streaming media
CN101909049A (en) * 2009-12-17 2010-12-08 新奥特(北京)视频技术有限公司 Method and system for quickly searching and playing stream media data
CN102118539A (en) * 2009-12-30 2011-07-06 Tcl集团股份有限公司 Multimedia playing terminal as well as playing method and device for dragging multimedia files
CN102137302A (en) * 2010-12-09 2011-07-27 华为技术有限公司 Method and device for playing video contents of streaming media

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008236390A (en) * 2007-03-20 2008-10-02 Asv:Kk Video seek control method in video reproduction system
CN101540881A (en) * 2008-03-19 2009-09-23 华为技术有限公司 Method, device and system for realizing positioning playing of streaming media
CN101483757A (en) * 2009-01-09 2009-07-15 深圳市同洲电子股份有限公司 Skipping method, system and server for network interactive play-on-demand
CN101909049A (en) * 2009-12-17 2010-12-08 新奥特(北京)视频技术有限公司 Method and system for quickly searching and playing stream media data
CN102118539A (en) * 2009-12-30 2011-07-06 Tcl集团股份有限公司 Multimedia playing terminal as well as playing method and device for dragging multimedia files
CN102137302A (en) * 2010-12-09 2011-07-27 华为技术有限公司 Method and device for playing video contents of streaming media

Also Published As

Publication number Publication date
CN102264004A (en) 2011-11-30

Similar Documents

Publication Publication Date Title
CN102264004B (en) Method and device for preventing deficiency of key frame from causing seek incapability
CN102986218B (en) Video for stream video data switches
CN102388616B (en) Image signal decoding device, image signal decoding method, image signal encoding device, and image signal encoding method
JP3228874B2 (en) Method and apparatus for dividing compressed digital video bit stream and method and apparatus for decoding the same
CN102396221B (en) Support for blocking trick mode operations
CN101765016B (en) Video decoding method
US8803906B2 (en) Method and system for converting a 3D video with targeted advertisement into a 2D video for display
US20060109385A1 (en) Digital broadcast receiving apparatus
JP2006279971A (en) Grouping of image frame in video coding
CN101335883A (en) Method and apparatus for processing video stream in digital video broadcast system
US20070147517A1 (en) Video processing system capable of error resilience and video processing method for same
EP2642764B1 (en) Transcoding a video stream to facilitate accurate display
TW201206202A (en) Moving image prediction encoding device, moving image prediction encoding method, moving image prediction encoding program, moving image prediction decoding device, moving image prediction decoding method, and moving image prediction decoding program
US20150062295A1 (en) Image processing system, transmitting device, receiving device, transmitting method, receiving method, and computer program
JP5170708B2 (en) Moving picture stream processing method and apparatus, moving picture reproduction apparatus and moving picture distribution apparatus using the same
CN102065319A (en) Method and device for multiplexing H.264 elementary stream
EP1229742A2 (en) Method and apparatus for recording and playing back moving picture data
CN106470291A (en) Recover in the interruption in time synchronized from audio/video decoder
KR101142379B1 (en) Method and Apparatus of playing digital broadcasting and Method of recording digital broadcasting
CN106878290B (en) Audio and video playing method and device
EP1061737A1 (en) Process and device for switching digital television programmes
CN111918121B (en) Accurate editing method for streaming media file
CN114731395A (en) Encoder, decoder and data stream for progressive decoder refresh coding and scalable coding
EP1641262B1 (en) Circuit for processing video signal containing information such as closed caption
JP2009218934A (en) Video reproducing device and video reproducing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20141112

Termination date: 20200805

CF01 Termination of patent right due to non-payment of annual fee