CN100437546C - Method for realizing audio-frequency and video frequency synchronization - Google Patents
Method for realizing audio-frequency and video frequency synchronization Download PDFInfo
- Publication number
- CN100437546C CN100437546C CNB2005100816218A CN200510081621A CN100437546C CN 100437546 C CN100437546 C CN 100437546C CN B2005100816218 A CNB2005100816218 A CN B2005100816218A CN 200510081621 A CN200510081621 A CN 200510081621A CN 100437546 C CN100437546 C CN 100437546C
- Authority
- CN
- China
- Prior art keywords
- thread
- synchronous
- duration
- playing
- video
- 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
Links
Images
Abstract
The invention discloses a method to achieve the synchrony of the audio frequency and the video frequency. The process includes: a. the audio/video player play the audio/video data and compute the playing time to judge if the time is same, if it is same, the process b. is operated or the process a. is operated repeat; b. the audio/video playing line returns to the process a. to run the next synchrony process after the video/audio playing line finishing this data. The invention adjusts the synchrony time of the audio frequency and the video frequency by the true time excursion movably, so it can control the synchrony time and save the cost.
Description
Technical field
The present invention relates to multimedia technology, refer to a kind of method that realizes that Voice ﹠ Video is synchronous especially.
Background technology
In today of multimedia technology high speed development, because multimedia play system need be taken into account decoding, broadcast and the complex operations such as synchronous of Voice ﹠ Video, so the handling property of the CPU of execution multimedia operations is had relatively high expectations.In the PC environment, because existing C PU performance improves constantly, the processing power of multimedia play system is perfect day by day, and multimedia just progressively becomes an indispensable part in people's life, the study and work.Along with portable terminal, as the appearance of portable small-sized electronic equipments such as smart mobile phone, PDA, people expect the perfection experience that this kind equipment also can provide multimedia to bring whenever and wherever possible.Be subjected to the influence of factors such as volume, cost, the cpu performance of mini-plants such as portable terminal can't be compared with PC, the equipment that this type of cpu performance is not high is called low performance equipment, how to realize on low performance equipment better that multimedia has become the focus that industry is paid close attention to.
In multimedia play system, the simultaneous techniques of Voice ﹠ Video is a very crucial technology, and it directly has influence on the quality of user experience.Present audio-visual synchronization is generally taked the precise synchronization method, if the audio frequency in certain section multi-medium data plays earlier, and corresponding with it video does not finish as yet, then skips the video data of not playing as yet, play-overs next section multi-medium data, and vice versa.What Fig. 1 showed is the process flow diagram of realizing the Voice ﹠ Video precise synchronization in the prior art, and this method may further comprise the steps:
Wherein, step 103 comprises the process of following two executed in parallel: voice playing process and video display process.
The process of A, voice playing specifically may further comprise the steps as shown in Figure 2:
The process of B, video playback specifically may further comprise the steps as shown in Figure 3:
Step 301, video playback thread obtain and the playing video data piece.
Step 302, after the described block of video data of step 301 finishes, multimedia player judges with this block of video data corresponding audio data block whether finish, if execution in step 304 then, otherwise execution in step 303.
Step 303, multimedia player are closed the voice playing thread to skip the voice data that does not play.
Step 304, multimedia player restart the voice playing thread, and return execution in step 301.
Find out that from step 103 the described precise synchronization method of prior art is all carried out a synchronous operation to Voice ﹠ Video when playing each data block, each synchronous operation meeting produces the expense of restarting that audio or video is play thread.On the enough fast PC of CPU, above-mentioned expense can not produce too many influence to the performance of multimedia play system, but for low performance equipments such as portable terminal, because its cpu performance can not show a candle to PC, so these expenses highlight immediately to the multimedia play system Effect on Performance.
In addition, even under the substantially identical situation of the Voice ﹠ Video data volume of in each synchronizing process, playing, because the broadcasting speed difference of Voice ﹠ Video also can cause certain reproduction time difference.If voice data is play very fast, video data can frequently be skipped because of precise synchronization, makes broadcasting pictures discontinuous thereby produce the ringing on video phenomenon; If video data is play very fast, frequent audio discontinuity problem will appear, influence the user to multimedia appreciation.For the Voice ﹠ Video data volume of each broadcast situation inequality, adopt precise synchronization more can cause the discontinuous phenomenon that audio or video is play.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of method that realizes that Voice ﹠ Video is synchronous, the system overhead that saving causes synchronously because of Voice ﹠ Video, when guaranteeing that Voice ﹠ Video serious step-out can not occur, make low performance equipment can realize the smooth playing of Voice ﹠ Video better.
For achieving the above object, technical scheme of the present invention specifically is achieved in that
A kind of method that realizes that Voice ﹠ Video is synchronous is characterized in that, this method may further comprise the steps:
A, voice playing thread and video playback thread enter broadcast state respectively, play the data of corresponding types, calculate the playing duration of this synchronizing process institute's playing audio-fequency data and video data respectively, and judge respectively whether described playing duration arrives synchronous duration, if there is one of them playing duration of playing thread to arrive synchronous duration earlier, execution in step b then, otherwise repeated execution of steps a;
Another this synchronizing process data playback of broadcast thread of broadcast thread waits that arrives synchronous duration in b, described voice playing thread and the video playback thread earlier finishes, and returns step a and carries out synchronizing process next time.
Before the step a, set in advance synchronous duration and the maximum out of alignment time that allows.
Further, judge described in the step a whether playing duration arrives being operating as of synchronous duration: after whenever playing the unit length data, carry out described judgement.
Further, the described broadcast thread that arrives synchronous duration earlier is the voice playing thread, the method of waiting for described in the step b is: voice playing thread oneself state is set to synchronous waiting status, and judgement video playback thread state of living in, if the video playback thread is in broadcast state, then described voice playing thread keeps synchronous waiting status, finishes until the video playback thread.
Further, the described broadcast thread that arrives synchronous duration earlier is the video playback thread, the method of waiting for described in the step b is: video playback thread oneself state is set to synchronous waiting status, and judgement voice playing thread state of living in, if the voice playing thread is in broadcast state, then described video playback thread keeps synchronous waiting status, finishes until the voice playing thread.
Further, describedly play the method that thread is set to synchronous waiting status and be: suspend described broadcast thread;
Or close described broadcast thread, then among the step b, before returning step a, this method further comprises: start the broadcast thread that is in synchronous waiting status.
Among the step b, before returning step a, this method further comprises: calculate two stand-by period of playing between the thread, and recomputate and be provided with the synchronous duration of synchronizing process next time according to stand-by period that is calculated and the predefined maximum out of alignment time that allows.
The described calculating method of the synchronous duration of synchronizing process next time is specially: the synchronous duration of this synchronizing process is taken advantage of maximum the long-pending divided by the stand-by period of out of alignment time that allow, obtain the synchronous duration of synchronizing process next time.
The described calculating method of the synchronous duration of synchronizing process next time further comprises: round under the merchant of synchronous duration divided by unit data piece playing duration with acquired synchronizing process next time, multiply by unit data piece playing duration again.
Further, two methods of playing the stand-by period between the thread of described calculating are:
B1, when the broadcast thread that arrives earlier synchronous duration in voice playing thread and the video playback thread is set to synchronous waiting status, zero-time waited in record;
B2, when the broadcast thread that arrives earlier synchronous duration in described voice playing thread and the video playback thread judges that another is play thread and is in synchronous waiting status, the concluding time waited in record;
B3, obtain the stand-by period by waiting for the concluding time and waiting for that zero-time is calculated.
Preferably, described voice playing thread or video playback thread are on portable terminal.
As seen from the above technical solution, the synchronous method of this realization Voice ﹠ Video of the present invention passes through to be provided with the synchronous duration greater than the unit data reproduction time, make multimedia player needn't carry out the synchronous operation that Voice ﹠ Video is play thread in the duration synchronously, promptly needn't all carry out one subsynchronous to each data block, reduce the synchronous operation frequency of multimedia play system, thereby save because the system overhead that synchronous operation brings.
On the other hand, this method is play under the nonsynchronous situation of thread at Voice ﹠ Video, carry out synchronous operation by the mode of playing the slow thread of fast thread wait broadcast, promptly needn't skip the audio/video data that does not play, guarantee that the broadcast of audio frequency and/or video is smooth more.On this basis, multimedia player is dynamically adjusted the synchronous duration of Voice ﹠ Video according to the real time drift, thereby guarantees that Voice ﹠ Video serious step-out can not occur.
Description of drawings
Fig. 1 is a process flow diagram of realizing the Voice ﹠ Video precise synchronization in the prior art;
Fig. 2 is the process flow diagram of prior art sound intermediate frequency playing process;
Fig. 3 is the process flow diagram of video display process in the prior art;
Fig. 4 realizes the synchronous process flow diagram of Voice ﹠ Video in a preferred embodiment of the present invention;
Fig. 5 is the process flow diagram of a preferred embodiment of the present invention sound intermediate frequency playing process;
Fig. 6 is the process flow diagram of video display process in a preferred embodiment of the present invention.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
Fig. 4 is that multimedia player is realized the synchronous method flow diagram of Voice ﹠ Video in the present embodiment, and described multimedia player preestablishes synchronous duration iSyncTime and maximum time drift iDeltaTime.This method specifically may further comprise the steps:
Described unit data piece playing duration iUnitTime is used to weigh the size of audio/video data piece, supposes that unit data piece playing duration iUnitTime is 6 seconds, and then the data volume of each audio/video data piece is 6 seconds.
In this step, the voice playing thread is used to play the voice data that is obtained, and the video playback thread is used to play the video data that is obtained, these two independent, the concurrent workings of broadcast thread.
(1) voice playing thread playing audio-fequency data and the process of carrying out synchronous operation are specifically carried out as follows as shown in Figure 5:
In step 501 and 502, the voice playing thread is the unit length playing audio-fequency data with the piece.Because duration is traditionally arranged to be the integral multiple of unit data piece playing duration iUnitTime synchronously, suppose that unit data piece playing duration iUnitTime is 6 seconds, duration is 24 seconds synchronously, then in synchronizing process, the voice playing thread can be play four audio data blocks continuously, whenever play the unit length voice data, just once judge whether arriving synchronous duration.
Described synchronous waiting status is meant that thread is in time-out or pent duty.The voice playing thread that is in synchronous waiting status can first break-off, still is in synchronous waiting status if surpass certain hour, and multimedia player will be closed the voice playing thread.
Zero-time WT1 waited in step 504, voice playing thread record, and be in synchronous waiting status and wait for that this synchronizing process finishes.
Step 505, voice playing thread register system current time are used to calculate stand-by period iWaitTime as waiting for concluding time WT2.After multimedia player is adjusted synchronous duration iSyncTime according to stand-by period iWaitTime, restart Voice ﹠ Video and play thread, and return step 501 and carry out synchronizing process next time.
Because Voice ﹠ Video is play thread parallel work, the video playback thread has been in synchronous waiting status when carrying out this step in whole synchronizing process, so multimedia player has recorded the wait zero-time WT1 when the video playback thread enters synchronous waiting status.
Described stand-by period iWaitTime waits for the poor of zero-time WT1 for waiting for that concluding time WT2 deducts, and multimedia player calculates and reset synchronous duration iSyncTime according to formula (1) or (2).
In formula (1) and formula (2), the iSyncTime on equation the right is the synchronous duration of this synchronizing process, and the iSyncTime on the equation left side is the synchronous duration of next synchronizing process.Formula (2) is to round after the synchronous duration of next synchronizing process that formula (1) is calculated removes with unit data piece playing duration iUnitTime, again the result be multiply by unit data piece playing duration iUnitTime, thereby the synchronous duration that guarantees next synchronizing process is the integral multiple of unit data piece playing duration iUnitTime.Wherein, symbol
Round under the expression.
When stand-by period iWaitTime drifts about iDeltaTime greater than the maximum time of appointment, show that the real time drift surpasses permissible value, multimedia player will reduce synchronous duration iSyncTime to strengthen the frequency of synchronous operation, avoid producing serious step-out, otherwise increase synchronous duration iSyncTime.
By the method for above-mentioned dynamic adjustment, multimedia player is controlled at the drift of the out of alignment time between voice playing thread and the video playback thread in the specified scope, realizes the weak synchronous of audio frequency and video.
(2) video playback thread playing video data and the process of carrying out synchronous operation are specifically carried out as followsly as shown in Figure 6, and this process is identical with process ():
Zero-time WT1 waited in step 604, video playback thread record, and be in synchronous waiting status and wait for that this synchronizing process finishes.
From step 403 as can be seen, multimedia player is that unit carries out synchronous operation with synchronous duration iSyncTime, and dynamically adjusts synchronous duration iSyncTime by record stand-by period iWaitTime.In synchronous duration iSyncTime, audio/video is play thread can play a plurality of audio/video data pieces continuously, has only when the accumulative total playing duration of any thread and just carries out synchronous processing more than or equal to duration iSyncTime synchronously the time.The playing duration of supposing audio data block A1 is Ta1, and the playing duration of corresponding block of video data V1 is Tv1, and the playing duration of audio data block A2 is Ta2, and the playing duration of corresponding block of video data V2 is Tv2.Greater than Tv1, under the situation of Ta2 less than Tv2,, need carry out twice synchronous operation at Ta1, and Voice ﹠ Video is play all and can be abandoned jumping phenomena of appearance because of data if use the precise synchronization method of prior art.Adopt method for synchronous of the present invention, be not less than MAX (Ta1+Ta2, Tv1+Tv2), said process need be carried out a synchronous operation at most, so reduced the synchronous operation frequency, saves system overhead by synchronous duration iSyncTime is set.If (Ta1-Tv1 Tv2-Ta1) greater than ABS (Ta1+Ta2-Tv1-Tv2), then uses the method for the invention to realize when synchronous to MAX, and the broadcast of Voice ﹠ Video will be smooth more.In addition, on most of portable terminals, because clock accuracy is difficult to really realize precise synchronization inadequately, and the influence of using the method for the invention can offset clock accuracy reaches better synchronous effect.
In view of this, this method for synchronous can be applied on the low performance equipment such as portable terminal preferably, and the CPU that alleviates the said equipment handles burden, and this kind equipment is experienced for the perfection that the user provides multimedia to bring better.
By the above embodiments as seen, the synchronous operation time that the synchronous method of this realization Voice ﹠ Video of the present invention is passed through the control multimedia play system, and by the dynamic synchronous duration of adjusting Voice ﹠ Video of real time drift, when saving system overhead, can also guarantee that Voice ﹠ Video serious step-out can not occur.
Claims (11)
1, a kind of method that realizes that Voice ﹠ Video is synchronous is characterized in that, this method may further comprise the steps:
A, voice playing thread and video playback thread enter broadcast state respectively, play the data of corresponding types, calculate the playing duration of this synchronizing process institute's playing audio-fequency data and video data respectively, and judge respectively whether described playing duration arrives synchronous duration, if there is one of them playing duration of playing thread to arrive synchronous duration earlier, execution in step b then, otherwise repeated execution of steps a;
Another this synchronizing process data playback of broadcast thread of broadcast thread waits that arrives synchronous duration in b, described voice playing thread and the video playback thread earlier finishes, and returns step a and carries out synchronizing process next time.
2, method according to claim 1 is characterized in that, before the step a, sets in advance synchronous duration and the maximum out of alignment time that allows.
3, method according to claim 1 is characterized in that, judges described in the step a whether playing duration arrives being operating as of synchronous duration: carry out described judgement after whenever playing the unit length data.
4, method according to claim 1, it is characterized in that, the described broadcast thread that arrives synchronous duration earlier is the voice playing thread, the method of waiting for described in the step b is: voice playing thread oneself state is set to synchronous waiting status, and judgement video playback thread state of living in, if the video playback thread is in broadcast state, then described voice playing thread keeps synchronous waiting status, finishes until the video playback thread.
5, method according to claim 1, it is characterized in that, the described broadcast thread that arrives synchronous duration earlier is the video playback thread, the method of waiting for described in the step b is: video playback thread oneself state is set to synchronous waiting status, and judgement voice playing thread state of living in, if the voice playing thread is in broadcast state, then described video playback thread keeps synchronous waiting status, finishes until the voice playing thread.
6, according to claim 4 or 5 described methods, it is characterized in that, describedly play the method that thread is set to synchronous waiting status and be: suspend described broadcast thread;
Or close described broadcast thread, then among the step b, before returning step a, this method further comprises: start the broadcast thread that is in synchronous waiting status.
7, method according to claim 1, it is characterized in that, among the step b, before returning step a, this method further comprises: calculate two stand-by period of playing between the thread, and recomputate and be provided with the synchronous duration of synchronizing process next time according to stand-by period that is calculated and the predefined maximum out of alignment time that allows.
8, method according to claim 7, it is characterized in that, the described calculating method of the synchronous duration of synchronizing process next time is specially: the synchronous duration of this synchronizing process is taken advantage of maximum the long-pending divided by the stand-by period of out of alignment time that allow, obtain the synchronous duration of synchronizing process next time.
9, according to claim 7 or 8 described methods, it is characterized in that, the described calculating method of the synchronous duration of synchronizing process next time further comprises: round under the merchant of synchronous duration divided by unit data piece playing duration with acquired synchronizing process next time, multiply by unit data piece playing duration again.
10, method according to claim 7 is characterized in that, two methods of playing the stand-by period between the thread of described calculating are:
B1, when the broadcast thread that arrives earlier synchronous duration in voice playing thread and the video playback thread is set to synchronous waiting status, zero-time waited in record;
B2, when the broadcast thread that arrives earlier synchronous duration in described voice playing thread and the video playback thread judges that another is play thread and is in synchronous waiting status, the concluding time waited in record;
B3, obtain the stand-by period by waiting for the concluding time and waiting for that zero-time is calculated.
11, method according to claim 1 is characterized in that, described voice playing thread or video playback thread are on portable terminal.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100816218A CN100437546C (en) | 2005-06-30 | 2005-06-30 | Method for realizing audio-frequency and video frequency synchronization |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100816218A CN100437546C (en) | 2005-06-30 | 2005-06-30 | Method for realizing audio-frequency and video frequency synchronization |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1889068A CN1889068A (en) | 2007-01-03 |
CN100437546C true CN100437546C (en) | 2008-11-26 |
Family
ID=37578347
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2005100816218A Active CN100437546C (en) | 2005-06-30 | 2005-06-30 | Method for realizing audio-frequency and video frequency synchronization |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100437546C (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108269597B (en) * | 2018-04-20 | 2019-12-20 | 杭州海泰电子有限公司 | Audio workstation management method and system |
CN115119033B (en) * | 2022-06-23 | 2024-02-02 | 北京字跳网络技术有限公司 | Sound and picture synchronization method and device, storage medium and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5617502A (en) * | 1996-03-22 | 1997-04-01 | Cirrus Logic, Inc. | System and method synchronizing audio and video digital data signals during playback |
CN1393094A (en) * | 2000-08-16 | 2003-01-22 | 皇家菲利浦电子有限公司 | Method of playing multimedia applications |
US20030058224A1 (en) * | 2001-09-18 | 2003-03-27 | Chikara Ushimaru | Moving image playback apparatus, moving image playback method, and audio playback apparatus |
WO2004039056A2 (en) * | 2002-10-24 | 2004-05-06 | Thomson Licensing S.A. | A method and system for maintaining lip synchronization |
-
2005
- 2005-06-30 CN CNB2005100816218A patent/CN100437546C/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5617502A (en) * | 1996-03-22 | 1997-04-01 | Cirrus Logic, Inc. | System and method synchronizing audio and video digital data signals during playback |
CN1393094A (en) * | 2000-08-16 | 2003-01-22 | 皇家菲利浦电子有限公司 | Method of playing multimedia applications |
US20030058224A1 (en) * | 2001-09-18 | 2003-03-27 | Chikara Ushimaru | Moving image playback apparatus, moving image playback method, and audio playback apparatus |
WO2004039056A2 (en) * | 2002-10-24 | 2004-05-06 | Thomson Licensing S.A. | A method and system for maintaining lip synchronization |
Also Published As
Publication number | Publication date |
---|---|
CN1889068A (en) | 2007-01-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103959807B (en) | Match the method for outputting and inputting timestamp in video encoder and advertisement inserter | |
US10380968B2 (en) | Method for adjusting the adaptive screen-refresh rate and device thereof | |
CN110636370B (en) | Video processing method and device, electronic equipment and readable medium | |
CN103856812B (en) | A kind of video broadcasting method and device | |
CN107509100A (en) | Audio and video synchronization method, system, computer installation and computer-readable recording medium | |
CN107396171A (en) | Live network broadcast method, device and storage medium | |
US8244897B2 (en) | Content reproduction apparatus, content reproduction method, and program | |
US8238420B1 (en) | Video content transcoding for mobile devices | |
US9396762B2 (en) | Systems and methods for networked media synchronization | |
CN103327368B (en) | Perform method and device thereof that multimedia controls | |
CN104717509A (en) | Method and device for decoding video | |
US20060271999A1 (en) | Digital data receiver apparatus | |
CN113490029A (en) | Video playing method, device, equipment and storage medium | |
CN100437546C (en) | Method for realizing audio-frequency and video frequency synchronization | |
CN103581730A (en) | Method for achieving synchronization of audio and video on digital set top box | |
CN106331820A (en) | Synchronous audio and video processing method and device | |
US20190222886A1 (en) | Method and apparatus for synchronously playing media and vibration | |
US8749362B2 (en) | Apparatus and method for providing haptic function in portable terminal | |
KR20130040350A (en) | Device and method for controlling screen brightness in wireless terminal | |
CN103716650B (en) | Server unit and information processing method | |
CN107710754A (en) | Audio, video data synchronous method and device | |
CN100428788C (en) | Method for transcribing opening picture | |
CN100426410C (en) | Method, installation, and embedded type devices for playing back video file | |
CN112019858B (en) | Video playing method and device, computer equipment and storage medium | |
JP4579877B2 (en) | Playback apparatus and playback method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |