CN108574856A - Determine that video file tries the method, apparatus, equipment and medium of cut off - Google Patents
Determine that video file tries the method, apparatus, equipment and medium of cut off Download PDFInfo
- Publication number
- CN108574856A CN108574856A CN201710527320.6A CN201710527320A CN108574856A CN 108574856 A CN108574856 A CN 108574856A CN 201710527320 A CN201710527320 A CN 201710527320A CN 108574856 A CN108574856 A CN 108574856A
- Authority
- CN
- China
- Prior art keywords
- length
- video file
- time stamp
- initial
- time
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/85—Assembly of content; Generation of multimedia applications
- H04N21/854—Content authoring
- H04N21/8547—Content authoring involving timestamps for synchronizing content
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/24—Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
- H04N21/2407—Monitoring of transmitted content, e.g. distribution time, number of downloads
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/242—Synchronization processes, e.g. processing of PCR [Program Clock References]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/47—End-user applications
- H04N21/472—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
- H04N21/47202—End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for requesting content on demand, e.g. video on demand
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/835—Generation of protective data, e.g. certificates
- H04N21/8352—Generation of protective data, e.g. certificates involving content or source identification data, e.g. Unique Material Identifier [UMID]
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Television Signal Processing For Recording (AREA)
Abstract
An embodiment of the present invention provides method, apparatus, equipment and medium that a kind of determining video file tries cut off, this method includes:Initial time stamp, the ending time stamp of video file are obtained, and determines the corresponding initial length of initial time stamp and the corresponding end length of the ending time stamp;According to the initial time stamp, the ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, the average byte code check for obtaining the video file is calculated;According to the corresponding initial length of the initial time stamp, the initial time stamp and the average byte code check, estimated length is calculated, the estimated length is the length corresponding to the timestamp after trying the video file preset time;According to the estimated length, determine that the video file tries cut off.The embodiment of the present invention can set the function of the video file of payment viewing TS formats.
Description
Technical field
The present invention relates to multimedia technology field, more particularly to a kind of determining video file try cut off method,
Device, equipment and medium.
Background technology
Develop with the technology of video on demand (VOD, Video on Demand), user can like according to the interest of oneself
Good, the content watched is wished in direct program request at any time in terminal, moreover, user can also position the arbitrary of watched video file
Length.In general, video source includes:User's original content (UGC, User Generated Content) video, professional institution's wound
Make content (PGC, Professional Generated Content) video and and major news site creation video,
In, professional structure generally requires the higher cost of input when creating video, for example, the more time, more manpower, more
Material resources, because higher cost of investment can create more good video content, in order to encourage the personnel of creation video to create
More good video can establish charging mode, i.e., user is by watching the video in a period of time in target video file
It selects to want to pay, watching entire target video file.
The video that major video provider is provided can be oneself creation, can also be to buy other people to create,
So needing to put into certain cost, charging mode is established to which video provider can be directed to the video provided, that is, use
The partial video that family can be provided with view for free video provider, the partial video that video provider is provided need user to pay
Take viewing.In general, video provider can count and analyze hot data by big data technology, determine that it was provided regards
Whether frequency is arranged paid video or free video.For paid video, when video provider can allow user's viewing default
Between section video, with attract user further pay viewing video because, user can pass through watch preset time period video
To judge whether paid video is worth viewing.
Currently, video provider establishes what payment mode was mainly realized by the video player of user terminal, mainly
Including:Include the video of index information to terminal transmission when server receives the request of terminal plays target video file
Stream, wherein index information includes:The total duration of target video file tries the information such as duration, the video flowing that terminal-pair receives
It playing out, the monitor in the video player of terminal, which listens to user, to be watched target video file and reaches when trying duration,
It triggers video player and stops playing the video flowing of target video file, and send a notification message to server, server
In reception, the notification message is off the video flowing to terminal transmission target video file, meanwhile, on the video player of terminal
It can could continue to watch the pay imformation of target video file with display reminding user charges.For example, with multimedia player
For (MP, MoviePlayer), server requirement tries that the time is 3 minutes, and video total duration is 60 minutes, is set in terminal
Determine monitor, when monitor, which listens to MP, is played to 3 minutes, monitor, which triggers MP, to be stopped playing, and tries end.
But with the development of internet, the mode that user obtains HD video is more and more, and the format of video file is in
Existing diversification, for example, some TV box sub-video files are packaged based on TS formats, wherein the video text of TS formats
Part does not have index information, so video player cannot set the function of payment viewing target video by above-mentioned technical method.
Invention content
A kind of determining video file of being designed to provide of the embodiment of the present invention tries the method, apparatus of cut off, equipment
And medium, solve the problems, such as that the video player of the prior art cannot set the function of video file of payment viewing TS formats.
Specific technical solution is as follows:
In a first aspect, an embodiment of the present invention provides a kind of method that determining video file tries cut off, applied to regarding
Frequency server, the method includes:
Initial time stamp, the ending time stamp of video file are obtained, and determines the corresponding starting length of the initial time stamp
Degree and the corresponding end length of the ending time stamp;
According to the initial time stamp, the ending time stamp, the corresponding initial length of the initial time stamp and described
The corresponding end length of ending time stamp calculates the average byte code check for obtaining the video file;
According to the corresponding initial length of the initial time stamp, the initial time stamp and the average byte code check, meter
Estimated length is calculated, the estimated length is the length corresponding to the timestamp after trying the video file preset time;
According to the estimated length, determine that the video file tries cut off.
Optionally, the step of initial time stamp for obtaining video file, ending time stamp includes:
The first key frame of the video file is searched, and obtains the header of first key frame;
Timestamp in the header of first key frame is determined as the initial time stamp;
The end key frame of the video file is searched, and obtains the header for terminating key frame;
Timestamp in the header for terminating key frame is determined as the ending time stamp.
Optionally, the corresponding initial length of the determination initial time stamp and the corresponding end of the ending time stamp
The step of length includes:
By the initial time stamp, corresponding length is determined as initial length in the video file;
By the ending time stamp, corresponding length is determined as terminating length in the video file;
The corresponding initial length of the determination initial time stamp and the corresponding end length of the ending time stamp it
Afterwards, the method further includes:
To the initial length assignment;
It obtains the video file and occupies storage size value;
Video file occupancy storage size value is assigned to the end length.
Optionally, described according to the initial time stamp, the ending time stamp, the corresponding starting of the initial time stamp
The step of length and corresponding end length of the ending time stamp, the average byte code check for calculating the acquisition video file, wraps
It includes:
Calculate the time span between the ending time stamp and the initial time stamp;
Calculate the content-length between the initial length of the initial time stamp and the end length of the ending time stamp;
According to the time span and the content-length, the average byte code check of the video file is determined;
The step of time span calculated between the ending time stamp and the initial time stamp includes:
The time difference that the ending time stamp is subtracted to the initial time stamp is determined as the time span;
The calculating corresponding initial length of initial time stamp and the corresponding end length of the ending time stamp it
Between content-length the step of include:
The difference that the end length subtracts the initial length is determined as the content-length;
It is described according to the time span and the content-length, determine the step of the average byte code check of the video file
Suddenly include:
By the content-length divided by the quotient of the time span, it is determined as the average byte code check of the video file.
Optionally, described according to the corresponding initial length of the initial time stamp, the initial time stamp and described average
Byte code check, calculate estimated length the step of include:
The time difference between the video file preset time and the initial time stamp is tried described in calculating;
Product between the time difference and the average byte code check is determined as preset length;
It will be between the preset length and the initial length and be determined as the estimated length.
Optionally, described according to the estimated length, determine that the step of video file tries cut off includes:
The estimated length is searched in the video file whether there is key frame;
If so, the timestamp in the header of the key frame is determined as absolute time;If it is not, searching the estimation length
The neighbouring key frame of degree, and the timestamp in the header of the neighbouring key frame is determined as absolute time;The neighbouring pass
The distance between length where key frame and the estimated length be less than or equal to length where any key frame with it is described
Distance between estimated length;
According to the absolute time, determine that the video file tries cut off.
Optionally, described according to the absolute time, determine that the step of video file tries cut off includes:
Judge the absolute time and the absolute difference tried between the video file preset time whether be less than or
Equal to preset time deviation, judging result is obtained;
According to the judging result, determine that the video file tries cut off.
Optionally, described according to the judging result, determine that the step of video file tries cut off includes:
If the absolute time and the absolute difference tried between the video file preset time are less than or equal to pre-
If time deviation, it is determined as the absolute time or the corresponding estimated length of the absolute time to try cut off.
Optionally, described according to the judging result, determine that the step of video file tries cut off includes:
If the absolute time and the absolute difference tried between the video file preset time are more than preset time
Deviation, then judge the absolute time tries the video file preset time described in whether being more than;
If the absolute time tries the video file preset time described in being more than, the ending time stamp is updated
For the absolute time, the end length is updated to the corresponding estimated length of the absolute time;
According to the updated ending time stamp and the end length, return execute according to the initial time stamp,
The ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, meter
The step of calculating the average byte code check for obtaining the video file, until the absolute time obtained tries the video with described
Absolute difference between file preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained
The corresponding estimated length of absolute time is determined as trying cut off.
Optionally, the method further includes:
If the absolute time tries the video file preset time described in being less than or equal to, when by the starting
Between stamp be updated to the absolute time, the initial length is updated to the corresponding estimated length of the absolute time;
According to the updated initial time stamp and the initial length, return execute according to the initial time stamp,
The ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, meter
The step of calculating the average byte code check for obtaining the video file, until the absolute time obtained tries the video with described
Absolute difference between file preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained
The corresponding estimated length of absolute time is determined as trying cut off.
Optionally, the method further includes:
Try that cut off adds identification information in the video file;
When detecting the identification information of the video file, stop the video flowing that the video file is exported to terminal.
Second aspect, an embodiment of the present invention provides the device that a kind of determining video file tries cut off, applied to regarding
Frequency server, described device include:
Acquiring unit, initial time stamp, ending time stamp for obtaining video file, and determine the initial time stamp
Corresponding initial length and the corresponding end length of the ending time stamp;
First computing unit, for being corresponded to according to the initial time stamp, the ending time stamp, the initial time stamp
Initial length and the corresponding end length of the ending time stamp, calculate the average byte code check for obtaining the video file;
Second computing unit, for according to the corresponding initial length of the initial time stamp, the initial time stamp and institute
Average byte code check is stated, calculates estimated length, the estimated length is the timestamp tried after the video file preset time
Corresponding length;
Determination unit, for according to the estimated length, determining that the video file tries cut off.
Optionally, the acquiring unit includes:
First searches subelement, the first key frame for searching the video file, and obtains first key frame
Header;
First determination subelement, when for the timestamp in the header of first key frame to be determined as the starting
Between stab;
Second searches subelement, the end key frame for searching the video file, and obtains the end key frame
Header;
Second determination subelement, for by the timestamp in the header for terminating key frame be determined as it is described at the end of
Between stab.
Optionally, the acquiring unit includes:
Third determination subelement, for corresponding length to be determined as in the video file by the initial time stamp
Beginning length;
4th determination subelement, for corresponding length to be determined as tying in the video file by the ending time stamp
Shu Changdu;
The acquiring unit further includes:
First assignment subelement, for the initial length assignment;
Subelement is obtained, storage size value is occupied for obtaining the video file;
Second assignment subelement is grown for video file occupancy storage size value to be assigned to the end
Degree obtains terminating length.
Optionally, first computing unit includes:
First computation subunit, for calculating the time span between the ending time stamp and the initial time stamp;
Second computation subunit, the end of initial length and the ending time stamp for calculating the initial time stamp
Content-length between length;
5th determination subelement, for according to the time span and the content-length, determining the video file
Average byte code check;
First computation subunit, specifically for the ending time stamp to be subtracted to the time difference of the initial time stamp
Value is determined as the time span;
Second computation subunit is determined as specifically for the difference that the end length is subtracted the initial length
The content-length;
5th determination subelement is specifically used for, by the quotient of the content-length divided by the time span, being determined as
The average byte code check of the video file.
Optionally, second computing unit includes:
Third computation subunit, for calculate it is described try the video file preset time and the initial time stamp it
Between time difference;
6th determination subelement, for the product between the time difference and the average byte code check to be determined as presetting
Length;
7th determination subelement, for will be between the preset length and the initial length and be determined as the estimation
Length.
Optionally, the determination unit includes:
Estimate subelement, whether there is key frame for searching the estimated length in the video file;
8th determination subelement, for searching the estimated length in the video file, there are key frames, will be described
Timestamp in the header of key frame is determined as absolute time;If it is not, the neighbouring key frame of the estimated length is searched, and will
Timestamp in the header of the neighbouring key frame is determined as absolute time;Length where the neighbouring key frame with it is described
The distance between estimated length is less than or equal to the length where any key frame and distance between the estimated length;
9th determination subelement, for according to the absolute time, determining that the video file tries cut off.
Optionally, the 9th determination subelement is specifically used for:
Judge the absolute time and the absolute difference tried between the video file preset time whether be less than or
Equal to preset time deviation, judging result is obtained;
According to the judging result, determine that the video file tries cut off.
Optionally, the 9th determination subelement is specifically used for:
If the absolute time and the absolute difference tried between the video file preset time are less than or equal to pre-
If time deviation, it is determined as the absolute time or the corresponding estimated length of the absolute time to try cut off.
Optionally, the 9th determination subelement is specifically used for:
If the absolute time and the absolute difference tried between the video file preset time are more than preset time
Deviation, then judge the absolute time tries the video file preset time described in whether being more than;
If the absolute time tries the video file preset time described in being more than, the ending time stamp is updated
For the absolute time, the end length is updated to the corresponding estimated length of the absolute time;
According to the updated ending time stamp and the end length, return execute according to the initial time stamp,
The ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, meter
The step of calculating the average byte code check for obtaining the video file, until the absolute time obtained tries the video with described
Absolute difference between file preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained
The corresponding estimated length of absolute time is determined as trying cut off.
Optionally, the 9th determination subelement is specifically used for:
If the absolute time tries the video file preset time described in being less than or equal to, when by the starting
Between stamp be updated to the absolute time, the initial length is updated to the corresponding estimated length of the absolute time;
According to the updated initial time stamp and the initial length, return execute according to the initial time stamp,
The ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, meter
The step of calculating the average byte code check for obtaining the video file, until the absolute time obtained tries the video with described
Absolute difference between file preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained
The corresponding estimated length of absolute time is determined as trying cut off.
Optionally, described device further includes:
Adding device, for trying that cut off adds identification information in the video file;
Detection unit exports the video text for when detecting the identification information of the video file, stopping to terminal
The video flowing of part.
The third aspect, the embodiment of the present invention additionally provide a kind of electronic equipment, including processor, communication interface, memory
And communication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes following steps:
Initial time stamp, the ending time stamp of video file are obtained, and determines the corresponding starting length of the initial time stamp
Degree and the corresponding end length of the ending time stamp;
According to the initial time stamp, the ending time stamp, the corresponding initial length of the initial time stamp and described
The corresponding end length of ending time stamp calculates the average byte code check for obtaining the video file;
According to the corresponding initial length of the initial time stamp, the initial time stamp and the average byte code check, meter
Estimated length is calculated, the estimated length is the length corresponding to the timestamp after trying the video file preset time;
According to the estimated length, determine that the video file tries cut off.
Fourth aspect, the embodiment of the present invention disclose a kind of computer readable storage medium again, described computer-readable to deposit
Computer program is stored in storage media, the computer program realizes following steps when being executed by processor:
Initial time stamp, the ending time stamp of video file are obtained, and determines the corresponding starting length of the initial time stamp
Degree and the corresponding end length of the ending time stamp;
According to the initial time stamp, the ending time stamp, the corresponding initial length of the initial time stamp and described
The corresponding end length of ending time stamp calculates the average byte code check for obtaining the video file;
According to the corresponding initial length of the initial time stamp, the initial time stamp and the average byte code check, meter
Estimated length is calculated, the estimated length is the length corresponding to the timestamp after trying the video file preset time;
According to the estimated length, determine that the video file tries cut off.
A kind of determining video file provided in an embodiment of the present invention tries the method, apparatus, equipment and medium of cut off,
In, determine that the method that video file tries cut off can be applied to video server, should be applied to video server can obtain
Initial time stamp, the ending time stamp of video file are taken, and determines the corresponding initial length of initial time stamp and ending time stamp
Corresponding end length, also, video server can be corresponding according to initial time stamp, ending time stamp, initial time stamp
Initial length and the corresponding end length of ending time stamp calculate the average byte code check for obtaining video file, further, video
Server calculates estimated length according to the corresponding initial length of initial time stamp, initial time stamp and average byte code check, into
And video server can determine that video file tries cut off according to estimated length.
In the present solution, initial time stamp, ending time stamp, starting that video server can obtain and pass through video file
Length and end length, determination try that the corresponding estimated length of timestamp after video file preset time is estimated based on this in turn
Meter length accurately determines that video file tries cut off.As it can be seen that video server to terminal send video flowing during,
When trying cut off, video server can voluntarily stop to end in the corresponding video file of video flowing transmitted by detecting
End sends video flowing, in this way, when terminal does not receive video flowing, the method stopping broadcasting that the prior art may be used in terminal should
Video file.In addition, due to there is no index information in video file, a large amount of computing resources of video server and terminal are saved
And storage resource.Certainly, it implements any of the products of the present invention or method must be not necessarily required to reach all the above simultaneously
Advantage.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
Obtain other attached drawings according to these attached drawings.
Fig. 1 is a flow chart of the method that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 2 is another flow chart for the method that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 3 is the another flow chart for the method that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 4 is a structural schematic diagram of the device that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 5 is another structural schematic diagram for the device that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 6 is another structural schematic diagram for the device that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 7 is the another structural schematic diagram for the device that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 8 is the another structural schematic diagram for the device that determining video file provided in an embodiment of the present invention tries cut off;
Fig. 9 is the another structural schematic diagram for the device that determining video file provided in an embodiment of the present invention tries cut off;
Figure 10 is a structural schematic diagram of the equipment that determining video file provided in an embodiment of the present invention tries cut off.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
It should be noted that in the absence of conflict, the feature in embodiment and embodiment in the present invention can phase
Mutually combination.The present invention will be described in detail below with reference to the accompanying drawings and embodiments.
The existing method for trying video file is mainly terminal to realize, specific steps include:When server receives
To terminal video player request play target video file when, server can to terminal send include index information mesh
The corresponding video flowing of video file is marked, the video flowing that terminal-pair receives plays out, and is seen when the monitor of terminal listens to user
See that target video file reaches when trying duration, triggering video player stops playing the video flowing of target video file, concurrently
Send a notification message to server, server can stop sending target video text to terminal when receiving the notification message
The video flowing of part, meanwhile, it can could continue to watch target video text with display reminding user charges on the video player of terminal
The pay imformation of part.When the video file quantity that video server includes is more, established for each video file corresponding
Index information can then consume a large amount of computing resource.In addition, more index information will occupy more memory spaces, no
Conducive to management.Importantly, when believing without index in the video file of TS formats, it can cause video player that cannot set
The function of fixed payment viewing target video file.
In order to set the function that the video file of TS formats is watched in payment, an embodiment of the present invention provides a kind of determining videos
File tries the process of the method for cut off, as shown in Figure 1, the process may comprise steps of:
S101 obtains initial time stamp, the ending time stamp of video file, and determines corresponding of the initial time stamp
Beginning length and the corresponding end length of the ending time stamp.
Method provided in an embodiment of the present invention can be applied to a kind of video server, which can be to terminal
The video resource of TS formats is provided.Compared with prior art, the present invention is different from the application scenarios of the prior art, the prior art
In, the operation for terminating to try video can be executed by terminal, and in the embodiment of the present invention, the video server of video flowing is provided
To execute the operation for terminating to try video.Specifically, for the terminal for playing video capability, in video server to terminal
When the video resource of TS formats is provided, stop sending video flowing to terminal by video server, and terminal is regarded not receiving
When frequency flows, the prior art may be used and stop playing video.
In embodiments of the present invention, video server can periodically obtain target video file initial time stamp,
Ending time stamp can determine the initial time stamp in mesh according to the initial time stamp of the target video file obtained in turn
Corresponding initial length in video file is marked, and according to the ending time stamp of the target video file obtained in target video
Corresponding end length in file.Wherein, target video file can be the video file that terminal request plays.
Wherein, any video file can include multiple video frame, and a key can be included at least in multiple video frame
Frame, and each key frame has header, and existence time is stabbed in header, so, video server obtains video file
Initial time stamp, the process of ending time stamp can be:Video server can search the first key frame in video file, and
And extracting the header of first key frame, wherein existence time is stabbed in the header of first key frame, so, it is searching
To after the header of first key frame, using the timestamp in the header of first key frame as the starting of video file
Timestamp.Similarly, video server can search the end key frame of the video file in video file, that is, in video
The last one key frame of the video file is searched in file, further, obtains the header for terminating key frame, each key frame
All there is corresponding header, there are a timestamps in each header, so, by the header for terminating key frame when
Between stamp be determined as the ending time stamp of the video file.
In the embodiment of the present invention, video server determines that the process of the corresponding initial length of initial time stamp can be:It will
Initial time stamp corresponding length in video file is determined as initial length, that is, by initial time stamp in video file
Corresponding length is defined as initial length.
Video server determines that the corresponding process for terminating length of ending time stamp can be:Video server is by the end of
Between stamp corresponding length in video file be determined as terminating length, that is, it is ending time stamp is corresponding in video file
Length is defined as terminating length.
Further, video server is determining the corresponding initial length of initial time stamp and the corresponding knot of ending time stamp
After Shu Changdu, the step of can also be performed, is:Assignment is carried out to identified initial length, for example, can be by initial time
Stamp corresponding length in video file is defined as 0 byte.In addition, video server can obtain the occupied storage of video file
The sizes values in space, also, the sizes values of memory space occupied by the video file are assigned to end length, for example, given
When one target video file, what the sizes values of the target video file were to determine, it can be by the target video file size
Byte length is as end length.For example, the size of memory space occupied by video file is 1024 bytes, then by the end time
Stamp corresponding length in video file is defined as 1024 bytes.
S102, according to the initial time stamp, the ending time stamp, the corresponding initial length of the initial time stamp and
The corresponding end length of the ending time stamp, calculates the average byte code check for obtaining the video file.
In the embodiment of the present invention, video server can be corresponding by initial time stamp, ending time stamp, initial time stamp
Initial length and the corresponding end length of ending time stamp substitute into preset formula, and the average byte code of video file is calculated
Rate.
Specifically, video file is according to initial time stamp, ending time stamp, the corresponding initial length of initial time stamp and knot
The corresponding end length of beam timestamp, calculating the process for the average byte code check for obtaining video file can be:
Video server can according to ending time stamp and initial time stamp, calculate ending time stamp and initial time stamp it
Between time span, that is, using the difference between ending time stamp and initial time stamp as ending time stamp and initial time
The time span of stamp.
Further, video server can with zero computing time stab initial length and ending time stamp end length it
Between content-length, that is, calculate ending time stamp end length subtract initial time stamp initial length difference conduct
The content-length of the initial length of initial time stamp and the end length of ending time stamp.
Further, video server can determine the average byte of video file according to time span and content-length
Code check, that is, using the quotient of content-length divided by time span as the average byte code check of video file.For example, according to the time
Length and content-length determine that the average byte code check of video file can be expressed as:ByteRate=Content_len/
Duration, wherein Content_len can indicate that content-length, Duration can indicate that time span, ByteRate can
To indicate the average byte code check of video file.In another example Content_len=1024 bytes, Duration=20 seconds, then
The byte per second of byte/20 second ByteRate=Content_len/Duration=1024=5.12.
S103, according to the corresponding initial length of the initial time stamp, the initial time stamp and the average byte code
Rate calculates estimated length.
Wherein, estimated length is the length corresponding to the timestamp after trying video file preset time.
In the embodiment of the present invention, video server can be according to the corresponding initial length of initial time stamp, the initial time
Stamp and average byte code check, are calculated the length corresponding to the timestamp after trying video file preset time.
Specifically, video server is according to the corresponding initial length of initial time stamp, the initial time stamp and average byte
Code check, calculating the process of estimated length can be:
Video server can calculate the time difference tried between video file preset time and initial time stamp,
In, it tries that video file preset time is to be set in advance for each video file, tries the preset time of each video file
Can be different, can also be the same, it is that can be directed to all video files when trying that the preset time of each video file is different
In each video file and try that the preset time of the video file establishes mapping table, video server can be each
Video file and try that the preset time of the video file established each video file of correspondence table search tries preset time,
In turn, it according to video file preset time and initial time stamp is tried, is calculated and tries video file preset time and starting
Time difference between timestamp.
Further, video server can will try the time difference between video file preset time and initial time stamp
Product between average byte code check is determined as preset length.To, video server can by obtained preset length with
It is between beginning length and be determined as trying the length corresponding to timestamp after video file preset time, that is, will be obtained
It is between preset length and initial length and be determined as estimated length.
S104 determines that the video file tries cut off according to the estimated length.
In the embodiment of the present invention, video server can try cut off using estimated length as video file, that is,
When video server monitors that video server to terminal transmission video data flow arrival estimated length, then stops sending out to terminal
Send the flow of video file.
Video server determines that video file tries that the process of cut off can be according to estimated length:Video server
Estimated length is searched in video file and whether there is key frame, if there are key frame, video servers in estimated length
Timestamp in header in key frame existing for the estimated length can be determined as absolute time, if video server
Estimated length is searched in video file, and finds that key frame is not present in the estimated length, then video server can be further
The neighbouring key frame of the estimated length is searched, and the timestamp in the header of neighbouring key frame is determined as absolute time.
Wherein, the distance between the length where neighbouring key frame and estimated length are less than or equal to any key frame institute
Length and estimated length between distance.Namely adjacent to where key frame length and the distance between estimated length be to appoint
It is minimum in distance between length and estimated length where one key frame.When there are two neighbouring key frames, optional two
A key frame in a neighbouring key frame is used as neighbouring key frame.
Further, video server can determine that video file tries cut off according to absolute time.
Specifically, video server according to absolute time, determines that video file tries that the process of cut off may include:
Video server judges obtained absolute time and tries the absolute difference between the video file preset time
Whether preset time deviation is less than or equal to;Wherein, absolute difference is absolute time and tries between video file preset time
Absolute value of the difference, preset time deviation are a pre-set time thresholds.In turn, video server can be based on being judged
As a result, determine that video file tries cut off.
In the embodiment of the present invention, video server can according to absolute time and try the video file preset time it
Between absolute difference, and preset time deviation magnitude relationship, determine that video file tries that the process of cut off can be:Video takes
Business device can subtract absolute time and the absolute difference for trying between the video file preset time obtained by preset time deviation
Difference and preset time deviation be compared, if absolute time and tried absolute between the video file preset time
When difference is less than or equal to preset time deviation, video server can be by absolute time or the corresponding estimated length of absolute time
It is determined as trying cut off.
In addition, if video server is by absolute time and tries the absolute subtractive between the video file preset time
After going difference and the preset time deviation obtained by preset time deviation to be compared, obtains absolute time and try video file
When absolute difference between preset time is more than preset time deviation, then video server may determine that whether absolute time is more than examination
See the video file preset time.
Further, it tries video file preset time when video server judges to obtain absolute time and is more than, then will terminate
Update of time stamp is absolute time, also, is updated to the corresponding estimated length of absolute time by length is terminated, meanwhile, video clothes
Business device can be returned according to updated ending time stamp and end length and execute according to initial time stamp, ending time stamp, rise
The corresponding initial length of beginning timestamp and the corresponding end length of ending time stamp calculate in turn and obtain video file again
The step of average byte code check, until the absolute time that is obtained of video server and try the video file preset time it
Between absolute difference be less than or equal to preset time deviation, the absolute time obtained or the absolute time obtained is corresponding
Estimated length is determined as trying cut off.
But when video server judges to obtain absolute time less than or equal to trying that the video file is preset
Between, then initial time stamp is updated to absolute time, and initial length is updated to the corresponding estimated length of absolute time, into
And video server can be returned according to updated initial time stamp and initial length and execute according to initial time stamp, terminate
The corresponding initial length of timestamp, initial time stamp and the corresponding end length of ending time stamp calculate and obtain video file
The step of average byte code check, up to the absolute time obtained and tries the absolute difference between the video file preset time
It is less than or equal to preset time deviation, the absolute time obtained or the corresponding estimated length of the absolute time obtained is true
It is set to and tries cut off.
In the embodiment of the present invention, video server can pass through the initial time stamp, ending time stamp, starting of video file
The corresponding estimated length of timestamp after video file preset time is tried in length and end length, determination, in turn, in video text
Cut off is tried in determination in part.In this way, video server can try cut off according to this, it is determined whether continue to send to terminal
The video flowing of video file.Compared with prior art, no matter index information, video server whether do not need in video file
Obtain video file in index information so that reception video flowing terminal according to the index information to determine whether terminate examination
See function.Video server in this programme to terminal during sending video flowing, when detecting transmitted video flowing pair
In the video file answered when trying cut off, video server voluntarily stop to terminal send video flowing, it is seen then that when terminal connects
When can not receive video flowing, it can stop playing the video file.In addition, due to there is no index information in video file, save
The a large amount of computing resources and storage resource of video server and terminal.
In the prior art, when terminal sends the playing request for the video file for playing TS formats to video server, terminal
The video flowing of reception is played out, reaches when the monitor of terminal listens to user and watches target video file and tries duration
When, triggering video player stops playing the video flowing of target video file, and sends a notification message to server, service
Device can stop the video flowing that target video file is sent to terminal when receiving the notification message, meanwhile, the video of terminal is broadcast
Putting can could continue to watch with display reminding user charges the pay imformation of target video file on device.And the embodiment of the present invention
In, when user needs to watch the video file or other video files of TS formats, terminal can send to server and play
Above-mentioned embodiment of the method may be used in the request of purpose video file, video server, sends video flowing to terminal, works as video
When server stops sending video flowing to terminal, terminal can return to terminal plays homepage according to factory setting or in terminal
The last received video frame of interface display, these are all the step of prior art may be implemented.
Optionally, as shown in Fig. 2, on the basis of including S101, S102, S103 and S104, the embodiment of the present invention provides
The determination video file method of trying cut off further include:
S105 tries that cut off adds identification information in the video file;
In the embodiment of the present invention, video server can try that cut off adds mark letter respectively in each video file
It ceases, tries that cut off is added to identification information in each video file.
S106 stops exporting regarding for the video file to terminal when detecting the identification information of the video file
Frequency flows.
In the embodiment of the present invention, when video server detects that user watches by terminal the identification information of video file
When the length at place, the video flowing that the video file is exported to terminal can be stopped, that is, user can only be watched by terminal
Video flowing before video file identification information.When video server stops sending video flowing to terminal, terminal can basis
Factory setting returns to terminal plays homepage or shows last received video frame in terminal interface, these are all the prior arts
The step of may be implemented.For example, when terminal does not receive video flowing, the broadcast interface of terminal can return to homepage or display
The last frame video frame of video flowing, wherein payment prompt message can be carried in the video frame.
In the embodiment of the present invention, video server can obtain and by the initial time stamp of video file, end time
The corresponding estimated length of timestamp after video file preset time is tried in stamp, initial length and end length, determination, in turn,
It is determined in video file based on the estimated length and tries cut off.Specifically, video server can try cut-off according to this
Point, it is determined whether continue to send the video flowing of video file to terminal.Compared with prior art, video server need not regarding
Index information is added in frequency file so that reception video flowing terminal according to the index information to determine whether terminate try work(
Energy.Specifically, the video server in this programme when trying cut off, is voluntarily stopping to terminal in detecting video file
Send video flowing.In addition, due to there is no index information in video file, a large amount of calculating money of video server and terminal is saved
Source and storage resource.
Specifically, trying that cut off indicates some position of video file, for example, memory space occupied by video file
Size is 1024 bytes, and a virtual location can be corresponded at each byte of the video file, and what video server determined regards
When frequency cut off is 200 byte, that is, before video server can only provide the terminal with the virtual location corresponding to 200 bytes
Video flowing, in the embodiment of the present invention, be convenient for operation, try cut off, the unit of length can be defined as byte.
It should be noted that the embodiment of the present invention realizes that determining video file tries cut-off from a side of video server
Point, it is seen then that whether the present invention there is index information not limit video file, whether have index letter for video file
Breath, the determination video file that technical scheme of the present invention realization may be used in video server try cut off.
With reference to specific application example, it is provided for the embodiments of the invention a kind of determining video file and tries cut-off
The method of point is introduced, as shown in figure 3, this method includes:
S301 obtains the initial time stamp First_DTS of video file;
Specifically, the first key frame during the video data of video file can be searched in video file, wherein first
Key frame has header, is stored with timestamp in header, can the timestamp in header be determined as video file
Initial time stamp First_DTS.
S302, the corresponding initial length First_Pos of initialization initial time stamp;
Specifically, being initialized to the corresponding length of initial time stamp, the corresponding initial length of initial time stamp is obtained,
Namely initial length is initialized, for example, initialization initial length First_Pos=0, wherein 0 unit can be
Byte.
S303 obtains the ending time stamp Last_DTS of video file;
Specifically, the last one key frame during the video data of video file can be searched in video file, wherein
The last one key frame has header, and is stored with timestamp in the header, can be true by the timestamp in the header
It is set to the ending time stamp Last_DTS of video file.
S304 determines the corresponding end length Last_Pos of ending time stamp;
Wherein, the size of the occupied memory space of each video file is known, gives a video file, then should
The size of video file is known.Video file can be sized to the corresponding end length of ending time stamp
Last_Pos。
S305 calculates the content-length of video file according to length Last_Pos and initial length First_Pos is terminated
Content_Len;
Specifically, because initial length First_Pos and end length Last_Pos have determined that, it is possible to according to
Initial length First_Pos and the content-length for terminating length Last_Pos calculating video files, for example, Content_Len=
Last_Pos-First_Pos, i.e. the content-length Content_Len of video file can be to terminate length Last_Pos and rise
The difference of beginning length First_Pos.
S306, according to ending time stamp Last_DTS and initial time stamp First_DTS, the time for calculating video file is long
Spend Duration;
In the embodiment of the present invention, since step S301 determines the initial time stamp First_DTS, Yi Jibu of video file
Rapid S303 determines the ending time stamp Last_DTS of video file, then can be according to the initial time stamp First_ of video file
The ending time stamp Last_DTS of DTS and video file calculates the time span Duration for obtaining video file.For example, the time
Length Duration=Last_DTS-First_DTS, it is seen then that the time span Duration of video file can be video text
The ending time stamp Last_DTS of part subtracts the difference of initial time stamp First_DTS.
S307 calculates video file according to the content-length Content_Len and time span Duration of video file
Average byte code check ByteRate;
Specifically, can content-length Content_Len and time span Duration quotient be determined as video file
Average byte code check, i.e. content-length ByteRate=Content_Len/Duration.
S308, according to the corresponding initial length First_Pos of initial time stamp, initial time stamp First_DTS and averagely
Byte code check ByteRate calculates the estimated length corresponding to the timestamp after trying video file preset time DST_DST
EST_Pos;
Wherein, try that video file preset time DST_DST can be that video server is directed to video file setting in advance
The time span that can try of user.
For example, estimated length EST_Pos=First_Pos+ (DST_DST-First_DTS) × ByteRate, Ke Yili
Solution, can first zero computing time stamp and preset time and, further, by this and product with average byte code check
In addition the sum of initial length, is determined as estimated length EST_Pos.
S309 determines the corresponding absolute time Cur_DTS of estimated length EST_Pos;
Specifically, can search estimated length EST_Pos whether there is key frame, if estimated length EST_Pos
There are key frames, then the timestamp in the header of the key frame are determined as absolute time Cur_DTS;If the estimated length
Key frame is not present in EST_Pos, searches the neighbouring key frame of estimated length EST_Pos, and will be adjacent to the header of key frame
In timestamp be determined as absolute time Cur_DTS, wherein length and estimated length EST_Pos where neighbouring key frame it
Between distance be less than or equal to any key frame where length and the estimated length between distance.
S310 judges absolute time Cur_DTS and tries the absolute difference between the video file preset time DST_DST
Whether be less than or equal to preset time deviation delta, i.e., | Cur_DTS-DST_DST |<=delta;If so, thening follow the steps
S314, if it is not, thening follow the steps S311;
Wherein, preset time deviation is preset time deviation, for example, preset time deviation can be 5 milliseconds, 10
Millisecond or 20 milliseconds, but not limited to this.When preset time deviation is 8 milliseconds, judge | Cur_DTS-DST_DST |<=8 millis
Second.
Cut off is tried in order to enable accurately determining, and when absolute time difference is calculated, is needed the absolute time
Difference is compared with user preset time deviation, if absolute time difference is more than preset time deviation, illustrates identified examination
It sees cut off inaccuracy, needs to recalculate, if absolute time difference is less than or equal to preset time deviation, illustrate to determine
Try that cut off is more accurate.
In the embodiment of the present invention, it can be determined that absolute time Cur_DTS and try the video file preset time DST_
Whether the absolute difference between DST is in the range of preset time deviation.
S311 judges whether absolute time Cur_DTS is more than and tries video file preset time DST_DST, if Cur_DTS
>DST_DST thens follow the steps S312, if Cur_DTS<=DST_DST, thens follow the steps S313;
Ending time stamp is updated to absolute time, i.e. Last_DTS=Cur_DTS by S312, will be terminated length and is updated to
The corresponding estimated length of absolute time, i.e. Last_Pos=EST_Pos return to step S305;
In the embodiment of the present invention, work as Cur_DTS>When DST_DST, ending time stamp is updated to absolute time, that is,
End time is become the value of absolute time from original value, and is updated to the corresponding estimated length of absolute time by length is terminated,
Further, S305 is returned to step, i.e., according to updated end length Last_Pos and updated initial length
First_Pos recalculates the content-length Content_Len of video file.
Initial time stamp is updated to absolute time, i.e. First_DTS=Cur_DTS, initial length is updated to by S313
The corresponding estimated length of absolute time, i.e. First_Pos=EST_Pos return to step S305;
In the embodiment of the present invention, work as Cur_DTS<When=DST_DST, initial time stamp is updated to absolute time, also
It is the value that initial time is become absolute time from original value, and initial length is updated to the corresponding estimation of absolute time and is grown
Degree, further, returns to step S305, i.e., according to updated initial time stamp and updated initial length
First_Pos recalculates the content-length Content_Len of video file.
S314 is determined as absolute time Cur_DTS or the corresponding estimated length EST_Pos of absolute time to try cut-off
Point.
Compared with prior art, in the embodiment of the present invention, starting that video server can obtain and pass through video file
Timestamp, ending time stamp, initial length and end length, determination try that the timestamp after video file preset time is corresponding
Estimated length tries cut off based on estimated length determination in turn.Namely video server can try cut-off according to this
Point, it is determined whether continue to send the video flowing of video file to terminal.As it can be seen that video server need not add in video file
Index information so that reception video flowing terminal according to the index information to determine whether terminate try function.Video takes
Device be engaged in during sending video flowing to terminal, cut-off is tried when detecting in the corresponding video file of transmitted video flowing
When point, video server voluntarily stops sending video flowing to terminal.In addition, due to there is no index information in video file, save
The a large amount of computing resources and storage resource of video server and terminal.In the present solution, video server can be determined accurately
Video file tries that cut off, video server determine the method that video file tries cut off so that user tries video
The process of file is more convenient, relative to the process for trying video file is realized from terminal, tries and regards from video server realization
The cost of the process of frequency file is lower.
Corresponding to above method embodiment, embodiment that the embodiment of the present invention also provides corresponding devices.Fig. 4 is this hair
Bright embodiment provides the device 400 that a kind of determining video file tries cut off, which includes:
Acquiring unit 410, initial time stamp, ending time stamp for obtaining video file, and when the determining starting
Between stab corresponding initial length and the corresponding end length of the ending time stamp;
First computing unit 420, for according to the initial time stamp, the ending time stamp, the initial time stamp
Corresponding initial length and the corresponding end length of the ending time stamp calculate the average byte code for obtaining the video file
Rate;
Second computing unit 430, for according to the corresponding initial length of the initial time stamp, the initial time stamp and
The average byte code check calculates estimated length, and the estimated length is the time tried after the video file preset time
The corresponding length of stamp;
Determination unit 440, for according to the estimated length, determining that the video file tries cut off.
Compared with prior art, the video server in this programme can obtain and by video text in the video server
Initial time stamp, ending time stamp, initial length and the end length of part, it is determining to try the time after video file preset time
Corresponding estimated length is stabbed, it is in turn, determining in video file to try cut off.In this way, video server can be according to the examination
See cut off, it is determined whether continue to send the video flowing of video file to terminal.As it can be seen that video server need not be in video text
Index information is added in part so that reception video flowing terminal according to the index information to determine whether terminate try function.
Specifically, video server is to terminal during sending video flowing, when detecting the corresponding video text of transmitted video flowing
In part when trying cut off, video server voluntarily stop to terminal send video flowing.In addition, due to not having in video file
Index information saves a large amount of computing resources and storage resource of video server and terminal.
Optionally, as shown in figure 5, the acquiring unit 410 includes:
First searches subelement 411, the first key frame for searching the video file, and it is crucial to obtain described first
The header of frame;
First determination subelement 412, for the timestamp in the header of first key frame to be determined as described rise
Beginning timestamp;
Second searches subelement 413, the end key frame for searching the video file, and it is crucial to obtain the end
The header of frame;
Second determination subelement 414, for the timestamp in the header for terminating key frame to be determined as the knot
Beam timestamp.
Optionally, the acquiring unit 410 includes:
Third determination subelement 415, for corresponding length to determine in the video file by the initial time stamp
For initial length;
4th determination subelement 416, for corresponding length to determine in the video file by the ending time stamp
To terminate length;
Optionally, the acquiring unit 410 further includes:
First assignment subelement 417, for the initial length assignment;
Subelement 418 is obtained, storage size value is occupied for obtaining the video file;
Second assignment subelement 419, for video file occupancy storage size value to be assigned to the end
Length.
Optionally, as shown in fig. 6, first computing unit 420 includes:
First computation subunit 421 is long for calculating the time between the ending time stamp and the initial time stamp
Degree;
Second computation subunit 422, initial length and the ending time stamp for calculating the initial time stamp
Terminate the content-length between length;
5th determination subelement 423, for according to the time span and the content-length, determining the video file
Average byte code check;
First computation subunit 421, specifically for by the ending time stamp subtract the initial time stamp when
Between difference be determined as the time span;
Second computation subunit 422, specifically for by it is described end length subtract the initial length difference it is true
It is set to the content-length;
5th determination subelement 423 is specifically used for, by the quotient of the content-length divided by the time span, determining
For the average byte code check of the video file.
Optionally, as shown in fig. 7, second computing unit 430 includes:
Third computation subunit 431 described tries the video file preset time and the initial time for calculating
Time difference between stamp;
6th determination subelement 432, for the product between the time difference and the average byte code check to be determined as
Preset length;
7th determination subelement 433, for will be between the preset length and the initial length and be determined as described
Estimated length.
Optionally, as shown in figure 8, the determination unit 440 includes:
Estimate subelement 441, whether there is key frame for searching the estimated length in the video file;
8th determination subelement 442, for searching the estimated length in the video file, there are key frames, by institute
The timestamp stated in the header of key frame is determined as absolute time;If it is not, the neighbouring key frame of the estimated length is searched, and
Timestamp in the header of the neighbouring key frame is determined as absolute time;Length where the neighbouring key frame and institute
The distance between estimated length is stated less than or equal to the length where any key frame and distance between the estimated length;
9th determination subelement 443, for according to the absolute time, determining that the video file tries cut off.
Optionally, the 9th determination subelement 443 is specifically used for:
Judge the absolute time and the absolute difference tried between the video file preset time whether be less than or
Equal to preset time deviation, judging result is obtained;
According to the judging result, determine that the video file tries cut off.
Optionally, the 9th determination subelement 443 is specifically used for:
If the absolute time and the absolute difference tried between the video file preset time are less than or equal to pre-
If time deviation, it is determined as the absolute time or the corresponding estimated length of the absolute time to try cut off.
Optionally, the 9th determination subelement 443 is specifically used for:
If the absolute time and the absolute difference tried between the video file preset time are more than preset time
Deviation, then judge the absolute time tries the video file preset time described in whether being more than;
If the absolute time tries the video file preset time described in being more than, the ending time stamp is updated
For the absolute time, the end length is updated to the corresponding estimated length of the absolute time;
According to the updated ending time stamp and the end length, return execute according to the initial time stamp,
The ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, meter
The step of calculating the average byte code check for obtaining the video file, until the absolute time obtained tries the video with described
Absolute difference between file preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained
The corresponding estimated length of absolute time is determined as trying cut off.
Optionally, the 9th determination subelement 443 is specifically used for:
If the absolute time tries the video file preset time described in being less than or equal to, when by the starting
Between stamp be updated to the absolute time, the initial length is updated to the corresponding estimated length of the absolute time;
According to the updated initial time stamp and the initial length, return execute according to the initial time stamp,
The ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, meter
The step of calculating the average byte code check for obtaining the video file, until the absolute time obtained tries the video with described
Absolute difference between file preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained
The corresponding estimated length of absolute time is determined as trying cut off.
Optionally, as shown in figure 9, described device 400 further includes:
Adding device 450, for trying that cut off adds identification information in the video file;
Detection unit 460 exports the video for when detecting the identification information of the video file, stopping to terminal
The video flowing of file.
The embodiment of the present invention additionally provides a kind of electronic equipment, as shown in Figure 10, including processor 1010, communication interface
1020, memory 1030 and communication bus 1040, wherein processor 1010, communication interface 1020, memory 1030 pass through communication
Bus 1040 completes mutual communication;
Memory 1030, for storing computer program;
Processor 1010 when for executing the program stored on memory 1030, realizes following steps:
Initial time stamp, the ending time stamp of video file are obtained, and determines the corresponding starting length of the initial time stamp
Degree and the corresponding end length of the ending time stamp;
According to the initial time stamp, the ending time stamp, the corresponding initial length of the initial time stamp and described
The corresponding end length of ending time stamp calculates the average byte code check for obtaining the video file;
According to the corresponding initial length of the initial time stamp, the initial time stamp and the average byte code check, meter
Estimated length is calculated, the estimated length is the length corresponding to the timestamp after trying the video file preset time;
According to the estimated length, determine that the video file tries cut off.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Pomponent
Interconnect, abbreviation PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, abbreviation EISA) bus etc..The communication bus can be divided into address bus, data/address bus, controlling bus etc..
For ease of indicating, only indicated with a thick line in figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, abbreviation RAM), can also include
Nonvolatile memory (non-volatile memory), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be at least one storage device for being located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
Abbreviation CPU), network processing unit (Network Processor, abbreviation NP) etc.;It can also be digital signal processor
(Digital Signal Processing, abbreviation DSP), application-specific integrated circuit (Application Specific
Integrated Circuit, abbreviation ASIC), field programmable gate array (Field-Programmable Gate Array,
Abbreviation FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware components.
The embodiment of the present invention additionally provides a kind of computer readable storage medium, storage in the computer readable storage medium
There is computer program, which realizes that determining video file of the present invention tries cut off when being executed by processor
Method and step.
For device/electronic equipment/computer readable storage medium embodiment, since it is substantially similar to method reality
Example is applied, so description is fairly simple, the relevent part can refer to the partial explaination of embodiments of method.
It should be noted that herein, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also include other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, identical similar portion between each embodiment
Point just to refer each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so description is fairly simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (24)
1. a kind of method that determining video file tries cut off, which is characterized in that be applied to video server, the method packet
It includes:
Obtain initial time stamp, the ending time stamp of video file, and determine the corresponding initial length of the initial time stamp and
The corresponding end length of the ending time stamp;
According to the initial time stamp, the ending time stamp, the corresponding initial length of the initial time stamp and the end
The corresponding end length of timestamp calculates the average byte code check for obtaining the video file;
Estimated according to the corresponding initial length of the initial time stamp, the initial time stamp and the average byte code check, calculating
Length is counted, the estimated length is the length corresponding to the timestamp after trying the video file preset time;
According to the estimated length, determine that the video file tries cut off.
2. according to the method described in claim 1, it is characterized in that, it is described obtain video file initial time stamp, at the end of
Between stab the step of include:
The first key frame of the video file is searched, and obtains the header of first key frame;
Timestamp in the header of first key frame is determined as the initial time stamp;
The end key frame of the video file is searched, and obtains the header for terminating key frame;
Timestamp in the header for terminating key frame is determined as the ending time stamp.
3. according to the method described in claim 1, it is characterized in that, the corresponding initial length of the determination initial time stamp
And the step of ending time stamp corresponding end length, includes:
By the initial time stamp, corresponding length is determined as initial length in the video file;
By the ending time stamp, corresponding length is determined as terminating length in the video file;
After the corresponding initial length of the determination initial time stamp and the corresponding end length of the ending time stamp, institute
The method of stating further includes:
To the initial length assignment;
It obtains the video file and occupies storage size value;
Video file occupancy storage size value is assigned to the end length.
4. according to the method described in claim 3, it is characterized in that, described according to the initial time stamp, the end time
Stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp are calculated and are regarded described in obtaining
The step of average byte code check of frequency file includes:
Calculate the time span between the ending time stamp and the initial time stamp;
Calculate the content-length between the initial length of the initial time stamp and the end length of the ending time stamp;
According to the time span and the content-length, the average byte code check of the video file is determined;
The step of time span calculated between the ending time stamp and the initial time stamp includes:
The time difference that the ending time stamp is subtracted to the initial time stamp is determined as the time span;
Between the calculating corresponding initial length of initial time stamp and the corresponding end length of the ending time stamp
The step of content-length includes:
The difference that the end length subtracts the initial length is determined as the content-length;
It is described according to the time span and the content-length, the step of average byte code check for determining the video file, wraps
It includes:
By the content-length divided by the quotient of the time span, it is determined as the average byte code check of the video file.
5. according to the method described in claim 1, it is characterized in that, described grow according to the corresponding starting of the initial time stamp
Degree, the initial time stamp and the average byte code check, the step of calculating estimated length include:
The time difference between the video file preset time and the initial time stamp is tried described in calculating;
Product between the time difference and the average byte code check is determined as preset length;
It will be between the preset length and the initial length and be determined as the estimated length.
6. according to the method described in claim 5, it is characterized in that, described according to the estimated length, the video text is determined
Part tries that the step of cut off includes:
The estimated length is searched in the video file whether there is key frame;
If so, the timestamp in the header of the key frame is determined as absolute time;If it is not, searching the estimated length
Neighbouring key frame, and the timestamp in the header of the neighbouring key frame is determined as absolute time;The neighbouring key frame
The distance between the length at place and the estimated length are less than or equal to length and the estimation where any key frame
Distance between length;
According to the absolute time, determine that the video file tries cut off.
7. according to the method described in claim 6, it is characterized in that, described according to the absolute time, the video text is determined
Part tries that the step of cut off includes:
Judge the absolute time and described tries whether the absolute difference between the video file preset time is less than or equal to
Preset time deviation, obtains judging result;
According to the judging result, determine that the video file tries cut off.
8. the method according to the description of claim 7 is characterized in that described according to the judging result, the video text is determined
Part tries that the step of cut off includes:
If the absolute time and the absolute difference tried between the video file preset time are less than or equal to default
Between deviation, be determined as the absolute time or the corresponding estimated length of the absolute time to try cut off.
9. the method according to the description of claim 7 is characterized in that described according to the judging result, the video text is determined
Part tries that the step of cut off includes:
If the absolute time and the absolute difference tried between the video file preset time are more than preset time deviation,
Then judge the absolute time tries the video file preset time described in whether being more than;
If the absolute time tries the video file preset time described in being more than, the ending time stamp is updated to institute
Absolute time is stated, the end length is updated to the corresponding estimated length of the absolute time;
According to the updated ending time stamp and the end length, returns and execute according to the initial time stamp, described
Ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, calculating obtain
The step of taking the average byte code check of the video file, until the absolute time obtained tries the video file with described
Absolute difference between preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained absolute
Time, corresponding estimated length was determined as trying cut off.
10. according to the method described in claim 9, it is characterized in that, the method further includes:
If the absolute time tries the video file preset time described in being less than or equal to, by the initial time stamp
It is updated to the absolute time, the initial length is updated to the corresponding estimated length of the absolute time;
According to the updated initial time stamp and the initial length, returns and execute according to the initial time stamp, described
Ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, calculating obtain
The step of taking the average byte code check of the video file, until the absolute time obtained tries the video file with described
Absolute difference between preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained absolute
Time, corresponding estimated length was determined as trying cut off.
11. according to the method described in claim 1, it is characterized in that, the method further includes:
Try that cut off adds identification information in the video file;
When detecting the identification information of the video file, stop the video flowing that the video file is exported to terminal.
12. a kind of determining video file tries the device of cut off, which is characterized in that be applied to video server, described device
Including:
Acquiring unit, initial time stamp, ending time stamp for obtaining video file, and determine that the initial time stamp corresponds to
Initial length and the corresponding end length of the ending time stamp;
First computing unit, for according to the initial time stamp, the ending time stamp, corresponding of the initial time stamp
Beginning length and the corresponding end length of the ending time stamp calculate the average byte code check for obtaining the video file;
Second computing unit, for according to the corresponding initial length of the initial time stamp, the initial time stamp and described flat
Equal byte code check, calculates estimated length, and the estimated length is tries that the timestamp after the video file preset time is right
The length answered;
Determination unit, for according to the estimated length, determining that the video file tries cut off.
13. device according to claim 12, which is characterized in that the acquiring unit includes:
First searches subelement, the first key frame for searching the video file, and obtains the head of first key frame
Information;
First determination subelement, for the timestamp in the header of first key frame to be determined as the initial time
Stamp;
Second searches subelement, the end key frame for searching the video file, and obtains the head for terminating key frame
Information;
Second determination subelement, for the timestamp in the header for terminating key frame to be determined as the end time
Stamp.
14. device according to claim 12, which is characterized in that the acquiring unit includes:
Third determination subelement, for corresponding length to be determined as starting length in the video file by the initial time stamp
Degree;
4th determination subelement, for corresponding length to be determined as terminating length in the video file by the ending time stamp
Degree;
The acquiring unit further includes:
First assignment subelement, for the initial length assignment, obtaining initial length;
Subelement is obtained, storage size value is occupied for obtaining the video file;
Second assignment subelement, for video file occupancy storage size value to be assigned to the end length.
15. device according to claim 14, which is characterized in that first computing unit includes:
First computation subunit, for calculating the time span between the ending time stamp and the initial time stamp;
Second computation subunit, the end length of initial length and the ending time stamp for calculating the initial time stamp
Between content-length;
5th determination subelement, for according to the time span and the content-length, determining being averaged for the video file
Byte code check;
First computation subunit, it is true specifically for time difference that the ending time stamp is subtracted to the initial time stamp
It is set to the time span;
Second computation subunit is determined as described specifically for the difference that the end length is subtracted the initial length
Content-length;
5th determination subelement is specifically used for, by the quotient of the content-length divided by the time span, being determined as described
The average byte code check of video file.
16. device according to claim 12, which is characterized in that second computing unit includes:
Third computation subunit, for calculating described try between the video file preset time and the initial time stamp
Time difference;
6th determination subelement, for the product between the time difference and the average byte code check to be determined as default length
Degree;
7th determination subelement, for will be between the preset length and the initial length and be determined as the estimation and grow
Degree.
17. device according to claim 16, which is characterized in that the determination unit includes:
Estimate subelement, whether there is key frame for searching the estimated length in the video file;
8th determination subelement, for searching the estimated length in the video file, there are key frames, by the key
Timestamp in the header of frame is determined as absolute time;If it is not, the neighbouring key frame of the estimated length is searched, and will be described
Timestamp in the header of neighbouring key frame is determined as absolute time;Length where the neighbouring key frame and the estimation
The distance between length is less than or equal to the length where any key frame and distance between the estimated length;
9th determination subelement, for according to the absolute time, determining that the video file tries cut off.
18. device according to claim 17, which is characterized in that the 9th determination subelement is specifically used for:
Judge the absolute time and described tries whether the absolute difference between the video file preset time is less than or equal to
Preset time deviation, obtains judging result;
According to the judging result, determine that the video file tries cut off.
19. device according to claim 18, which is characterized in that the 9th determination subelement is specifically used for:
If the absolute time and the absolute difference tried between the video file preset time are less than or equal to default
Between deviation, be determined as the absolute time or the corresponding estimated length of the absolute time to try cut off.
20. device according to claim 18, which is characterized in that the 9th determination subelement is specifically used for:
If the absolute time and the absolute difference tried between the video file preset time are more than preset time deviation,
Then judge the absolute time tries the video file preset time described in whether being more than;
If the absolute time tries the video file preset time described in being more than, the ending time stamp is updated to institute
Absolute time is stated, the end length is updated to the corresponding estimated length of the absolute time;
According to the updated ending time stamp and the end length, returns and execute according to the initial time stamp, described
Ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, calculating obtain
The step of taking the average byte code check of the video file, until the absolute time obtained tries the video file with described
Absolute difference between preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained absolute
Time, corresponding estimated length was determined as trying cut off.
21. device according to claim 20, which is characterized in that the 9th determination subelement is specifically used for:
If the absolute time tries the video file preset time described in being less than or equal to, by the initial time stamp
It is updated to the absolute time, the initial length is updated to the corresponding estimated length of the absolute time;
According to the updated initial time stamp and the initial length, returns and execute according to the initial time stamp, described
Ending time stamp, the corresponding initial length of the initial time stamp and the corresponding end length of the ending time stamp, calculating obtain
The step of taking the average byte code check of the video file, until the absolute time obtained tries the video file with described
Absolute difference between preset time is less than or equal to preset time deviation, by the absolute time obtained or is obtained absolute
Time, corresponding estimated length was determined as trying cut off.
22. device according to claim 12, which is characterized in that described device further includes:
Adding device, for trying that cut off adds identification information in the video file;
Detection unit, for when detecting the identification information of the video file, stopping exporting the video file to terminal
Video flowing.
23. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method and steps of claim 1-11.
24. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium
Program realizes claim 1-11 any method and steps when the computer program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710527320.6A CN108574856A (en) | 2017-06-30 | 2017-06-30 | Determine that video file tries the method, apparatus, equipment and medium of cut off |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710527320.6A CN108574856A (en) | 2017-06-30 | 2017-06-30 | Determine that video file tries the method, apparatus, equipment and medium of cut off |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108574856A true CN108574856A (en) | 2018-09-25 |
Family
ID=63576112
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710527320.6A Pending CN108574856A (en) | 2017-06-30 | 2017-06-30 | Determine that video file tries the method, apparatus, equipment and medium of cut off |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108574856A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111787342A (en) * | 2020-06-22 | 2020-10-16 | 亦非云互联网技术(上海)有限公司 | Streaming media live broadcast viewing method, system, medium and device |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1972440A (en) * | 2006-12-13 | 2007-05-30 | 北京大学 | An implementation method for picture-in-picture in IPTV |
CN101534408A (en) * | 2009-04-22 | 2009-09-16 | 北京数码视讯科技股份有限公司 | Method for storing and playing dynamic code rate transport stream and media stream and for detecting exception |
US20100290460A1 (en) * | 2007-02-09 | 2010-11-18 | Byoung Gill Kim | Digital broadcasting system and method of processing data |
CN102780919A (en) * | 2012-08-24 | 2012-11-14 | 乐视网信息技术(北京)股份有限公司 | Method for carrying out video location and displaying through key frame |
CN103024561A (en) * | 2011-09-28 | 2013-04-03 | 深圳市快播科技有限公司 | Method and device for displaying dragging progress bar |
CN103873891A (en) * | 2014-03-20 | 2014-06-18 | 深圳创维-Rgb电子有限公司 | TS streaming media file fast positioning method and system |
CN104883618A (en) * | 2015-05-11 | 2015-09-02 | 腾讯科技(北京)有限公司 | Method, device, and system for tentatively watching living programs |
CN105979380A (en) * | 2016-03-31 | 2016-09-28 | 乐视控股(北京)有限公司 | Test broadcasting method and device for multimedia contents on demand |
-
2017
- 2017-06-30 CN CN201710527320.6A patent/CN108574856A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1972440A (en) * | 2006-12-13 | 2007-05-30 | 北京大学 | An implementation method for picture-in-picture in IPTV |
US20100290460A1 (en) * | 2007-02-09 | 2010-11-18 | Byoung Gill Kim | Digital broadcasting system and method of processing data |
CN101534408A (en) * | 2009-04-22 | 2009-09-16 | 北京数码视讯科技股份有限公司 | Method for storing and playing dynamic code rate transport stream and media stream and for detecting exception |
CN103024561A (en) * | 2011-09-28 | 2013-04-03 | 深圳市快播科技有限公司 | Method and device for displaying dragging progress bar |
CN102780919A (en) * | 2012-08-24 | 2012-11-14 | 乐视网信息技术(北京)股份有限公司 | Method for carrying out video location and displaying through key frame |
CN103873891A (en) * | 2014-03-20 | 2014-06-18 | 深圳创维-Rgb电子有限公司 | TS streaming media file fast positioning method and system |
CN104883618A (en) * | 2015-05-11 | 2015-09-02 | 腾讯科技(北京)有限公司 | Method, device, and system for tentatively watching living programs |
CN105979380A (en) * | 2016-03-31 | 2016-09-28 | 乐视控股(北京)有限公司 | Test broadcasting method and device for multimedia contents on demand |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111787342A (en) * | 2020-06-22 | 2020-10-16 | 亦非云互联网技术(上海)有限公司 | Streaming media live broadcast viewing method, system, medium and device |
CN111787342B (en) * | 2020-06-22 | 2022-05-20 | 亦非云互联网技术(上海)有限公司 | Streaming media live broadcast viewing test method, system, medium and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107277160A (en) | A kind of content delivery network node switching method and device | |
TW202205870A (en) | Method, computing system, and non-transitory computer readable medium for establishment and use of time mapping | |
CN108337563B (en) | Video evaluation method, device, equipment and storage medium | |
CN105939485B (en) | System and method based on user's barrage behavior monitoring barrage service availability | |
JP2011234198A (en) | Information providing method, content display terminal, mobile terminal, server device, information providing system, and program | |
US20160295269A1 (en) | Information pushing method, device and system | |
US9301104B2 (en) | Data output method, data output program, and terminal device | |
JPH03501314A (en) | Method and system for collecting and transmitting information about television program viewers | |
CN105791902B (en) | User's recommended method and device | |
CN109257618A (en) | Company wheat interflow method, apparatus and server in a kind of live streaming | |
CN108574851A (en) | Method for pushing, device, streaming media server and computer readable storage medium | |
JP2018509818A (en) | Dynamic time window and cache mechanism in heterogeneous network transmission | |
CN109714622A (en) | A kind of video data handling procedure, device and electronic equipment | |
JP2000209200A (en) | Packet charging system | |
WO2018121335A1 (en) | Real-time data processing method and device | |
JP6574031B2 (en) | Mobile video call quality measurement method and system | |
CN106792209A (en) | Video preference information processing method, apparatus and system | |
CN109982068A (en) | Synthetic video method for evaluating quality, device, equipment and medium | |
CN108415908B (en) | Multimedia data processing method and server | |
CN108574856A (en) | Determine that video file tries the method, apparatus, equipment and medium of cut off | |
KR20160052704A (en) | Association of a social message with a related multimedia flow | |
CN110213671A (en) | A kind of short-sighted frequency of hot spot determines method and apparatus | |
CN110298001B (en) | Method and device for acquiring log data packet and computer readable storage medium | |
CN112804574A (en) | Multimedia content transmission and playing method and device | |
JP5139869B2 (en) | Content distribution server, communication system, and content distribution method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180925 |