CN103269460A - Device and method for computing duration of audio/video file - Google Patents
Device and method for computing duration of audio/video file Download PDFInfo
- Publication number
- CN103269460A CN103269460A CN2013101545203A CN201310154520A CN103269460A CN 103269460 A CN103269460 A CN 103269460A CN 2013101545203 A CN2013101545203 A CN 2013101545203A CN 201310154520 A CN201310154520 A CN 201310154520A CN 103269460 A CN103269460 A CN 103269460A
- Authority
- CN
- China
- Prior art keywords
- video
- audio
- frame
- 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.)
- Granted
Links
Images
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Television Signal Processing For Recording (AREA)
Abstract
The invention provides a method for computing duration of an audio/video file. The method comprises a step of unpackaging: analyzing the audio/video file into a corresponding audio frame sequence and a corresponding video frame sequence; a step of analyzing parameters: obtaining the number of video frames and audio frames, a video frame rate, an audio frame rate, the timestamp when a first video frame is started, the timestamp when a first audio frame is started, the timestamp when a last video frame is ended, and the timestamp when a last audio frame is ended in the audio/video file; a step of computing duration of the audio/video frame sequence: computing the duration of the video frame sequence according to the number of the video frames and the video frame rate, and/or computing the duration of the audio frame sequence according to the number of the audio frames and the audio frame rate; a step of computing the duration of the audio/video file based on the duration of the video frame sequence or the duration of the audio frame sequence. The invention further provides a device for computing the duration of the audio/video file.
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 to audio-video document accurately calculates.
Background technology:
In life, people or when checking the information of an audio-video document, can see the duration information of audio-video document in progress bar or video information zone usually when watching video playback.In the prior art, the duration of audio-video document is duration (i.e. (TSNV-the TSOv)+1/FRv that adds a frame by the difference that the timestamp (TSNV) with the last frame of sequence of frames of video deducts the timestamp (TSOv) of first frame, wherein FRv is video frame rate) obtain, or obtain by the duration (i.e. (TSNA-TSOa)+1/FRa, wherein FRa is the audio frequency frame per second) that the difference that the timestamp (TSNA) with the last frame of audio frame sequence deducts the timestamp (TSOa) of first frame is added a frame.Yet reason can the cause duration of the audio-video document that calculates by said method and this physical length of looking audio file are inconsistent owing to the timestamp in the audio-video document is discontinuous etc. sometimes.
If play for common audio-video document, had more several seconds than physical length or lacked the hundreds of millisecond by the duration that calculates the audio-video document that obtains, concern not quite there is not what influence.Yet, for the processing of audio-video document (such as intercutting of the montage merging of audio-video document, program etc.), this error is too big really, perhaps can bring serious consequence, and the audio-video document after causing handling can't seamlessly transit or problem such as discontinuous.
Summary of the invention:
In order to solve the problems of the technologies described above, the invention provides a kind of audio-video document duration calculation device, comprising: de-encapsulating devices is used for audio-video document is resolved to corresponding audio frame sequence and sequence of frames of video; The parametric solution analysis apparatus, the timestamp the when timestamp during for the frame of video quantity of obtaining described audio-video document, audio frame number, video frame rate, audio frequency frame per second, the timestamp when first frame of video begins, the timestamp when first audio frame begins, last frame of video end and last audio frame finish; The duration calculation device of audio/video frame sequence calculates the duration of sequence of frames of video and/or calculates the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second according to described frame of video quantity and described video frame rate; The duration calculation device of audio-video document is based on the duration of the described audio-video document of duration calculation of the duration of described sequence of frames of video or described audio frame sequence.
Preferably, during timestamp when the timestamp when described first frame of video begins begins greater than described first audio frame, the difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described sequence of frames of video and described first frame of video and described first audio frame begin and as the duration of described audio-video document.
Preferably, during timestamp when the timestamp when described last audio frame finishes finishes greater than described last frame of video, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described sequence of frames of video with described first frame of video and described first audio frame begin and described last audio frame finish and described last frame of video end and as the duration of described audio-video document.
Preferably, during timestamp when the timestamp the when timestamp the when timestamp when described first frame of video begins begins smaller or equal to described first audio frame and described last audio frame finish finishes smaller or equal to described last frame of video, the duration calculation device of described audio-video document is with the duration of the described sequence of frames of video duration as described audio-video document.
Preferably, during timestamp when the timestamp when described first audio frame begins begins greater than described first frame of video, the difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described audio frame sequence and described first audio frame and described first frame of video begin and as the duration of described audio-video document.。
Preferably, during timestamp when the timestamp when described last frame of video finishes finishes greater than last audio frame, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described audio frame sequence with described first audio frame and described first frame of video begin and described last frame of video finish and described last audio frame end and as the duration of described audio-video document.
Preferably, during timestamp when the timestamp the when timestamp the when timestamp when described first audio frame begins begins smaller or equal to described first frame of video and described last frame of video finish finishes smaller or equal to described last audio frame, the duration calculation device of described audio-video document is with the duration of the described audio frame sequence duration as described audio-video document.
Preferably, audio-video document duration calculation device also comprises the storage device for the storage data.
On the other hand, the present invention also provides a kind of audio-video document duration calculation method, comprising: the decapsulation step resolves to corresponding audio frame sequence and sequence of frames of video with audio-video document; The parameter analyzing step, the timestamp when obtaining frame of video quantity in the described audio-video document, audio frame number, video frame rate, audio frequency frame per second, the timestamp when first frame of video begins, the timestamp when first audio frame begins, the timestamp when last frame of video finishes and last audio frame and finishing; The duration calculation step of audio/video frame sequence is calculated the duration of sequence of frames of video and/or is calculated the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second according to described frame of video quantity and described video frame rate; The duration calculation step of audio-video document is based on the duration of the described audio-video document of duration calculation of the duration of 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 begins begins greater than described first audio frame, the difference between the timestamp the when timestamp the when duration of described sequence of frames of video and described first frame of video are begun and described first audio frame begin and 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 last audio frame finishes finishes greater than described last frame of video, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when duration and described first frame of video of described sequence of frames of video begun and described first audio frame begin and described last audio frame finish and described last frame of video end and as the duration of described audio-video document.
Preferably, in the duration calculation step of described audio-video document, during timestamp when the timestamp the when timestamp the when timestamp when described first frame of video begins begins smaller or equal to described first audio frame and described last audio frame finish finishes smaller or equal to described last frame of video, with the duration of the described sequence of frames of video duration as 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 begins begins greater than described first frame of video, the difference between the timestamp the when timestamp the when duration of described audio frame sequence and described first audio frame are begun and described first frame of video begin and 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 last frame of video finishes finishes greater than last audio frame, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when duration and described first audio frame of described audio frame sequence begun and described first frame of video begin and described last frame of video finish and described last audio frame end and as the duration of described audio-video document.
Preferably, in the duration calculation step of described audio-video document, during timestamp when the timestamp the when timestamp the when timestamp when described first audio frame begins begins smaller or equal to described first frame of video and described last frame of video finish finishes smaller or equal to described last audio frame, with the duration of the described audio frame sequence duration as described audio-video document.
Preferably, the duration calculation step of described decapsulation step, described parameter analyzing step, described audio/video frame sequence and/or the duration calculation step of described audio-video document also comprise the storing step of storing data.
Technique scheme of the present invention can accurately calculate the duration of audio-video document.Simultaneously, technical scheme of the present invention has solved at different audio-video document and has merged in the processing procedure because too big audio-video document after causing handling can't seamlessly transit or problem such as discontinuous to the duration calculation error of audio-video document.
Description of drawings:
The structured flowchart of the audio-video document duration calculation device that Fig. 1 relates to for embodiment of the present invention;
The structured flowchart of the decapsulation module of the multimedia processing apparatus that Fig. 2 relates to for embodiment of the present invention;
The flow chart of the audio-video document duration calculation processing procedure that Fig. 3 relates to for embodiment of the present invention;
The flow chart of the step S15 that the duration to audio-video document that Fig. 4 relates to for embodiment of the present invention calculates;
Another flow chart of the step S15 that the duration to audio-video document that Fig. 5 relates to for embodiment of the present invention calculates.
Embodiment:
Illustrated embodiment is set forth this invention with reference to the accompanying drawings below.
Fig. 1 has shown the structured flowchart of the audio-video document duration calculation device that embodiment of the present invention relates to.As shown in Figure 1, above-mentioned audio-video document duration calculation device comprises the duration calculation module 4 of audio, video data receiver module 1, decapsulation module 2, parameter parsing module 3, audio/video frame sequence, duration calculation module 5, memory module 6 and the data/address bus 7 of audio-video document.The duration calculation module 4 of above-mentioned audio, video data receiver module 1, decapsulation module 2, parameter parsing module 3, audio/video frame sequence, the duration calculation module 5 of audio-video document are connected by above-mentioned data/address bus with memory module 6.
Above-mentioned audio, video data receiver module 1 is used for receiving and need carries out the audio-video document data of duration calculation, and the above-mentioned audio, video data that receives is delivered to above-mentioned decapsulation module 2 carries out corresponding decapsulation.After above-mentioned decapsulation module 2 receives above-mentioned audio-video document data from above-mentioned audio, video data receiver module 1, carry out decapsulation according to the corresponding document form of the above-mentioned audio, video data of receiving.In above-mentioned decapsulation process, above-mentioned decapsulation module 2 is interpreted as corresponding sequence of frames of video and audio frame sequence separately respectively with audio-video document, and above-mentioned sequence of frames of video and audio frame sequence are stored in the above-mentioned memory module 6.Then, above-mentioned parameter parsing module 3 obtains institute's stored video frames sequence 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 the 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 when first frame of video begins (ms), time stamp T S0a when first audio frame begins (ms), time stamp T SNv (ms) when last frame of video finishes, time stamp T SNa (ms) when last audio frame finishes, and with frame of video quantity Nv in the 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 when first frame of video begins (ms), time stamp T S0a when first audio frame begins (ms), time stamp T SNv (ms) when last frame of video finishes, time stamp T SNa (ms) when last audio frame finishes is stored in the above-mentioned memory module 6.The duration calculation module 4 of above-mentioned audio/video frame sequence can be obtained the stored video frames quantity Nv of institute from above-mentioned memory module 6, audio frame number Na, video frame rate FRv and audio frequency frame per second FRa, and can calculate the duration Dv(ms of sequence of frames of video according to above-mentioned frame of video quantity Nv and video frame rate FRv), and the duration Da(ms that can calculate audio frame sequence according to above-mentioned audio frame number Na and audio frequency frame per second FRa), then with 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 the above-mentioned memory module 6.The duration calculation module 5 of above-mentioned audio-video document is obtained 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), the time stamp T SNa (ms) when the time stamp T S0v (ms) when first frame of video begins, the time stamp T S0a (ms) when first audio frame begins, the time stamp T SNv (ms) when last frame of video finishes and the end of last audio frame, and calculate the duration Dt (ms) of audio-video document.
The structured flowchart of the decapsulation module 2 of the audio-video document duration calculation device that Fig. 2 relates to for embodiment of the present invention.As shown in Figure 2, above-mentioned decapsulation module 2 comprises audio-video document form judging unit 21, decapsulation selected cell 22 and several decapsulation unit 23,24,25 ...Wherein, above-mentioned several decapsulation unit 23,24,25 ... have different forms, can carry out decapsulation corresponding to different file formats.Above-mentioned audio-video document form judging unit 21 can be judged the file format of the audio frequency and video that receive from above-mentioned audio, video data receiver module 1, above-mentioned decapsulation selected cell 22 can be according to the judged result (being the form of audio-video document) of above-mentioned audio-video document form judging unit 21 from decapsulation unit 23,24,25 ... the corresponding decapsulation unit of middle selection is carried out decapsulation to above-mentioned audio-video document, and above-mentioned corresponding decapsulation unit (is above-mentioned decapsulation unit 23,24,25 ... one of in) received above-mentioned audio-video document is resolved to corresponding sequence of frames of video and audio frame sequence.For example, when the form of audio-video document of input was AVI form, RM form or WMV form, the form of 21 pairs of audio-video documents that receive of above-mentioned audio-video document form judging unit was judged; If above-mentioned audio-video document form judging unit 21 judges when the form of the audio-video document that receives is the AVI form that above-mentioned decapsulation selected cell 22 selects the decapsulation unit (such as decapsulation unit 23) corresponding with the AVI form to carry out decapsulation; If above-mentioned audio-video document form judging unit 21 judges when the form of the audio-video document that receives is the RM form that above-mentioned decapsulation selected cell 22 selects the decapsulation unit (such as decapsulation unit 24) corresponding with the RM form to carry out decapsulation; If above-mentioned audio-video document form judging unit 21 judges when the form of the audio-video document that receives is the WMV form that above-mentioned decapsulation selected cell 22 selects the decapsulation unit (such as decapsulation unit 25) corresponding with the WMV form to carry out decapsulation.
The flow chart of the audio-video document duration calculation processing procedure that Fig. 3 relates to for embodiment of the present invention.Below, the calculation processes of the audio-video document duration that relates in present embodiment with reference to Fig. 3 explanation.
At first, the input audio-video document, above-mentioned audio, video data receiver module 1 receives above-mentioned audio-video document data and it is delivered 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 carried out decapsulation, the audio-video document data of above-mentioned different file formats are resolved to sequence of frames of video and audio frame sequence, and above-mentioned sequence of frames of video and audio frame sequence are stored in the above-mentioned memory module 6 (step S12).
Above-mentioned parameter parsing module 3 obtains institute's stored video frames sequence 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 the 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 when first frame of video begins (ms), time stamp T S0a when first audio frame begins (ms), time stamp T SNa (ms) when the time stamp T SNv (ms) when last frame of video finishes and last audio frame finish, and with frame of video quantity Nv in the 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 when first frame of video begins (ms), time stamp T S0a when first audio frame begins (ms), time stamp T SNa (ms) when the time stamp T SNv (ms) when last frame of video finishes and last audio frame finish is stored in the above-mentioned memory module 6 (step S13).
In step S14, the duration calculation module 4 of above-mentioned audio/video frame sequence is obtained above-mentioned frame of video quantity Nv and above-mentioned video frame rate FRv from above-mentioned memory module 6, and calculate the duration of each frame of video according to above-mentioned video frame rate FRv, wherein the duration dv of each frame of video is the inverse 1 ÷ FRv of above-mentioned video frame rate FRv, that is: dv (ms)=(1 ÷ FRv) * 1000ms/s=1000ms ÷ (FRv * 1s).Then, the duration dv with above-mentioned each frame of video multiply by the duration Dv (ms) that above-mentioned frame of video quantity Nv can obtain sequence of frames of video, that is: Dv (ms)=Nv * dv.Simultaneously, the duration calculation module 4 of above-mentioned audio/video frame sequence is obtained above-mentioned audio frame number Na and above-mentioned audio frequency frame per second FRa from above-mentioned memory module 6, and calculate the duration of each audio frame according to above-mentioned audio frequency frame per second FRa, wherein the duration da of each audio frame is the inverse 1 ÷ FRa of above-mentioned audio frequency frame per second FRa, that is: da (ms)=(1 ÷ FRa) * 1000ms/s=1000ms ÷ (FRa * 1s).Then, the duration da with above-mentioned each audio frame multiply by the duration Da (ms) that above-mentioned audio frame number Nv can obtain audio frame sequence, that is: 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 are stored in the above-mentioned memory module 6.
The duration calculation module 5 of above-mentioned audio-video document is obtained 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 when first frame of video begins (ms), time stamp T S0a when first audio frame begins (ms), time stamp T SNa (ms) when the time stamp T SNv (ms) when last frame of video finishes and last audio frame finish, and according to the duration Da (ms) of above-mentioned sequence of frames of video, time stamp T S0v when first frame of video begins (ms), time stamp T S0a when first audio frame begins (ms), time stamp T SNa (ms) when the time stamp T SNv (ms) when last frame of video finishes and last audio frame finish calculates the duration Dt (ms) (step S15) of audio-video document, exports the duration Dt (ms) (step S16) of above-mentioned audio-video document then.
The flow chart of the step S15 that the duration to audio-video document that Fig. 4 relates to for embodiment of the present invention calculates.Below, with reference to Fig. 4 the process that the duration of the audio-video document that relates in present embodiment carries out computing is described.
The value (step 151) of time stamp T SNa (ms) when the duration calculation module 5 of above-mentioned audio-video document is obtained the duration Dv (ms) of above-mentioned sequence of frames of video, the time stamp T S0v (ms) when first frame of video begins, the time stamp T S0a (ms) when first audio frame begins, the time stamp T SNv (ms) when last frame of video finishes and the end of last audio frame from above-mentioned memory module 6.
The duration calculation module 5 of above-mentioned audio-video document is judged the time stamp T S0a (ms) (step 152) when whether the time stamp T S0v (ms) when first frame of video begins begins greater than first audio frame.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T S0a (ms) (step 152: be) when the time stamp T S0v (ms) when first frame of video begins begins greater than first audio frame, difference between the time stamp T S0a (ms) when the time stamp T S0v (ms) when then the duration Dt (ms) of audio-video document begins for the duration Dv (ms) of above-mentioned sequence of frames of video and above-mentioned first frame of video and above-mentioned first audio frame begin 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 is judged the time stamp T SNv (ms) (step 154) when whether time stamp T SNa (ms) when last audio frame finishes finishes greater than last frame of video.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T SNv (ms) (step 154: be) when the time stamp T SNa (ms) when last audio frame finishes finishes greater than last frame of video, then the duration DT (ms) of audio-video document be the duration Dt (ms) of the above-mentioned audio-video document that in step 153, calculate to obtain when finishing with above-mentioned last audio frame time stamp T SNa (ms) and the difference between the time stamp T SNv (ms) during above-mentioned last frame of video end with (step 155), represent with following formula 2.
DT= Dt+(TSNa–TSNv) (2)
The duration calculation module 5 of above-mentioned audio-video document will be calculated the duration DT (ms) of the audio-video document that obtains as final calculation result output (step 156) in the step 155.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T SNv (ms) (step 154: deny) when the time stamp T SNa (ms) when above-mentioned last audio frame finishes finishes smaller or equal to above-mentioned last frame of video, the duration calculation module 5 of above-mentioned audio-video document will be calculated the duration Dt (ms) of the above-mentioned audio-video document that obtains as final calculation result output (step 156) in step 153.
If the duration calculation module of above-mentioned audio-video document 5 judges that (step 152: not), then the duration calculation module 5 of above-mentioned audio-video document is judged the time stamp T SNv (ms) (step 157) when whether time stamp T SNa (ms) when above-mentioned last audio frame finishes finishes greater than above-mentioned last frame of video again for time stamp T S0a (ms) when the time stamp T S0v (ms) when first frame of video begin begins smaller or equal to first audio frame.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T SNv (ms) (step 157: be) when the time stamp T SNa (ms) when above-mentioned last audio frame finishes finishes greater than above-mentioned last frame of video, then the duration DT (ms) of audio-video document be the duration Dv (ms) of above-mentioned sequence of frames of video and above-mentioned last audio frame when finishing time stamp T SNa (ms) and the difference between the time stamp T SNv (ms) of above-mentioned last frame of video when finishing with (step 158), represent with following formula 3.
DT= Dv+(TSNa–TSNv) (3)
If the duration calculation module of above-mentioned audio-video document 5 is judged time stamp T SNv (the ms) (step 157: not) when the time stamp T SNa (ms) when above-mentioned last audio frame finishes finishes smaller or equal to above-mentioned last frame of video, then the duration DT (ms) of audio-video document is the duration Dv (ms) (step 159) of above-mentioned sequence of frames of video, represents with following formula 4.
DT= Dv (4)
The duration calculation module 5 of above-mentioned audio-video document will be calculated the duration DT (ms) of the audio-video document that obtains as result of calculation output (step 156) in step 159.
Fig. 5 is another flow chart of the step S15 that calculates of the duration to audio-video document that the present invention relates to.Below, with reference to Fig. 5 another process that the duration of the audio-video document that relates in present embodiment carries out computing is described.
The value (step 161) of time stamp T SNa (ms) when the duration calculation module 5 of above-mentioned audio-video document is obtained the duration Da (ms) of above-mentioned audio frame sequence, the time stamp T S0v (ms) when first frame of video begins, the time stamp T S0a (ms) when first audio frame begins, the time stamp T SNv (ms) when last frame of video finishes and the end of last audio frame from above-mentioned memory module 6.
Time stamp T S0v (ms) (step 162) when the time stamp T S0a (ms) when the duration calculation module 5 of above-mentioned audio-video document judges whether that first audio frame begins begins greater than first frame of video.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T S0v (ms) (step 162: be) when the time stamp T S0a (ms) when first audio frame begins begins greater than first frame of video, difference between the time stamp T S0v (ms) when the time stamp T S0a (ms) when then the duration Dt (ms) of audio-video document begins for the duration Da (ms) of above-mentioned audio frame sequence and above-mentioned first audio frame and above-mentioned first frame of video begin 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 is judged the time stamp T SNa (ms) (step 164) when whether time stamp T SNv (ms) when last frame of video finishes finishes greater than last audio frame.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T SNa (ms) (step 164: be) when the time stamp T SNv (ms) when last frame of video finishes finishes greater than last audio frame, then the duration DT (ms) of audio-video document be the duration Dt (ms) of the above-mentioned audio-video document that in step 163, calculate to obtain when finishing with above-mentioned last frame of video time stamp T SNv (ms) and the difference between the time stamp T SNa (ms) during above-mentioned last audio frame end with (step 165), represent with following formula 6.
DT= Dt+(TSNv–TSNa) (6)
The duration calculation module 5 of above-mentioned audio-video document will be calculated the duration DT (ms) of the audio-video document that obtains as final calculation result output (step 166) in the step 165.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T SNa (ms) (step 164: deny) when the time stamp T SNv (ms) when above-mentioned last frame of video finishes finishes smaller or equal to above-mentioned last audio frame, the duration calculation module 5 of above-mentioned audio-video document will be calculated the duration Dt (ms) of the above-mentioned audio-video document that obtains as final calculation result output (step 166) in step 163.
If the duration calculation module of above-mentioned audio-video document 5 judge time stamp T S0v (ms) when the time stamp T S0a (ms) when first audio frames begin begins smaller or equal to first frame of video (step 162: not), the time stamp T SNa (ms) (step 167) when the time stamp T SNv (ms) when then the duration calculation module 5 of above-mentioned audio-video document judges whether again that above-mentioned last frame of video finishes finishes greater than above-mentioned last audio frame.
If the duration calculation module of above-mentioned audio-video document 5 is judged the time stamp T SNa (ms) (step 167: be) when the time stamp T SNv (ms) when above-mentioned last frame of video finishes finishes greater than above-mentioned last audio frame, then the duration DT (ms) of audio-video document be the duration Da (ms) of above-mentioned audio frame sequence and above-mentioned last frame of video when finishing time stamp T SNv (ms) and the difference between the time stamp T SNa (ms) of above-mentioned last audio frame when finishing with (step 168), represent with following formula 7.
DT= Da+(TSNv–TSNa) (7)
If the duration calculation module of above-mentioned audio-video document 5 is judged time stamp T SNa (the ms) (step 167: not) when the time stamp T SNv (ms) when above-mentioned last frame of video finishes finishes smaller or equal to above-mentioned last audio frame, then the duration DT (ms) of audio-video document is the duration Da (ms) (step 169) of above-mentioned audio frame sequence, represents with following formula 8.
DT= Da (8)
The duration calculation module 5 of above-mentioned audio-video document will be calculated the duration DT (ms) of the audio-video document that obtains as result of calculation output (step 166) in step 169.
Should understand embodiment described in the above specification and embodiment only is used for explanation the present invention and is not used in and limits the scope of the invention.After having read the present invention, those skilled in the art all fall within the application's claims institute restricted portion to the modification of various equivalents of the present invention.
Claims (16)
1. audio-video document duration calculation device comprises:
De-encapsulating devices is used for audio-video document is resolved to corresponding audio frame sequence and sequence of frames of video;
The parametric solution analysis apparatus, the timestamp the when timestamp during for the frame of video quantity of obtaining described audio-video document, audio frame number, video frame rate, audio frequency frame per second, the timestamp when first frame of video begins, the timestamp when first audio frame begins, last frame of video end and last audio frame finish;
The duration calculation device of audio/video frame sequence calculates the duration of sequence of frames of video and/or calculates the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second according to described frame of video quantity and described video frame rate;
The duration calculation device of audio-video document is based on the duration of the described audio-video document of duration calculation of the duration of described sequence of frames of video or described audio frame sequence.
2. calculation element according to claim 1 is characterized in that:
During timestamp when the timestamp when described first frame of video begins begins greater than described first audio frame, the difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described sequence of frames of video and described first frame of video and described first audio frame begin and as the duration of described audio-video document.
3. according to any described calculation element of claim 1~2, it is characterized in that:
During timestamp when the timestamp when described last audio frame finishes finishes greater than described last frame of video, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described sequence of frames of video with described first frame of video and described first audio frame begin and described last audio frame finish and described last frame of video end and as the duration of described audio-video document.
4. calculation element according to claim 1 is characterized in that:
During timestamp when the timestamp the when timestamp the when timestamp when described first frame of video begins begins smaller or equal to described first audio frame and described last audio frame finish finishes smaller or equal to described last frame of video, the duration calculation device of described audio-video document is with the duration of the described sequence of frames of video duration as described audio-video document.
5. calculation element according to claim 1 is characterized in that:
During timestamp when the timestamp when described first audio frame begins begins greater than described first frame of video, the difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described audio frame sequence and described first audio frame and described first frame of video begin and as the duration of described audio-video document.
6. calculation element according to claim 1 or 5 is characterized in that:
During timestamp when the timestamp when described last frame of video finishes finishes greater than last audio frame, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when the duration calculation device of described audio-video document begins the duration of described audio frame sequence with described first audio frame and described first frame of video begin and described last frame of video finish and described last audio frame end and as the duration of described audio-video document.
7. calculation element according to claim 1 is characterized in that:
During timestamp when the timestamp the when timestamp the when timestamp when described first audio frame begins begins smaller or equal to described first frame of video and described last frame of video finish finishes smaller or equal to described last audio frame, the duration calculation device of described audio-video document is with the duration of the described audio frame sequence duration as described audio-video document.
8. calculation element according to claim 1 also comprises: the storage device that is used for the storage data.
9. audio-video document duration calculation method comprises:
The decapsulation step resolves to corresponding audio frame sequence and sequence of frames of video with audio-video document;
The parameter analyzing step, the timestamp when obtaining frame of video quantity in the described audio-video document, audio frame number, video frame rate, audio frequency frame per second, the timestamp when first frame of video begins, the timestamp when first audio frame begins, the timestamp when last frame of video finishes and last audio frame and finishing;
The duration calculation step of audio/video frame sequence is calculated the duration of sequence of frames of video and/or is calculated the duration of audio frame sequence according to described audio frame number and described audio frequency frame per second according to described frame of video quantity and described video frame rate;
The duration calculation step of audio-video document is based on the duration of the described audio-video document of duration calculation of the duration of described sequence of frames of video or described audio frame sequence.
10. computational methods according to claim 9 is characterized in that:
In the duration calculation step of described audio-video document, during timestamp when the timestamp when described first frame of video begins begins greater than described first audio frame, the difference between the timestamp the when timestamp the when duration of described sequence of frames of video and described first frame of video are begun and described first audio frame begin and as the duration of described audio-video document.
11. according to any described computational methods of claim 9~10, it is characterized in that:
In the duration calculation step of described audio-video document, during timestamp when the timestamp when described last audio frame finishes finishes greater than described last frame of video, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when duration and described first frame of video of described sequence of frames of video begun and described first audio frame begin and described last audio frame finish and described last frame of video end and as the duration of described audio-video document.
12. computational methods according to claim 9 is characterized in that:
In the duration calculation step of described audio-video document, during timestamp when the timestamp the when timestamp the when timestamp when described first frame of video begins begins smaller or equal to described first audio frame and described last audio frame finish finishes smaller or equal to described last frame of video, with the duration of the described sequence of frames of video duration as described audio-video document.
13. computational methods according to claim 9 is characterized in that:
In the duration calculation step of described audio-video document, during timestamp when the timestamp when described first audio frame begins begins greater than described first frame of video, the difference between the timestamp the when timestamp the when duration of described audio frame sequence and described first audio frame are begun and described first frame of video begin and as the duration of described audio-video document.
14. according to claim 9 or 13 described computational methods, it is characterized in that:
In the duration calculation step of described audio-video document, during timestamp when the timestamp when described last frame of video finishes finishes greater than last audio frame, the difference between the timestamp the when timestamp the when difference between the timestamp the when timestamp when duration and described first audio frame of described audio frame sequence begun and described first frame of video begin and described last frame of video finish and described last audio frame end and as the duration of described audio-video document.
15. computational methods according to claim 9 is characterized in that:
In the duration calculation step of described audio-video document, during timestamp when the timestamp the when timestamp the when timestamp when described first audio frame begins begins smaller or equal to described first frame of video and described last frame of video finish finishes smaller or equal to described last audio frame, with the duration of the described audio frame sequence duration as described audio-video document.
16. computational methods according to claim 9 is characterized in that: the duration calculation step of described decapsulation step, described parameter analyzing step, described audio/video frame sequence and/or the duration calculation step of described audio-video document also comprise the storing step of 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 true CN103269460A (en) | 2013-08-28 |
CN103269460B 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) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105578261A (en) * | 2015-12-18 | 2016-05-11 | 无锡天脉聚源传媒科技有限公司 | Video editing method and device |
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 |
CN106911926A (en) * | 2015-12-23 | 2017-06-30 | 华为技术服务有限公司 | A kind of video code rate recognition methods and device |
Citations (4)
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 |
US20090185072A1 (en) * | 2008-01-18 | 2009-07-23 | Kabushiki Kaisha Toshiba | Information processing apparatus |
CN102215429A (en) * | 2010-04-01 | 2011-10-12 | 安凯(广州)微电子技术有限公司 | Recording method for mobile TV |
-
2013
- 2013-04-28 CN CN201310154520.3A patent/CN103269460B/en not_active Expired - Fee Related
Patent Citations (4)
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 |
US20090185072A1 (en) * | 2008-01-18 | 2009-07-23 | Kabushiki Kaisha Toshiba | Information processing apparatus |
CN102215429A (en) * | 2010-04-01 | 2011-10-12 | 安凯(广州)微电子技术有限公司 | Recording method for mobile TV |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105578261A (en) * | 2015-12-18 | 2016-05-11 | 无锡天脉聚源传媒科技有限公司 | Video editing method and device |
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 |
CN106911926A (en) * | 2015-12-23 | 2017-06-30 | 华为技术服务有限公司 | A kind of video code rate recognition methods and device |
CN106911926B (en) * | 2015-12-23 | 2019-01-08 | 华为技术服务有限公司 | A kind of video code rate recognition methods and device |
Also Published As
Publication number | Publication date |
---|---|
CN103269460B (en) | 2016-08-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106658133B (en) | Audio and video synchronous playing method and terminal | |
WO2017067489A1 (en) | Set-top box audio-visual synchronization method, device and storage medium | |
US9578210B2 (en) | A/V Receiving apparatus and method for delaying output of audio signal and A/V signal processing system | |
CN110996182B (en) | Timestamp processing method and device, electronic equipment and computer storage medium | |
CN111464256A (en) | Time stamp correction method and device, electronic equipment and storage medium | |
CN104038846B (en) | Buffer status method of estimation and equipment | |
CN103269460A (en) | Device and method for computing duration of audio/video file | |
JP6314252B2 (en) | Network video playback method and apparatus | |
JP2017505486A (en) | Application error detection method for cloud streaming service, apparatus and system therefor | |
CN106657090B (en) | Multimedia stream processing method and device and embedded equipment | |
US9423822B1 (en) | Automatic data acquisition subsystem synchronization and sample rate arbitration | |
WO2017113708A1 (en) | Video playback method and device | |
US20100329360A1 (en) | Method and apparatus for svc video and aac audio synchronization using npt | |
CN114299972A (en) | Audio processing method, device, equipment and storage medium | |
CN110875897B (en) | Data transmission method, device, server and storage medium | |
CN110543428A (en) | Application system testing method and device | |
CN104113778A (en) | Video stream decoding method and device | |
US20170280193A1 (en) | Method and device for processing a streaming media file | |
CN106331820A (en) | Synchronous audio and video processing method and device | |
CN103685975B (en) | A kind of audio/video player system and method | |
US20140081589A1 (en) | Method for measuring performance of an appliance | |
CN104753811A (en) | Streaming medium service optimizing method, device and system | |
CN105847990B (en) | The method and apparatus for playing media file | |
CN106464974A (en) | Requesting media content segments via multiiple network connections | |
CN103179449B (en) | The player method of media file, electronic equipment and virtual machine architecture |
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 |