CN104822008B - video synchronization method and device - Google Patents

video synchronization method and device Download PDF

Info

Publication number
CN104822008B
CN104822008B CN201410171896.XA CN201410171896A CN104822008B CN 104822008 B CN104822008 B CN 104822008B CN 201410171896 A CN201410171896 A CN 201410171896A CN 104822008 B CN104822008 B CN 104822008B
Authority
CN
China
Prior art keywords
video data
data frame
synchronization parameter
global synchronization
frame
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.)
Active
Application number
CN201410171896.XA
Other languages
Chinese (zh)
Other versions
CN104822008A (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.)
Tencent Technology Beijing Co Ltd
Original Assignee
Tencent Technology Beijing 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 Tencent Technology Beijing Co Ltd filed Critical Tencent Technology Beijing Co Ltd
Priority to CN201410171896.XA priority Critical patent/CN104822008B/en
Publication of CN104822008A publication Critical patent/CN104822008A/en
Application granted granted Critical
Publication of CN104822008B publication Critical patent/CN104822008B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The invention discloses a kind of video synchronization method and devices.Wherein, this method comprises: obtaining the present system time and the preset play time for playing current video data frame completed when decoding to current video data frame;Global synchronization parameter is updated according to the difference between present system time and play time, obtains updated global synchronization parameter;Obtain simultaneously operating corresponding with updated global synchronization parameter;Simultaneously operating is executed in rear video data frame to after current video data frame, to reduce the difference to the present system time and preset broadcasting completed when decoding in rear video data frame between the play time of rear video data frame.The present invention solves and there is technical issues that more serious card broke when playing video in the prior art.

Description

