CN103269460B - A kind of audio-video document duration calculation device and method - Google Patents
A kind of audio-video document duration calculation device and method Download PDFInfo
- Publication number
- CN103269460B CN103269460B CN201310154520.3A CN201310154520A CN103269460B CN 103269460 B CN103269460 B CN 103269460B CN 201310154520 A CN201310154520 A CN 201310154520A CN 103269460 B CN103269460 B CN 103269460B
- Authority
- CN
- China
- Prior art keywords
- video
- frame
- audio
- timestamp
- duration
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Abstract
The present invention provides a kind of audio-video document duration calculation method, including: decapsulation step, audio-video document is resolved to corresponding audio frame sequence and sequence of frames of video;Parameter analysis of electrochemical step, obtains the frame of video quantity in described audio-video document, timestamp when starting of audio frame number, video frame rate, audio frequency frame per second, first frame of video, first audio frame timestamp when starting, the timestamp at the end of last frame of video and the timestamp at the end of last audio frame;The duration calculation step of audio/video frame sequence, calculates the duration of sequence of frames of video according to described frame of video quantity and described video frame rate and/or calculates the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second;The duration calculation step of audio-video document, the duration of audio-video document described in the duration calculation of duration based on described sequence of frames of video or described audio frame sequence.The present invention also provides for a kind of audio-video document duration calculation device.
Description
Technical field:
The present invention relates to a kind of audio-video document treatment technology, especially relate to the devices and methods therefor that the duration of audio-video document is precisely calculated.
Background technology:
In life, people are when watching video playback, or when checking the information of an audio-video document, it will usually see the duration information of audio-video document at progress bar or video information region.In the prior art, the duration of audio-video document is the duration (i.e. (TSNV-that the difference of the timestamp (TSOv) by the timestamp of the last frame of sequence of frames of video (TSNV) deducts the first frame adds a frame
TSOv)+1/FRv, wherein FRv is video frame rate) and obtain, or the duration (i.e. (TSNA-of a frame is added by the difference that the timestamp of the last frame of audio frame sequence (TSNA) is deducted the timestamp (TSOa) of the first frame
TSOa)+1/FRa, wherein FRa is audio frequency frame per second) and obtain.But, the duration of the audio-video document that reason can cause sometimes due to the timestamp in audio-video document is discontinuous etc. is calculated by said method is inconsistent with the physical length of this video and audio file.
If for common audio-video document is play, being had more several seconds by the time length ratio physical length calculating obtained audio-video document or lacked hundreds of millisecond, relation is little, does not has anything to affect.But, for the process (the editing merging of such as audio-video document, program intercut) of audio-video document, this error is the biggest really, perhaps can bring serious consequence, the problem such as cause the audio-video document after processing to seamlessly transit or discontinuous.
Summary of the invention:
In order to solve above-mentioned technical problem, the invention provides a kind of audio-video document duration calculation device, including: de-encapsulating devices, for audio-video document being resolved to corresponding audio frame sequence and sequence of frames of video;Parameter analysis of electrochemical device, for obtaining frame of video quantity in described audio-video document, timestamp when starting of audio frame number, video frame rate, audio frequency frame per second, first frame of video, first audio frame timestamp when starting, the timestamp at the end of last frame of video and the timestamp at the end of last audio frame;The duration calculation device of audio/video frame sequence, calculates the duration of sequence of frames of video according to described frame of video quantity and described video frame rate and/or calculates the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second;The duration calculation device of audio-video document, the duration of audio-video document described in the duration calculation of duration based on described sequence of frames of video or described audio frame sequence.
Preferably, during timestamp when the timestamp when described first frame of video starts starts more than described first audio frame, the difference between timestamp when timestamp when the duration of described sequence of frames of video and described first frame of video are started by the duration calculation device of described audio-video document and described first audio frame start and duration as described audio-video document.
Preferably, when timestamp at the end of last audio frame described is more than timestamp at the end of last frame of video described, the difference between difference and the timestamp at the end of last audio frame described and the timestamp at the end of last frame of video described between timestamp when timestamp when the duration of described sequence of frames of video and described first frame of video are started by the duration calculation device of described audio-video document and described first audio frame start and duration as described audio-video document.
Preferably, when timestamp when timestamp when described first frame of video starts starts less than or equal to described first audio frame and the timestamp at the end of last audio frame described are less than or equal to timestamp at the end of last frame of video described, the duration calculation device of described audio-video document using the duration of described sequence of frames of video as the duration of described audio-video document.
Preferably, during timestamp when the timestamp when described first audio frame starts starts more than described first frame of video, the difference between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame are started by the duration calculation device of described audio-video document and described first frame of video start and duration as described audio-video document..
Preferably, when timestamp at the end of last frame of video described is more than timestamp at the end of last audio frame, the difference between difference and the timestamp at the end of last frame of video described and the timestamp at the end of last audio frame described between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame are started by the duration calculation device of described audio-video document and described first frame of video start and duration as described audio-video document.
Preferably, when timestamp when timestamp when described first audio frame starts starts less than or equal to described first frame of video and the timestamp at the end of last frame of video described are less than or equal to timestamp at the end of last audio frame described, the duration calculation device of described audio-video document using the duration of described audio frame sequence as the duration of described audio-video document.
Preferably, audio-video document duration calculation device also includes the storage device for storing data.
On the other hand, the present invention also provides for a kind of audio-video document duration calculation method, including: decapsulation step, audio-video document is resolved to corresponding audio frame sequence and sequence of frames of video;Parameter analysis of electrochemical step, obtains the frame of video quantity in described audio-video document, timestamp when starting of audio frame number, video frame rate, audio frequency frame per second, first frame of video, first audio frame timestamp when starting, the timestamp at the end of last frame of video and the timestamp at the end of last audio frame;The duration calculation step of audio/video frame sequence, calculates the duration of sequence of frames of video according to described frame of video quantity and described video frame rate and/or calculates the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second;The duration calculation step of audio-video document, the duration of audio-video document described in the duration calculation of duration based on described sequence of frames of video or described audio frame sequence.
Preferably, in the duration calculation step of described audio-video document, during timestamp when the timestamp when described first frame of video starts starts more than described first audio frame, the difference between timestamp when timestamp when the duration of described sequence of frames of video and described first frame of video being started and described first audio frame start and duration as described audio-video document.
Preferably, in the duration calculation step of described audio-video document, when timestamp at the end of last audio frame described is more than timestamp at the end of last frame of video described, the difference between difference and the timestamp at the end of last audio frame described and the timestamp at the end of last frame of video described between timestamp when timestamp when the duration of described sequence of frames of video and described first frame of video being started and described first audio frame start and duration as described audio-video document.
Preferably, in the duration calculation step of described audio-video document, when timestamp when timestamp when described first frame of video starts starts less than or equal to described first audio frame and the timestamp at the end of last audio frame described are less than or equal to timestamp at the end of last frame of video described, using the duration of described sequence of frames of video as the duration of described audio-video document.
Preferably, in the duration calculation step of described audio-video document, during timestamp when the timestamp when described first audio frame starts starts more than described first frame of video, the difference between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame being started and described first frame of video start and duration as described audio-video document.
Preferably, in the duration calculation step of described audio-video document, when timestamp at the end of last frame of video described is more than timestamp at the end of last audio frame, the difference between difference and the timestamp at the end of last frame of video described and the timestamp at the end of last audio frame described between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame being started and described first frame of video start and duration as described audio-video document.
Preferably, in the duration calculation step of described audio-video document, when timestamp when timestamp when described first audio frame starts starts less than or equal to described first frame of video and the timestamp at the end of last frame of video described are less than or equal to timestamp at the end of last audio frame described, using the duration of described audio frame sequence as the duration of described audio-video document.
Preferably, the duration calculation step of described decapsulation step, described Parameter analysis of electrochemical step, the duration calculation step of described audio/video frame sequence and/or described audio-video document also includes the storing step storing data.
The technique scheme of the present invention can be precisely calculated the duration of audio-video document.Meanwhile, technical scheme solves during different audio-video document merging treatment because of problems such as the audio-video document that caused process after the biggest to the duration calculation error of audio-video document cannot seamlessly transit or discontinuous.
Accompanying drawing illustrates:
Fig. 1 is the structured flowchart of the audio-video document duration calculation device that embodiment of the present invention relates to;
Fig. 2 is the structured flowchart of the decapsulation module of the multimedia processing apparatus that embodiment of the present invention relates to;
Fig. 3 is the flow chart of the audio-video document duration calculation processing procedure that embodiment of the present invention relates to;
Fig. 4 is the flow chart of step S15 that the duration to audio-video document that embodiment of the present invention relates to calculates;
Fig. 5 is another flow chart of step S15 that the duration to audio-video document that embodiment of the present invention relates to calculates.
Detailed description of the invention:
This invention is illustrated below according to accompanying drawing illustrated embodiment.
Fig. 1 shows the structured flowchart of the audio-video document duration calculation device that embodiment of the present invention relates to.As it is shown in figure 1, above-mentioned audio-video document duration calculation device includes audio, video data receiver module 1, decapsulation module 2, Parameter analysis of electrochemical module 3, the duration calculation module 4 of audio/video frame sequence, the duration calculation module 5 of audio-video document, memory module 6 and data/address bus 7.Above-mentioned audio, video data receiver module 1, decapsulation module 2, Parameter analysis of electrochemical module 3, the duration calculation module 4 of audio/video frame sequence, the duration calculation module 5 of audio-video document and memory module 6 are attached by above-mentioned data/address bus.
Above-mentioned audio, video data receiver module 1 needs to carry out the audio-video document data of duration calculation for receiving, and the above-mentioned audio, video data received is delivered to above-mentioned decapsulation module 2 decapsulates accordingly.Above-mentioned decapsulation module 2, after above-mentioned audio, video data receiver module 1 receives above-mentioned audio-video document data, decapsulates according to the corresponding document form of the above-mentioned audio, video data received.In above-mentioned decapsulation process, audio-video document is interpreted respectively as respective sequence of frames of video and audio frame sequence by above-mentioned decapsulation module 2, and above-mentioned sequence of frames of video and audio frame sequence is stored in above-mentioned memory module 6.nullThen,Above-mentioned parameter parsing module 3 obtains the sequence of frames of video stored and audio frame sequence from above-mentioned memory module 6,And respectively above-mentioned sequence of frames of video and above-mentioned audio frame sequence are resolved,Obtain frame of video quantity Nv in audio-video document、Audio-video document sound intermediate frequency number of frames Na、Video frame rate FRv、Audio frequency frame per second FRa、Time stamp T S0v (ms) when first frame of video starts、Time stamp T S0a (ms) when first audio frame starts、Time stamp T SNv (ms) at the end of last frame of video、Time stamp T SNa (ms) at the end of last audio frame,And by frame of video quantity Nv in above-mentioned audio-video document、Audio-video document sound intermediate frequency number of frames Na、Video frame rate FRv、Audio frequency frame per second FRa、Time stamp T S0v (ms) when first frame of video starts、Time stamp T S0a (ms) when first audio frame starts、Time stamp T SNv (ms) at the end of last frame of video、Time stamp T SNa (ms) at the end of last audio frame is stored in above-mentioned memory module 6.The duration calculation module 4 of above-mentioned audio/video frame sequence can obtain frame of video quantity Nv stored from above-mentioned memory module 6, audio frame number Na, video frame rate FRv and audio frequency frame per second FRa, and the duration Dv(ms of sequence of frames of video can be calculated according to above-mentioned frame of video quantity Nv and video frame rate FRv), and the duration Da(ms of audio frame sequence can be calculated according to above-mentioned audio frame number Na and audio frequency frame per second FRa), then by the duration Dv(ms of above-mentioned sequence of frames of video) and/or the duration Da(ms of audio frame sequence) be stored in above-mentioned memory module 6.The duration calculation module 5 of above-mentioned audio-video document obtains the duration Dv(ms of above-mentioned sequence of frames of video from above-mentioned memory module 6) or the duration Da(ms of above-mentioned audio frame sequence), first frame of video time stamp T S0v (ms) when starting, first audio frame time stamp T S0a (ms) when starting, time stamp T SNv (ms) at the end of last frame of video and time stamp T SNa (ms) at the end of last audio frame, and calculate the duration Dt (ms) of audio-video document.
Fig. 2 is the structured flowchart of the decapsulation module 2 of the audio-video document duration calculation device that embodiment of the present invention relates to.As in figure 2 it is shown, above-mentioned decapsulation module 2 includes that audio-video document form judging unit 21, decapsulation select unit 22 and several decapsulation unit 23,24,25 ....Wherein, above-mentioned several decapsulation unit 23,24,25 ... there is different forms, can correspond to different file formats and decapsulate.Above-mentioned audio-video document form judging unit 21 may determine that the file format of the audio frequency and video received from above-mentioned audio, video data receiver module 1, above-mentioned decapsulation selection unit 22 can be according to the judged result (i.e. the form of audio-video document) of above-mentioned audio-video document form judging unit 21 from decapsulation unit 23, 24, 25 ... above-mentioned audio-video document is decapsulated by the corresponding decapsulation unit of middle selection, above-mentioned corresponding decapsulation unit (the most above-mentioned decapsulation unit 23, 24, one of 25 ...) received above-mentioned audio-video document is resolved to corresponding sequence of frames of video and audio frame sequence.Such as, when the form of audio-video document of input is AVI format, RM form or WMV form, the form of the above-mentioned audio-video document form judging unit 21 audio-video document to being received judges;If above-mentioned audio-video document form judging unit 21 judges when the form of the audio-video document received is AVI format, above-mentioned decapsulation selects unit 22 to select the decapsulation unit (such as decapsulation unit 23) corresponding with AVI format to decapsulate;If above-mentioned audio-video document form judging unit 21 judges when the form of the audio-video document received is RM form, above-mentioned decapsulation selects unit 22 to select the decapsulation unit (such as decapsulation unit 24) corresponding with RM form to decapsulate;If above-mentioned audio-video document form judging unit 21 judges when the form of the audio-video document received is WMV form, above-mentioned decapsulation selects unit 22 to select the decapsulation unit (such as decapsulation unit 25) corresponding with WMV form to decapsulate.
Fig. 3 is the flow chart of the audio-video document duration calculation processing procedure that embodiment of the present invention relates to.Below, with reference to Fig. 3, the calculation processes at audio-video document duration of the present embodiment is described.
First, inputting audio-video document, above-mentioned audio, video data receiver module 1 receives above-mentioned audio-video document data and is transported to above-mentioned decapsulation module 2(step S11).Above-mentioned decapsulation module 2 one receives above-mentioned audio-video document data, just select corresponding decapsulation unit that above-mentioned audio-video document data are decapsulated, it is sequence of frames of video and audio frame sequence by the audio-video document data parsing of above-mentioned different file formats, and above-mentioned sequence of frames of video and audio frame sequence are stored in above-mentioned memory module 6 (step S12).
nullAbove-mentioned parameter parsing module 3 obtains the sequence of frames of video stored and audio frame sequence from above-mentioned memory module 6,And respectively above-mentioned sequence of frames of video and above-mentioned audio frame sequence are resolved,Obtain frame of video quantity Nv in audio-video document、Audio-video document sound intermediate frequency number of frames Na、Video frame rate FRv、Audio frequency frame per second FRa、Time stamp T S0v (ms) when first frame of video starts、Time stamp T S0a (ms) when first audio frame starts、Time stamp T SNv (ms) at the end of last frame of video and time stamp T SNa (ms) at the end of last audio frame,And by frame of video quantity Nv in above-mentioned audio-video document、Audio-video document sound intermediate frequency number of frames Na、Video frame rate FRv、Audio frequency frame per second FRa、Time stamp T S0v (ms) when first frame of video starts、Time stamp T S0a (ms) when first audio frame starts、Time stamp T SNv (ms) at the end of last frame of video and time stamp T SNa (ms) at the end of last audio frame are stored in above-mentioned memory module 6 (step S13).
In step S14, the duration calculation module 4 of above-mentioned audio/video frame sequence obtains above-mentioned frame of video quantity Nv and above-mentioned video frame rate FRv from above-mentioned memory module 6, and the duration of each frame of video is calculated according to above-mentioned video frame rate FRv, the duration dv of each of which frame of video is the inverse 1 ÷ FRv of above-mentioned video frame rate FRv, it may be assumed that dv (ms)=(1 ÷ FRv) × 1000ms/s=1000ms ÷ (FRv × 1s).Then, the duration dv of above-mentioned each frame of video is multiplied by above-mentioned frame of video quantity Nv and i.e. can get the duration Dv (ms) of sequence of frames of video, it may be assumed that Dv (ms)=Nv × dv.Simultaneously, the duration calculation module 4 of above-mentioned audio/video frame sequence obtains above-mentioned audio frame number Na and above-mentioned audio frequency frame per second FRa from above-mentioned memory module 6, and the duration of each audio frame is calculated according to above-mentioned audio frequency frame per second FRa, the duration da of each of which audio frame is the inverse 1 ÷ FRa of above-mentioned audio frequency frame per second FRa, it may be assumed that da (ms)=(1 ÷ FRa) × 1000ms/s=1000ms ÷ (FRa × 1s).Then, the duration da of above-mentioned each audio frame is multiplied by above-mentioned audio frame number Nv and i.e. can get the duration Da (ms) of audio frame sequence, it may be assumed that Da (ms)=Na × da.The duration Dv (ms) of above-mentioned sequence of frames of video and the duration Da (ms) of above-mentioned audio frame sequence is stored in above-mentioned memory module 6.
nullThe duration calculation module 5 of above-mentioned audio-video document obtains the duration Dv (ms) of above-mentioned sequence of frames of video or the duration Da (ms) of above-mentioned audio frame sequence from above-mentioned memory module 6、Time stamp T S0v (ms) when first frame of video starts、Time stamp T S0a (ms) when first audio frame starts、Time stamp T SNv (ms) at the end of last frame of video and time stamp T SNa (ms) at the end of last audio frame,And according to the duration Da (ms) of above-mentioned sequence of frames of video、Time stamp T S0v (ms) when first frame of video starts、Time stamp T S0a (ms) when first audio frame starts、Time stamp T SNv (ms) at the end of last frame of video and time stamp T SNa (ms) at the end of last audio frame calculate the duration Dt (ms) (step S15) of audio-video document,Then the duration Dt (ms) (step S16) of above-mentioned audio-video document is exported.
Fig. 4 is the flow chart of step S15 that the duration to audio-video document that embodiment of the present invention relates to calculates.Below, illustrate that the duration at audio-video document of the present embodiment carries out the process of calculating process with reference to Fig. 4.
The value (step 151) of time stamp T SNa (ms) at the end of time stamp T S0a (ms) when time stamp T S0v (ms) when the duration calculation module 5 of above-mentioned audio-video document obtains the duration Dv (ms) of above-mentioned sequence of frames of video from above-mentioned memory module 6, first frame of video starts, first audio frame start, time stamp T SNv (ms) at the end of last frame of video and last audio frame.
The duration calculation module 5 of above-mentioned audio-video document judges time stamp T S0a (ms) (step 152) when whether time stamp T S0v (ms) when first frame of video starts starts more than first audio frame.
If the duration calculation module 5 of above-mentioned audio-video document judges time stamp T S0a (ms) (step 152: yes) when time stamp T S0v (ms) when first frame of video starts starts more than first audio frame, the difference between time stamp T S0a (ms) when time stamp T S0v (ms) when then the duration Dv (ms) that duration Dt (ms) is above-mentioned sequence of frames of video of audio-video document and above-mentioned first frame of video start and above-mentioned first audio frame start and (step 153), represent with following formula 1.
Dt=Dv+(TS0v TS0a) (1)
Then, the duration calculation module 5 of above-mentioned audio-video document judges that whether time stamp T SNa (ms) at the end of last audio frame is more than time stamp T SNv (ms) (step 154) at the end of last frame of video.
If the duration calculation module 5 of above-mentioned audio-video document judges that time stamp T SNa (ms) at the end of last audio frame is more than time stamp T SNv (ms) (step 154: yes) at the end of last frame of video, then the difference between time stamp T SNa (ms) and time stamp T SNv (ms) at the end of last frame of video above-mentioned at the end of the duration Dt (ms) that duration DT (ms) is the above-mentioned audio-video document calculating acquisition in step 153 of audio-video document and last audio frame above-mentioned and (step 155), represent with following formula 2.
DT=Dt+(TSNa TSNv) (2)
The duration DT (ms) being calculated the audio-video document obtained in step 155 is exported (step 156) as final calculation result by the duration calculation module 5 of above-mentioned audio-video document.
If the duration Dt (ms) of the above-mentioned audio-video document calculating acquisition in step 153 is exported (step 156) as final calculation result less than or equal to time stamp T SNv (ms) (step 154: no) at the end of last frame of video above-mentioned, the duration calculation module 5 of above-mentioned audio-video document by time stamp T SNa (ms) at the end of the duration calculation module 5 of above-mentioned audio-video document judges last audio frame above-mentioned.
If the duration calculation module 5 of above-mentioned audio-video document judges time stamp T S0a (ms) (step 152: no) when time stamp T S0v (ms) when first frame of video starts starts less than or equal to first audio frame, whether time stamp T SNa (ms) at the end of the duration calculation module 5 of the most above-mentioned audio-video document judges last audio frame above-mentioned again is more than time stamp T SNv (ms) (step 157) at the end of last frame of video above-mentioned.
If time stamp T SNa (ms) at the end of the duration calculation module 5 of above-mentioned audio-video document judges last audio frame above-mentioned is more than time stamp T SNv (ms) (step 157: yes) at the end of last frame of video above-mentioned, then the difference between time stamp T SNa (ms) and time stamp T SNv (ms) at the end of last frame of video above-mentioned at the end of the duration Dv (ms) that duration DT (ms) is above-mentioned sequence of frames of video of audio-video document and last audio frame above-mentioned and (step 158), represent with following formula 3.
DT=Dv+(TSNa TSNv) (3)
If time stamp T SNa (ms) at the end of the duration calculation module 5 of above-mentioned audio-video document judges last audio frame above-mentioned is less than or equal to time stamp T SNv (ms) (step 157: no) at the end of last frame of video above-mentioned, then the duration Dv (ms) (step 159) that duration DT (ms) is above-mentioned sequence of frames of video of audio-video document, represents with following formula 4.
DT= Dv
(4)
The duration DT (ms) being calculated the audio-video document obtained in step 159 is exported (step 156) as result of calculation by the duration calculation module 5 of above-mentioned audio-video document.
Fig. 5 is another flow chart of step S15 that the duration to audio-video document that the present invention relates to calculates.Below, illustrate that the duration at audio-video document of the present embodiment carries out another process of calculating process with reference to Fig. 5.
The value (step 161) of time stamp T SNa (ms) at the end of time stamp T S0a (ms) when time stamp T S0v (ms) when the duration calculation module 5 of above-mentioned audio-video document obtains the duration Da (ms) of above-mentioned audio frame sequence from above-mentioned memory module 6, first frame of video starts, first audio frame start, time stamp T SNv (ms) at the end of last frame of video and last audio frame.
The duration calculation module 5 of above-mentioned audio-video document judges whether time stamp T S0v (ms) (step 162) when time stamp T S0a (ms) when first audio frame starts starts more than first frame of video.
If the duration calculation module 5 of above-mentioned audio-video document judges time stamp T S0v (ms) (step 162: yes) when time stamp T S0a (ms) when first audio frame starts starts more than first frame of video, the difference between time stamp T S0v (ms) when time stamp T S0a (ms) when then the duration Da (ms) that duration Dt (ms) is above-mentioned audio frame sequence of audio-video document and above-mentioned first audio frame start and above-mentioned first frame of video start and (step 163), represent with following formula 5.
Dt=Da+(TS0a TS0v) (5)
Then, the duration calculation module 5 of above-mentioned audio-video document judges that whether time stamp T SNv (ms) at the end of last frame of video is more than time stamp T SNa (ms) (step 164) at the end of last audio frame.
If the duration calculation module 5 of above-mentioned audio-video document judges that time stamp T SNv (ms) at the end of last frame of video is more than time stamp T SNa (ms) (step 164: yes) at the end of last audio frame, then the difference between time stamp T SNv (ms) and time stamp T SNa (ms) at the end of last audio frame above-mentioned at the end of the duration Dt (ms) that duration DT (ms) is the above-mentioned audio-video document calculating acquisition in step 163 of audio-video document and last frame of video above-mentioned and (step 165), represent with following formula 6.
DT=Dt+(TSNv TSNa) (6)
The duration DT (ms) being calculated the audio-video document obtained in step 165 is exported (step 166) as final calculation result by the duration calculation module 5 of above-mentioned audio-video document.
If the duration Dt (ms) of the above-mentioned audio-video document calculating acquisition in step 163 is exported (step 166) as final calculation result less than or equal to time stamp T SNa (ms) (step 164: no) at the end of last audio frame above-mentioned, the duration calculation module 5 of above-mentioned audio-video document by time stamp T SNv (ms) at the end of the duration calculation module 5 of above-mentioned audio-video document judges last frame of video above-mentioned.
If the duration calculation module 5 of above-mentioned audio-video document judges time stamp T S0v (ms) (step 162: no) when time stamp T S0a (ms) when first audio frame starts starts less than or equal to first frame of video, time stamp T SNv (ms) at the end of the duration calculation module 5 of the most above-mentioned audio-video document judges whether last frame of video above-mentioned again is more than time stamp T SNa (ms) (step 167) at the end of last audio frame above-mentioned.
If time stamp T SNv (ms) at the end of the duration calculation module 5 of above-mentioned audio-video document judges last frame of video above-mentioned is more than time stamp T SNa (ms) (step 167: yes) at the end of last audio frame above-mentioned, then the difference between time stamp T SNv (ms) and time stamp T SNa (ms) at the end of last audio frame above-mentioned at the end of the duration Da (ms) that duration DT (ms) is above-mentioned audio frame sequence of audio-video document and last frame of video above-mentioned and (step 168), represent with following formula 7.
DT=Da+(TSNv TSNa) (7)
If time stamp T SNv (ms) at the end of the duration calculation module 5 of above-mentioned audio-video document judges last frame of video above-mentioned is less than or equal to time stamp T SNa (ms) (step 167: no) at the end of last audio frame above-mentioned, then the duration Da (ms) (step 169) that duration DT (ms) is above-mentioned audio frame sequence of audio-video document, represents with following formula 8.
DT= Da
(8)
The duration DT (ms) being calculated the audio-video document obtained in step 169 is exported (step 166) as result of calculation by the duration calculation module 5 of above-mentioned audio-video document.
It should be understood that detailed description of the invention and embodiment described in description above are merely to illustrate the present invention rather than limit the scope of the present invention.After having read the present invention, those skilled in the art all fall within the application claims limited range to the amendment of the various equivalents of the present invention.
Claims (10)
1. an audio-video document duration calculation device, including:
De-encapsulating devices, for resolving to corresponding audio frame sequence and sequence of frames of video by audio-video document;
Parameter analysis of electrochemical device, for obtaining frame of video quantity in described audio-video document, timestamp when starting of audio frame number, video frame rate, audio frequency frame per second, first frame of video, first audio frame timestamp when starting, the timestamp at the end of last frame of video and the timestamp at the end of last audio frame;
The duration calculation device of audio/video frame sequence, calculates the duration of sequence of frames of video according to described frame of video quantity and described video frame rate and/or calculates the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second;
The duration calculation device of audio-video document, judge the size of timestamp when timestamp when described first frame of video starts and first audio frame start and calculate its difference, the size of the timestamp at the end of the timestamp at the end of judging last frame of video and last audio frame also calculates its difference, duration according to described sequence of frames of video or the duration of described audio frame sequence, the difference of timestamp when timestamp when first audio frame starts and first frame of video start, timestamp at the end of last audio frame and the difference of the timestamp at the end of last frame of video, calculate the duration of described audio-video document,
nullTime stamp T S0a when time stamp T S0v when first frame of video starts starts more than the first audio frame,And time stamp T SNv at the end of last frame of video is less than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv+ (TS0v-TS0a)+(TSNa-TSNv),Time stamp T S0a when time stamp T S0v when first frame of video starts starts more than the first audio frame,And time stamp T SNv at the end of last frame of video is more than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv+ (TS0v-TS0a),Time stamp T S0a when time stamp T S0v when first frame of video starts starts less than the first audio frame,And time stamp T SNv at the end of last frame of video is less than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv+ (TSNa-TSNv),Time stamp T S0a when time stamp T S0v when first frame of video starts starts less than the first audio frame,And time stamp T SNv at the end of last frame of video is more than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv,Wherein,Dv is the duration of sequence of frames of video.
Calculating device the most according to claim 1, it is characterised in that:
During timestamp when the timestamp when described first audio frame starts starts more than described first frame of video, the difference between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame are started by the duration calculation device of described audio-video document and described first frame of video start and duration as described audio-video document.
Calculating device the most according to claim 1 and 2, it is characterised in that:
When timestamp at the end of last frame of video described is more than timestamp at the end of last audio frame, the difference between difference and the timestamp at the end of last frame of video described and the timestamp at the end of last audio frame described between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame are started by the duration calculation device of described audio-video document and described first frame of video start and duration as described audio-video document.
Calculating device the most according to claim 1, it is characterised in that:
When timestamp when timestamp when described first audio frame starts starts less than or equal to described first frame of video and the timestamp at the end of last frame of video described are less than or equal to timestamp at the end of last audio frame described, the duration calculation device of described audio-video document using the duration of described audio frame sequence as the duration of described audio-video document.
Calculating device the most according to claim 1, also includes: for storing the storage device of data.
6. an audio-video document duration calculation method, including:
Decapsulation step, resolves to corresponding audio frame sequence and sequence of frames of video by audio-video document;
Parameter analysis of electrochemical step, obtains the frame of video quantity in described audio-video document, timestamp when starting of audio frame number, video frame rate, audio frequency frame per second, first frame of video, first audio frame timestamp when starting, the timestamp at the end of last frame of video and the timestamp at the end of last audio frame;
The duration calculation step of audio/video frame sequence, calculates the duration of sequence of frames of video according to described frame of video quantity and described video frame rate and/or calculates the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second;
The duration calculation step of audio-video document, judge the size of timestamp when timestamp when described first frame of video starts and first audio frame start and calculate its difference, the size of the timestamp at the end of the timestamp at the end of judging last frame of video and last audio frame also calculates its difference, duration according to described sequence of frames of video or the duration of described audio frame sequence, the difference of timestamp when timestamp when first audio frame starts and first frame of video start, timestamp at the end of last audio frame and the difference of the timestamp at the end of last frame of video, calculate the duration of described audio-video document,
nullTime stamp T S0a when time stamp T S0v when first frame of video starts starts more than the first audio frame,And time stamp T SNv at the end of last frame of video is less than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv+ (TS0v-TS0a)+(TSNa-TSNv),Time stamp T S0a when time stamp T S0v when first frame of video starts starts more than the first audio frame,And time stamp T SNv at the end of last frame of video is more than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv+ (TS0v-TS0a),Time stamp T S0a when time stamp T S0v when first frame of video starts starts less than the first audio frame,And time stamp T SNv at the end of last frame of video is less than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv+ (TSNa-TSNv),Time stamp T S0a when time stamp T S0v when first frame of video starts starts less than the first audio frame,And time stamp T SNv at the end of last frame of video is more than time stamp T SNa at the end of last audio frame,Then the duration DT of audio-video document is DT=Dv,Wherein,Dv is the duration of sequence of frames of video.
Computational methods the most according to claim 6, it is characterised in that:
In the duration calculation step of described audio-video document, during timestamp when the timestamp when described first audio frame starts starts more than described first frame of video, the difference between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame being started and described first frame of video start and duration as described audio-video document.
8. according to the computational methods described in claim 6 or 7, it is characterised in that:
In the duration calculation step of described audio-video document, when timestamp at the end of last frame of video described is more than timestamp at the end of last audio frame, the difference between difference and the timestamp at the end of last frame of video described and the timestamp at the end of last audio frame described between timestamp when timestamp when the duration of described audio frame sequence and described first audio frame being started and described first frame of video start and duration as described audio-video document.
Computational methods the most according to claim 6, it is characterised in that:
In the duration calculation step of described audio-video document, when timestamp when timestamp when described first audio frame starts starts less than or equal to described first frame of video and the timestamp at the end of last frame of video described are less than or equal to timestamp at the end of last audio frame described, using the duration of described audio frame sequence as the duration of described audio-video document.
Computational methods the most according to claim 6, it is characterised in that: the duration calculation step of described decapsulation step, described Parameter analysis of electrochemical step, the duration calculation step of described audio/video frame sequence and/or described audio-video document also includes the storing step storing data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310154520.3A CN103269460B (en) | 2013-04-28 | 2013-04-28 | A kind of audio-video document duration calculation device and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310154520.3A CN103269460B (en) | 2013-04-28 | 2013-04-28 | A kind of audio-video document duration calculation device and method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103269460A CN103269460A (en) | 2013-08-28 |
CN103269460B true CN103269460B (en) | 2016-08-17 |
Family
ID=49013065
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310154520.3A Expired - Fee Related CN103269460B (en) | 2013-04-28 | 2013-04-28 | A kind of audio-video document duration calculation device and method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103269460B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105578260A (en) * | 2015-12-18 | 2016-05-11 | 无锡天脉聚源传媒科技有限公司 | Video editing method and device |
CN105592321A (en) * | 2015-12-18 | 2016-05-18 | 无锡天脉聚源传媒科技有限公司 | Method and device for clipping video |
CN105578261B (en) * | 2015-12-18 | 2019-04-26 | 无锡天脉聚源传媒科技有限公司 | A kind of method and apparatus of video clipping |
CN106911926B (en) * | 2015-12-23 | 2019-01-08 | 华为技术服务有限公司 | A kind of video code rate recognition methods and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006050362A (en) * | 2004-08-06 | 2006-02-16 | Casio Comput Co Ltd | Device for reproducing moving image with sound and method for correcting reproduction clock |
CN1852425A (en) * | 2006-05-19 | 2006-10-25 | 北京中星微电子有限公司 | Method and apparatus for obtaining current broadcasting time while broadcasting multi-medium document |
CN102215429A (en) * | 2010-04-01 | 2011-10-12 | 安凯(广州)微电子技术有限公司 | Recording method for mobile TV |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4346663B2 (en) * | 2008-01-18 | 2009-10-21 | 株式会社東芝 | Information processing apparatus and program |
-
2013
- 2013-04-28 CN CN201310154520.3A patent/CN103269460B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006050362A (en) * | 2004-08-06 | 2006-02-16 | Casio Comput Co Ltd | Device for reproducing moving image with sound and method for correcting reproduction clock |
CN1852425A (en) * | 2006-05-19 | 2006-10-25 | 北京中星微电子有限公司 | Method and apparatus for obtaining current broadcasting time while broadcasting multi-medium document |
CN102215429A (en) * | 2010-04-01 | 2011-10-12 | 安凯(广州)微电子技术有限公司 | Recording method for mobile TV |
Also Published As
Publication number | Publication date |
---|---|
CN103269460A (en) | 2013-08-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106658133B (en) | Audio and video synchronous playing method and terminal | |
CN106162235B (en) | For the method and apparatus of Switch Video stream | |
CN111464256A (en) | Time stamp correction method and device, electronic equipment and storage medium | |
WO2017067489A1 (en) | Set-top box audio-visual synchronization method, device and storage medium | |
CN103269460B (en) | A kind of audio-video document duration calculation device and method | |
CN108063970A (en) | A kind of method and apparatus for handling live TV stream | |
CN110996182B (en) | Timestamp processing method and device, electronic equipment and computer storage medium | |
KR102379530B1 (en) | Method and apparatus for transmitting and receiving media information in a communication system | |
CN103475932A (en) | Seamless on-line playing method and device of network video and network television system | |
WO2017161766A1 (en) | Method and device for resuming video playback across multiple terminals | |
US7885514B2 (en) | Apparatus and method for determining rendering duration of video frame | |
EP3142381A1 (en) | Network video playing method and device | |
CN106657090B (en) | Multimedia stream processing method and device and embedded equipment | |
WO2012092725A1 (en) | Method, device and mobile terminal for processing fast forward/fast backward during video playing | |
CN108156500B (en) | Multimedia data time correction method, computer device and computer readable storage medium | |
CN104918108A (en) | Video accurate positioning device and method based on HLS (HTTP Live Streaming) protocol | |
CN103491430A (en) | Streaming media data processing method and electronic device | |
CN114299972A (en) | Audio processing method, device, equipment and storage medium | |
CN103152635B (en) | A kind of method solving reproduction time saltus step and client | |
KR101503082B1 (en) | rich media stream management | |
CN105847990B (en) | The method and apparatus for playing media file | |
US8509598B1 (en) | Electronic apparatus and index generation method | |
US9525843B2 (en) | Multimedia file playback method, playback apparatus and system | |
WO2014036877A1 (en) | Video playback system and method | |
CN103139610A (en) | Method and device of cluster video synchronized broadcast |
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 | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right | ||
PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: An audio and video file length calculation device and method Effective date of registration: 20210104 Granted publication date: 20160817 Pledgee: Inner Mongolia Huipu Energy Co.,Ltd. Pledgor: TVMINING (BEIJING) MEDIA TECHNOLOGY Co.,Ltd. Registration number: Y2020990001527 |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160817 Termination date: 20210428 |