CN101303880A - Method and apparatus for recording and playing audio-video document - Google Patents

Method and apparatus for recording and playing audio-video document Download PDF

Info

Publication number
CN101303880A
CN101303880A CNA2008101159486A CN200810115948A CN101303880A CN 101303880 A CN101303880 A CN 101303880A CN A2008101159486 A CNA2008101159486 A CN A2008101159486A CN 200810115948 A CN200810115948 A CN 200810115948A CN 101303880 A CN101303880 A CN 101303880A
Authority
CN
China
Prior art keywords
data
video
audio
video data
index information
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.)
Granted
Application number
CNA2008101159486A
Other languages
Chinese (zh)
Other versions
CN101303880B (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.)
Vimicro Corp
Original Assignee
Vimicro Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vimicro Corp filed Critical Vimicro Corp
Priority to CN2008101159486A priority Critical patent/CN101303880B/en
Publication of CN101303880A publication Critical patent/CN101303880A/en
Application granted granted Critical
Publication of CN101303880B publication Critical patent/CN101303880B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Television Signal Processing For Recording (AREA)

Abstract

The invention discloses a method and a device for recording and playing audio and video files. The recording method consists of the following steps: collecting audio data and video data; sequentially saving the audio data and the video data collected in set time length and establishing and sequentially storing corresponding index information; generating the audio and video files according to the saved audio data and the video data and the corresponding index information. The playing method consists of the following steps: reading the index information corresponding to the audio data and the video data in the audio and video files according to a set period; judging whether the corresponding audio and video data is the data collected in the same set time length according to the read index information: if not, regulating the playing speed of the video data so that the audio data and the video data are synchronous. The technical proposal can synchronously play the audio and video files and has the advantages of simple implementation, low demand for the operating system and guarantee of playing effect when switching programs.

Description