Video synchronization method and device
Technical field
The present invention relates to MultiMedia Fields, in particular to a kind of video synchronization method and device.
Background technique
Currently on the market in mature media file format agreement, all contain some temporal informations with define player with Which kind of speed and show corresponding audio and video information at what point in time.Specifically, display speed or adjacent The interval of frame is defined respectively by the image frame per second of the signal sampling rate of audio, video.Certainly, if simply by frame number It is obviously inadequate for carrying out synchronized audio/video with the mode of frame per second.Then as supplement, DTS is contained in audio-video code stream (Decoding Time-Stamp, decoded time stamp) and PTS (Presentation Time-Stamp, Presentation Time Stamp) machine System, wherein DTS defines the decoding time point of the frame data, and PTS defines the play time of the frame data.In view of currently leading Stream video coding all uses hybrid encoding frame, and bi-directional predictive coding technology is utilized often to improve compression efficiency, therefore The coded sequence and decoding order of cine-oriented image are different.What DTS mechanism solved is that this encoding and decoding sequence is inconsistent The problem of (to audio stream be not present the problem), PTS then exactly defines the play time of data, so as to play end It realizes the problem of picture or sound continue, and implicitly establishes the logic corresponding relationship of audio, video data simultaneously.
Audio-visual synchronization, i.e., by implementing certain audio, video data waiting or drop policy, so that it is according to preparatory The speed of setting and time point are shown.Conversely, being known as when not shown according to preset speed or time point Step-out (or lock-out).Synchronization occurs in film picture and sound are typically shown as at this time does not meet logic pair It should be related to.Traditional audio-visual synchronization is divided into two parts: 1) after showing a frame image or sound, it is fixed to start a program When device, stop timing when its timing reaches the next frame image perhaps PTS of sound while showing the frame image or sound; 2) after completing decoding according to DTS in media file, discovery present system time alreadys exceed the PTS of the frame image or sound, Then carry out discard processing.
The commercial operation system of current main-stream is (such as: Windows, the Mac OSX of apple and the Linux/ of open source of Microsoft Unix/Android etc.) it is all based on timeslice/priority scheduling multi-task parallel operating system, user is in the same period It is interior it is possible run multiple programs or service, even if then the computing resource used for media player in the course of the twinkling of an eye may also Differ totally different.Time point of audio, video data after the completion of decoding in this way, between audio & video and itself and system time Between difference can may also change over time it is larger.Additionally, for online streaming media service, nondeterministic network shake, The factors such as time delay and packet loss can also aggravate gap between real time point and the PTS of definition.Particularly, in recent years smart phone and Mobile Internet is quickly grown, and the habit for watching film is extended by PC desktop or be transformed into mobile device by many users On.And asynchronous risk of mobile device limited computing resource when can more aggravate audio and video playing.Based on this, traditional audio-video The strategy that the non-black i.e. white, non-camp that synchronous method uses abandons can be easy to cause video in the case where changing faster system environments Occur serious card disconnected phenomenon when broadcasting, greatly reduces user and play experience.
For above-mentioned problem, currently no effective solution has been proposed.
Summary of the invention
The embodiment of the invention provides a kind of video synchronization method and devices, at least to solve to play video in the prior art When there is technical issues that more serious card is disconnected.
According to an aspect of an embodiment of the present invention, a kind of video synchronization method is provided, comprising: obtain to current video Data frame completes present system time and the preset play time for playing current video data frame when decoding;According to current Difference between system time and play time updates global synchronization parameter, obtains updated global synchronization parameter;Obtain with The corresponding simultaneously operating of updated global synchronization parameter;To being executed together in rear video data frame after current video data frame Step operation, to reduce to the present system time and preset broadcasting completed in rear video data frame when decoding in backsight frequency According to the difference between the play time of frame.
Optionally, if it includes: updated global same for obtaining simultaneously operating corresponding with updated global synchronization parameter The step-out degree for walking the global synchronization parameter instruction that the step-out degree that parameter indicates is greater than before updating then obtains and updated complete The corresponding simultaneously operating of office's synchronization parameter, wherein execute that simultaneously operating reduced to being decoded in rear video data frame Time be greater than execute with the corresponding first simultaneously operating of global synchronization parameter before update reduced in rear video data frame The time being decoded.
Optionally, if it includes: updated global same for obtaining simultaneously operating corresponding with updated global synchronization parameter The step-out degree for walking the global synchronization parameter instruction that the step-out degree that parameter indicates is less than before updating then obtains and updated complete The corresponding simultaneously operating of office's synchronization parameter, wherein execute that simultaneously operating reduced to being decoded in rear video data frame Time be less than execute with the corresponding first simultaneously operating of global synchronization parameter before update reduced in rear video data frame The time being decoded.
Optionally, which is characterized in that include at least one of to simultaneously operating is executed in rear video data frame: skipping pair The broadcasting of current video data frame;Skip the decoding to the B frame in rear video data frame;Skip to rear video data frame into Loop filtering operation in capable video decoding operation;It skips in the present image set GOP where current video data frame The decoding in rear video data frame after current video data frame.
Optionally, to rear video data frame execute simultaneously operating include following one: when global synchronization parameter be greater than etc. In first threshold and be less than second threshold when, skip the decoding to the B frame in rear video data frame;When global synchronization parameter When more than or equal to second threshold and being less than third threshold value, skips the decoding to the B frame in rear video data frame and skip pair The broadcasting of current video data frame;When global synchronization parameter is more than or equal to third threshold value and when less than four threshold values, skip to The decoding of B frame in rear video data frame is skipped to the loop filtering in the video decoding operation that rear video data frame carries out It operates and skips the broadcasting to current video data frame;When global synchronization parameter is more than or equal to four threshold values, skip to current The broadcasting of video data frame and skip in the present image set GOP where current video data frame be located at current video number According to the decoding in rear video data frame after frame;Wherein, the bigger expression global synchronization parameter of the value of global synchronization parameter refers to The step-out degree shown is bigger.
Optionally, if it includes: poor for updating global synchronization parameter according to the difference between present system time and play time Value is more than or equal to the 5th threshold value, then increases the value of the global synchronization parameter before update;If difference less than the 5th threshold value, Then the value of the global synchronization parameter before update is reduced.
Optionally, if the difference of difference and the 5th threshold value is bigger, the value of the global synchronization parameter before update is increased Numerical value it is bigger.
According to another aspect of an embodiment of the present invention, a kind of video synchronization device is additionally provided, comprising: first obtains list Member, for obtaining the present system time and preset broadcasting current video data completed when decoding to current video data frame The play time of frame;Updating unit, for updating global synchronization ginseng according to the difference between present system time and play time Number, obtains updated global synchronization parameter;Second acquisition unit, it is corresponding with updated global synchronization parameter for obtaining Simultaneously operating;Synchronization unit, for executing simultaneously operating in rear video data frame to after current video data frame, to reduce To the present system time and preset broadcasting completed in rear video data frame when decoding in the broadcasting of rear video data frame Between between difference.
Optionally, second acquisition unit includes: the first acquisition module, for global synchronization parameter instruction in the updated When step-out degree is greater than the step-out degree of the global synchronization parameter instruction before updating, obtain and updated global synchronization parameter pair The simultaneously operating answered, wherein what execution simultaneously operating was reduced is greater than execution to the time being decoded in rear video data frame First simultaneously operating corresponding with the global synchronization parameter before update reduced to when rear video data frame is decoded Between.
Optionally, second acquisition unit includes: the second acquisition module, for global synchronization parameter instruction in the updated When step-out degree is less than the step-out degree of the global synchronization parameter instruction before updating, obtain and updated global synchronization parameter pair The simultaneously operating answered, wherein what execution simultaneously operating was reduced is less than execution to the time being decoded in rear video data frame First simultaneously operating corresponding with the global synchronization parameter before update reduced to when rear video data frame is decoded Between.
Optionally, synchronization unit includes skipping module, skips module for executing following at least one operation: being skipped to working as The broadcasting of preceding video data frame;Skip the decoding to the B frame in rear video data frame;It skips and is carried out in rear video data frame Video decoding operation in loop filtering operation;It skips to position in the present image set GOP where current video data frame The decoding in rear video data frame after current video data frame.
Optionally, skipping module includes following one: first skips submodule, for being more than or equal to when global synchronization parameter First threshold and be less than second threshold when, skip the decoding to the B frame in rear video data frame;Second skips submodule, uses In when global synchronization parameter is more than or equal to second threshold and is less than third threshold value, skip to the B frame in rear video data frame Decoding and skip broadcasting to current video data frame;Third skips submodule, for being more than or equal to when global synchronization parameter Third threshold value and when less than four threshold values, skips the decoding to the B frame in rear video data frame, skips in backsight frequency The loop filtering operation in video decoding operation that carries out according to frame and skip broadcasting to current video data frame;The forth jump Submodule, for skipping the broadcasting to current video data frame and skipping when global synchronization parameter is more than or equal to four threshold values To in the present image set GOP where current video data frame be located at current video data frame after in rear video data frame Decoding;Wherein, the bigger step-out degree for indicating the instruction of global synchronization parameter of the value of global synchronization parameter is bigger.
Optionally, updating unit includes: the first update module, is used for when difference is more than or equal to five threshold values, to update The value of preceding global synchronization parameter is increased;Second update module is used for when difference is less than five threshold values, before update The value of global synchronization parameter reduced.
In video synchronization method provided in an embodiment of the present invention and device, pass through the system of decoded video data frame Difference is between time and play time PTS come whether measuring current audio video synchronization or step-out and its severity, and in letter Implement dynamic on the policy grounds of single " non-camp is to abandon " to adjust, be changed to by single discarding, frame-skipping processing corresponding same Step operation, for example, skipping decoding B frame, skipping loop filtering operation, skip to the current GOP frame where current video data frame In set be located at current video data frame after the decoding in rear video data frame, so as to realize it is stepped, damage service Target, " ground of trying one's best " ensure that video frame rate thus under the premise of guaranteeing audio video synchronization, improve due to system Video breaking phenomenon caused by the factors such as resource, and then solve when playing video in the prior art that there are more serious card is disconnected The phenomenon that the technical issues of.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes part of this application, this hair Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is a kind of flow chart of the method for optional audio video synchronization according to an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram of the method for optional audio video synchronization according to an embodiment of the present invention;
Fig. 3 is the schematic diagram of the method for another optional audio video synchronization according to an embodiment of the present invention;
Fig. 4 is the schematic diagram of the method for another optional audio video synchronization according to an embodiment of the present invention;
Fig. 5 is the schematic diagram of the method for another optional audio video synchronization according to an embodiment of the present invention;
Fig. 6 is a kind of schematic diagram of the device of optional audio video synchronization according to an embodiment of the present invention;And
Fig. 7 is a kind of schematic diagram of the device of optional audio video synchronization according to an embodiment of the present invention.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work It encloses.
It should be noted that description and claims of this specification and term " first " in above-mentioned attached drawing, " Two " etc. be to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that using in this way Data be interchangeable under appropriate circumstances, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that cover Cover it is non-exclusive include, for example, the process, method, system, product or equipment for containing a series of steps or units are not necessarily limited to Step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, product Or other step or units that equipment is intrinsic.
Embodiment 1
According to embodiments of the present invention, a kind of video synchronization method is provided, as shown in Figure 1, this method comprises:
S102 obtains present system time and preset broadcasting when completing decoding to current video data frame and works as forward sight The play time of frequency data frame;
Optionally, in the present embodiment, above-mentioned video synchronization method can be applied in media player, optionally, this Video synchronization method in embodiment also can be applied to audio sync, alternatively, the audio synchronization method in the present embodiment can be with Using synchronization scheme in the prior art, the application is not limited this.
Optionally, in the present embodiment, video data frame includes but is not limited to: B frame, wherein including the above-mentioned frame including B Multiple video data frames constitute a GOP (Group Of Pictures, image collection) frame set, wherein GOP frame set Refer in video data frame sequence from a key frame (or also referred to as I frame) to all frame set next key frame. Further, B frame is bi-directional predicted frames, and bi-directional predicted frames are exactly both with reference to the former frame on this frame time, referring also to this A later frame on one frame time.Optionally, a frame in the present embodiment can indicate piece image.
For example, Fig. 2 shows in media player multiple continuous video data frame F1, F2, F3, F4, F5, F6, F7, F8, wherein F1, F2, F3, F4 belong to the first GOP frame set, and F5, F6, F7, F8 belong to the 2nd GOP frame set, F2, F4, F8 For B frame.Assuming that F1 is current video data frame, then F2, F3, F4 are to be located at current video data frame F1 in the first GOP frame set Later in rear video data frame, F2-F8 is after F1 in rear video data frame, other situations and so on, this implementation Details are not described herein for example.
S104 updates global synchronization parameter according to the difference between present system time and play time, after obtaining update Global synchronization parameter;
Optionally, in the present embodiment difference between present system time and play time with positive and negative attribute, If above-mentioned difference is positive number, represents present system time T0 and have already fallen behind in preset play time PTS, need to take and lose The tactful video data frame to avoid displaying " out-of-date " such as abandoning, frame-skipping;Conversely, it is leading or be equal to pre- then to represent present system time If broadcasting current video data frame play time PTS, need to wait until can show the view after reaching play time PTS Frequency data frame.
Optionally, global synchronization parameter in the present embodiment can be, but not limited to be identified with score, and above-mentioned score can To there is a value range, for example, minimum value is 0, maximum value 30.Purpose in such a way is, total score 0, Then indicate that current media player without using any discarding or frame-skipping strategy, waits until reaching preset broadcasting works as forward sight The play time PTS of frequency data frame.And due to centainly needing waiting, (otherwise video data can be demonstrated earlier than PTS, equally It is also nonsynchronous performance), so logically global synchronization parameter is negative without in all senses.Correspondingly, working as above-mentioned point Number forward direction values arrive maximum value when, then can indicate that current video seriously loses synchronization, need to carry out immediately frame-skipping etc. handle. That is, in the present embodiment, the bigger step-out journey for indicating the global synchronization parameter instruction of the value of global synchronization parameter It spends bigger.It should be noted that between the step-out degree that the value and global synchronization parameter of above-mentioned global synchronization parameter indicate Corresponding relationship is only a kind of example, and the application can also indicate above-mentioned relation by other means, for example, global synchronization parameter The smaller step-out degree for indicating global synchronization parameter instruction of value it is bigger, the application does not limit this.
It optionally, in the present embodiment, can be corresponding according to the setting of the difference between present system time and play time Global synchronization parameter update threshold value, for example, table 1 shows difference between present system time and play time and global A kind of corresponding relationship of the update threshold value of synchronization parameter, wherein time difference (1 second=1000000 microsecond) as unit of microsecond. It is understood that corresponding relationship shown in table 1 is a kind of example, other corresponding passes are set also according to actual demand System, for example, the big of update threshold value corresponding to the time difference range and different difference ranges different from table 1 can be set Small, the application does not limit this.
Table 1
(Delta=TO-PTS) time difference The update threshold value of global synchronization parameter
Delta >=200000 +20
2000000 > Delta >=1000000 +15
>=500000 100000O > Delta +5
50000O > Delta >=- 500000 0
-500000>Delta -5
Optionally, it based on corresponding relationship shown in above-mentioned table 1, is calculating between present system time and play time Difference after, global synchronization parameter is updated according to the difference corresponding update threshold value, is obtained updated global same Walk parameter.
Optionally, in the present embodiment, the simultaneously operating of the corresponding video data frame of global synchronization parameter can with but it is unlimited Shown in following table 2 control parameter collection indicates, wherein the parameter that above-mentioned control parameter is concentrated includes but is not limited to: being used for Indicate skip in the present image set GOP where current video data frame be located at current video data frame after in backsight The decoded control parameter (SKIP_GOP) of frequency data frame is used to indicate the decoding skipped to the B frame in rear video data frame Control parameter (SKIP_B_FRAME), be used to indicate the ring skipped in the video decoding operation that rear video data frame carries out The control parameter (SKIP_DEBLOCKING) of road filtering operation is used to indicate the control for skipping the broadcasting to current video data frame Parameter (SKIP_FRAME) processed.
As shown in table 2, the global synchronization parameter in table 1 is identified with S, and the step-out degree of global synchronization parameter instruction is marked with L Know, for indicating the step-out degree of current video, the numerical value for losing synchronous L is bigger, and it is bigger that expression loses synchronous degree.
Table 2
It is understood that corresponding relationship shown in table 2 is a kind of example, it is arranged also according to actual demand other Corresponding relationship, for example, the global synchronization parameter area different from table 2 can be set
And the selection of step-out degree and control parameter corresponding to different global synchronization parameter areas, the application is to this Without limitation.
S106 obtains simultaneously operating corresponding with updated global synchronization parameter;
Optionally, simultaneously operating in the present embodiment includes at least one of: being skipped to current video data frame It plays;Skip the decoding to the B frame in rear video data frame after current video data frame;It skips in rear video data The loop filtering operation in video decoding operation that frame carries out;It skips to the present image set where current video data frame The decoding in rear video data frame being located at after current video data frame in GOP;Skip current video data frame.
For example, in conjunction with shown in table 1- table 2, it is assumed that the initial value of global synchronization parameter is 0, and current video data frame completes solution The difference between present system time T0 and the preset play time PTS for playing current video data frame when code is 500000 Microsecond, then as shown in Table 1, the update threshold value of corresponding global synchronization parameter are+5, that is, update the value of global synchronization parameter It is 5, further, as shown in Table 2, the corresponding step-out degree of current video data frame is 2, then corresponding simultaneously operating is to skip pair The decoding of the B frame in rear video data frame after current video data frame.
S108 executes simultaneously operating in rear video data frame to after current video data frame.
Optionally, simultaneously operating in the present embodiment be used for reduces to it is described rear video data frame complete decoding when The difference of present system time and preset broadcasting between the play time of rear video data frame.
For example, still combining above-mentioned example, updated when according to the difference between present system time T0 and play time PTS Global synchronization parameter S is known that the corresponding step-out degree of current video data frame is 2 according to global synchronization parameter S, is jumped Frame.Further, as shown in Table 2, step-out degree be 2 when, should execute to after current video data frame in rear video data Frame executes the decoded simultaneously operating for skipping B frame.
By embodiment provided by the present application, when completing current system when decoding to current video data frame by obtaining Between and it is preset play current video data frame play time between difference, obtain updated global synchronization parameter, Wherein, global synchronization parameter is for whether measuring current synchronization or step-out (or lock-out) and its severity, and benefit Simultaneously operating is executed in rear video data frame to after current video data frame with updated global synchronization parameter, to reduce To the present system time and preset broadcasting completed in rear video data frame when decoding in the broadcasting of rear video data frame Between between difference, to ensure that video frame rate with trying one's best under the premise of guaranteeing audio video synchronization, improve due to Video breaking phenomenon caused by the factors such as system resource.
As a kind of optional scheme, step S106 obtains simultaneously operating corresponding with updated global synchronization parameter Include:
S1, if the step-out degree of updated global synchronization parameter instruction is greater than the global synchronization parameter instruction before updating Step-out degree then obtains simultaneously operating corresponding with updated global synchronization parameter, wherein the simultaneously operating of above-mentioned acquisition is full Sufficient the following conditions: being greater than to the time being decoded in rear video data frame of executing that the simultaneously operating of above-mentioned acquisition reduced is held Row and the corresponding first simultaneously operating of global synchronization parameter before update reduced to being decoded in rear video data frame Time.
For example, as shown in Fig. 2, multiple continuous video data frames in media player be F1, F2, F3, F4, F5, F6, F7, F8, wherein F1, F2, F3, F4 belong to the first GOP frame set, and F5, F6, F7, F8 belong to the 2nd GOP frame set, F2, F4, F8 For B frame;Assuming that F1 is current video data frame, then F2, F3, F4 are to be located at current video data frame F1 in the first GOP frame set Later in rear video data frame, F2-F8 is after F1 in rear video data frame, other situations and so on, this implementation Details are not described herein for example.
It is assumed that when playing to video data frame F1, according to the difference between present system time T1 and play time PTS1 The value of global synchronization parameter S is updated to 5 by value, and corresponding step-out degree is 2, then is executed to current video data frame F1 rear Video data frame execute and skip the simultaneously operating of B frame.For example, as shown in figure 3, then needing to skip to after video data frame F1 The decoding of B frame F2 optionally for B frame F4, then need to determine again after the step-out degree for judging video data frame F3 Whether skip, optionally, for B frame F8, then needs to decide whether again after the step-out degree for judging video data frame F7 It skips.
It is assumed that when playing to video data frame F3, according to the difference between present system time T3 and play time PTS3 The value of global synchronization parameter S is updated to 12 by value, and corresponding step-out degree is 3, then updated global synchronization parameter S instruction Step-out degree 3 be greater than update before global synchronization parameter S instruction step-out degree 2, in this way indicate video step-out it is tighter Weight, need to be further reduced rear video data frame decoding time and/or skip the broadcasting of current video data frame.That is, obtaining The simultaneously operating corresponding with updated global synchronization parameter taken meets the following conditions: executing the simultaneously operating institute of above-mentioned acquisition That reduces is corresponding to the global synchronization parameter before the time that rear video data frame is decoded is greater than execution and updates first Simultaneously operating reduced to the time being decoded in rear video data frame.For example, as shown in Table 2, should execute skip to The decoding of B frame in rear video data frame and skip broadcasting to current video data frame.For example, as shown in figure 4, video counts Also it is B frame according to the video data frame F4 after frame F3, then skips the decoding to B frame F4, and skips to current video data frame F3 Broadcasting.
By embodiment provided by the present application, the step-out degree of updated global synchronization parameter instruction is learnt by comparing Greater than the step-out degree of the global synchronization parameter instruction before update, it is known that step-out degree increases, and then executes to video data frame Corresponding simultaneously operating.In this way, the variation tendency by judging step-out degree, executes corresponding synchronous behaviour to video data frame Make.
As a kind of optional scheme, step S106 obtains simultaneously operating corresponding with updated global synchronization parameter Include:
S1, if the step-out degree of updated global synchronization parameter instruction is less than the global synchronization parameter instruction before updating Step-out degree then obtains simultaneously operating corresponding with updated global synchronization parameter, wherein the simultaneously operating of above-mentioned acquisition is full Sufficient the following conditions: being less than to the time being decoded in rear video data frame of executing that the simultaneously operating of above-mentioned acquisition reduced is held Row and the corresponding first simultaneously operating of global synchronization parameter before update reduced to being decoded in rear video data frame Time.
It is assumed that as shown in Fig. 2, multiple continuous video data frames in media player be F1, F2, F3, F4, F5, F6, F7, F8, wherein F1, F2, F3, F4 belong to the first GOP frame set, and F5, F6, F7, F8 belong to the 2nd GOP frame set, F2, F4, F8 For B frame.Assuming that F1 is current video data frame, then F2, F3, F4 are to be located at current video data frame F1 in the first GOP frame set Later in rear video data frame, F2-F8 is after F1 in rear video data frame, other situations and so on, this implementation Details are not described herein for example.
Based on above-mentioned example, it is assumed that after playing video data frame F1, F3, when playing to video data frame F5, The difference between the present system time T5 and play time PTS5 when decoding is completed according to video data frame F5 by global synchronization The value of parameter S is updated to 6, and corresponding step-out degree is 2, then executes to the posterior video data frame of current video data frame F5 Execute the simultaneously operating for skipping B frame.The step-out degree 2 of global synchronization parameter S instruction updated compared to video data frame F5 Less than the step-out degree 3 of the global synchronization parameter S instruction before update, then it represents that the step-out of video makes moderate progress than before, in this way The simultaneously operating corresponding with updated global synchronization parameter obtained can satisfy the following conditions: execute the synchronous of above-mentioned acquisition Operation is reduced corresponding with the global synchronization parameter before updating to execution is less than in the time that rear video data frame is decoded First simultaneously operating reduced to the time being decoded in rear video data frame.For example, as shown in table 2, execution it is same Step is operated from " execution skips the decoding to the B frame in rear video data frame and skips the broadcasting to current video data frame " It is changed to the simultaneously operating of " executing the decoding for executing to the posterior video data frame of current video data frame F5 and skipping B frame ".Into one Step, it is assumed that when playing to video data frame F6, the step-out degree of updated global synchronization parameter S instruction, which is less than, updates forward sight The step-out degree of frequency data frame F5 corresponding global synchronization parameter S instruction, then can will be to the posterior view of current video data frame F6 The simultaneously operating that B frame is skipped in the execution of frequency data frame is also cancelled, i.e., no longer carries out skipping decoding or skip the simultaneously operating of broadcasting.
By embodiment provided by the present application, the step-out degree by comparing the instruction of updated global synchronization parameter is less than The step-out degree of global synchronization parameter instruction before update, it is known that step-out degree reduces, and then executes to video data frame corresponding Simultaneously operating.In this way, the variation tendency by judging step-out degree, executes corresponding simultaneously operating to video data frame, It substantially improves user and plays experience.
Include at least one of to simultaneously operating is executed in rear video data frame as a kind of optional scheme:
S1 skips the decoding to the B frame in rear video data frame;
Optionally, the decoding for skipping the B frame in rear video data frame in the present embodiment, the purpose is to: B frame is used for Bi-directional predicted, the time can not only be saved by skipping decoding B frame, for subsequent video data the output time catch up with that PTS provides can Can, and the decoding of other video data frames will not be affected.
S2 is skipped to the loop filtering operation in the video decoding operation that rear video data frame carries out;
Optionally, in the present embodiment in the video decoding operation that rear video data frame carries out loop filtering grasp Make, the purpose is to: skipping the loop filtering link in video decoding process equally may be implemented to save decoding time, and be subsequent The output time of video data frame catches up with PTS offer may.
S3 is skipped and is located at after current video data frame in the present image set GOP where current video data frame The decoding in rear video data frame.
Optionally, in the present embodiment current to being located in the present image set GOP where current video data frame The decoding in rear video data frame after video data frame.The purpose is to: remaining data in GOP are abandoned, in this way, can save Save a large amount of decoding time, and when for the output of next synchronous point (the I frame or key frame of i.e. next GOP beginning) data Between catch up with PTS provide may.
Optionally, it directly executes and skips in GOP frame set in current video data in GOP frame set in the present embodiment The decoding in rear video data frame after frame is skipped without judging whether to execute again to the B frame in rear video data frame Decoding, or skip to the loop filtering operation in the video decoding operation that rear video data frame carries out.In other words, as long as Included in GOP set, and it is located at the video data frame after current video data frame, will executes and skip decoded behaviour Make.
For example, it is assumed that as shown in figure 5, in the 2nd GOP frame set of present image set include video data frame F5, F6, F7, F8, wherein video data frame F5 is current video data frame, if step-out degree indicated by global synchronization parameter S meets item Part, then execute skip in the present image set GOP where current video data frame F5 be located at current video data frame F5 it The decoding in rear video data frame afterwards, that is, video data frame F6, F7, the F8 being to skip in present image set GOP.
Optionally, it may also include in the present embodiment and skip current video data frame, the purpose is to: it abandons already " out-of-date " Data, prevent image from losing due logic corresponding relationship.Furthermore it is possible to save the system time of image rendering needs, be Subsequent improvement audio-visual synchronization provides may.
By embodiment provided by the present application, implements dynamic on the policy grounds of simple " non-camp is to abandon " and adjust It is whole, it is handled by single discarding, frame-skipping and is changed to skip decoding B frame, skips loop filtering, skip current video data frame until jumping Remaining frame is crossed in current GOP frame set to realize target that is stepped, damaging service, thus before guaranteeing audio video synchronization It puts and ensure that video frame rate with trying one's best.
Include following one to simultaneously operating is executed in rear video data frame as a kind of optional scheme:
S1 is skipped when global synchronization parameter is more than or equal to first threshold and is less than second threshold in rear video data The decoding of B frame in frame;
Optionally, the bigger step-out for indicating the instruction of global synchronization parameter of the value of global synchronization parameter in the present embodiment Degree is bigger.
For example, in conjunction with shown in table 2, it is assumed that the first threshold of global synchronization parameter is 5, second threshold 10, then by current Video data frame is 6 according to the corresponding global synchronization parameter S of difference between present system time and play time, judgement It knows more than or equal to first threshold 5 and is less than second threshold 10, then execute the solution skipped to the B frame in rear video data frame Code.
S2 is skipped when global synchronization parameter is more than or equal to second threshold and is less than third threshold value in rear video data The decoding of B frame in frame and skip broadcasting to current video data frame;
For example, in conjunction with shown in table 2, it is assumed that the second threshold of global synchronization parameter is 10, and third threshold value is 15, then by current Video data frame is 12 according to the corresponding global synchronization parameter S of difference between present system time and play time, is sentenced More than or equal to second threshold 10 and less than third threshold value 15 known to disconnected, then execute and skip to the B frame in rear video data frame It decodes and skips the broadcasting to current video data frame.
S3 is skipped in rear video data when global synchronization parameter is more than or equal to third threshold value and when less than four threshold values The decoding of B frame in frame is skipped to the loop filtering operation in the video decoding operation that rear video data frame carries out and is skipped Broadcasting to current video data frame;
For example, in conjunction with shown in table 2, it is assumed that the third threshold value of global synchronization parameter is 15, and the 4th threshold value is 20, then by current Video data frame is 18 according to the corresponding global synchronization parameter S of difference between present system time and play time, is sentenced More than or equal to third threshold value 15 and less than the 4th threshold value 20 known to disconnected, then execute and skip to the B frame in rear video data frame It decodes, skip to the loop filtering operation in the video decoding operation that rear video data frame carries out and skip to current video The broadcasting of data frame.
S4 skips the broadcasting to current video data frame and skips when global synchronization parameter is more than or equal to four threshold values To in the present image set GOP where current video data frame be located at current video data frame after in rear video data frame Decoding;
For example, in conjunction with shown in table 2, it is assumed that the 4th threshold value of global synchronization parameter is 20, then by current video data frame root It is 25 according to corresponding global synchronization parameter S known to the difference between present system time and play time, be greater than known to judgement etc. In the 4th threshold value, then executes and skip the broadcasting to current video data frame and skip to current where current video data frame The decoding in rear video data frame being located at after current video data frame in image collection GOP.
By embodiment provided by the present application, implements dynamic on the policy grounds of simple " non-camp is to abandon " and adjust It is whole, it is handled by single discarding, frame-skipping and is changed to skip decoding B frame, skips loop filtering, skip current video data frame until jumping Remaining frame is crossed in current GOP frame set to realize target that is stepped, damaging service, thus before guaranteeing audio video synchronization It puts and ensure that video frame rate with trying one's best.
As a kind of optional scheme, global synchronization ginseng is updated according to the difference between present system time and play time Number includes:
S1 increases the value of the global synchronization parameter before update if difference is more than or equal to the 5th threshold value;
S2, if difference reduces the value of the global synchronization parameter before update less than the 5th threshold value.
Optionally, if the difference of difference and the 5th threshold value is bigger in the present embodiment, to the global synchronization parameter before update The increased numerical value of value institute it is bigger.
It optionally, may include in the present embodiment following to the control mode of the value of the global synchronization parameter before update At least one: it is directly changed the value of global synchronization parameter;Global synchronization parameter is gradually carried out to halve operation, until no longer going out The phenomenon that existing lock-out.
For example, in conjunction with shown in table 1, it is assumed that the 5th threshold value is -50000 microseconds, then when according to present system time and broadcasting Difference between time is that 100000 microseconds are greater than -50000 microseconds, then increases to the value of the global synchronization parameter before update Add, in order to realize saving decoding time, and is subsequent video number in this way, indicating that current video data frame lock-out degree is serious PTS being caught up with according to the output time of frame, possibility being provided, the degree for needing to be implemented frame-skipping will also increase.Concrete example explanation, for example, more The value of global synchronization parameter before new is 2, increases the value to 4, then the simultaneously operating needed to be implemented is by skipping in backsight The decoding of B frame in frequency data frame is revised as skipping the decoding to the B frame in rear video data frame and skip to current video The broadcasting of data frame.Conversely, if difference less than -50000 microsecond of the 5th threshold value, to the value of the global synchronization parameter before update Reduced.Concrete example explanation reduces the value to 2, then needs for example, the value of the global synchronization parameter before updating is 4 The simultaneously operating of execution broadcasts current video data frame by skipping the decoding to the B frame in rear video data frame and skipping Put the decoding for being revised as skipping to the B frame in rear video data frame.
By embodiment provided by the present application, by judging the variation tendency of step-out degree, phase is executed to video data frame Corresponding simultaneously operating substantially improves user and plays experience.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation The method of example can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but it is very much In the case of the former be more preferably embodiment.Based on this understanding, technical solution of the present invention is substantially in other words to existing The part that technology contributes can be embodied in the form of software products, which is stored in a storage In medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, calculate Machine, server or network equipment etc.) execute method described in each embodiment of the present invention.
Embodiment 2
According to embodiments of the present invention, additionally provide it is a kind of for implementing the video synchronization device of above-mentioned video synchronization method, As shown in fig. 6, the device includes:
(1) first acquisition unit 602, for obtain to current video data frame complete decode when present system time with And the preset play time for playing current video data frame;
Optionally, in the present embodiment, above-mentioned video synchronization method can be applied in media player, optionally, this Video synchronization method in embodiment also can be applied to audio sync, alternatively, the audio synchronization method in the present embodiment can be with Using synchronization scheme in the prior art, the application is not limited this.
Optionally, in the present embodiment, video data frame includes but is not limited to: B frame, wherein including the above-mentioned frame including B Multiple video data frames constitute a GOP (Group Of Pictures, image collection) frame set, wherein GOP frame set Refer in video data frame sequence from a key frame (or also referred to as I frame) to all frame set next key frame. Further, B frame is bi-directional predicted frames, and bi-directional predicted frames are exactly both with reference to the former frame on this frame time, referring also to this A later frame on one frame time.Optionally, a frame in the present embodiment can indicate piece image.
For example, Fig. 2 shows in media player multiple continuous video data frame F1, F2, F3, F4, F5, F6, F7, F8, wherein F1, F2, F3, F4 belong to the first GOP frame set, and F5, F6, F7, F8 belong to the 2nd GOP frame set, F2, F4, F8 For B frame.Assuming that F1 is current video data frame, then F2, F3, F4 are to be located at current video data frame F1 in the first GOP frame set Later in rear video data frame, F2-F8 is after F1 in rear video data frame, other situations and so on, this implementation Details are not described herein for example.
(2) updating unit 604, for updating global synchronization ginseng according to the difference between present system time and play time Number, obtains updated global synchronization parameter;
Optionally, in the present embodiment difference between present system time and play time with positive and negative attribute, If above-mentioned difference is positive number, represents present system time T0 and have already fallen behind in preset play time PTS, need to take and lose The tactful video data frame to avoid displaying " out-of-date " such as abandoning, frame-skipping;Conversely, it is leading or be equal to pre- then to represent present system time If broadcasting current video data frame broadcasting when PTS, need to wait until can show the video after reaching play time PTS Data frame.
Optionally, global synchronization parameter in the present embodiment can be, but not limited to be identified with score, and above-mentioned score can To there is a value range, for example, minimum value is 0, maximum value 30.Purpose in such a way is, total score 0, Then indicate that current media player without using any discarding or frame-skipping strategy, waits until reaching preset broadcasting works as forward sight The play time PTS of frequency data frame.And due to centainly needing waiting, (otherwise video data can be demonstrated earlier than PTS, equally It is also nonsynchronous performance), so logically global synchronization parameter is negative without in all senses.Correspondingly, working as above-mentioned point Number forward direction values arrive maximum value when, then can indicate that current video seriously loses synchronization, need to carry out immediately frame-skipping etc. handle. That is, in the present embodiment, the bigger step-out journey for indicating the global synchronization parameter instruction of the value of global synchronization parameter It spends bigger.It should be noted that between the step-out degree that the value and global synchronization parameter of above-mentioned global synchronization parameter indicate Corresponding relationship is only a kind of example, and the application can also indicate above-mentioned relation by other means, for example, global synchronization parameter The smaller step-out degree for indicating global synchronization parameter instruction of value it is bigger, the application does not limit this.
It optionally, in the present embodiment, can be corresponding according to the setting of the difference between present system time and play time Global synchronization parameter update threshold value, for example, table 3 shows difference between present system time and play time and global A kind of corresponding relationship of the update threshold value of synchronization parameter.Wherein, time difference (1 second=1000000 microsecond) as unit of microsecond. It is understood that corresponding relationship shown in table 3 is a kind of example, other corresponding passes are set also according to actual demand System, for example, the big of update threshold value corresponding to the time difference range and different difference ranges different from table 3 can be set Small, the application does not limit this.
Table 3
(Delta=T0-PTS) time difference The update threshold value of global synchronization parameter
Delta >=200000 +20
2000000 > Delta >=1000000 +15
1000000 > Delta >=500000 +5
500000 > Delta >=- 500000 0
-500000>Delta -5
Optionally, it based on corresponding relationship shown in above-mentioned table 3, is calculating between present system time and play time Difference after, global synchronization parameter is updated according to the difference corresponding update threshold value, is obtained updated global same Walk parameter.
Optionally, in the present embodiment, the simultaneously operating of the corresponding video data frame of global synchronization parameter can with but it is unlimited Shown in following table 4 control parameter collection indicates, wherein the parameter that above-mentioned control parameter is concentrated includes but is not limited to: being used for Indicate skip in the present image set GOP where current video data frame be located at current video data frame after in backsight The decoded control parameter (SKIP_GOP) of frequency data frame is used to indicate the decoding skipped to the B frame in rear video data frame Control parameter (SKIP_B_FRAME), be used to indicate the ring skipped in the video decoding operation that rear video data frame carries out The control parameter (SKIP_DEBLOCKING) of road filtering operation is used to indicate the control for skipping the broadcasting to current video data frame Parameter (SKIP_FRAME) processed.
As shown in table 4, the global synchronization parameter in table 3 is identified with S, and the step-out degree of global synchronization parameter instruction is marked with L Know, for indicating the step-out degree of current video, the numerical value for losing synchronous L is bigger, and it is bigger that expression loses synchronous degree.
Table 4
It is understood that corresponding relationship shown in table 4 is a kind of example, it is arranged also according to actual demand other Corresponding relationship, for example, the global synchronization parameter area different from table 4 and different global synchronization parameter area institutes can be set The selection of corresponding step-out degree and control parameter, the application do not limit this.
(3) second acquisition unit 606, for obtaining simultaneously operating corresponding with updated global synchronization parameter;
Optionally, simultaneously operating in the present embodiment includes at least one of: being skipped to current video data frame It plays;Skip the decoding to the B frame in rear video data frame after current video data frame;It skips in rear video data The loop filtering operation in video decoding operation that frame carries out;It skips to the present image set where current video data frame The decoding in rear video data frame being located at after current video data frame in GOP;Skip current video data frame.
For example, in conjunction with shown in table 3- table 4, it is assumed that the initial value of global synchronization parameter is 0, and current video data frame completes solution The difference between present system time T0 and the preset play time PTS for playing current video data frame when code is 500000 Microsecond, then as shown in Table 3, the update threshold value of corresponding global synchronization parameter are+5, that is, update the value of global synchronization parameter It is 5, further, as shown in Table 4, the corresponding step-out degree of current video data frame is 2, then corresponding simultaneously operating is to skip pair The decoding of the B frame in rear video data frame after current video data frame.
(4) synchronization unit 608, for executing simultaneously operating in rear video data frame to after current video data frame, To reduce to the present system time and preset broadcasting completed in rear video data frame when decoding in rear video data frame Difference between play time.
Optionally, simultaneously operating in the present embodiment be used for reduces to it is described rear video data frame complete decoding when The difference of present system time and preset broadcasting between the play time of rear video data frame.
For example, still combining above-mentioned example, updated when according to the difference between present system time T0 and play time PTS Global synchronization parameter S is known that the corresponding step-out degree of current video data frame is 2 according to global synchronization parameter S, is jumped Frame.Further, as shown in Table 4, step-out degree be 2 when, should execute to after current video data frame in rear video data Frame executes the decoded simultaneously operating for skipping B frame.
By embodiment provided by the present application, when completing current system when decoding to current video data frame by obtaining Between and it is preset play current video data frame play time between difference, obtain updated global synchronization parameter, Wherein, global synchronization parameter is for whether measuring current synchronization or step-out (or lock-out) and its severity, and benefit Simultaneously operating is executed in rear video data frame to after current video data frame with updated global synchronization parameter, to reduce To the present system time and preset broadcasting completed in rear video data frame when decoding in the broadcasting of rear video data frame Between between difference, to ensure that video frame rate with trying one's best under the premise of guaranteeing audio video synchronization, improve due to Video breaking phenomenon caused by the factors such as system resource.
As a kind of optional scheme, as shown in fig. 7, second acquisition unit 606 includes:
(1) first obtains module 702, before the step-out degree for global synchronization parameter instruction in the updated is greater than update The instruction of global synchronization parameter step-out degree when, obtain corresponding with updated global synchronization parameter simultaneously operating, wherein The simultaneously operating of above-mentioned acquisition meets the following conditions: execute that the simultaneously operating of above-mentioned acquisition reduced in rear video data frame The time being decoded be greater than execute with the corresponding first simultaneously operating of global synchronization parameter before update reduced to rear The time that video data frame is decoded.
For example, as shown in Fig. 2, multiple continuous video data frames in media player be F1, F2, F3, F4, F5, F6, F7, F8, wherein F1, F2, F3, F4 belong to the first GOP frame set, and F5, F6, F7, F8 belong to the 2nd GOP frame set, F2, F4, F8 For B frame;Assuming that F1 is current video data frame, then F2, F3, F4 are to be located at current video data frame F1 in the first GOP frame set Later in rear video data frame, F2-F8 is after F1 in rear video data frame, other situations and so on, this implementation Details are not described herein for example.
It is assumed that when playing to video data frame F1, according to the difference between present system time T1 and play time PTS1 The value of global synchronization parameter S is updated 5 by value, and corresponding step-out degree is 2, then is executed posterior to current video data frame F1 Video data frame executes the simultaneously operating for skipping B frame.For example, as shown in figure 3, then needing to skip to after video data frame F1 The decoding of B frame F2, optionally, for B frame F4, then need to determine again after the step-out degree for judging video data frame F3 be It is no to skip, optionally, for B frame F8, then need to decide whether to jump again after the step-out degree for judging video data frame F7 It crosses.
It is assumed that when playing to video data frame F3, according to the difference between present system time T3 and play time PTS3 The value of global synchronization parameter S known to value updates 12, and corresponding step-out degree is 3, then updated global synchronization parameter S instruction Step-out degree 3 be greater than update before global synchronization parameter S instruction step-out degree 2, in this way indicate video step-out it is tighter Weight, need to be further reduced rear video data frame decoding time and/or skip the broadcasting of current video data frame.That is, obtaining The simultaneously operating corresponding with updated global synchronization parameter taken meets the following conditions: executing the simultaneously operating institute of above-mentioned acquisition That reduces is corresponding to the global synchronization parameter before the time that rear video data frame is decoded is greater than execution and updates first Simultaneously operating reduced to the time being decoded in rear video data frame.For example, as shown in Table 4, should execute skip to The decoding of B frame in rear video data frame and skip broadcasting to current video data frame.For example, as shown in figure 4, video counts Also it is B frame according to the video data frame F4 after frame F3, then skips the decoding to B frame F4, and skips to current video data frame F3 Broadcasting.
By embodiment provided by the present application, the step-out degree of updated global synchronization parameter instruction is learnt by comparing Greater than the step-out degree of the global synchronization parameter instruction before update, it is known that step-out degree increases, and then executes to video data frame Corresponding simultaneously operating.In this way, the variation tendency by judging step-out degree, executes corresponding synchronous behaviour to video data frame Make, substantially improves user and play experience.
As a kind of optional scheme, as shown in fig. 7, second acquisition unit 606 further include:
(1) second obtains module 704, before the step-out degree for global synchronization parameter instruction in the updated is less than update The instruction of global synchronization parameter step-out degree when, obtain corresponding with updated global synchronization parameter simultaneously operating, wherein The simultaneously operating of above-mentioned acquisition meets the following conditions: execute that the simultaneously operating of above-mentioned acquisition reduced in rear video data frame The time being decoded be less than execute with the corresponding first simultaneously operating of global synchronization parameter before update reduced to rear The time that video data frame is decoded.
It is assumed that as shown in Fig. 2, multiple continuous video data frames in media player be F1, F2, F3, F4, F5, F6, F7, F8, wherein F1, F2, F3, F4 belong to the first GOP frame set, and F5, F6, F7, F8 belong to the 2nd GOP frame set, F2, F4, F8 For B frame.Assuming that F1 is current video data frame, then F2, F3, F4 are to be located at current video data frame F1 in the first GOP frame set Later in rear video data frame, F2-F8 is after F1 in rear video data frame, other situations and so on, this implementation Details are not described herein for example.
Based on above-mentioned example, it is assumed that after playing video data frame F1, F3, when playing to video data frame F5, The difference between the present system time T5 and play time PTS5 when decoding is completed according to video data frame F5 by global synchronization The value of parameter S is updated to 6, and corresponding step-out degree is 2, then executes to the posterior video data frame of current video data frame F5 Execute the simultaneously operating for skipping B frame.The step-out degree 2 of global synchronization parameter S instruction updated compared to video data frame F5 Less than the step-out degree 3 of the global synchronization parameter S instruction before update, then it represents that the step-out of video makes moderate progress than before, in this way The simultaneously operating corresponding with updated global synchronization parameter obtained can satisfy the following conditions: execute the synchronous of above-mentioned acquisition Operation is reduced corresponding with the global synchronization parameter before updating to execution is less than in the time that rear video data frame is decoded First simultaneously operating reduced to the time being decoded in rear video data frame.For example, as shown in table 4, execution it is same Step is operated from " execution skips the decoding to the B frame in rear video data frame and skips the broadcasting to current video data frame ", It is changed to " execute and the decoded of B frame is skipped to the execution of current video data frame F5 posterior video data frame " simultaneously operating.Into one Step, it is assumed that when playing to video data frame F6, the step-out degree of updated global synchronization parameter S instruction, which is less than, updates forward sight The step-out degree of frequency data frame F5 corresponding global synchronization parameter S instruction, then can will be to the posterior view of current video data frame F6 The simultaneously operating that B frame is skipped in the execution of frequency data frame is also cancelled, i.e., no longer carries out skipping decoding or skip the simultaneously operating of broadcasting.
By embodiment provided by the present application, the step-out degree by comparing the instruction of updated global synchronization parameter is less than The step-out degree of global synchronization parameter instruction before update, it is known that step-out degree reduces, and then executes to video data frame corresponding Simultaneously operating.In this way, the variation tendency by judging step-out degree, executes corresponding simultaneously operating to video data frame, It substantially improves user and plays experience.
As a kind of optional scheme, synchronization unit 608 includes skipping module, skips module for executing following at least one Kind operation:
(1) decoding to the B frame in rear video data frame is skipped;
Optionally, the decoding for skipping the B frame in rear video data frame in the present embodiment, the purpose is to: B frame is used for Bi-directional predicted, the time can not only be saved by skipping decoding B frame, for subsequent video data the output time catch up with that PTS provides can Can, and the decoding of other video data frames will not be affected.
(2) it skips to the loop filtering operation in the video decoding operation that rear video data frame carries out;
Optionally, in the present embodiment in the video decoding operation that rear video data frame carries out loop filtering grasp Make, the purpose is to: skipping the loop filtering link in video decoding process equally may be implemented to save decoding time, and be subsequent The output time of video data frame catches up with PTS offer may.
(3) it skips and is located at after current video data frame in the present image set GOP where current video data frame The decoding in rear video data frame.
Optionally, in the present embodiment current to being located in the present image set GOP where current video data frame The decoding in rear video data frame after video data frame.The purpose is to: remaining data in GOP are abandoned, in this way, can save Save a large amount of decoding time, and when for the output of next synchronous point (the I frame or key frame of i.e. next GOP beginning) data Between catch up with PTS provide may.
Optionally, it directly executes and skips in GOP frame set in current video data in GOP frame set in the present embodiment The decoding in rear video data frame after frame is skipped without judging whether to execute again to the B frame in rear video data frame Decoding, or skip to the loop filtering operation in the video decoding operation that rear video data frame carries out.In other words, as long as Included in GOP set, and it is located at the video data frame after current video data frame, will executes and skip decoded behaviour Make.
For example, it is assumed that as shown in figure 5, in the 2nd GOP frame set of present image set include video data frame F5, F6, F7, F8, wherein video data frame F5 is current video data frame, if step-out degree indicated by global synchronization parameter S meets item Part, then execute skip in the present image set GOP where current video data frame F5 be located at current video data frame F5 it The decoding in rear video data frame afterwards, that is, video data frame F6, F7, the F8 being to skip in present image set GOP.
Optionally, it may also include in the present embodiment and skip current video data frame, the purpose is to: it abandons already " out-of-date " Data, prevent image from losing due logic corresponding relationship.Furthermore it is possible to save the system time of image rendering needs, be Subsequent improvement audio-visual synchronization provides may.
By embodiment provided by the present application, implements dynamic on the policy grounds of simple " non-camp is to abandon " and adjust It is whole, it is handled by single discarding, frame-skipping and is changed to skip decoding B frame, skips loop filtering, skip current video data frame until jumping Remaining frame is crossed in current GOP frame set to realize target that is stepped, damaging service, thus before guaranteeing audio video synchronization It puts and ensure that video frame rate with trying one's best.
As a kind of optional scheme, skipping module includes following one:
(1) first skips submodule, for when global synchronization parameter is more than or equal to first threshold and is less than second threshold When, skip the decoding to the B frame in rear video data frame;
Optionally, the bigger step-out for indicating the instruction of global synchronization parameter of the value of global synchronization parameter in the present embodiment Degree is bigger.
For example, in conjunction with shown in table 4, it is assumed that the first threshold of global synchronization parameter is 5, second threshold 10, then by current Video data frame is 6 according to the corresponding global synchronization parameter S of difference between present system time and play time, judgement It knows more than or equal to first threshold 5 and is less than second threshold 10, then execute the solution skipped to the B frame in rear video data frame Code.
(2) second skip submodule, for when global synchronization parameter is more than or equal to second threshold and is less than third threshold value When, it skips the decoding to the B frame in rear video data frame and skips the broadcasting to current video data frame;
For example, in conjunction with shown in table 4, it is assumed that the second threshold of global synchronization parameter is 10, and third threshold value is 15, then by current Video data frame is 12 according to the corresponding global synchronization parameter S of difference between present system time and play time, is sentenced More than or equal to second threshold 10 and less than third threshold value 15 known to disconnected, then execute and skip to the B frame in rear video data frame It decodes and skips the broadcasting to current video data frame.
(3) third skips submodule, for being more than or equal to third threshold value and less than the 4th threshold value when global synchronization parameter When, skip in the decoding of the B frame in rear video data frame, skip in the video decoding operation that rear video data frame carries out Loop filtering operation and skip broadcasting to current video data frame;
For example, in conjunction with shown in table 4, it is assumed that the third threshold value of global synchronization parameter is 15, and the 4th threshold value is 20, then by current Video data frame is 18 according to the corresponding global synchronization parameter S of difference between present system time and play time, is sentenced More than or equal to third threshold value 15 and less than the 4th threshold value 20 known to disconnected, then execute and skip to the B frame in rear video data frame It decodes, skip to the loop filtering operation in the video decoding operation that rear video data frame carries out and skip to current video The broadcasting of data frame.
(4) submodule is crossed in the forth jump, for skipping to current video when global synchronization parameter is more than or equal to four threshold values The broadcasting of data frame and skip in the present image set GOP where current video data frame be located at current video data frame The decoding in rear video data frame later;
For example, in conjunction with shown in table 4, it is assumed that the 4th threshold value of global synchronization parameter is 20, then by current video data frame root It is 25 according to corresponding global synchronization parameter S known to the difference between present system time and play time, be greater than known to judgement etc. In the 4th threshold value, then executes and skip the broadcasting to current video data frame and skip to current where current video data frame The decoding in rear video data frame being located at after current video data frame in image collection GOP.
By embodiment provided by the present application, implements dynamic on the policy grounds of simple " non-camp is to abandon " and adjust It is whole, it is handled by single discarding, frame-skipping and is changed to skip decoding B frame, skips loop filtering, skip current video data frame until jumping Remaining frame is crossed in current GOP frame set to realize target that is stepped, damaging service, thus before guaranteeing audio video synchronization It puts and ensure that video frame rate with trying one's best.
As a kind of optional scheme, updating unit 604 includes:
(1) first update module is used for when difference is more than or equal to five threshold values, to the global synchronization parameter before update Value is increased;
(2) second update modules are used for when difference is less than five threshold values, to the value of the global synchronization parameter before update Reduced.
Optionally, if the difference of difference and the 5th threshold value is bigger in the present embodiment, to the global synchronization parameter before update The increased numerical value of value institute it is bigger.
It optionally, can include in the present embodiment following to the control mode of the value of the global synchronization parameter before update At least one: it is directly changed the value of global synchronization parameter;Global synchronization parameter is gradually carried out to halve operation, until no longer going out The phenomenon that existing lock-out.
For example, in conjunction with shown in table 3, it is assumed that the 5th threshold value is -50000 microseconds, then when according to present system time and broadcasting Difference between time is that 100000 microseconds are greater than -50000 microseconds, then increases to the value of the global synchronization parameter before update Add, in order to realize saving decoding time, and is subsequent video number in this way, indicating that current video data frame lock-out degree is serious PTS being caught up with according to the output time of frame, possibility being provided, the degree for needing to be implemented frame-skipping will also increase.Concrete example explanation, for example, more The value of global synchronization parameter before new is 2, increases the value to 4, then the simultaneously operating needed to be implemented is by skipping in backsight The decoding of B frame in frequency data frame is revised as skipping the decoding to the B frame in rear video data frame and skip to current video The broadcasting of data frame.Conversely, if difference less than -50000 microsecond of the 5th threshold value, to the value of the global synchronization parameter before update Reduced.Concrete example explanation reduces the value to 2, then needs for example, the value of the global synchronization parameter before updating is 4 The simultaneously operating of execution broadcasts current video data frame by skipping the decoding to the B frame in rear video data frame and skipping Put the decoding for being revised as skipping to the B frame in rear video data frame.
By embodiment provided by the present application, by judging the variation tendency of step-out degree, phase is executed to video data frame Corresponding simultaneously operating substantially improves user and plays experience.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
In the above embodiment of the invention, it all emphasizes particularly on different fields to the description of each embodiment, does not have in some embodiment The part of detailed description, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed client, it can be by others side Formula is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of the unit, and only one Kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or It is desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed it is mutual it Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of unit or module It connects, can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words It embodies, which is stored in a storage medium, including some instructions are used so that a computer Equipment (can for personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or Part steps.And storage medium above-mentioned includes: that USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic or disk etc. be various to can store program code Medium.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (11)

1. a kind of video synchronization method characterized by comprising
Obtain the present system time and the preset broadcasting current video number completed when decoding to current video data frame According to the play time of frame;
Global synchronization parameter is updated according to the difference between the present system time and the play time, is obtained updated Global synchronization parameter;
Obtain simultaneously operating corresponding with the updated global synchronization parameter;
The simultaneously operating is executed in rear video data frame to after the current video data frame, to reduce to described rear Video data frame completes the play time described in present system time and preset broadcasting when decoding in rear video data frame Between difference;
Described includes following one in the rear video data frame execution simultaneously operating to described:
When the global synchronization parameter is more than or equal to first threshold and is less than second threshold, skip to described in backsight frequency According to the decoding of the B frame in frame;
When the global synchronization parameter is more than or equal to the second threshold and is less than third threshold value, skip to described in backsight The decoding of B frame in frequency data frame and skip broadcasting to the current video data frame;
When the global synchronization parameter is more than or equal to the third threshold value and when less than four threshold values, skip to described in backsight The decoding of B frame in frequency data frame is skipped to the loop filtering in the video decoding operation that rear video data frame carries out It operates and skips the broadcasting to the current video data frame;
When the global synchronization parameter be more than or equal to four threshold value when, skip the broadcasting to the current video data frame, And skip in the present image set GOP where the current video data frame be located at current video data frame after described in In the decoding of rear video data frame.
2. the method according to claim 1, wherein the acquisition and the updated global synchronization parameter pair The simultaneously operating answered includes:
If the step-out degree of the updated global synchronization parameter instruction is greater than the mistake of the global synchronization parameter instruction before updating Step degree then obtains the simultaneously operating corresponding with the updated global synchronization parameter, wherein executes described synchronous grasp That makees to be reduced is greater than the global synchronization ginseng executed with before the update to the time being decoded in rear video data frame The corresponding first simultaneously operatings of number reduced to the time being decoded in rear video data frame.
3. the method according to claim 1, wherein the acquisition and the updated global synchronization parameter pair The simultaneously operating answered includes:
If the step-out degree of the updated global synchronization parameter instruction is less than the mistake of the global synchronization parameter instruction before updating Step degree then obtains the simultaneously operating corresponding with the updated global synchronization parameter, wherein executes described synchronous grasp That makees to be reduced is less than the global synchronization ginseng executed with before the update to the time being decoded in rear video data frame The corresponding first simultaneously operatings of number reduced to the time being decoded in rear video data frame.
4. the method according to claim 1, wherein the value of the global synchronization parameter is bigger to indicate described complete The step-out degree of office's synchronization parameter instruction is bigger.
5. the method according to claim 1, wherein described according to the present system time and when the broadcasting Between between difference update global synchronization parameter further include:
If the difference is more than or equal to the 5th threshold value, the value of the global synchronization parameter before update is increased;
If the difference is less than the 5th threshold value, the value of the global synchronization parameter before update is reduced.
6. according to the method described in claim 5, it is characterized in that, if the difference of the difference and the 5th threshold value is bigger, It is bigger to the increased numerical value of value institute of the global synchronization parameter before the update.
7. a kind of video synchronization device characterized by comprising
First acquisition unit is completed present system time when decoding to current video data frame and preset is broadcast for obtaining Put the play time of the current video data frame;
Updating unit, for updating global synchronization ginseng according to the difference between the present system time and the play time Number, obtains updated global synchronization parameter;
Second acquisition unit, for obtaining simultaneously operating corresponding with the updated global synchronization parameter;
Synchronization unit, for executing the simultaneously operating in rear video data frame to after the current video data frame, with Reduction is completed described in present system time and preset broadcasting when decoding in rear video data frame in backsight frequency to described According to the difference between the play time of frame;
The synchronization unit includes skipping module, and the module of skipping includes following one:
First skips submodule, for jumping when the global synchronization parameter is more than or equal to first threshold and is less than second threshold Cross the decoding of the B frame to described in rear video data frame;
Second skips submodule, for when the global synchronization parameter is more than or equal to the second threshold and is less than third threshold value When, it skips the decoding of the B frame to described in rear video data frame and skips the broadcasting to the current video data frame;
Third skips submodule, for being more than or equal to the third threshold value and less than the 4th threshold value when the global synchronization parameter When, it skips the decoding of the B frame to described in rear video data frame, skip to the video solution carried out in rear video data frame Loop filtering operation in code operation and skip broadcasting to the current video data frame;
Submodule is crossed in the forth jump, for skipping and working as to described when the global synchronization parameter is more than or equal to four threshold value It the broadcasting of preceding video data frame and skips current to being located in the present image set GOP where the current video data frame The decoding in rear video data frame after video data frame.
8. device according to claim 7, which is characterized in that the second acquisition unit includes:
First obtains module, for being greater than the overall situation before updating in the step-out degree of the updated global synchronization parameter instruction When the step-out degree of synchronization parameter instruction, the simultaneously operating corresponding with the updated global synchronization parameter is obtained, In, execute that the simultaneously operating reduced the time being decoded in rear video data frame is greater than execute with it is described more The corresponding first simultaneously operating of global synchronization parameter before new reduced to described when rear video data frame is decoded Between.
9. device according to claim 7, which is characterized in that the second acquisition unit includes:
Second obtains module, for being less than the overall situation before updating in the step-out degree of the updated global synchronization parameter instruction When the step-out degree of synchronization parameter instruction, the simultaneously operating corresponding with the updated global synchronization parameter is obtained, In, execute that the simultaneously operating reduced the time being decoded in rear video data frame is less than execute with it is described more The corresponding first simultaneously operating of global synchronization parameter before new reduced to described when rear video data frame is decoded Between.
10. device according to claim 7, which is characterized in that described in the bigger expression of value of the global synchronization parameter The step-out degree of global synchronization parameter instruction is bigger.
11. device according to claim 7, which is characterized in that the updating unit includes:
First update module is used for when the difference is more than or equal to five threshold values, to taking for the global synchronization parameter before update Value is increased;
Second update module is used for when the difference is less than five threshold value, to taking for the global synchronization parameter before update Value is reduced.
CN201410171896.XA 2014-04-25 2014-04-25 video synchronization method and device Active CN104822008B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410171896.XA CN104822008B (en) 2014-04-25 2014-04-25 video synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410171896.XA CN104822008B (en) 2014-04-25 2014-04-25 video synchronization method and device

Publications (2)

Publication Number Publication Date
CN104822008A CN104822008A (en) 2015-08-05
CN104822008B true CN104822008B (en) 2019-01-08

Family

ID=53732165

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410171896.XA Active CN104822008B (en) 2014-04-25 2014-04-25 video synchronization method and device

Country Status (1)

Country Link
CN (1) CN104822008B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105262950B (en) * 2015-10-15 2018-08-17 广州市百果园网络科技有限公司 A kind of method and apparatus generating video information
CN106792154B (en) * 2016-12-02 2020-02-11 广东赛特斯信息科技有限公司 Frame skipping synchronization system of video player and control method thereof
CN106817614B (en) * 2017-01-20 2020-08-04 浙江瑞华康源科技有限公司 Audio and video frame loss device and method
CN109391585B (en) * 2017-08-03 2021-06-11 杭州海康威视数字技术股份有限公司 Video data processing method, device, terminal and computer readable storage medium
CN108063973A (en) * 2017-12-14 2018-05-22 浙江大华技术股份有限公司 A kind of method for decoding video stream and equipment
CN110430445B (en) * 2019-06-26 2021-12-10 深圳拙河科技有限公司 Video synchronous playing method, device, equipment and medium
CN110435880B (en) * 2019-08-12 2022-07-29 深圳市道通智能航空技术股份有限公司 Data acquisition method, unmanned aerial vehicle and storage medium
CN113225598B (en) * 2021-05-07 2023-01-20 上海一谈网络科技有限公司 Method, device and equipment for synchronizing audio and video of mobile terminal and storage medium
CN114245453B (en) * 2021-12-27 2023-10-13 东莞市阿尔法电子科技有限公司 Time synchronization method, device, TWS earphone, computer equipment and storage medium
CN115665483B (en) * 2022-12-27 2023-03-31 北京蓝色星际科技股份有限公司 Video playing method and device and hard disk video recorder

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7130316B2 (en) * 2001-04-11 2006-10-31 Ati Technologies, Inc. System for frame based audio synchronization and method thereof
CN1859567A (en) * 2006-03-07 2006-11-08 华为技术有限公司 Digital TV decoding method and system
CN101778269A (en) * 2009-01-14 2010-07-14 扬智电子(上海)有限公司 Synchronization method of audio/video frames of set top box
CN102685507A (en) * 2011-07-12 2012-09-19 天脉聚源(北京)传媒科技有限公司 Audio and video synchronization method and system for decoding moving picture experts group-2 (MPEG-2) transport streams

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7471337B2 (en) * 2004-06-09 2008-12-30 Lsi Corporation Method of audio-video synchronization
CN101466045B (en) * 2007-12-20 2011-03-16 上海奇码数字信息有限公司 Adaptive decoding synchronous device, synchronous method as well as video decoding and displaying system
CN101710997A (en) * 2009-11-04 2010-05-19 中兴通讯股份有限公司 MPEG-2 (Moving Picture Experts Group-2) system based method and system for realizing video and audio synchronization
JP5489675B2 (en) * 2009-11-27 2014-05-14 三菱電機株式会社 Video information playback method and system, and video information content
CN102075803B (en) * 2010-12-22 2013-08-14 Tcl通力电子(惠州)有限公司 Method for synchronously playing video and audio
CN102547299A (en) * 2010-12-30 2012-07-04 福建星网视易信息系统有限公司 Audio and video synchronous control method based on moving picture experts group (MPEG)-2
JP2012147127A (en) * 2011-01-07 2012-08-02 Sony Corp Image processing apparatus and method
CN102368823A (en) * 2011-06-28 2012-03-07 上海盈方微电子有限公司 Video framedropping strategy based on grading mechanism
CN103310820B (en) * 2012-03-14 2016-03-09 三星电子(中国)研发中心 A kind of method that multimedia player is optimized

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7130316B2 (en) * 2001-04-11 2006-10-31 Ati Technologies, Inc. System for frame based audio synchronization and method thereof
CN1859567A (en) * 2006-03-07 2006-11-08 华为技术有限公司 Digital TV decoding method and system
CN101778269A (en) * 2009-01-14 2010-07-14 扬智电子(上海)有限公司 Synchronization method of audio/video frames of set top box
CN102685507A (en) * 2011-07-12 2012-09-19 天脉聚源(北京)传媒科技有限公司 Audio and video synchronization method and system for decoding moving picture experts group-2 (MPEG-2) transport streams

Also Published As

Publication number Publication date
CN104822008A (en) 2015-08-05

Similar Documents

Publication Publication Date Title
CN104822008B (en) video synchronization method and device
CN107659825B (en) A kind of method, apparatus, server, main broadcaster end and medium that live video is retained
CN104822074B (en) A kind of recommendation method and device of TV programme
CN110139148B (en) Video switching definition method and related device
CN106851044B (en) Video synchronous playback method and device
CN109168084A (en) A kind of method and apparatus of video clipping
KR20160010507A (en) Method and apparatus for processing video images
CN103529931A (en) Implementation method and system of individuation interfaces of intelligent equipment and intelligent equipment
CN105142031A (en) Method and device for displaying character information in barrage during video play
CN105472440B (en) The method for previewing and smart television of video program
CN106612452A (en) Audio-video synchronizing method and device of set top box
CN106658030B (en) A kind of playback method and equipment of the composite video comprising SCVF single channel voice frequency multi-channel video
CN104378662A (en) System and method for judging effective program watching of user for intelligent television
CN108310766A (en) Data processing method and device, storage medium, processor and terminal
CN111131874B (en) Method, equipment and computer storage medium for solving problem of playing jam of H.265 code stream random access point
CN104780448A (en) A time-period-based TV serial tracking method and system
CN106131671A (en) A kind of method and device regulating video definition
CN107370827A (en) The system of active push personalized service
CN109040830A (en) Prediction technique, switching method and the device of live play Caton
CN105376610B (en) A kind of video switching method and system based on picture recognition
CN108737874A (en) A kind of video broadcasting method and electronic equipment
CN105847946A (en) Screen transmission video processing method
WO2016141712A1 (en) Network set-top box and working method therefor
CN105872728A (en) Screen transfer video processing method for multi-screen interaction
CN103607605B (en) Data processing method and apparatus for audience rating statistics

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant