Summary of the invention
In view of this, the application's technical problem to be solved has been to provide the method and system that the video playout speed of a kind of flash of being applied to is adjusted, and while watching video online to solve, in browser, flash acquiring unit can not be adjusted the problem of video playout speed.
In order to solve the problems of the technologies described above, the application discloses the method for the video playout speed adjustment of a kind of flash of being applied to, it is characterized in that, comprising:
Browser obtains frame of video and the audio frame in video file data flow, and obtains the timestamp of described frame of video; Wherein, described timestamp is the label of the play time of preset described frame of video;
Described browser is according to the adjustment indication information obtaining, identify corresponding broadcasting speed adjusted value, using described broadcasting speed adjusted value as the timestamp that accelerates multiple or deceleration multiple and revise the described frame of video of not playing, generates and utilize the timestamp of the described frame of video after adjustment to determine the playing duration of described frame of video;
Described browser is divided into many group audio sample according to the preset time interval by all audio frames of not playing, according to the playing duration of described frame of video, described audio sample is deleted or replication processes, accumulative total playing duration corresponding to described audio sample is adjusted into consistent with the playing duration of described frame of video;
By the described audio sample after described adjustment and described frame of video, with the time sequencing that the timestamp of this frame of video after adjusting is corresponding, set up association, carry out described audio/video coding.
Preferably, identify corresponding broadcasting speed adjusted value, the described broadcasting speed adjusted value of usining is revised the not timestamp of the described frame of video of broadcasting as accelerating multiple or deceleration multiple, is further:
When described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being less than 1 value, described browser according to this broadcasting speed adjusted value as deceleration multiple, the timestamp of all described frame of video of not playing, all divided by this deceleration multiple, is generated to the video frame time stamp after slowing down;
When described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being greater than 1 value, described browser according to this broadcasting speed adjusted value as accelerating multiple, the timestamp of all described frame of video of not playing is all accelerated to multiple divided by this, generate the video frame time stamp after accelerating.
Preferably, according to the playing duration of described frame of video, described audio sample is deleted or replication processes, accumulative total playing duration corresponding to described audio sample is adjusted into consistent with the playing duration of described frame of video, be further:
When the playing duration of playing duration corresponding to described audio frame and the frame of video of determining according to the video frame time stamp after slowing down is inconsistent, according to described deceleration multiple, copy described audio sample, accumulative total playing duration corresponding to all described audio sample is extended for consistent with the playing duration of described frame of video.
Preferably, according to the playing duration of described frame of video, described audio sample is deleted or replication processes, accumulative total playing duration corresponding to described audio sample is adjusted into consistent with the playing duration of described frame of video, be further:
When the playing duration of playing duration corresponding to described audio frame and the frame of video of determining according to the video frame time stamp after accelerating is inconsistent, according to described acceleration multiple, delete described audio sample, accumulative total playing duration corresponding to all described audio sample shortened to consistent with the playing duration of described frame of video.
Preferably, according to described deceleration multiple, copy described audio sample, be further: the quantity of the described audio sample before copying, divided by described deceleration multiple, is obtained to the quantity of the described audio sample after copying;
According to described acceleration multiple, delete described audio sample, be further: the quantity of the described audio sample before deleting is multiplied by described acceleration multiple, obtains the quantity of the described audio sample after deleting.
In order to solve the problems of the technologies described above, disclosed herein as well is the system of the video playout speed adjustment of a kind of flash of being applied to, couple mutually with browser, it is characterized in that, comprising: acquiring unit, frame of video unit, audio frame unit and output unit, wherein,
Described acquiring unit, for obtaining frame of video and the audio frame of video file data flow, and obtains the timestamp of described frame of video; Wherein, described timestamp is the label of the play time of preset described frame of video;
Described frame of video unit, for the adjustment indication information obtaining according to described browser, identify corresponding broadcasting speed adjusted value, using described broadcasting speed adjusted value as the timestamp that accelerates multiple or deceleration multiple and revise the described frame of video of not playing, generates and utilize the timestamp of the described frame of video after adjustment to determine the playing duration of described frame of video;
Described audio frame unit, for all audio frames of not playing being divided into many group audio sample according to the preset time interval, according to the playing duration of described frame of video, described audio sample is deleted or replication processes, accumulative total playing duration corresponding to described audio sample is adjusted into consistent with the playing duration of described frame of video;
Described output unit, for by the described audio sample after described adjustment and described frame of video, sets up association with the time sequencing that the timestamp of this frame of video after adjusting is corresponding, carries out described audio/video coding.
Preferably, described frame of video unit, is further used for:
When described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being less than 1 value, described browser according to this broadcasting speed adjusted value as deceleration multiple, the timestamp of all described frame of video of not playing, all divided by this deceleration multiple, is generated to the video frame time stamp after slowing down;
When described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being greater than 1 value, described browser according to this broadcasting speed adjusted value as accelerating multiple, the timestamp of all described frame of video of not playing is all accelerated to multiple divided by this, generate the video frame time stamp after accelerating.
Preferably, described audio frame unit, is further used for:
When the playing duration of playing duration corresponding to described audio frame and the frame of video of determining according to the video frame time stamp after slowing down is inconsistent, according to described deceleration multiple, copy described audio sample, accumulative total playing duration corresponding to all described audio sample is extended for consistent with the playing duration of described frame of video.
Preferably, described audio frame unit, is further used for:
When the playing duration of playing duration corresponding to described audio frame and the frame of video of determining according to the video frame time stamp after accelerating is inconsistent, according to described acceleration multiple, delete described audio sample, accumulative total playing duration corresponding to all described audio sample shortened to consistent with the playing duration of described frame of video.
Preferably, according to described deceleration multiple, copy described audio sample, be further: the quantity of the described audio sample before copying, divided by described deceleration multiple, is obtained to the quantity of the described audio sample after copying;
According to described acceleration multiple, delete described audio sample, be further: the quantity of the described audio sample before deleting is multiplied by described acceleration multiple, obtains the quantity of the described audio sample after deleting.
Compared with prior art, the method and system that a kind of video playout speed that is applied to flash described in the application is adjusted, have reached following effect:
1) the application adjusts according to the adjusted value of broadcasting speed for frame of video and audio frame respectively, the timestamp of frame of video is modified, according to the timestamp of amended frame of video, the audio sample of dividing is copied or deleted again, guaranteed the correspondence of audio frequency and video, can not have influence on the broadcasting of video file, efficiently solve while watching video online the problem that flash acquiring unit in browser can not be adjusted video playout speed.
2) the application can maintain the details characteristic of image and sound when video file speed change is play, the viewing effect that provides user's fast browsing and emphasis to play.
Certainly, arbitrary product of enforcement the application must not necessarily need to reach above-described all technique effects simultaneously.
Embodiment
As used some vocabulary in the middle of specification and claim, censure specific components.Those skilled in the art should understand, and hardware manufacturer may be called same assembly with different nouns.This specification and claims are not used as distinguishing the mode of assembly with the difference of title, but the difference in function is used as the criterion of distinguishing with assembly.If " comprising " mentioned in the middle of specification and claim is in the whole text an open language, therefore should be construed to " comprise but be not limited to "." roughly " refer to that in receivable error range, those skilled in the art can solve the technical problem within the scope of certain error, reach described technique effect substantially.In addition, " couple " word and comprise directly any and electric property coupling means indirectly at this.Therefore, if describe a first device in literary composition, be coupled to one second device, represent that described first device can directly be electrically coupled to described the second device, or be indirectly electrically coupled to described the second device by other devices or the means that couple.Specification subsequent descriptions is for implementing the application's better embodiment, and right described description is to illustrate that the application's rule is object, not in order to limit the application's scope.The application's protection range is when being as the criterion depending on the claims person of defining.
As shown in Figure 1, the method flow diagram of the method for adjusting for the video playout speed that is applied to flash described in the application one embodiment, comprising:
Step 101, browser obtains frame of video and the audio frame in video file data flow, and obtains the timestamp of described frame of video; Wherein, described timestamp is the label of the play time of preset described frame of video.
In step 101, when user watches video by described browser in corresponding video website, video file is transferred in the client of user's use from corresponding video server, video file is not whole video file overall coordination transmission in transmitting procedure, but video file is formed to data sequence according to a definite sequence, the form of data flow is transmitted.For video file, by the frame of video of representative image picture and the audio frame of representative voice, formed, so, when described video file transmission, in formed data flow, can get described frame of video and audio frame.
For described frame of video, in its frame data, include the timestamp being set in advance by described video server, represent time point when this frame of video will be play, so when video playback, all described frame of video are successively play according to the time sequencing of its timestamp, have formed coherent video.In the present embodiment, described frame of video and described audio frame possess corresponding relation, and this corresponding relation arranges when described video file generates, and described in each, audio frame, corresponding to a frame of video, has represented sound corresponding to this image frame.Certainly, the corresponded manner of described frame of video and audio frame can also be that corresponding timestamp is set in described audio frame, by timestamp, set up the corresponding relation of described frame of video and audio frame, this is in the present embodiment, a kind of mode of described frame of video and audio frame corresponding relation, can also adopt other modes, not form the restriction to the application.
Step 102, described browser is according to the adjustment indication information obtaining, identify corresponding broadcasting speed adjusted value, using described broadcasting speed adjusted value as the timestamp that accelerates multiple or deceleration multiple and revise the described frame of video of not playing, generates and utilize the timestamp of the described frame of video after adjustment to determine the playing duration of described frame of video.
In step 102, described adjustment indication information is specifically as follows and accelerates broadcasting indication information and slow down to play indication information, and when described adjustment indication information is play indication information for acceleration, corresponding described broadcasting speed adjusted value is greater than 1; When described adjustment indication information is play indication information for slowing down, corresponding described broadcasting speed adjusted value is less than 1.Generally, it is 2,4,8 and 16 that described broadcasting speed adjusted value corresponding to indication information play in described acceleration, represent to accelerate to play with the broadcasting speed of 2 times, 4 times, 8 times and 16 times, certainly, in actual applications, the multiple that accelerates to play is generally no more than 2 times, otherwise, there will be serious frame losing phenomenon; Equally, described broadcasting speed adjusted value corresponding to indication information play in described deceleration can use negative or decimal, represents that in actual applications, the multiple of deceleration broadcasting is generally also no more than 2 times with broadcastings of slowing down of corresponding multiple.
For step 102, the timestamp of described frame of video changes according to described broadcasting speed adjusted value, just means that the playing duration of described video changes according to described broadcasting speed adjusted value.As: when as described in the timestamp of frame of video while becoming original 2 times, the duration of this video has also become original 2 times, described video has carried out slowing down and has play, so increased the duration of video.
Step 103, described browser is divided into many group audio sample according to the preset time interval by all audio frames of not playing, according to the playing duration of described frame of video, described audio sample is deleted or replication processes, accumulative total playing duration corresponding to described audio sample is adjusted into consistent with the playing duration of described frame of video.
In step 103, the described preset time interval can be arranged by described browser, as: using 40ms(millisecond) as described in the preset time interval, described audio sample carries out the increase of quantity or the change of minimizing according to the playing duration of video corresponding to described frame of video.
It should be noted that, because described audio sample is to divide according to the time interval, so the quantity of described audio sample just reflects the playing duration that described audio frame is corresponding, be about to all described audio sample cumulative after, just can obtain the accumulative total duration of described audio frame.
Step 104, by the described audio sample after described adjustment and described frame of video, sets up association with the time sequencing that the timestamp of this frame of video after adjusting is corresponding, carries out described audio/video coding.
As shown in Figure 2, the method flow diagram of the method for adjusting for the video playout speed that is applied to flash described in the embodiment of the present application two, comprising:
Step 201, browser obtains frame of video and the audio frame in video file data flow, and obtains the timestamp of described frame of video.
The corresponding form of described audio frame includes but not limited to clear stereo, Dolby Surround, Dolby Digital 5.1, Dolby Digital EX, DTS(Digital Theatre System, digitlization cinema system) digital rings is expanded surround sound around, DTS ES() 6.1 or MPEG(Moving Pictures Experts Group/Motion Pictures Experts Group, dynamic image expert group) multi-channel audio etc.
Step 202, described browser receives user's adjustment indication information, when described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being less than 1 value, described browser according to this broadcasting speed adjusted value as deceleration multiple, the timestamp of all described frame of video of not playing, all divided by this deceleration multiple, is generated to the video frame time stamp after slowing down; When described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being greater than 1 value, described browser according to this broadcasting speed adjusted value as accelerating multiple, the timestamp of all described frame of video of not playing is all accelerated to multiple divided by this, generate the video frame time stamp after accelerating, according to the video frame time stamp after adjusting, determine the playing duration of frame of video.
Step 203, described browser is divided into many group audio sample according to the preset time interval by all audio frames of not playing, and the playing duration of the frame of video of determining according to the video frame time stamp after adjusting deletes or replication processes described audio sample, accumulative total playing duration corresponding to all described audio sample is adjusted into consistent with the playing duration of described frame of video.
In step 203, the described preset time interval can be 10ms(millisecond), 40ms, 60ms, 1s(second) etc. the multiple time interval, certainly, due to the audio frame that contains enormous amount in high-quality audio frequency, so as preferably, the described preset time interval is no more than 100ms, take 40ms as best.
It should be noted that, no matter acceleration is play or slowed down is play, the timestamp of the described frame of video after adjusting can reflect the playing duration of video, for example: a certain duration of not playing is in the video of 10 minutes, the timestamp of last frame of video is 0:10:00, represent that this frame of video will play in the time of the 10th minute, if (multiple that slows down is 0.5) play in the deceleration of now carrying out 2 times, the timestamp of described frame of video is that 0:10:00 will be divided by 0.5, the timestamp of playing this frame of video after adjusting through slowing down becomes 0:20:00, so, this video is lengthened to 20 minutes.That is to say, according to the described timestamp of described frame of video, just can determine its playing duration.
So, while playing when slowing down, for step 203, the playing duration of the frame of video of determining according to the video frame time stamp after adjusting is deleted or replication processes described audio sample, accumulative total playing duration corresponding to all described audio sample is adjusted into consistent with the playing duration of described frame of video, be specially: when the playing duration of playing duration corresponding to described audio frame and the frame of video of determining according to the video frame time stamp after slowing down is inconsistent, according to described deceleration multiple, copy described audio sample, accumulative total playing duration corresponding to all described audio sample is extended for consistent with the playing duration of described frame of video.
When accelerating to play, for step 203, the playing duration of the frame of video of determining according to the video frame time stamp after adjusting is deleted or replication processes described audio sample, accumulative total playing duration corresponding to all described audio sample is adjusted into consistent with the playing duration of described frame of video, be specially: when the playing duration of playing duration corresponding to described audio frame and the frame of video of determining according to the video frame time stamp after accelerating is inconsistent, according to described acceleration multiple, delete described audio sample, accumulative total playing duration corresponding to all described audio sample shortened to consistent with the playing duration of described frame of video.
Step 204, by the described audio sample after described adjustment and described frame of video, sets up association with the time sequencing that the timestamp of this frame of video after adjusting is corresponding, carries out exporting after described audio/video coding.
Embodiment tri-
Aforesaid operations how to realize the application is described with next application example.
Set: video A is that duration is 10 minutes videos, and the quantity of its frame of video is 12W frame, do not considering under the impact of network bandwidth condition, video A can be downloaded buffer memory fast to the client of user's use.
Step 1, user watches video A by the flash player in browser, and now, described browser obtains frame of video and the audio frame in the video file data flow of transmitting from video website, and obtains the timestamp of described frame of video.
Step 2, user is when watching, in order not hear the statement in video A, user selects to slow down broadcasting, the deceleration that user can carry out video by respective selection in this flash player of mouse control is play, now, browser receives the deceleration broadcasting indication information that user sends, and identify corresponding broadcasting speed adjusted value, this adjusted value is 0.5, the deceleration that expression is carried out video A with 0.5 times of speed is play, described browser is according to this broadcasting speed adjusted value 0.5, by the timestamp of all described frame of video of not playing all divided by 0.5, the timestamp that is described frame of video is that 0:10:00 will be divided by 0.5, the timestamp of playing the frame of video after adjusting through slowing down becomes 0:20:00, so, video A has just been lengthened to 20 minutes.That is to say, slowing down to play just means that the whole reproduction time of video A will extend.
Step 3, now, frame of video has been adjusted complete, described browser is adjusted audio frame, browser is according to preset time interval 1s, all audio frames of not playing are divided into many group audio sample, have 600 groups, before not adjusting, the accumulative total duration that these 600 groups of audio sample are corresponding is 10 minutes, and the playing duration of the frame of video that browser is determined according to the video frame time stamp after adjusting is 20 minutes, that is to say, for the video duration after adjusting, audio sample is less, so, browser will carry out replication processes to described audio sample, 600 groups of quantity that are about to audio sample are broadcasting speed adjusted value divided by 0.5(), obtain 1200 groups of audio sample (each audio sample copies once), and the cumulative time of these 1200 groups of audio sample is 20 minutes, so that can be corresponding with the playing duration of video A.
Step 4, by the described audio sample after described adjustment and described frame of video, sets up association with the time sequencing that the timestamp of this frame of video after adjusting is corresponding, carries out exporting after described audio/video coding.
Embodiment tetra-
As shown in Figure 3, the system for the video playout speed that is applied to flash described in the embodiment of the present application four is adjusted, couples mutually with browser, comprising: acquiring unit 401, frame of video unit 402, audio frame unit 403 and output unit 404; Wherein,
Described acquiring unit 401, couples mutually with described frame of video unit 402, for obtaining frame of video and the audio frame of video file data flow, and obtains the timestamp of described frame of video; Wherein, described timestamp is the label of the play time of preset described frame of video.
Described frame of video unit 402, couple mutually with described acquiring unit 401, audio frame unit 403 and output unit 404, be used for according to the user's of described browser reception adjustment indication information, identify the broadcasting speed adjusted value that this adjustment indication information is corresponding, according to described broadcasting speed adjusted value, as accelerating multiple or deceleration multiple, revise the not timestamp of the described frame of video of broadcasting, generate the video frame time stamp after adjusting, according to the video frame time stamp after adjusting, determine the playing duration of frame of video.
Described audio frame unit 403, couple mutually with described acquiring unit 401, frame of video unit 402 and output unit 404, for all audio frames of not playing being divided into many group audio sample according to the preset time interval, and the playing duration of the frame of video of determining according to the video frame time stamp after adjusting deletes or replication processes described audio sample, accumulative total playing duration corresponding to all described audio sample is adjusted into consistent with the playing duration of described frame of video.
Described output unit 404, couple mutually with described audio frame unit 403 and frame of video unit 402, for by the described audio sample after described adjustment and described frame of video, with the time sequencing that the timestamp of this frame of video after adjusting is corresponding, set up association, carry out described audio/video coding.
Described frame of video unit 402, specifically for:
When described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being less than 1 value, described browser according to this broadcasting speed adjusted value as deceleration multiple, the timestamp of all described frame of video of not playing, all divided by this deceleration multiple, is generated to the video frame time stamp after slowing down;
When described browser identifies the broadcasting speed adjusted value that described adjustment indication information is corresponding, be while being greater than 1 value, described browser according to this broadcasting speed adjusted value as accelerating multiple, the timestamp of all described frame of video of not playing is all accelerated to multiple divided by this, generate the video frame time stamp after accelerating.
Wherein, for described frame of video, in its frame data, include the timestamp being set in advance by described video server, represent time point when this frame of video will be play, so when video playback, all described frame of video are successively play according to the time sequencing of its timestamp, have formed coherent video.In the present embodiment, described frame of video and described audio frame possess corresponding relation, and this corresponding relation arranges when described video file generates, and described in each, audio frame, corresponding to a frame of video, has represented sound corresponding to this image frame.Certainly, the corresponded manner of described frame of video and audio frame can also be that corresponding timestamp is set in described audio frame, by timestamp, set up the corresponding relation of described frame of video and audio frame, this is in the present embodiment, a kind of mode of described frame of video and audio frame corresponding relation, can also adopt other modes, not form the restriction to the application.
For described audio frame, its corresponding form includes but not limited to clear stereo, Dolby Surround, Dolby Digital 5.1, Dolby Digital EX, DTS(Digital Theatre System, digitlization cinema system) digital rings is expanded surround sound around, DTS ES() 6.1 or MPEG(Moving Pictures Experts Group/Motion Pictures Experts Group, dynamic image expert group) multi-channel audio etc.
It should be noted that, no matter acceleration is play or slowed down is play, the timestamp of the described frame of video after adjusting can reflect the playing duration of video, for example: a certain duration of not playing is in the video of 10 minutes, the timestamp of last frame of video is 0:10:00, represent that this frame of video will play in the time of the 10th minute, if (multiple that slows down is 0.5) play in the deceleration of now carrying out 2 times, the timestamp of described frame of video is that 0:10:00 will be divided by 0.5, the timestamp of playing this frame of video after adjusting through slowing down becomes 0:20:00, so, this video is lengthened to 20 minutes.That is to say, according to the described timestamp of described frame of video, just can determine its playing duration.
So, while playing when slowing down, described audio frame unit 403, when inconsistent with the playing duration of stabbing the frame of video of determining according to the video frame time after slowing down specifically for playing duration corresponding to described audio frame, according to described deceleration multiple, copy described audio sample, accumulative total playing duration corresponding to all described audio sample is extended for consistent with the playing duration of described frame of video.
When accelerating to play, described audio frame unit 403, when inconsistent with the playing duration of stabbing the frame of video of determining according to the video frame time after accelerating specifically for playing duration corresponding to described audio frame, according to described acceleration multiple, delete described audio sample, accumulative total playing duration corresponding to all described audio sample shortened to consistent with the playing duration of described frame of video.
Because method part have been described in detail the embodiment of the present application, here the expansion of the method and system corresponding part relating in embodiment is described and omitted, repeat no more.Description for particular content in system can, with reference to the content of described embodiment of the method, no longer specifically limit here.
Compared with prior art, the method and system that a kind of video playout speed that is applied to flash described in the application is adjusted, have reached following effect:
1) the application adjusts according to the adjusted value of broadcasting speed for frame of video and audio frame respectively, the timestamp of frame of video is modified, according to the timestamp of amended frame of video, the audio sample of dividing is copied or deleted again, guaranteed the correspondence of audio frequency and video, can not have influence on the broadcasting of video file, efficiently solve while watching video online the problem that flash acquiring unit in browser can not be adjusted video playout speed.
2) the application can maintain the details characteristic of image and sound when video file speed change is play, the viewing effect that provides user's fast browsing and emphasis to play.
Those skilled in the art should understand, the application's embodiment can be provided as method, device or computer program.Therefore, the application can adopt complete hardware implementation example, implement software example or in conjunction with the form of the embodiment of software and hardware aspect completely.And the application can adopt the form that wherein includes the upper computer program of implementing of computer-usable storage medium (including but not limited to magnetic disc store, CD-ROM, optical memory etc.) of computer usable program code one or more.
Above-mentioned explanation has illustrated and has described some preferred embodiments of the application, but as previously mentioned, be to be understood that the application is not limited to disclosed form herein, should not regard the eliminating to other embodiment as, and can be used for various other combinations, modification and environment, and can, in invention contemplated scope described herein, by technology or the knowledge of above-mentioned instruction or association area, change.And the spirit and scope that the change that those skilled in the art carry out and variation do not depart from the application, all should be in the protection range of the application's claims.