Record, the method and the device of playing audio-video document
Technical field
The present invention relates to multimedia technology field, relate in particular to record, the method and the device of playing audio-video document.
Background technology
Prosperity along with electronic industry, PC (Personal Computer, PC), PDA (PersonalDigital Assist, PDA (Personal Digital Assistant)), SP (Smart Phone, intelligent mobile phone), the various deeply popular daily lifes of digital processing device that can play multimedia files such as electronic dictionary translation machine, bring the digital multimedia amusement and recreation life that people enrich.
General multimedia file mainly is divided into two parts, is respectively video data and voice data.Multimedia file is play after respectively video data and voice data being deciphered when playing again.In a kind of broadcast operation of multimedia file, voice data is play continuously, and video file then is to play one by one according to the set time that timer TI (Timer Interrupt, the time interrupts) is produced.In the running of the actual play of multimedia file, the time that timer TI is produced has a little error, can not be the interval of fixing, makes that the broadcast of the broadcast of video file and audio file can not be synchronous fully.In addition, because also there is error in digital processing device when the sampling frequency of setting audio, so the time of voice data actual play can just in time not equal the time that audio file should be play, for instance, when movie, the performer that might produce in the film does not speak as yet, but the situation that sound is played out, perhaps the performer lifts up one's voice, but sound but postpones the situation that a period of time just is played.
Audio file and video file are play the asynchronous viewing effect that can influence the user and the user use experience to digital processing device, in order to address this problem, the most frequently used a kind of technology is in the playing process of multimedia file, cooperates the broadcast of control multimedia file by program clock reference (being called for short PCR) and displaying timestamp (being called for short PTS).PCR is arranged in the adaptation field in audio frequency and video transport stream packet header, and its effect is the precise synchronization that keeps decoder clocks and encoder clock; PTS is arranged in the packet header of audio frequency and video primary flow packet, it has stipulated the first frame audio frequency that begins or the reproduction time of video in this primary flow packet, and it is to be benchmark with the system clock that recovers from PCR.
The method that cooperates the broadcast of control audio-video document by PCR and PTS, the synchronous playing that can keep audio-video document to a certain extent, but this method occupying system resources is many, and the encoding and decoding relative complex, so for some shirtsleeve operation systems and inapplicable.In addition; in the playing process of the audio-video document of reality; carry out the switching of program through regular meeting; the for example replacement of commercial breaks or program; a problem of Cun Zaiing is that two programs that switch front and back may adopt no time reference to encode like this, will cause the uncontinuity of PCR like this.When the discontinuous situation of PCR occurring, PTS before this PCR is corresponding to the time reference before switching, and PTS afterwards is corresponding to new time reference, the moment that PCR arrives after switching, may also not decode corresponding to the video of old time reference and finish or demonstration as yet, show and perhaps can't show mistake if directly new PCR is applied to video that the recovery system clock may cause benchmark between the old times, thereby influence the result of broadcast of multimedia file.
As seen, the method for existing audio-video document synchronous playing is low to operating system call height, versatility.
Summary of the invention
The invention provides record, the method and the device of playing audio-video document, in order to solve the method problem high of existing audio-video document synchronous playing to operating system call.
The embodiment of the invention is achieved through the following technical solutions:
The embodiment of the invention provides a kind of method of recording audio/video file, comprises the steps:
Audio frequency acquiring data and video data;
Each is set the voice data and the video data that collect in the duration preserves in proper order;
Each is set the voice data that collects in duration and video data set up index information respectively and it is preserved in proper order, described index information comprises the address offset amount of corresponding data;
According to the voice data of preserving and video data and corresponding index information generation audio-video document.
The embodiment of the invention also provides a kind of method of playing audio-video document, comprises the steps:
Read voice data and the pairing separately index information of video data in the described audio-video document according to setting cycle, described index information comprises the address offset amount of corresponding data;
Judge according to the index information that reads whether corresponding audio data and video data are the data that collect in the same setting duration, each sets voice data and video data and the index information corresponding sequential storage in audio-video document thereof that collects in the duration;
When being judged as the data that are not to collect in the same setting duration, the broadcasting speed of adjusting video data is so that video data and voice data are synchronous.
The embodiment of the invention also provides a kind of device of recording audio/video file, comprising: collecting unit, timing unit and processing unit;
Collecting unit is used for audio frequency acquiring data and video data;
Timing unit is used for carrying out timing according to setting duration;
Processing unit, be used for when the timing time of described timing unit arrives, voice data and video data that described collecting unit collects in this section timing time are preserved in proper order, the voice data that collects in this section timing time and video data are set up index information respectively and it is preserved in proper order, described index information comprises the address offset amount of corresponding data, and according to the voice data of preserving and video data and corresponding index information generation audio-video document.
The embodiment of the invention also provides a kind of device of playing audio-video document, comprising:
Synchronous judging unit, be used for reading the voice data and the pairing separately index information of video data of audio-video document according to setting cycle, described index information comprises the address offset amount of corresponding data, judge according to the index information that reads whether corresponding audio data and video data are the data that collect in the same setting duration, each sets voice data and video data and the index information corresponding sequential storage in audio-video document thereof that collects in the duration;
Synchronous processing unit, be used for when described synchronous judgment unit judges when being not the data that collect in the same setting duration, the broadcasting speed of adjusting video data is so that video data and voice data are synchronous;
Broadcast unit is used for playing according to the synchronous processing result of described synchronous processing unit the voice data and the video data of described audio-video document.
The embodiment of the invention is passed through technique scheme, in the recording process of audio-video document, each is set the voice data and the video data that collect in the duration preserves in proper order, and set up corresponding index information and should preserve in proper order by corresponding index information, in the playing process of audio-video document, read the pairing separately index information of voice data and video data, when judging that according to the index information that reads corresponding audio data and video data are not the data that collect in the same setting duration, the broadcasting speed of adjusting video data is so that video data and voice data are synchronous.Whether technical scheme provided by the present invention can be judged it synchronously at voice data and video data playing process, and when asynchronous, in time adjust the broadcasting speed of video data, thereby guarantee that voice data and video data are synchronous when playing, and when occurring to guarantee that the synchronous playing of audio-video document also can guarantee result of broadcast when program switches.In addition, the method for recording of multimedia file provided by the invention, not be used in and be information such as voice data and video data joining day stamp in the recording process, when playing, do not rely on information such as timestamp yet, thereby encoding and decoding are simple, low to operating system call, and occupying system resources is less relatively.
Description of drawings
Fig. 1 is the synoptic diagram of audio-video document allocation index number for what the embodiment of the invention provided in the audio-video document recording process;
The preservation form synoptic diagram of the audio-video document that Fig. 2 provides for the embodiment of the invention;
Fig. 3 is the form synoptic diagram of file header among Fig. 2;
Fig. 4 is the form synoptic diagram of data field among Fig. 2;
Fig. 5 is the form synoptic diagram of index area among Fig. 2;
The process flow diagram that audio-video document is recorded that Fig. 6 provides for the embodiment of the invention;
The process flow diagram that audio-video document is play that Fig. 7 provides for the embodiment of the invention;
The record device synoptic diagram of the audio-video document that Fig. 8 provides for the embodiment of the invention;
The playing device synoptic diagram of the audio-video document that Fig. 9 provides for the embodiment of the invention.
Embodiment
At the prior art above shortcomings, embodiment of the invention proposition is recorded, the method and the device of playing audio-video document, and with the synchronous playing of assurance audio-video document, and encoding and decoding are simple, low to operating system call.Be explained in detail to the main realization principle of the embodiment of the invention, specific implementation process and to the beneficial effect that should be able to reach below in conjunction with Figure of description.
Audio file is generally gathered according to baud rate, that is to say that in the gatherer process of audio file, the data volume that each section set time produces is equally big, DMA (Direct MemoryAccess, direct memory access) the interruptions in transmissions time is the same each time.The embodiment of the invention is according to this principle, the broadcasting speed of audio file is kept synchronization basic standard as audio-video document, particularly, in the recording process of audio-video document, every duration through setting is preserved voice data and the video data that collects in this duration, and interior voice data and the video data recording index information of this duration for preserving, this index information can indicate the playing sequence of corresponding audio data and video data, and this duration is set at the needed time of voice data that direct memory access DMA transmits the needed time or gathers the setting data amount.
Index information is made of the address offset amount (being the side-play amount of current data to the data field start address) and the data length information of data, can further include call number.If index information comprises call number, then can directly obtain the playing sequence of Voice ﹠ Video data by call number; Just do not constitute if index information does not comprise call number, then need by calculating the playing sequence of audio or video data by the address offset amount and the data length of data.
Fig. 1 has provided when index information comprises call number, the voice data in the about 20 seconds multimedia file of a segment length and the call number distribution condition of video data.Suppose that a DMA transmission needed 5 seconds or the voice data of recording setting data volume needs 5 seconds, then voice data and the video data recorded in the 0th~5 second are preserved, and respectively the voice data recorded in this time period and video data are distributed identical call number, allocation index number " 1 " all for example; Voice data and the video data recorded in the 5th~10 second are preserved, and respectively voice data and the video data of recording in this time period distributed identical call number, for example allocation index number " 2 " all; The rest may be inferred, with the voice data recorded in the 10th~15 second with video data is preserved and allocation index number " 3 " respectively, with the voice data recorded in the 15th~20 second with video data is preserved and allocation index number " 4 " respectively.
In the present embodiment, the file layout that can adopt when the voice data that collects in the setting-up time section and video data are preserved comprises file header information, data field and index area as shown in Figure 2.
Wherein, file header information comprises the total header of file, Audio (audio frequency) information and Video (video) information as shown in Figure 3, is described in order to the essential information to multimedia file, adopts corresponding mode to decode when being convenient to play.Wherein, definable file name, the position (as start address) at place, data field and the position (as start address) at place, index area etc. in the total header of file, definable message length in the Audio information, transmission sound channel and sampling rate etc., show wide height, frame per second and code stream etc. at definable message length, original wide height in the Vidio information.Concrete structure can be defined as follows:
The definition of Audio message structure:
typedef?struct?tag_AviAudioFormat{
UINT32?StreamFormat;//″pcm″
UINT32?StreamFormatSize;
UINT32?wFormatTag_nChannels;//WORD?nChannels;
UINT32?nSamplesPerSec;
//UINT32?nAvgBytesPerSec;
//UINT32?nBlockAlign_wBitsPerSample;
}AviAudioFormat,*PAviAudioFormat;///WAVEFORMATEX;
Wherein, StreamFormat represents the stream format of Audio, can be the pcm form; StreamFormatSize represents the length of Audio information; WFormatTag_nChannels represents the sound channel of Audio transmission; NSamplesPerSec represents the sampling rate to Audio.
The definition of Video message structure:
typedef?struct?tag_AviVideoFormat{
UINT32?StreamFormat;//″strf″
UINT32?StreamFormatSize;//0x28
UINT32?dwWidth;
UINT32?dwHeight;
UINT32?dwTargWidth;//0xa000
UINT32?dwTargHeight;//00000
UINT32?FramRate; //00000
UINT32BitRate;//00000
}AviVideoFormat,*PAviVideoFormat;
Wherein, StreamFormat represents the stream format of Video, can be strf; StreamFormatSize represents the length of Video information; DwWidth represents the wide of the original screen of Video; DwHeight represents the height of the original screen of Video; DwTargWidth represents the wide of Video screen display; DwTargHeight represents the height of Video screen display; FramRate represents frame per second; BitRate represents code stream.
The header organization definition that file is total:
typedef?struct?tag_AviFileHeader{
UINT32RIFF;
UINT32DataPosition;
UINT32IndexPosition;
AviVideoFormat?VideoFormat;
AviAudioFormat?AudioFormat;
}AviFileHeader,*PAviFileHeader;
Wherein, RIFF represents the title of file layout; DataPosition represents the position at place, data field; IndexPosition represents the position at place, index area; VideoFormat represents the data layout of Vide0; AudioFormat represents the data layout of Audio.
The form of data field as shown in Figure 4, comprise type identification part and data division, type identification part is in order to indicate the data type of the data after this sign, as, when being designated 00dc, this represents that data thereafter are the Video data, represent that when this is designated 01wb data thereafter are the Audio data, the type identification division is the data length of indication the type sign further; Data division is in order to preserve concrete data.When preserving, Video data and Audio data cross are preserved, promptly preserve the voice data that collects in the duration of setting, and the video data that collects in the same duration is preserved in the position after this voice data of preserving, perhaps, preserve the video data that collects in the duration of setting, and the voice data that collects in the same duration is preserved in the position after this video data of preserving.Can partly be defined as follows structure for type identification:
The organization definition of Video type identification:
typedef?struct?tag_AviVideoInsert{
UINT32?dc00;//″00dc″
UINT32?Length;
}AviVideoInsert,*PAviVideoInsert;
Wherein, dc00 is the Video type identification, and its value is " 00dc ", represents that the data that insert this sign back are the Video data, and Length is the length of this sign.
The organization definition that the Audio type is represented:
typedef?struct?tag_AudioInsert{
UINT32?wb01;//″01wb″
UINT32?Length;
}AviAudioInsert,*PAviAudioInsert;
Wherein, wb01 is the Audio type identification, and its value is " 01wb ", represents that the data that insert this sign back are the Audio data, and Length is the length of this sign.
The form of index area comprises Audio index part and Video index part as shown in Figure 5, and each index part has mainly defined the offset address and the length at corresponding data place, and concrete structure is defined as follows:
typedef?struct?tag_AviIndex
{
AviAudioIndex?Audio_Index;
AviVideoIndex?Vedio_Index;
}AviIndex,*PAviIndex;
Above-mentioned coded representation index part comprises Audio index (Audio_Index) and Vedio index (Vedio_Index).
The organization definition of Audio index:
typedef?struct?tag_AviAudioIndex{
UINT32?IndexNumber;
UINT32?wb01;//″wb01″
UINT32Audio;//″0x10?00?00?00″
UINT32?Position;//0x?10
UINT32Length;//0x01,0?0x01?0
}AviAudioIndex,*PAviAudioIndex;
Wherein, wb01 represents that this index part is the index of Audio data; Position represents the address offset amount of the Audio data of index; Length represents the length of the Audio data of index.
The organization definition of Video index:
typedef?struct?tag_AviVideoIndex{
UINT32?IndexNumber;
UINT32?dc00;//″00dc″
UINT32?frame;//″0x10?00?00?00″
UINT32?Position;//0x10
UINT32?Length;//0x01,0?0x01?0
}AviVideoIndex,*PAviVideoIndex;
Wherein, dc00 represents that this index part is the index of Video data; Position represents the address offset amount of the Video data of index; Length represents the length of the Video data of index; Frame represents the frame number that comprises in these Video data.
The order of stores audio data and video data is corresponding in the storage order of Audio index and Video index and the data field, promptly, write sequence to the data that collect in the same time period is first audio frequency rear video, then writes the Audio index in the index area earlier and writes the Video index thereafter.
Can also in Audio index and Video index, increase call number IndexNumber respectively, the Audio data call number identical that collects in same period with the Video data allocations, the call number of distributing when at every turn setting up index increases progressively in proper order, so that carry out synchronously when playing.
Fig. 6 has provided embodiment of the invention recording audio/video file, and is stored as the process of above-mentioned file layout, comprises the steps:
Step 601, after receiving record command, start the recording process of voice data and video data, audio frequency acquiring data and video data, and storage file carried out initialization.
In this step, when the recording process that starts voice data and video data, as after receiving record command, on the one hand voice data and the video data that collects write in the buffer area, start timer simultaneously and carry out timing, the timing of timer can be that a DMA transmits the needed time; On the one hand the multimedia file to stores audio data and video data carries out initialization, as opens up address space (address space that comprises file header, data field and index area), writes file header information etc.The included content of file header information as shown in Figure 3.
Step 602, when the timing of timer arrives, execution in step 603.
Step 603, voice data and video data that this section of preserving in the buffer area gathered in the period write the data field, and these section audio data and video data are generated corresponding Audio index and Vedio index, write the index area.
In this step, voice data that this section of preserving in the buffer area gathered in the period and video data are written to the data field according to form as shown in Figure 4, promptly, write the voice data type identification in the data field order, write voice data thereafter, write the video data type identification then, write video data thereafter, thereby make voice data and video data stored interleaved and cut apart by corresponding data type sign.The Audio index information that generates comprises the length of these section audio data in the address offset amount of data field (the address offset amount as from the start address of data field to this section audio data start address can calculate according to the data length of the data that write previously), these section audio data; The Vedio index information that generates comprises that this section video data is in the address offset amount of data field, the length of this section video data.The index information that generates is written to the index area according to as shown in Figure 5 form, that is, order writes Audio index information and Vedio index information, and wherein the Audio index information occupies the storage space of identical size with the Vedio index information.After voice data and video data write the data field, can remove this section collected in the period in the buffer area voice data and video data.
In this step, increase identical call number in the voice data that can also collect in the period this section and the Audio index information of video data correspondence and the Video index information, being used to identify corresponding audio data and video data and being the same time period gathers, so that carry out synchronously when playing.The generation of call number can be realized by counter, that is, when each timer arrives timing, counter values increased progressively, and the voice data that count value is collected in the period as this section and the call number of video data.
Step 604, judge to record whether finish, if process ends then, otherwise return step 602.
By above-mentioned recording process, obtain the multimedia file to form shown in Figure 5 as Fig. 2.
When this multimedia file is play, read the pairing index information of current voice data and video data in real time, judge according to index information whether corresponding audio data and video data be synchronous, whether be the data that collect in the same time period promptly, when judgement is asynchronous, thereby the broadcasting speed of adjustment video data is realized the synchronous playing of Voice ﹠ Video.In order to realize reading voice data and the pairing index information of video data in real time, read the pairing index information of video data frame that the next one will play and the index information of voice data after can playing at each frame of video data, also can be according to the duration of setting or according to the data volume of setting, when setting duration and arrive or the audio or video data playback of setting data amount when finishing, read and be about to video data and each self-corresponding index information of voice data of playing.Wherein, the duration of setting can be set to be not more than the time span of the timer that is provided with when carrying out data acquisition, the data volume of setting can be set to be not more than the voice data that collects in each time period when carrying out data acquisition or the data volume of video data, so that can in time carry out synchronously.
The instantiation that the multimedia file of recording based on said method is play comprises the steps: as shown in Figure 7
Step 701, after receiving play command, start the playing process of audio-video document.
In this step, after receiving play command, a certain amount of data in the corresponding multimedia file data field are put into play in the buffer memory, from play buffer memory, read voice data and video data and decode respectively and play.Usually the data volume of playing in the buffer memory is that a DMA transmits pairing data volume.
Step 702, obtain voice data and each self-corresponding index information of video data of be about to playing.
In this step, after whenever playing a frame of video, read the index information of pairing index information of frame of video that the next one will play and the voice data correspondence that will play.
Step 703, according to the voice data index information and the video data index information that get access to, judge whether corresponding audio data and video data synchronous, whether be voice data and the video data that collects in the time period promptly, as if normal play then synchronously; If asynchronous then execution in step 704.
In this step,, can judge whether corresponding audio data and video data be synchronous by voice data index information and the video data index information that gets access to.If comprise call number in the index information, then directly the call number of comparing audio data and the call number of video data just can judge whether synchronously, and call number is identical then to be judged as synchronously, and the call number difference then is judged as asynchronous.Also can judge according to the address offset amount in the index information.Because there is certain corresponding relation in the index information of the voice data of data area stores and video data and index area storage, be that the storage order of every segment data and the storage order of the index information of correspondence are consistent, therefore can obtain the voice data of data area stores or the correspondence position of video data by the address offset amount in the index information, and then whether collect can to judge voice data and video data the same time period.For example, among Fig. 4, if determine that according to the address offset amount of video data next Frame is arranged in the Video data 1 of memory block, and determine that according to the address offset amount of voice data the voice data that will play is arranged in Audio data 2, can judge that then video data and voice data are asynchronous.If determine that according to the address offset amount of video data next Frame is arranged in the Video data 1 of memory block, and determine that according to the address offset amount of voice data the voice data that will play is arranged in Audio data 1, can judge that then video data and voice data are synchronous.Also can judge by the position of index information in the index area of voice data and video data, as, in Fig. 5, if the index information of voice data is positioned at the position of Audio index 1, the index information of video data is positioned at the position of Video data 2, because index information length is identical, can calculate the voice data index and whether the video data index is adjacent, if non-conterminous, can judge that then video data and voice data are asynchronous.
Step 704, voice data and video data are adjusted into synchronously.
Step 705, judge to play and whether to finish, if process ends then, otherwise return step 702.
In the above-mentioned steps 704,, so in this step, can adjust the broadcasting speed of frame of video by the Timer that adjusts frame of video, thereby realize video and audio sync owing to the broadcasting speed of frame of video can be controlled by timer Timer.When judging that video data is play soon than voice data, as the call number of video data correspondence call number greater than the voice data correspondence, perhaps video data, then can increase the value of Timer after the voice data position in the position of data field, thereby the broadcasting speed of frame of video is reduced; When judging that video data is play slowly than voice data, as the call number of video data correspondence call number less than the voice data correspondence, perhaps video data in the position of data field before the voice data position and other the audio or video data of being separated by betwixt, then the value of Timer can be reduced, thereby the broadcasting speed of frame of video is improved.The adjustment amount of Timer can calculate by following formula:
T=|T1-S/R|
Wherein, T is the adjustment amount of Timer; The voice data time corresponding of T1 for having play; S is the frame number of playing video data; R is the frame per second that video data is play.S/R is and plays the time that S frame video data needs in theory, T1-S/R represents to play S frame video data actual work time and the difference between time of needing in theory, if this difference is a positive number, illustrate that the video data broadcasting speed is slow partially, then increase the Timer value of current playing video data according to the T that calculates, if this difference is a negative, illustrate that the video data broadcasting speed is fast, then reduce the Timer value of current playing video data according to the T that calculates.
In actual applications, specifically increase or the numerical value that reduces can calculate in the following way:
If video data is play soon, then draw the video frame number of playing in the T time, obtain new Timer value with T divided by this frame number, if this new Timer value greater than current Timer value, then will this new Timer value as the Timer value of follow-up play frame of video.
If video data is play slowly, then draw the video frame number that T can play in the time, obtain new Timer value with T divided by this frame number, if this new Timer value greater than current Timer value, then subtracts 15ms with this new Timer value, compare with current Timer value again, the rest may be inferred, subtract 15ms, up to than current Timer value hour, the Timer value that this is new is as the Timer value of follow-up play frame of video at every turn.
The embodiment of the invention provides a kind of device of recording audio/video file, as shown in Figure 8, comprising: collecting unit 801, timing unit 802 and processing unit 803.Wherein,
Collecting unit 801 is used for audio frequency acquiring data and video data.
Timing unit 802 is used for carrying out timing according to setting duration, and this timing time is set at a direct memory access DMA and transmits the needed time, perhaps is set at the needed time of voice data of gathering the setting data amount.
Processing unit 803, be used for when the timing time of timing unit 802 arrives, voice data and video data that collecting unit 801 collects in this section timing time are preserved in proper order, the voice data that collects in this section timing time and video data are set up index information respectively and it is preserved in proper order, this index information comprises the address offset amount of corresponding data, and according to the voice data of preserving and video data and corresponding index information generation audio-video document.
This processing unit 803 is further used for, and increases call number in the index information of setting up, and each call number of setting foundation in the duration increases progressively in proper order, and is that the voice data that collects in the same setting duration is set up identical call number with video data.
In the said apparatus, processing unit 803 is further used for, and order is preserved and respectively to be set the voice data that collects in the duration data field to audio-video document, and the video data that collects in the same setting duration is preserved in the position after the respective audio data; Perhaps, order is preserved and respectively to be set the video data that collects in the duration data field to audio-video document, and the voice data that collects in the same setting duration is preserved in the position after the corresponding video data.
The embodiment of the invention also provides a kind of device of playing audio-video document, as shown in Figure 9, comprising: synchronous judging unit 901, synchronous processing unit 902 and broadcast unit 903.Wherein,
Synchronous judging unit 901, be used for reading the voice data and the pairing separately index information of video data of the current broadcast of audio-video document according to setting cycle, this index information comprises the address offset amount of corresponding data, judge according to the index information that reads whether corresponding audio data and video data are the data that collect in the same setting duration, each sets voice data and video data and the index information corresponding sequential storage in audio-video document thereof that collects in the duration.
This synchronous judging unit 901 specifically is used for, and determines corresponding audio data and the video data memory location in audio-video document according to the address offset amount in the index information; When voice data that is separated with other between corresponding audio data and the video data mutually or video data, perhaps when the corresponding audio data before video data but the preservation of the data of gathering in to same setting duration be first video in proper order after during audio frequency, perhaps when the corresponding audio data after video data but the preservation of the data of gathering in to same setting duration when being first audio frequency rear video in proper order judges that then corresponding audio data and video data are not the data that collect in the same setting duration.
Further, the index information that this synchronous judging unit 901 reads also comprises call number, and each call number of setting foundation in the duration increases progressively in proper order, and the voice data that collects in the same setting duration has identical call number with video data; When comprising call number in the index information, this synchronous judging unit 901 is further used for, when the call number of the call number of the voice data correspondence that reads and video data correspondence not simultaneously, judge that corresponding audio data and video data are not the data that collect in the same setting duration.
Synchronous processing unit 902 is used for when synchronous judging unit 901 is judged as the data that are not to collect in the same setting duration, and the broadcasting speed of adjusting video data is so that video data and voice data are synchronous.
This synchronous processing unit further comprises: first synchronous processing module and second synchronous processing module.Wherein,
First synchronous processing module is used for reducing the broadcasting speed of video data by the reproduction time of lengthening frame of video when judging corresponding video data broadcasting speed faster than the broadcasting speed of voice data according to index information;
Second synchronous processing module is used for improving the broadcasting speed of video data by the reproduction time that reduces frame of video when judging that according to index information corresponding video data broadcasting speed is slower than the broadcasting speed of voice data.
Broadcast unit 903 is used for according to the synchronous processing of synchronous processing unit 902 voice data and the video data of playing audio-video document as a result.
The embodiment of the invention is passed through technique scheme, in the recording process of audio-video document, each is set the voice data and the video data that collect in the duration preserves in proper order, and set up corresponding index information and it is preserved in proper order, in the playing process of audio-video document, read the pairing separately index information of voice data and video data, when judging that according to the index information that reads corresponding audio data and video data are not the data that collect in the same setting duration, the broadcasting speed of adjusting video data is so that video data and voice data are synchronous.Whether technical scheme provided by the present invention can be judged it synchronously at voice data and video data playing process, and when asynchronous, in time adjust the broadcasting speed of video data, thereby guarantee that voice data and video data are synchronous when playing, and when occurring to guarantee that the synchronous playing of audio-video document also can guarantee result of broadcast when program switches.In addition, the method for recording of multimedia file provided by the invention, not be used in and be information such as voice data and video data joining day stamp in the recording process, when playing, do not rely on information such as timestamp yet, thereby encoding and decoding are simple, low to operating system call, and occupying system resources is less relatively.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.

Claims (18)

1, a kind of method of recording audio/video file is characterized in that, comprising:
Audio frequency acquiring data and video data;
Each is set the voice data and the video data that collect in the duration preserves in proper order;
Each is set the voice data that collects in duration and video data set up index information respectively and it is preserved in proper order, described index information comprises the address offset amount of corresponding data;
According to the voice data of preserving and video data and corresponding index information generation audio-video document.
2, the method for claim 1 is characterized in that, described index information also comprises call number, and each call number of setting foundation in the duration increases progressively in proper order, and the voice data that collects in the same setting duration has identical call number with video data.
3, the method for claim 1 is characterized in that, each is set the voice data and the video data that collect in the duration preserve in proper order, is specially:
Order is preserved and respectively to be set the voice data that collects in the duration data field to audio-video document, and the video data that collects in the same setting duration is preserved in the position after the respective audio data;
Perhaps, order is preserved and respectively to be set the video data that collects in the duration data field to audio-video document, and the voice data that collects in the same setting duration is preserved in the position after the corresponding video data.
4, method as claimed in claim 3 is characterized in that, described voice data is identified by audio types, and described video data is identified by video type.
As each described method of claim 1~4, it is characterized in that 5, described setting duration is that a direct memory access DMA transmits the needed time; Perhaps, described setting duration is for gathering the needed time of voice data of setting data amount.
6, a kind of method of playing audio-video document is characterized in that, comprising:
Read voice data and the pairing separately index information of video data in the described audio-video document according to setting cycle, described index information comprises the address offset amount of corresponding data;
Judge according to the index information that reads whether corresponding audio data and video data are the data that collect in the same setting duration, each sets voice data and video data and the index information corresponding sequential storage in audio-video document thereof that collects in the duration;
When being judged as the data that are not to collect in the same setting duration, the broadcasting speed of adjusting video data is so that video data and voice data are synchronous.
7, method as claimed in claim 6 is characterized in that, judges according to the index information that reads whether corresponding audio data and video data are the data that collect in the same setting duration, are specially:
Determine corresponding audio data and the memory location of video data in described audio-video document according to the address offset amount in the described index information;
When voice data that is separated with other between corresponding audio data and the video data mutually or video data, perhaps when the corresponding audio data before video data but the preservation of the data of gathering in to same setting duration be first video in proper order after during audio frequency, perhaps when the corresponding audio data after video data but the preservation of the data of gathering in to same setting duration when being first audio frequency rear video in proper order judges that then corresponding audio data and video data are not the data that collect in the same setting duration.
8, method as claimed in claim 6 is characterized in that, described index information also comprises call number, and each call number of setting foundation in the duration increases progressively in proper order, and the voice data that collects in the same setting duration has identical call number with video data;
Judge according to the index information that reads whether corresponding audio data and video data are the data that collect in the same setting duration, are specially:
When the call number of the call number of the voice data correspondence that reads and video data correspondence not simultaneously, judge that corresponding audio data and video data are not the data that collect in the same setting duration.
9, method as claimed in claim 6 is characterized in that, the broadcasting speed of described adjustment video data is specially:
When judging corresponding video data broadcasting speed according to index information, reduce the broadcasting speed of video data by the reproduction time of lengthening frame of video faster than the broadcasting speed of voice data;
When judging that according to index information corresponding video data broadcasting speed is slower than the broadcasting speed of voice data, improve the broadcasting speed of video data by the reproduction time that reduces frame of video.
10, method as claimed in claim 6 is characterized in that, described setting cycle is the cycle that presentation of video frames is finished.
11, a kind of device of recording audio/video file is characterized in that, comprising: collecting unit, timing unit and processing unit;
Collecting unit is used for audio frequency acquiring data and video data;
Timing unit is used for carrying out timing according to setting duration;
Processing unit, be used for when the timing time of described timing unit arrives, voice data and video data that described collecting unit collects in this section timing time are preserved in proper order, the voice data that collects in this section timing time and video data are set up index information respectively and it is preserved in proper order, described index information comprises the address offset amount of corresponding data, and according to the voice data of preserving and video data and corresponding index information generation audio-video document.
12, device as claimed in claim 11, it is characterized in that, described processing unit is further used for, in the index information of setting up, increase call number, each call number of setting foundation in the duration increases progressively in proper order, and is that the voice data that collects in the same setting duration is set up identical call number with video data.
13, device as claimed in claim 11, it is characterized in that, described processing unit is further used for, order is preserved and respectively to be set the voice data that collects in the duration data field to audio-video document, and the video data that collects in the same setting duration is preserved in the position after the respective audio data;
Perhaps, order is preserved and respectively to be set the video data that collects in the duration data field to audio-video document, and the voice data that collects in the same setting duration is preserved in the position after the corresponding video data.
As each described device of claim 11~13, it is characterized in that 14, the setting duration of described timing unit is that direct memory access DMA transmits the needed time or gathers needed time of voice data of setting data amount.
15, a kind of device of playing audio-video document is characterized in that, comprising:
Synchronous judging unit, be used for reading the voice data and the pairing separately index information of video data of audio-video document according to setting cycle, described index information comprises the address offset amount of corresponding data, judge according to the index information that reads whether corresponding audio data and video data are the data that collect in the same setting duration, each sets voice data and video data and the index information corresponding sequential storage in audio-video document thereof that collects in the duration;
Synchronous processing unit, be used for when described synchronous judgment unit judges when being not the data that collect in the same setting duration, the broadcasting speed of adjusting video data is so that video data and voice data are synchronous;
Broadcast unit is used for playing according to the synchronous processing result of described synchronous processing unit the voice data and the video data of described audio-video document.
16, device as claimed in claim 15 is characterized in that, described synchronous judging unit is further used for, and determines corresponding audio data and the memory location of video data in described audio-video document according to the address offset amount in the described index information;
When voice data that is separated with other between corresponding audio data and the video data mutually or video data, perhaps when the corresponding audio data before video data but the preservation of the data of gathering in to same setting duration be first video in proper order after during audio frequency, perhaps when the corresponding audio data after video data but the preservation of the data of gathering in to same setting duration when being first audio frequency rear video in proper order judges that then corresponding audio data and video data are not the data that collect in the same setting duration.
17, device as claimed in claim 15, it is characterized in that, the index information that described synchronous judging unit reads also comprises call number, and each call number of setting foundation in the duration increases progressively in proper order, and the voice data that collects in the same setting duration has identical call number with video data;
Described synchronous judging unit is further used for, when the call number of the call number of the voice data correspondence that reads and video data correspondence not simultaneously, judge that corresponding audio data and video data are not the data that collect in the same setting duration.
18, device as claimed in claim 15 is characterized in that, described synchronous processing unit comprises:
First synchronous processing module is used for reducing the broadcasting speed of video data by the reproduction time of lengthening frame of video when judging corresponding video data broadcasting speed faster than the broadcasting speed of voice data according to index information;
Second synchronous processing module is used for improving the broadcasting speed of video data by the reproduction time that reduces frame of video when judging that according to index information corresponding video data broadcasting speed is slower than the broadcasting speed of voice data.
CN2008101159486A 2008-06-30 2008-06-30 Method and apparatus for recording and playing audio-video document Expired - Fee Related CN101303880B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101159486A CN101303880B (en) 2008-06-30 2008-06-30 Method and apparatus for recording and playing audio-video document

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101159486A CN101303880B (en) 2008-06-30 2008-06-30 Method and apparatus for recording and playing audio-video document

Publications (2)

Publication Number Publication Date
CN101303880A true CN101303880A (en) 2008-11-12
CN101303880B CN101303880B (en) 2010-08-11

Family

ID=40113749

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101159486A Expired - Fee Related CN101303880B (en) 2008-06-30 2008-06-30 Method and apparatus for recording and playing audio-video document

Country Status (1)

Country Link
CN (1) CN101303880B (en)

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102768846A (en) * 2012-07-20 2012-11-07 Tcl集团股份有限公司 Audio playing method, device and terminal
CN103491425A (en) * 2012-06-14 2014-01-01 腾讯科技(深圳)有限公司 System, device and method for video program broadcasting
CN103501408A (en) * 2013-09-23 2014-01-08 深圳市欧珀通信软件有限公司 Method and system for photographing video clips through mobile terminal
CN103905694A (en) * 2014-04-10 2014-07-02 中央电视台 Key frame processing method and system
CN103902746A (en) * 2014-03-11 2014-07-02 深圳市元征科技股份有限公司 Fault code, data stream and freeze frame data storage and playback method
CN103929478A (en) * 2014-04-10 2014-07-16 中央电视台 Video and audio file storing and downloading method and system
CN103974143A (en) * 2014-05-20 2014-08-06 北京速能数码网络技术有限公司 Method and device for generating media data
WO2015184861A1 (en) * 2014-06-03 2015-12-10 华为技术有限公司 Method and device for processing audio and image information, and terminal device
CN105744334A (en) * 2016-02-18 2016-07-06 海信集团有限公司 Method and equipment for audio and video synchronization and synchronous playing
RU2612362C1 (en) * 2013-07-30 2017-03-07 Сяоми Инк. Method of recording, method of playback, device, terminal and system
CN106792070A (en) * 2016-12-19 2017-05-31 广东威创视讯科技股份有限公司 A kind of audio, video data DMA transfer method and device
CN106878792A (en) * 2017-03-14 2017-06-20 上海兆芯集成电路有限公司 The audio synchronization method of video stream
WO2018072098A1 (en) * 2016-10-18 2018-04-26 深圳市福斯康姆智能科技有限公司 Method and device for synchronizing audio and video
CN110290413A (en) * 2019-07-02 2019-09-27 广州清汇信息科技有限公司 A kind of multi-medium data method for recording, playback method and record share system
CN111356003A (en) * 2020-03-11 2020-06-30 北京文香信息技术有限公司 Data writing method, system and terminal equipment
CN112637488A (en) * 2020-12-17 2021-04-09 深圳市普汇智联科技有限公司 Edge fusion method and device for audio and video synchronous playing system
CN112653896A (en) * 2020-11-24 2021-04-13 贝壳技术有限公司 House source information playback method and device with watching assistant, electronic equipment and medium
CN112702559A (en) * 2021-03-23 2021-04-23 浙江华创视讯科技有限公司 Recorded broadcast abnormity feedback method, system, equipment and readable storage medium
CN113676762A (en) * 2021-08-20 2021-11-19 北京房江湖科技有限公司 Method and device for playback with watching function
CN115643442A (en) * 2022-10-25 2023-01-24 广州市保伦电子有限公司 Audio and video converging recording and playing method, device, equipment and storage medium

Cited By (28)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103491425B (en) * 2012-06-14 2017-08-04 腾讯科技(深圳)有限公司 A kind of video program play system, method, remote terminal and set top box
CN103491425A (en) * 2012-06-14 2014-01-01 腾讯科技(深圳)有限公司 System, device and method for video program broadcasting
CN102768846A (en) * 2012-07-20 2012-11-07 Tcl集团股份有限公司 Audio playing method, device and terminal
CN102768846B (en) * 2012-07-20 2015-12-16 Tcl集团股份有限公司 A kind of audio frequency playing method, device and terminal
RU2612362C1 (en) * 2013-07-30 2017-03-07 Сяоми Инк. Method of recording, method of playback, device, terminal and system
CN103501408A (en) * 2013-09-23 2014-01-08 深圳市欧珀通信软件有限公司 Method and system for photographing video clips through mobile terminal
CN103501408B (en) * 2013-09-23 2017-09-26 广东欧珀移动通信有限公司 A kind of use mobile terminal shoots the method and system of video clip
CN103902746A (en) * 2014-03-11 2014-07-02 深圳市元征科技股份有限公司 Fault code, data stream and freeze frame data storage and playback method
CN103902746B (en) * 2014-03-11 2017-10-27 深圳市元征科技股份有限公司 DTC, data flow and the method for freezing frame data preservation and playback
CN103905694A (en) * 2014-04-10 2014-07-02 中央电视台 Key frame processing method and system
CN103929478A (en) * 2014-04-10 2014-07-16 中央电视台 Video and audio file storing and downloading method and system
CN103974143A (en) * 2014-05-20 2014-08-06 北京速能数码网络技术有限公司 Method and device for generating media data
WO2015184861A1 (en) * 2014-06-03 2015-12-10 华为技术有限公司 Method and device for processing audio and image information, and terminal device
CN105744334A (en) * 2016-02-18 2016-07-06 海信集团有限公司 Method and equipment for audio and video synchronization and synchronous playing
WO2018072098A1 (en) * 2016-10-18 2018-04-26 深圳市福斯康姆智能科技有限公司 Method and device for synchronizing audio and video
CN106792070A (en) * 2016-12-19 2017-05-31 广东威创视讯科技股份有限公司 A kind of audio, video data DMA transfer method and device
CN106792070B (en) * 2016-12-19 2020-06-23 广东威创视讯科技股份有限公司 DMA transmission method and device for audio and video data
CN106878792A (en) * 2017-03-14 2017-06-20 上海兆芯集成电路有限公司 The audio synchronization method of video stream
CN110290413A (en) * 2019-07-02 2019-09-27 广州清汇信息科技有限公司 A kind of multi-medium data method for recording, playback method and record share system
CN111356003A (en) * 2020-03-11 2020-06-30 北京文香信息技术有限公司 Data writing method, system and terminal equipment
CN111356003B (en) * 2020-03-11 2022-03-29 安徽文香科技有限公司 Data writing method, system and terminal equipment
CN112653896A (en) * 2020-11-24 2021-04-13 贝壳技术有限公司 House source information playback method and device with watching assistant, electronic equipment and medium
CN112653896B (en) * 2020-11-24 2023-06-13 贝壳技术有限公司 House source information playback method and device with viewing assistant, electronic equipment and medium
CN112637488A (en) * 2020-12-17 2021-04-09 深圳市普汇智联科技有限公司 Edge fusion method and device for audio and video synchronous playing system
CN112702559A (en) * 2021-03-23 2021-04-23 浙江华创视讯科技有限公司 Recorded broadcast abnormity feedback method, system, equipment and readable storage medium
CN112702559B (en) * 2021-03-23 2021-07-09 浙江华创视讯科技有限公司 Recorded broadcast abnormity feedback method, system, equipment and readable storage medium
CN113676762A (en) * 2021-08-20 2021-11-19 北京房江湖科技有限公司 Method and device for playback with watching function
CN115643442A (en) * 2022-10-25 2023-01-24 广州市保伦电子有限公司 Audio and video converging recording and playing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN101303880B (en) 2010-08-11

Similar Documents

Publication Publication Date Title
CN101303880B (en) Method and apparatus for recording and playing audio-video document
CN109168078B (en) Video definition switching method and device
CN104618786A (en) Audio/video synchronization method and device
CN103888813A (en) Audio and video synchronization realization method and system
CN103780977B (en) A kind of flow media playing method based on frame alignment technology
CN104780422B (en) Flow media playing method and DST PLAYER
CN103686315A (en) Synchronous audio and video playing method and device
CN104410807A (en) Method and device for synchronously replaying multi-channel video
CN105657524A (en) Seamless video switching method
CN102640511A (en) Method and system for playing video information, and video information content
CN101951517B (en) Method, system and terminal equipment for decoding and playing video
CN103686312B (en) DVR multipath audio and video recording method
CN105187896A (en) Multi-segment media file playing method and system
CN100370804C (en) AV synchronization system
CN1741170B (en) Method for generating additional information, recording medium, and recording, editing and/or playback apparatus using the same
CN101383961B (en) Content reproduction appratus, content reproduction method, and content reproduction system
CN101022523A (en) Mobile communication terminal video and audio file recording and broadcasting method and device
CN101119461A (en) System and method for maintaining video frame and audio frame synchronous broadcasting
CN101262612A (en) A system and method for synchronous playing of multimedia file audio and video
KR100490403B1 (en) Method for controlling buffering of audio stream and apparatus thereof
CN103581730A (en) Method for achieving synchronization of audio and video on digital set top box
CN102075803A (en) Method for synchronously playing video and audio
CN101290790B (en) Synchronous playing method and device for both audio and video
CN1758772B (en) Method for synchronous playing video and audio of medium document and its system
CN108566552B (en) Multimedia playing method and system suitable for digital set top box

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
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100811

Termination date: 20120630