CN108574874B - Video playing speed adjusting method and device - Google Patents

Video playing speed adjusting method and device Download PDF

Info

Publication number
CN108574874B
CN108574874B CN201710140357.3A CN201710140357A CN108574874B CN 108574874 B CN108574874 B CN 108574874B CN 201710140357 A CN201710140357 A CN 201710140357A CN 108574874 B CN108574874 B CN 108574874B
Authority
CN
China
Prior art keywords
frame
target
video
frames
video frames
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.)
Active
Application number
CN201710140357.3A
Other languages
Chinese (zh)
Other versions
CN108574874A (en
Inventor
许江浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201710140357.3A priority Critical patent/CN108574874B/en
Priority to US16/492,654 priority patent/US11217279B2/en
Priority to EP18763940.6A priority patent/EP3595324A4/en
Priority to PCT/CN2018/077766 priority patent/WO2018161843A1/en
Publication of CN108574874A publication Critical patent/CN108574874A/en
Application granted granted Critical
Publication of CN108574874B publication Critical patent/CN108574874B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/005Reproducing at a different information rate from the information rate of recording
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440281Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by altering the temporal resolution, e.g. by frame skipping
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/02Editing, e.g. varying the order of information signals recorded on, or reproduced from, record carriers
    • G11B27/031Electronic editing of digitised analogue information signals, e.g. audio or video signals
    • G11B27/036Insert-editing
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/10Indexing; Addressing; Timing or synchronising; Measuring tape travel
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/434Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
    • H04N21/4344Remultiplexing of multiplex streams, e.g. by modifying time stamps or remapping the packet identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream, rendering scenes according to MPEG-4 scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/8547Content authoring involving timestamps for synchronizing content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • H04N5/78Television signal recording using magnetic recording
    • H04N5/782Television signal recording using magnetic recording on tape
    • H04N5/783Adaptations for reproducing at a rate different from the recording rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/01Conversion of standards, e.g. involving analogue television standards or digital television standards processed at pixel level
    • H04N7/0127Conversion of standards, e.g. involving analogue television standards or digital television standards processed at pixel level by changing the field or frame frequency of the incoming video signal, e.g. frame rate converter
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/46Embedding additional information in the video signal during the compression process

Abstract

The embodiment of the invention discloses a method and a device for adjusting video playing speed, wherein the method comprises the following steps: when a play speed adjustment instruction for a target video is detected, determining a target play speed corresponding to the instruction; then determining the initial frame rate of the target video, and taking the product of the initial frame rate and the target playing speed as the target parameter of the target video; processing the target video according to a preset frame number adjusting rule corresponding to the target size relationship; and according to the preset target frame rate, performing timestamp adjustment on the video frames contained in the processed target video so as to play the adjusted target video according to the preset target frame rate. By applying the method and the device, the adjusted target video can be played according to the preset target frame rate, the display quality of the video with the adjusted playing speed is improved, and the user experience is further improved.

Description

Video playing speed adjusting method and device
Technical Field
The present invention relates to the field of video processing technologies, and in particular, to a method and an apparatus for adjusting a video playing speed.
Background
In recent years, with the development of electronic devices and the increase of network bandwidth, the threshold of video playing is greatly reduced, a user can play videos on the electronic devices anytime and anywhere, and the user may change the playing speed of the videos in the process of watching the videos, so that the video playing speed needs to be adjusted.
At present, the adjustment of the video playing speed is generally realized by adjusting the trigger frequency of a clock trigger; for example, the number of video frames displayed in the same time period is increased by increasing the trigger frequency, so that the effect of quick playing is achieved; the number of video frames displayed in the same time period is reduced by reducing the trigger frequency, so that the effect of slow playing is achieved. Because the adjustment of the video playing speed in the above manner is completed for the playing speed changed by the user, and when the user changes the video playing speed, the change degrees of the video playing speed at different moments may be different, therefore, the adjustment of the video playing speed is realized by adjusting the trigger frequency of the clock trigger, so that the number of video frames displayed by the adjusted video in the same time period is different, and the difference of the number of video frames displayed in the same time period causes the difference of the display effect, which results in the poor display quality of the video after the playing speed adjustment, and the user experience is poor.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for adjusting video playing speed, so as to improve the display quality of a video with the adjusted playing speed and further improve user experience.
In order to achieve the above object, an embodiment of the present invention discloses a method for adjusting a video playing speed, including:
when a play speed adjustment instruction for a target video is detected, determining a target play speed corresponding to the speed adjustment instruction;
determining an initial frame rate of the target video, and taking the product of the initial frame rate and the target playing speed as a target parameter of the target video;
processing the target video according to a preset frame number adjusting rule corresponding to a target size relationship, wherein the target size relationship is the size relationship between the target parameter and a preset target frame rate;
and according to the preset target frame rate, performing timestamp adjustment on video frames contained in the processed target video so as to play the adjusted target video according to the preset target frame rate.
Optionally, the step of processing the target video according to a preset frame number adjustment rule corresponding to the target size relationship includes:
when the target parameter is smaller than a preset target frame rate, increasing the number of video frames in the target video according to the preset frame number adjusting rule;
when the target parameter is larger than a preset target frame rate, reducing the number of video frames in the target video according to the preset frame number regulation rule;
and when the target parameter is equal to a preset target frame rate, keeping the number of video frames in the target video unchanged.
Optionally, the step of increasing the number of video frames in the target video according to the preset frame number adjustment rule includes:
calculating the frame adding quantity per second, wherein the frame adding quantity is equal to the difference value between the preset target frame rate and the target parameter;
calculating a framing processing unit according to the target parameters and the framing quantity;
dividing the target video into at least one video frame group based on the framing processing unit;
determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit;
and adding a transition video frame after each determined target video frame, wherein the transition video frame is a video frame generated based on the target video frame.
Optionally, the step of calculating a framing processing unit according to the target parameter and the framing number includes:
calculate T1PmAnd a greatest common divisor D1 of T1 × △ P1, wherein the T1 is a divisor of T1 × PmAnd T1 × △ P1 is the minimum natural number of integer, and PmFor the target parameter, the △ P1 is the number of frames;
mixing T1Pmthe/D1 is determined as a framing processing unit.
Optionally, the step of determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit includes:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a first frame number to be added is less than or equal to the frame adding processing unit, wherein the first frame number to be added is T1 × △ P1/D1;
when the judgment result is yes, determining the current first video frames to be added as target video frames from the video frame group;
and when the judgment result is negative, determining all the video frames contained in the video frame group as first target video frames, determining the difference value between the current first number of frames to be added and the frame adding processing unit as a new first number of frames to be added, judging whether the current first number of frames to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames of the current first number of frames to be added from the video frame group as second target video frames, determining all the determined first target video frames and the determined second target video frames as target video frames, and if not, returning to the step of determining all the video frames contained in the video frame group as first target video frames.
Optionally, the step of calculating a framing processing unit according to the target parameter and the framing number includes:
calculating PmAnd △ P1, wherein said P is a greatest common divisor D2mFor the target parameter, the △ P1 is the number of frames;
mixing T2Pmthe/D2 is determined as a framing processing unit, wherein the T2 is the processing unit capable of enabling the T2Pmthe/D2 and the T2 × △ P1/D2 are the minimum natural numbers of integers at the same time.
Optionally, the step of determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit includes:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a second frame number to be added is less than or equal to the frame adding processing unit, wherein the second frame number to be added is T2 × △ P1/D2;
when the judgment result is yes, determining the current second video frames to be added in number from the video frame group as target video frames;
and when the judgment result is negative, determining all the video frames contained in the video frame group as third target video frames, determining the difference value between the current second frame number to be added and the frame adding processing unit as a new second frame number to be added, judging whether the current second frame number to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames with the current second frame number to be added from the video frame group as fourth target video frames, determining all the determined third target video frames and the fourth target video frames as target video frames, and if not, returning to execute the step of determining all the video frames contained in the video frame group as third target video frames.
Optionally, the step of reducing the number of video frames in the target video according to the preset frame number adjustment rule includes:
calculating the frame reduction quantity per second, wherein the frame reduction quantity is equal to the difference value of the target parameter and a preset target frame rate;
calculating a frame reduction processing unit according to the target parameter and the frame reduction quantity
Dividing the target video into at least one video frame group based on the frame reduction processing unit;
determining a target video frame from the at least one video frame group based on the reduced frame number and the reduced frame processing unit;
and deleting the target video frame.
Optionally, the step of calculating a frame reduction processing unit according to the target parameter and the frame reduction number includes:
calculate T3PmAnd a greatest common divisor D3 of T3 × △ P2, wherein T3 is such that T3 × PmAnd T3 × △ P2 is the minimum natural number of integer, and PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T3Pmthe/D3 is determined as a frame reduction processing unit.
Optionally, the step of determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit includes:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
determining T3 x △ P2/D3 video frames from the group of video frames as target video frames.
Optionally, the step of calculating a frame reduction processing unit according to the target parameter and the frame reduction number includes:
calculating PmAnd △Greatest common divisor D4 of P2, wherein the PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T4Pmthe/D4 is determined as a frame reduction processing unit, wherein the T4 is the unit which can enable the T4Pmthe/D4 and the T4 × △ P2/D4 are the minimum natural numbers of integers at the same time.
Optionally, the step of determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit includes:
determining T4 x △ P2/D4 video frames from the group of video frames as target video frames.
Optionally, the method further comprises:
coding the target video after the timestamp adjustment is completed to obtain a target adjustment video;
storing and/or outputting the target adjusted video.
In order to achieve the above object, an embodiment of the present invention further discloses a video playing speed adjusting device, where the device includes:
the first determining module is used for determining a target playing speed corresponding to a speed adjusting instruction when the playing speed adjusting instruction for the target video is detected;
a second determining module, configured to determine an initial frame rate of the target video, and use a product of the initial frame rate and the target play speed as a target parameter of the target video;
the first processing module is used for processing the target video according to a preset frame number adjusting rule corresponding to a target size relationship, wherein the target size relationship is the size relationship between the target parameter and a preset target frame rate;
and the adjusting module is used for adjusting the timestamp of the video frame contained in the processed target video according to the preset target frame rate so as to play the adjusted target video according to the preset target frame rate.
Optionally, the first processing module includes:
the first processing submodule is used for increasing the number of video frames in the target video according to the preset frame number adjusting rule when the target parameter is smaller than the preset target frame rate;
the second processing submodule is used for reducing the number of video frames in the target video according to the preset frame number adjusting rule when the target parameter is larger than the preset target frame rate;
and the third processing submodule is used for keeping the number of the video frames in the target video unchanged when the target parameter is equal to a preset target frame rate.
Optionally, the first processing sub-module includes:
the first calculating unit is used for calculating the frame adding quantity per second, wherein the frame adding quantity is equal to the difference value between the preset target frame rate and the target parameter;
the second calculating unit is used for calculating the frame adding processing unit according to the target parameters and the frame adding quantity;
a first dividing unit configured to divide the target video into at least one video frame group based on the framing processing unit;
a first determination unit configured to determine a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit;
and the frame adding unit is used for adding a transition video frame after each determined target video frame, wherein the transition video frame is a video frame generated based on the target video frame.
Optionally, the second computing unit is specifically configured to:
calculate T1PmAnd a greatest common divisor D1 of T1 × △ P1, wherein the T1 is a divisor of T1 × PmAnd T1 × △ P1 is the minimum natural number of integer, and PmFor the target parameter, the △ P1 is the number of frames;
mixing T1Pmthe/D1 is determined as a framing processing unit.
Optionally, the first determining unit is specifically configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a first frame number to be added is less than or equal to the frame adding processing unit, wherein the first frame number to be added is T1 × △ P1/D1;
when the judgment result is yes, determining the current first video frames to be added as target video frames from the video frame group;
and when the judgment result is negative, determining all the video frames contained in the video frame group as first target video frames, determining the difference value between the current first number of frames to be added and the frame adding processing unit as a new first number of frames to be added, judging whether the current first number of frames to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames of the current first number of frames to be added from the video frame group as second target video frames, determining all the determined first target video frames and the determined second target video frames as target video frames, and if not, returning to the step of determining all the video frames contained in the video frame group as first target video frames.
Optionally, the second computing unit is specifically configured to:
calculating PmAnd △ P1, wherein said P is a greatest common divisor D2mFor the target parameter, the △ P1 is the number of frames;
mixing T2Pmthe/D2 is determined as a framing processing unit, wherein the T2 is the processing unit capable of enabling the T2Pmthe/D2 and the T2 × △ P1/D2 are the minimum natural numbers of integers at the same time.
Optionally, the first determining unit is specifically configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a second frame number to be added is less than or equal to the frame adding processing unit, wherein the second frame number to be added is T2 × △ P1/D2;
when the judgment result is yes, determining the current second video frames to be added in number from the video frame group as target video frames;
and when the judgment result is negative, determining all the video frames contained in the video frame group as third target video frames, determining the difference value between the current second frame number to be added and the frame adding processing unit as a new second frame number to be added, judging whether the current second frame number to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames with the current second frame number to be added from the video frame group as fourth target video frames, determining all the determined third target video frames and the fourth target video frames as target video frames, and if not, returning to execute the step of determining all the video frames contained in the video frame group as third target video frames.
Optionally, the second processing sub-module includes:
the third calculating unit is used for calculating the frame reduction quantity per second, wherein the frame reduction quantity is equal to the difference value of the target parameter and the preset target frame rate;
the fourth calculating unit is used for calculating a frame reduction processing unit according to the target parameter and the frame reduction quantity;
a second dividing unit for dividing the target video into at least one video frame group based on the frame reduction processing unit;
a second determining unit for determining a target video frame from the at least one video frame group based on the reduced frame number and the reduced frame processing unit;
and the frame reducing unit is used for deleting the target video frame.
Optionally, the fourth calculating unit is specifically configured to:
calculate T3PmAnd a greatest common divisor D3 of T3 × △ P2, wherein T3 is such that T3 × PmAnd T3 × △ P2 is the minimum natural number of integer, and PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T3Pmthe/D3 is determined as a frame reduction processing unit.
Optionally, the second determining unit is specifically configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
determining T3 x △ P2/D3 video frames from the group of video frames as target video frames.
Optionally, the fourth calculating unit is specifically configured to:
calculating the PmAnd a greatest common divisor D4 of the △ P2, wherein the PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T4Pmthe/D4 is determined as a frame reduction processing unit, wherein the T4 is the unit which can enable the T4Pmthe/D4 and the T4 × △ P2/D4 are the minimum natural numbers of integers at the same time.
Optionally, the second determining submodule is specifically configured to:
determining T4 x △ P2/D4 video frames from the group of video frames as target video frames.
Optionally, the apparatus further comprises:
the encoding module is used for encoding the target video after the timestamp adjustment is completed to obtain a target adjustment video;
and the second processing module is used for storing and/or outputting the target adjustment video.
In summary, in the scheme provided in the embodiment of the present invention, when a play speed adjustment instruction for a target video is detected, a target play speed corresponding to the instruction is determined; then determining the initial frame rate of the target video, and taking the product of the initial frame rate and the target playing speed as the target parameter of the target video; processing the target video according to a preset frame number adjusting rule corresponding to the target size relationship; and according to the preset target frame rate, performing timestamp adjustment on the video frames contained in the processed target video so as to play the adjusted target video according to the preset target frame rate. By applying the scheme provided by the embodiment of the invention to adjust the playing speed of the target video, the adjusted target video can be played according to the preset target frame rate, the phenomenon that the number of the displayed video frames in the same time period is different is avoided, the display quality of the video with the adjusted playing speed is improved, and the user experience is further improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a video playing speed adjustment method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another video playing speed adjustment method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a video playing speed adjusting apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another video playing speed adjusting apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The present invention will be described in detail below with reference to specific examples.
In order to solve the above technical problem, embodiments of the present invention provide a method and an apparatus for adjusting a video playing speed.
First, a method for adjusting a video playing speed according to an embodiment of the present invention is described below.
It should be noted that the video playing speed adjusting method provided by the embodiment of the present invention is applied to an electronic device, and the electronic device may be a smart phone, a tablet computer, a desktop terminal, and other devices capable of playing a video. Moreover, the software for realizing the function of the video playing speed adjusting method provided by the embodiment of the invention can be a special video playing client, and can also be a plug-in the existing video playing client, and the like, which is reasonable.
Fig. 1 is a schematic flow chart of a method for adjusting a video playing speed according to an embodiment of the present invention, where the method includes:
s101: when a play speed adjustment instruction for a target video is detected, determining a target play speed corresponding to the speed adjustment instruction.
As will be understood by those skilled in the art, for a video, it is generally played at a certain playing speed, and the playing speed of the video is normal by default, and the default playing speed is generally considered to be 1. However, during or before the video playing process, the user may set the playing speed of the video, that is, adjust the playing speed of the video to a speed other than the default playing speed, so that the fast playing or slow playing effect of the video can be achieved by adjusting the playing speed. For example: the playing speed is adjusted to 2.0 to achieve the purpose of fast playing the video, and the playing speed is adjusted to 0.8 to achieve the purpose of slow playing the video. In the solution provided in this embodiment of the present invention, the video with the adjusted play speed is referred to as a target video, and a user may set a play speed for the target video. It is to be understood that, in the solution provided by the embodiment of the present invention, if the target video is opened and played at the default play speed, the play speed set by the user at this time is considered to be 1, that is, V is 1.
Illustratively, assume that the target video is: a grand marriage to western sports, when playing a target video up to a highlight, the user wants that part of the content can be slowly played back to be seen more carefully. Alternatively, in order to prevent the amplitude of the playing speed adjustment from being too large, a range may be set for the playing speed and adjusted according to a certain step size, for example, the range of the playing speed may be (0, 2.0], the default playing speed is 1, the step size of the playing speed adjustment may be set to 0.1, and assuming that the playing speed set by the user, i.e., the target speed V, is 0.9, through the above process, it can be determined that the target playing speed V corresponding to the target video at this time is 0.9, i.e., slowly played by 0.9 times.
S102: and determining an initial frame rate of the target video, and taking the product of the initial frame rate and the target playing speed as a target parameter of the target video.
To more clearly describe the embodiments of the present invention, first, a concept of a Frame rate is introduced, where the Frame rate is used to reflect the number of video Frames displayed in a unit time, and is generally expressed in units of seconds, that is, the number of video Frames displayed Per Second (FPS), and a Frame rate is already set when each video is encodediFor example, the frame rate corresponding to "grand monkey marriage of western grand speech" is 15, i.e., the initial frame rate Pi=15。
Assuming that the target speed V, which is the playback speed set by the user, is 0.9, the initial frame rate P is set to be equal to the target frame rate ViThe product of the target playback speed V and the initial frame rate is 15 × 0.9 — 13.5, which is called the product of the initial frame rate and the target playback speed as the target parameter, and P can be used as the target parametermRepresenting, i.e. the target parameter Pm=Pi*V。
S103: and processing the target video according to a preset frame number adjusting rule corresponding to a target size relationship, wherein the target size relationship is the size relationship between the target parameter and a preset target frame rate.
Generally, a higher frame rate can achieve a smoother and more realistic display effect, but a higher frame rate requires a higher processing capability of a graphics processor, but a higher frame rate cannot be perceived obviouslyAn increase in fluency is felt. The two factors of the comprehensive playing effect and the requirement on the processing capacity of the graphics processor are that when the target video frame is played, a relatively ideal frame rate is usually available, for example, 30 frames/second is one of the relatively ideal frame rates that people can accept, therefore, in order to enable the target video after the playing speed is adjusted to reach the relatively ideal frame rate, a relatively ideal frame rate can be presetdIndicates that P can be, but is not limited to, setd=30。
Based on the above-mentioned preset target frame rate PdThe initial frame rate P for the above-mentioned grand marriage of West Speech can be setiThe product of the target playback speed V, i.e. the target parameter PmAnd the preset target frame rate PdComparing to obtain PmAnd PdThe size relationship between the target video and the target video can be called as a target size relationship, and the target video is processed according to a preset frame number adjusting rule corresponding to the target size relationship. The preset frame number regulation rule is based on the target parameter and the preset target frame rate PdAnd (4) setting rules.
For example, the step of processing the target video according to the preset frame number adjustment rule corresponding to the target size relationship may include:
when the target parameter is smaller than a preset target frame rate, increasing the number of video frames in the target video according to the preset frame number adjusting rule;
when the target parameter is larger than a preset target frame rate, reducing the number of video frames in the target video according to the preset frame number regulation rule;
and when the target parameter is equal to a preset target frame rate, keeping the number of video frames in the target video unchanged.
It will be appreciated that when the initial frame rate P is described above for a grand marriage of western grand wordsiThe product of the target playback speed V, i.e. the target parameter PmLess than the preset target frame rate PdNow, explain thisTherefore, in order to avoid the problem that the number of video frames displayed in the same time period is different, the number of video frames per second needs to be adjusted by increasing the number of video frames per second, that is, the number of video frames in the "mahogany marriage of western speeches" can be increased according to the preset frame number adjustment rule.
When the target parameter PmGreater than the preset target frame rate PdAt this time, it is explained that the number of video frames played per second is larger than the number corresponding to the target frame rate, and therefore, in order to avoid the problem that the number of video frames displayed in the same period of time is different, it is necessary to reduce the number of video frames per second to perform adjustment, and the number of video frames in the mahogany monkey-mahogany marriage can be reduced according to the preset frame number adjustment rule.
When the target parameter PmIs equal to the preset target frame rate PdAt this time, it means that the number of video frames played per second is equal to the number corresponding to the target frame rate, and therefore, it is not necessary to increase or decrease the number of video frames in the grand term of western speeches, and it is only necessary to keep the number of video frames in the grand term of western speeches unchanged.
From the above, when the target parameter P ismIs equal to the preset target frame rate PdIt is only necessary to keep the number of video frames in "grand monkey marriage of western grand speech" constant, since this is a simple case and in order to make the description as concise as possible, only the target parameter P is referred to hereinaftermLess than the preset target frame rate PdAnd a target parameter PmLess than the preset target frame rate PdBoth of these cases will be described in detail.
In the first case: when the target parameter is smaller than the preset target frame rate, the step of increasing the number of video frames in the target video according to the preset frame number adjustment rule may include steps a1-a5 (not shown in the figure), specifically as follows:
a1: calculating the frame adding quantity per second, wherein the frame adding quantity is equal to the difference value between the preset target frame rate and the target parameter;
a2: calculating a framing processing unit according to the target parameters and the framing quantity;
in the solution provided in the embodiment of the present invention, the frame adding processing unit is calculated according to the target parameter and the frame adding number, and may be obtained by, but not limited to, the following two ways; each of these modes is described below:
the first method is as follows: the step of calculating a framing processing unit according to the target parameter and the framing number may include:
calculate T1PmAnd a greatest common divisor D1 of T1 × △ P1, wherein the T1 is a divisor of T1 × PmAnd T1 × △ P1 is the minimum natural number of integer, and PmFor the target parameter, the △ P1 is the number of frames;
mixing T1Pmthe/D1 is determined as a framing processing unit.
Illustratively, assume a target frame rate Pd30, initial frame rate P corresponding to a grand monkey marriage of western grand speechi15, and the target playing speed V is 0.9, the target parameter P corresponding to the grand saint marriage of western speechesm15 × 0.9 ═ 13.5, clearly 13.5<30, i.e. the target parameter Pm<Target frame rate PdThen the number of frames added per second △ P1 ═ P can be calculatedd-Pm30-13.5-16.5; the process of calculating the framing processing unit according to the first mode specifically comprises the following steps: calculate T1PmAnd T1 × △ P1, wherein T1 is P1mAnd △ P1 are both the smallest natural numbers of integers, from which it can be seen that Pm13.5, △, 16.5, P1, and PmThe smallest natural number T1, which is an integer with △ P1, is 2, then T1Pm2, 13.5, 27, T1, △, P1, 2, 16.5, 33, calculating the greatest common divisor D1 of 27 and 33, without difficulty obtaining the greatest common divisor D1 of 3, and finally T1, Pmthe/D1 is determined as the framing unit, i.e., the resulting framing unit is 2 × 13.5/3 — 9.
The second method comprises the following steps: the step of calculating a framing processing unit according to the target parameter and the framing number may include:
calculating PmAnd △ P1, wherein said P is a greatest common divisor D2mFor the target parameter, the △ P1 is the number of frames;
mixing T2Pmthe/D2 is determined as a framing processing unit, wherein the T2 is the processing unit capable of enabling the T2Pmthe/D2 and the T2 × △ P1/D2 are the minimum natural numbers of integers at the same time.
In the scheme provided by the embodiment of the invention, P is calculatedmAnd △ P1, the greatest common divisor D2 may include the following two cases, one case being PmAnd △ P1 are both integers, in which case PmAnd △ P1, the greatest common divisor D2 is the current notion of greatest common divisor, and in another case, P ismAnd △ P1 are not both integers, i.e. PmAnd △ P1, when at least one of P and P is decimalmAnd △ P1 may be a decimal number, for example, P2m0.9, △ P1 is 1.2, then the greatest common divisor of 0.9 and 1.2 is 0.3, also for example, Pm1.5, △ P1 is 2, then the greatest common divisor of 1.5 and 2 is 0.5.
Illustratively, assume a target frame rate PdInitial frame rate P of 30iProduct P of target playing speed VmWhen the value is 13.5, then Pm<PdTherefore, the number of frames added per second △ P1 is calculated as Pd-Pm30-13.5-16.5, the process of calculating the framing processing unit according to the second mode specifically includes: calculating PmAnd △ P1, P being the greatest common divisor D2m13.5, △ P1 is 16.5, then the greatest common divisor of 13.5 and 16.5 is D2 is 1.5, and thus P ism9 for/D2, 11 for △ P1/D2, due to Pmboth/D2 and △ P1/D2 have been integers, so T2 equals 1, and finally T2 is Pmthe/D2 is determined as a framing unit, i.e., the resulting framing unit is 1 × 13.5/1.5 — 9.
A3: dividing the target video into at least one video frame group based on the framing processing unit;
the video frames contained in the mahogany marriage of western grand words can be divided according to the obtained frame adding processing unit, and the specific dividing process is as follows, starting from frame 1 in mahogany marriage of western grand words, every 9 video frames can be divided into a video frame group, such as video frame group 1 is video frames 1-9, video frame group 2 is video frames 10-18, and so on, if the number of the last remaining video frames is less than 9, then all the remaining video frames are taken as a video frame group, such as 60000 video frames in mahogany marriage of western grand words, then the last 4 video frames are finally taken as less than 9, and at this time, the last 4 video frames are taken as a video frame group. Alternatively, it is also reasonable to discard the last remaining 4 video frames in addition to the above-described manner. It can be seen that at least one video frame group can be obtained after the target video is divided as described above.
It is worth emphasizing that the above mentioned target video, the number of video frames contained in the target video, the size of the framing processing unit, and the target frame rate PdThe size of (b) is only a specific example provided by the embodiment of the present invention, and the embodiment of the present invention does not apply to the target video, the number of video frames included in the target video, the size of the frame adding processing unit, and the target frame rate PdThe size of (a) is clearly defined.
A4: determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit;
for the two different manners, based on the number of added frames and the frame adding processing unit, the target video frame is determined from the at least one video frame group, and there are two specific implementation manners, which are specifically:
with respect to the first mode in the step a2, the step of determining the target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit may include:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a first frame number to be added is less than or equal to the frame adding processing unit, wherein the first frame number to be added is T1 × △ P1/D1;
when the judgment result is yes, determining the current first video frames to be added as target video frames from the video frame group;
and when the judgment result is negative, determining all the video frames contained in the video frame group as first target video frames, determining the difference value between the current first number of frames to be added and the frame adding processing unit as a new first number of frames to be added, judging whether the current first number of frames to be added is less than or equal to the frame adding processing unit, if the current first number of frames to be added is less than or equal to the frame adding processing unit, determining the current first number of frames to be added as second target video frames from the video frame group, determining all the determined first target video frames and the determined second target video frames as target video frames, and if the current first number of frames to be added is greater than the frame adding processing unit, returning to the step of determining all the video frames contained in the video frame group as first target video frames.
Since the video frame groups are equal in form, the process of determining the target video frame from each video frame group is the same, and therefore, the following description will be given only by taking any one of the video frame groups as an example.
Example 1. by the foregoing procedure, the framing processing units 9, T1, △, P1, and T1, P can be obtainedmAnd the greatest common divisor D1 of T1 × △ P1 is 3, when T1 × △ P1/D1 is taken as the first number of frames to be added (which may be represented by H), then H33/3 is 11, that is, 11 video frames are determined from the video frame group 200 as target video frames.
As can be seen from the above description, H > G, all the 9 video frames included in the video frame group 200 need to be determined as the first target video frames, at this time, 9 first target video frames, that is, 9 target video frames, that is, it is also necessary to determine that H-G is 11-9 or 2 target video frames, and H-G is used as the new first number of frames to be added (which may be represented by H1), that is, H1 is 2, at this time, H1< G, at this time, it is necessary to determine H1 video frames from the video frame group 200 as the second target video frames, that is, 2 video frames from 9 video frames are determined as the second target video frames, there are various ways to determine 2 video frames from 9 video frames, for example, 2 video frames from 9 video frames can be determined by means of random lottery, and it is also possible to preset to select two video frames from the video frame group at fixed positions, it is reasonable if the predetermined fixing positions are the 1 st and the last, or the 1 st and the middle 5, or the 5 th and the last.
However, in order to distribute the target video frames determined from the video frame group as uniformly as possible and further ensure the accuracy of adjusting the playing speed of the target video, in a specific implementation manner provided by the embodiment of the present invention, the second target video frame may be determined from the video frame group according to a certain step size, for this specific implementation manner, since 2 video frames need to be determined from the video frame group 200 as the second target video frame, the step size may be set to be G/H1, since the step size is generally an integer, the G/H1 may be rounded, and in order to ensure that a sufficient number of target video frames can be obtained, a lower rounding manner, such as a lower rounding manner, may be adopted, for example, in order to ensure that a sufficient number of target video frames can be obtained
Figure GDA0002478690210000151
Therefore, the step size can be set to
Figure GDA0002478690210000152
Then, if the 1 st video frame determined from the video frame set 200 is the 1 st video frame in the video frame set 200, it may be determined that the 2 nd video frame is the 5 th (1 +4) th video frame in the video frame set 200, and then it may be determined from the 1 st and 5 th video frames in the video frame set 200 as the second target video frame. Thus, 9 first target video frames and 2 second target video frames can be obtained, that is, the 1 st and 5 th video frames in the video frame group 200 are respectively made into 2 target video frames, and the other video frames in the video frame group 200 are all made into 1 target video frame, so that 11 target video frames are obtained.
In the embodiment of the present invention, "first" and "second" of the first target video frame and the second target video frame are different only for distinguishing the process of determining the target video frame, and do not distinguish the form of the target video frame, and the target video frames are peer-to-peer in form.
Example 2 the framing processing unit G is still 9, T1 × △ P1 ═ 12, T1 × PmAnd the greatest common divisor D1 of T1 × △ P1 is 3, when T1 × △ P1/D1 is taken as the first number of frames to be added (which may be represented by H), then H12/3 is 4, that is, 4 video frames are determined from the 9 video frames in the video frame group 200 as the target video frames.
By judgment, H<G, then 4 video frames need to be determined from 9 video frames of the video frame group 200 as target video frames, and the selection may also be performed according to a certain step size, where the step size may be: lower the rounding of G/H1, i.e.
Figure GDA0002478690210000161
Therefore, the step size can be set to
Figure GDA0002478690210000162
Assuming that the 1 st video frame is determined as the 1 st target video frame from the video frame set 200 at this time, the remaining target video frames 2-4 may be determined as the 3 rd (1 +2), 5 (3 +2), and 7 (5 +2) video frames in the video frame set 200, respectively, and the 4 target video frames may be determined by the above description, and of course, if the 1 st target video frame is the 2 nd video frame in the video frame set, the remaining target video frames 2-4 may be the 4 th (2 +2), 6 (4 +2), and 8 (6 +2) video frames in the video frame set 200, respectively.
Example 3 the framing processing unit G is still 9, T1 × △ P1 ═ 60, T1 × PmAnd the greatest common divisor D1 of T1 × △ P1 is 3, when T1 × △ P1/D1 is taken as the first number of frames to be added (which may be represented by H), then H60/3 is 20, that is, 20 video frames are determined from the 9 video frames in the video frame group 200 as the target video frames.
It can be seen that H > G, therefore, it is necessary to determine all 9 video frames included in the video frame group 200 as the first target video frames, at this time, 9 first target video frames have been determined, that is, it is also necessary to determine that H-G is 20-9 or 11 target video frames, take H-G as the new first number of frames to be added (which may be represented by H1), that is, H1 is 11, at this time, it is determined whether the current first number of frames to be added is less than or equal to the frame adding processing unit, that is, it is determined whether the new first number of frames to be added H1 is less than or equal to the frame adding processing unit G, it is known that H1> G is performed, therefore, the step of determining all the video frames included in the video frame group as the first target video frames is returned, that all 9 video frames included in the video frame group 200 need to be determined as the first determined target video frames, that may be 9 first target video frames, at this time, a total of 9+9 ═ 18 first target video frames are determined; when the difference between the current first frame adding number H1 and the frame adding processing unit G is determined as H1-G-11-9-2, H1-G is taken as the new first frame adding number (which may be represented by H2 at this time), and H2-H1-G-11-9-2, that is, at this time, it is further required to determine 2 video frames from the 9 video frames included in the video frame group 200 as the second target video frames, so that 18 first target video frames and 2 second target video frames are determined, and the first target video frames and the second target video frames are both target video frames, so that the above-mentioned determination results in 20 target video frames.
In the second mode in step a2, the step of determining the target video frame from the at least one video frame group based on the number of added frames and the frame adding processing unit may include:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a second frame number to be added is less than or equal to the frame adding processing unit, wherein the second frame number to be added is T2 × △ P1/D2;
when the judgment result is yes, determining the current second video frames to be added in number from the video frame group as target video frames;
and when the judgment result is negative, determining all the video frames contained in the video frame group as third target video frames, determining the difference value between the current second frame number to be added and the frame adding processing unit as a new second frame number to be added, judging whether the current second frame number to be added is less than or equal to the frame adding processing unit, if the current second frame number to be added is less than or equal to the frame adding processing unit, determining the video frames with the current second frame number to be added from the video frame group as fourth target video frames, determining all the determined third target video frames and the determined fourth target video frames as the target video frames, and if the current second frame number to be added is greater than the frame adding processing unit, returning to the step of determining all the video frames contained in the video frame group as the third target video frames.
Since the process is similar to the corresponding step in the above-mentioned step a2, and the difference is only in the representation of the number of frames to be added, the content of this portion is not repeated in the embodiment of the present invention, and for the similarity, refer to the corresponding portion.
In addition to the above two ways, the target video frame may be determined from at least one video frame group based on the number of added frames and the frame adding processing unit, and the number of added frames may also be determined randomly from each video frame group, for example, the number of added frames is 6 and the number of added frames is 3, at which time 3 video frames may be randomly selected from the video frame group including 6 video frames as the target video frame.
The skilled person can understand that, when the video is encoded and decoded, there are key frames, and the key frames can be encoded and decoded without referring to other video frames, and have more content information, so that when the framing processing unit is much larger than the framing number, the framing number of video frames can be selected from the plurality of key frames of the video frame group as the target video frame.
Of course, the above are only examples of many ways of determining the target video frame provided by the embodiment of the present invention, and for the embodiment of the present invention, the specific way of determining the target video frame is not further limited.
A5: and adding a transition video frame after each determined target video frame, wherein the transition video frame is a video frame generated based on the target video frame.
After the target video frame is determined, a corresponding transition video frame can be generated according to the determined target video frame, and specifically, the target video frame can be directly copied as the transition video frame; the target video frame may also be used as a reference, and the next video frame corresponding to the target video frame may be averaged, weighted, and the like from the perspective of the pixel value to synthesize a new video frame as a transition video frame.
After the transition video frame is generated, the generated transition video frame is added to the target video frame, and the adjustment of the number of the video frames of the target video is completed.
In the second case: when the target parameter is greater than a preset target frame rate, the step of reducing the number of video frames in the target video according to the preset frame number adjustment rule may include steps B1-B5 (not shown in the figure), specifically as follows:
b1: calculating the frame reduction quantity per second, wherein the frame reduction quantity is equal to the difference value of the target parameter and a preset target frame rate;
b2: calculating a frame reduction processing unit according to the target parameters and the frame reduction quantity;
in the solution provided by the embodiment of the present invention, the frame reduction processing unit is calculated according to the target parameter and the frame reduction number, and can be obtained in the following two ways; each of these modes is described below:
the first method is as follows: the step of calculating a frame reduction processing unit according to the target parameter and the frame reduction number may include:
calculate T3PmAnd a greatest common divisor D3 of T3 × △ P2, wherein T3 is such that T3 × PmAnd T3 × △ P2 is the minimum natural number of integer, and PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T3Pmthe/D3 is determined as a frame reduction processing unit.
This process is the same as the process of solving the framing processing unit in step a2 in the first case described above, assuming, for example, that the target frame rate P isd=30, initial frame rate P corresponding to a grand monkey marriage of western grand Speechi25 and the target playing speed V is 1.9, the target parameter P corresponding to the grand term of western sports of the greater speechm25 × 1.9 ═ 47.5, apparently 47.5>30, then the number of frames per second △ P2 may be calculated as Pm-Pd47.5-30-17.5; according to the method, the frame reduction processing unit specifically comprises the following steps: calculate T3PmAnd T3 × △ P2, wherein T3 is P3mAnd △ P2 are both the smallest natural numbers of integers, from which it can be seen that Pm47.5, △, 17.5, P2, and PmThe smallest natural number T3, which is an integer with △ P1, is 2, then T3Pm2, 47.5, 95, T3, △, P2, 2, 17.5, 35, calculating the greatest common divisor D3 of 95 and 35, without difficulty obtaining the greatest common divisor D3, 5, and finally T3, Pmthe/D3 is determined as a frame reduction processing unit, and the obtained frame reduction processing unit is 2 × 47.5/5 ═ 19.
The second method comprises the following steps: the step of calculating a frame reduction processing unit according to the target parameter and the frame reduction number may include:
calculating PmAnd △ P2, wherein said P is a greatest common divisor D4mFor the target parameter, the △ P2 is the reduced frame number;
mixing T4Pmthe/D4 is determined as a frame reduction processing unit, wherein the T4 is the unit which can enable the T4Pmthe/D4 and the T4 × △ P2/D4 are the minimum natural numbers of integers at the same time.
In the scheme provided by the embodiment of the invention, P is calculatedmAnd △ P2, the greatest common divisor D4 may include the following two cases, one case being PmAnd △ P2 are both integers, in which case PmAnd △ P2, the greatest common divisor D4 is the current notion of greatest common divisor, and in another case, P ismAnd △ P2 are not both integers, i.e. PmAnd △ P2, when at least one of P and P is decimalmAnd △ P2 may be a decimal number, for example, P2m0.9, △ P2 is 1.2, then the greatest common divisor of 0.9 and 1.2 is 0.3, also for example, Pm7.5, △ P2 is 5, then the greatest common denominator of 7.5 and 5 isThe number was 2.5.
Illustratively, assume a target frame rate PdInitial frame rate P of 30iProduct P of target playing speed VmWhen the value is 47.5, then Pm>PdTherefore, the number of frames per second △ P2 is calculated as Pm-PdThe frame reduction processing unit calculates the frame reduction processing unit according to the second mode, namely 47.5-30-17.5, and specifically comprises the following steps: calculating PmAnd △ P2, P being the greatest common divisor D4m47.5, △ P2 is 17.5, then the greatest common divisor of 47.5 and 17.5 is 2.5, and thus Pm19 for/D4, 7 for △ P2/D4, due to Pmboth/D4 and △ P2/D4 have been integers, so T4 equals 1, and finally T4 is Pmthe/D4 is determined as a frame reduction unit, and the frame reduction unit is obtained by 1 × 47.5/2.5 ═ 19.
B3: dividing the target video into at least one video frame group based on the frame reduction processing unit;
the above-mentioned size of the determinable frame reduction processing unit is 19, then 60000 video frames contained in video "a great marriage of western sports of mainwords" can be divided into a video frame group according to every 19 video frames, which is completely similar to the aforementioned process of dividing the video frame group in a3 in the first case, and therefore, the description thereof is omitted here.
B4: determining a target video frame from the at least one video frame group based on the reduced frame number and the reduced frame processing unit;
for the two different manners, based on the frame reduction number and the frame reduction processing unit, the target video frame is determined from the at least one video frame group, and there are two specific implementation manners, specifically:
with respect to the first mode in the step B2, the step of determining the target video frame from the at least one video frame group based on the frame reduction number and the frame reduction processing unit may include:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
determining T3 x △ P2/D3 video frames from the group of video frames as target video frames.
Since the video frame groups are equal in form, the process of determining the target video frame from each video frame group is the same, and therefore, the following description will be given only by taking any one of the video frame groups as an example.
Example 4, frame reduction processing unit 19, T3 △ P2 35, T3PmAnd the greatest common divisor D3 of T3 × △ P2 is 5, when T3 × △ P2/D3 is taken as the first number of frames to be reduced (which may be denoted by K), then K is 35/5 × 7, that is, 7 video frames are determined from the 19 video frames of the video frame group 200 as target video frames, and in the following embodiment, the frame reduction processing unit may be denoted by F.
There are various ways to determine 7 video frames from a video frame group including 19 video frames, and in order to make the target video frames determined from the video frame group to be uniformly distributed as much as possible, the target video frames can be determined from the video frame group according to a certain step length, for this embodiment, since it is necessary to determine 7 video frames from the video frame group 200 as the target video frames, the step length can be set to be F/K, since the step length is generally an integer, F/K can be rounded, and in order to ensure that a sufficient number of target video frames can be obtained, a rounding-down manner can be adopted, such as
Figure GDA0002478690210000201
Therefore, the step size can be set to
Figure GDA0002478690210000202
Then, if the 1 st video frame determined from the video frame group 200 is the 1 st video frame in the video frame group 200, the target videos 2 to 7 may be determined to be the 3 rd (1 +2), 5 (3 +2), 7 (5 +2), 9 (7 +2), 11 (9 +2), and 13 (11 +2) video frames in the video frame group 200, respectively, and may be determined to be the target video frame from the 1 st, 3, 5, 7, 9, 11, and 13 video frames in the video frame group 200 in summary.
In the second mode of the step B2, the step of determining the target video frame from the at least one video frame group based on the frame reduction number and the frame reduction processing unit may include:
determining T4 x △ P2/D4 video frames from the group of video frames as target video frames.
Since the process is similar to the step corresponding to the first method in step B2, and the difference is only in the representation of the number of frames to be subtracted, the details of this part are not repeated in the embodiment of the present invention.
B5: and deleting the target video frame.
After the target video frame is determined in step B4, the determined target video frame is deleted, and the adjustment of the number of video frames of the target video is completed.
It should be noted that, for the step B4, in addition to the above two manners of determining the target video frame for the first manner and the second manner, the step of determining the target video frame from at least one video frame group of the target video according to the second preset determination rule may include:
for each of the at least one group of video frames, F-T3 × △ P2/D3 or F-T4 × △ P2/D4 video frames are determined from the group of video frames as target video frames.
Based on the process, after the target video frame is determined, the determined target video frame is recombined into a new video frame group, namely the new video frame group contains F-T3 × △ P2/D3 or F-T4 × △ P2/D4 video frames, and the number of the video frames contained in the formed video frame group is the same as that of the video frames deleted from the video frame group containing F video frames or T4 × △ P2/D4 video frames, so the process of deleting the target video frame in the step B5 is not needed.
Example 5, frame reduction processing unit 19, T3 △ P2 35, T3PmAnd T3 × △ P2, the greatest common divisor D3 is 5, at this time, it is necessary to determine F-T3 × △ P2/D3 equal to 19-7 equal to 12 video frames from the 19 video frames of the video frame group 200 as the target video frame, and there are various ways to determine 12 video frames from the 19 video frames, which is the same as the above-mentioned process, and will not be described in detail hereThe step size is determined from the video frame group, and for this embodiment, since 12 video frames are determined from the 19 video frames of the video frame group 200 as the target video frame, the step size is set to 19/12, and since the step size is generally an integer, the rounding is performed on 19/12, where the rounding, i.e., the rounding method, is adopted
Figure GDA0002478690210000211
The 1 st, 3 rd (1 +2), 5 th, 7 th, 9 th, 11 th, 13 th, 15 th, 17 th, 19 th video frames in the 19 video frames of the video frame group 200 may be used as the target video frames, and 10 video frames in the 19 video frames of the video frame group 200, and since 12 video frames need to be determined as the target video frames, 2 video frames need to be determined from the remaining video frames of the video frame group 200, at this time, 9 video frames in the video frame group 200 (the 9 video frames are regarded as the remaining video frame group 200 '), and the 9 video frames in the remaining video frame group 200' are respectively the 2 nd, 4 th, 6 th, 8 th, 10 th, 12 th, 14 th, 16 th, 18 th video frames in the video frame group 200 ', that is, 2 video frames are determined as the target video frames from the 9 video frames included in the remaining video frame group 200', and similarly to the foregoing method, 2 video frames from the 9 video frames may be determined according to a certain step size, and 9/2 may be rounded up, namely, it is
Figure GDA0002478690210000212
At this time, the 1 st and 6 th (1 +5 th) video frames or the 2 nd and 7 th (2 +5 th) video frames may be determined from the remaining video frame group 200 'as the target video frames, and so on, assuming that the 1 st and 6 th video frames determined from the remaining video frame group 200' are the target video frames, that is, the 2 nd and 12 th video frames in the original video frame group 200 are the target video frames, so that a total of 12 (10 +2) target video frames are obtained, which are the 1 st, 2, 3, 5, 7, 9, 11, 12, 13, 15, 17, 19 th video frames in the video frame group 200, respectively, and a total of 12 target video frames are obtained.
After the 12 target video frames are determined, the 12 target video frames are recombined into a new video frame group, and all the video frame groups containing 19 video frames can be adjusted into the new video frame group containing 12 video frames according to the above manner, which can also be understood as the effect of deleting 7 video frames from each video frame group; and forming a new video by all the new video frame groups, namely the target video after the number of the video frames of the target video is adjusted.
S104: and according to the preset target frame rate, performing timestamp adjustment on video frames contained in the processed target video so as to play the adjusted target video according to the preset target frame rate.
It is understood that, after the number of video frames of the target video is adjusted, the number of video frames included in the target video may be changed, and the reduction of the number of video frames is taken as an example, and it is assumed that the video "mahogany marriage of western language" includes 60000 video frames and an initial frame rate P corresponding to the video framesi25, the target playback speed V is 1.9, the processing is performed according to the frame reduction processing unit 19, the 60000 video frame group is divided into 3157 video frame groups, and then 17 video frames remain, the remaining 17 video frame groups are discarded, and through the above calculation process, each of the 3157 video frame groups can be adjusted to a new video frame group including 12 video frames, and then the adjusted target video includes 3157 × 12 — 37884 video frames in total, because the initial frame rate P of the target video before adjustment is the initial frame rate P of the target video before adjustmenti25, and the adjusted "grand marriage of western grand talent" is performed at a fixed frame rate (target frame rate P)d30), it is necessary to re-time stamp these 37884 video frames.
For a certain video, when the video playing speed changes to different degrees at different times, the method provided by the embodiment of the invention will obtain the following processing results: the number of the video frames displayed in the same time period is the same, so that the aim of improving the display quality is fulfilled.
In summary, in the scheme provided in the embodiment of the present invention, when a play speed adjustment instruction for a target video is detected, a target play speed corresponding to the instruction is determined; then determining the initial frame rate of the target video, and taking the product of the initial frame rate and the target playing speed as the target parameter of the target video; processing the target video according to a preset frame number adjusting rule corresponding to the target size relationship; and according to the preset target frame rate, performing timestamp adjustment on the video frames contained in the processed target video so as to play the adjusted target video according to the preset target frame rate. By applying the scheme provided by the embodiment of the invention to adjust the playing speed of the target video, the adjusted target video can be played according to the preset target frame rate, the phenomenon that the number of the displayed video frames in the same time period is different is avoided, the display quality of the video with the adjusted playing speed is improved, and the user experience is further improved.
Fig. 2 is a schematic flow chart of another video playing speed adjustment method according to an embodiment of the present invention, which includes, in addition to steps S101 to S104 provided in the embodiment of fig. 1, the method further includes the steps of:
s105: coding the target video after the timestamp adjustment is completed to obtain a target adjustment video;
the adjustment of the number of the video frames of the target video is specifically realized for the target playing speed, so that the adjusted target video is played according to the target playing speed, if the playing is directly quitted, the user still plays at the playing speed before the adjustment when the target video is opened next time, if the same target playing speed is reached last time, the user needs to input the corresponding target playing speed again, the target video needs to be adjusted again, and thus the speed of opening the target video is slowed down, and the user needs to wait for a longer time.
In view of the foregoing problems, an alternative solution provided by the embodiment of the present invention is to encode the target video after the timestamp adjustment is completed, so as to obtain a target adjusted video. The encoding refers to video encoding, and the video encoding refers to compressing and encapsulating video frames by a specific compression technology to obtain a target adjustment video; when the video coding is carried out, the currently set video playing speed V information can be written into the target adjusting video together, so that the user is reminded of the current video playing speed V when the target adjusting video is played again subsequently. For example, the target Video after the timestamp adjustment is completed may be encoded by, but not limited to, using an encoding standard such as h.264, hevc (high Efficiency Video coding), and the like.
S106: storing and/or outputting the target adjusted video.
In order to facilitate resource sharing and management, the obtained target adjustment video may be stored locally, or directly output to another video player or video playing device, or output to another video player or video playing device after being stored locally.
In summary, by applying the embodiment provided in fig. 2, the target video with the adjusted playing speed can be re-encoded and further stored or output, so that it is not necessary to adjust the target video again when the adjusted target video is opened by the user next time, and the effect after last adjustment is directly played, which is greatly convenient for the user, and further improves the user experience.
Corresponding to the above method embodiment, the embodiment of the present invention further provides a video playing speed adjusting device.
Fig. 3 is a schematic structural diagram of an apparatus for adjusting video playing speed according to an embodiment of the present invention, as shown in fig. 3, the apparatus includes: a first determination module 201, a second determination module 202, a first processing module 203 and an adjustment module 204.
A first determining module 201, configured to determine, when a play speed adjustment instruction for a target video is detected, a target play speed corresponding to the speed adjustment instruction;
a second determining module 202, configured to determine an initial frame rate of the target video, and use a product of the initial frame rate and the target playing speed as a target parameter of the target video;
a first processing module 203, configured to process the target video according to a preset frame number adjustment rule corresponding to a target size relationship, where the target size relationship is a size relationship between the target parameter and a preset target frame rate;
the adjusting module 204 is configured to perform timestamp adjustment on video frames included in the processed target video according to the preset target frame rate, so that the adjusted target video is played according to the preset target frame rate.
In summary, in the scheme provided in the embodiment of the present invention, when a play speed adjustment instruction for a target video is detected, a target play speed corresponding to the instruction is determined; then determining the initial frame rate of the target video, and taking the product of the initial frame rate and the target playing speed as the target parameter of the target video; processing the target video according to a preset frame number adjusting rule corresponding to the target size relationship; and according to the preset target frame rate, performing timestamp adjustment on the video frames contained in the processed target video so as to play the adjusted target video according to the preset target frame rate. By applying the scheme provided by the embodiment of the invention to adjust the playing speed of the target video, the adjusted target video can be played according to the preset target frame rate, the phenomenon that the number of the displayed video frames in the same time period is different is avoided, the display quality of the video with the adjusted playing speed is improved, and the user experience is further improved.
Optionally, the first processing module 203 may include:
the first processing submodule is used for increasing the number of video frames in the target video according to the preset frame number adjusting rule when the target parameter is smaller than the preset target frame rate;
the second processing submodule is used for reducing the number of video frames in the target video according to the preset frame number adjusting rule when the target parameter is larger than the preset target frame rate;
and the third processing submodule is used for keeping the number of the video frames in the target video unchanged when the target parameter is equal to a preset target frame rate.
In one aspect, the first processing sub-module may include: a first calculation unit, a second calculation unit, a first division unit, a first determination unit, and a framing unit (not shown in the figure); in particular, the method comprises the following steps of,
the first calculating unit is used for calculating the frame adding quantity per second, wherein the frame adding quantity is equal to the difference value between the preset target frame rate and the target parameter;
the second calculating unit is used for calculating the frame adding processing unit according to the target parameters and the frame adding quantity;
a first dividing unit configured to divide the target video into at least one video frame group based on the framing processing unit;
a first determination unit configured to determine a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit;
and the frame adding unit is used for adding a transition video frame after each determined target video frame, wherein the transition video frame is a video frame generated based on the target video frame.
In a first specific implementation manner, the second calculating unit may be specifically configured to:
calculate T1PmAnd a greatest common divisor D1 of T1 × △ P1, wherein T1 is such that T1 × PmAnd T1 × △ P1 is the minimum natural number of integer, and PmFor the target parameter, the △ P1 is the number of frames;
mixing T1Pmthe/D1 is determined as a framing processing unit.
Based on the first specific implementation manner of the second calculating unit, correspondingly, the first determining unit may specifically be configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a first frame number to be added is less than or equal to the frame adding processing unit, wherein the first frame number to be added is T1 × △ P1/D1;
when the judgment result is yes, determining the current first video frames to be added as target video frames from the video frame group;
and when the judgment result is negative, determining all the video frames contained in the video frame group as first target video frames, determining the difference value between the current first number of frames to be added and the frame adding processing unit as a new first number of frames to be added, judging whether the current first number of frames to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames of the current first number of frames to be added from the video frame group as second target video frames, determining all the determined first target video frames and the determined second target video frames as target video frames, and if not, returning to the step of determining all the video frames contained in the video frame group as first target video frames.
In a second specific implementation manner, the second calculating unit may be specifically configured to:
calculating PmAnd △ P1, wherein said P is a greatest common divisor D2mFor the target parameter, the △ P1 is the number of frames;
mixing T2Pmthe/D2 is determined as a framing processing unit, wherein the T2 is the processing unit capable of enabling the T2Pmthe/D2 and the T2 × △ P1/D2 are the minimum natural numbers of integers at the same time.
Based on the second specific implementation manner of the second calculating unit, correspondingly, the first determining unit may specifically be configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a second frame number to be added is less than or equal to the frame adding processing unit, wherein the second frame number to be added is T2 × △ P1/D2;
when the judgment result is yes, determining the current second video frames to be added in number from the video frame group as target video frames;
and when the judgment result is negative, determining all the video frames contained in the video frame group as third target video frames, determining the difference value between the current second frame number to be added and the frame adding processing unit as a new second frame number to be added, judging whether the current second frame number to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames with the current second frame number to be added from the video frame group as fourth target video frames, determining all the determined third target video frames and the fourth target video frames as target video frames, and if not, returning to execute the step of determining all the video frames contained in the video frame group as third target video frames.
On the other hand, the second processing sub-module may include: a third calculation unit, a fourth calculation unit, a second division unit, a second determination unit, and a frame reduction unit (not shown in the figure); in particular, the method comprises the following steps of,
the third calculating unit is used for calculating the frame reduction quantity per second, wherein the frame reduction quantity is equal to the difference value of the target parameter and the preset target frame rate;
the fourth calculating unit is used for calculating a frame reduction processing unit according to the target parameter and the frame reduction quantity;
a second dividing unit for dividing the target video into at least one video frame group based on the frame reduction processing unit;
a second determining unit for determining a target video frame from the at least one video frame group based on the reduced frame number and the reduced frame processing unit;
and the frame reducing unit is used for deleting the target video frame.
Specifically, in a first specific implementation manner, the fourth calculating unit may specifically be configured to:
calculate T3PmAnd a greatest common divisor D3 of T3 × △ P2, wherein T3 is such that T3 × PmAnd T3 × △ P2 is the minimum natural number of integer, and PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T3Pmthe/D3 is determined as a frame reduction processing unit.
Based on the first specific implementation manner of the fourth calculating unit, correspondingly, the second determining unit may be specifically configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
determining T3 x △ P2/D3 video frames from the group of video frames as target video frames.
In a second specific implementation manner, the fourth calculating unit may be specifically configured to:
calculating PmAnd △ P2, wherein said P is a greatest common divisor D4mFor the target parameter, the △ P2 is the reduced frame number;
mixing T4Pmthe/D4 is determined as a frame reduction processing unit, wherein the T4 is the unit which can enable the T4Pmthe/D4 and the T4 × △ P2/D4 are the minimum natural numbers of integers at the same time.
Based on the second specific implementation manner of the fourth calculating unit, correspondingly, the second determining unit may be specifically configured to:
determining T4 x △ P2/D4 video frames from the group of video frames as target video frames.
Fig. 4 is a schematic structural diagram of another video playing speed adjusting apparatus according to an embodiment of the present invention, which includes, in addition to the first determining module 201, the second determining module 202, the first processing module 203, and the adjusting module 204 provided in fig. 3, the apparatus according to the embodiment of the present invention further includes: an encoding module 205 and a second processing module 206.
The encoding module 205 is configured to encode the target video after the timestamp adjustment is completed, so as to obtain a target adjusted video;
a second processing module 206, configured to store and/or output the target adjustment video.
In summary, by applying the embodiment provided in fig. 4, the target video with the adjusted play speed can be re-encoded and further stored or output, so that it is ensured that the next time the user opens the adjusted target video, the target video does not need to be adjusted again, the effect after the previous adjustment is directly achieved, great convenience is brought to the user, and further user experience is improved.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Those skilled in the art will appreciate that all or part of the steps in the above method embodiments may be implemented by a program to instruct relevant hardware to perform the steps, and the program may be stored in a computer-readable storage medium, which is referred to herein as a storage medium, such as: ROM/RAM, magnetic disk, optical disk, etc.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (24)

1. A method for adjusting video playing speed, the method comprising:
when a play speed adjustment instruction for a target video is detected, determining a target play speed corresponding to the speed adjustment instruction;
determining an initial frame rate of the target video, and taking the product of the initial frame rate and the target playing speed as a target parameter of the target video;
processing the target video according to a preset frame number adjusting rule corresponding to a target size relationship, wherein the target size relationship is the size relationship between the target parameter and a preset target frame rate;
according to the preset target frame rate, performing timestamp adjustment on video frames contained in the processed target video so as to play the adjusted target video according to the preset target frame rate;
the step of processing the target video according to a preset frame number adjusting rule corresponding to the target size relationship comprises the following steps:
when the target parameter is smaller than a preset target frame rate, increasing the number of video frames in the target video according to the preset frame number adjusting rule;
when the target parameter is larger than a preset target frame rate, reducing the number of video frames in the target video according to the preset frame number regulation rule;
and when the target parameter is equal to a preset target frame rate, keeping the number of video frames in the target video unchanged.
2. The method according to claim 1, wherein the step of increasing the number of video frames in the target video according to the preset frame number adjustment rule comprises:
calculating the frame adding quantity per second, wherein the frame adding quantity is equal to the difference value between the preset target frame rate and the target parameter;
calculating a framing processing unit according to the target parameters and the framing quantity;
dividing the target video into at least one video frame group based on the framing processing unit;
determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit;
and adding a transition video frame after each determined target video frame, wherein the transition video frame is a video frame generated based on the target video frame.
3. The method of claim 2, wherein the step of calculating a framing processing unit based on the target parameter and the number of framed frames comprises:
calculate T1PmAnd a greatest common divisor D1 of T1 × △ P1, wherein T1 is such that T1 × PmAnd T1 × △ P1 is the minimum natural number of integer, and PmFor the target parameter, the △ P1 is the number of frames;
mixing T1Pmthe/D1 is determined as a framing processing unit.
4. The method of claim 3, wherein the step of determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit comprises:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a first frame number to be added is less than or equal to the frame adding processing unit, wherein the first frame number to be added is T1 × △ P1/D1;
when the judgment result is yes, determining the current first video frames to be added as target video frames from the video frame group;
and when the judgment result is negative, determining all the video frames contained in the video frame group as first target video frames, determining the difference value between the current first number of frames to be added and the frame adding processing unit as a new first number of frames to be added, judging whether the current first number of frames to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames of the current first number of frames to be added from the video frame group as second target video frames, determining all the determined first target video frames and the determined second target video frames as target video frames, and if not, returning to the step of determining all the video frames contained in the video frame group as first target video frames.
5. The method of claim 2, wherein the step of calculating a framing processing unit based on the target parameter and the number of framed frames comprises:
calculating PmAnd △ P1, wherein said P is a greatest common divisor D2mFor the target parameter, the △ P1 is the number of frames;
mixing T2Pmthe/D2 is determined as a framing processing unit, wherein the T2 is the processing unit capable of enabling the T2Pmthe/D2 and the T2 × △ P1/D2 are the minimum natural numbers of integers at the same time.
6. The method of claim 5, wherein the step of determining a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit comprises:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a second frame number to be added is less than or equal to the frame adding processing unit, wherein the second frame number to be added is T2 × △ P1/D2;
when the judgment result is yes, determining the current second video frames to be added in number from the video frame group as target video frames;
and when the judgment result is negative, determining all the video frames contained in the video frame group as third target video frames, determining the difference value between the current second frame number to be added and the frame adding processing unit as a new second frame number to be added, judging whether the current second frame number to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames with the current second frame number to be added from the video frame group as fourth target video frames, determining all the determined third target video frames and the fourth target video frames as target video frames, and if not, returning to execute the step of determining all the video frames contained in the video frame group as third target video frames.
7. The method according to claim 1, wherein the step of reducing the number of video frames in the target video according to the preset frame number adjustment rule comprises:
calculating the frame reduction quantity per second, wherein the frame reduction quantity is equal to the difference value of the target parameter and a preset target frame rate;
calculating a frame reduction processing unit according to the target parameters and the frame reduction quantity;
dividing the target video into at least one video frame group based on the frame reduction processing unit;
determining a target video frame from the at least one video frame group based on the reduced frame number and the reduced frame processing unit;
and deleting the target video frame.
8. The method of claim 7, wherein the step of calculating a frame reduction processing unit based on the target parameter and the number of reduced frames comprises:
calculate T3PmAnd a greatest common divisor D3 of T3 × △ P2, wherein T3 is such that T3 × PmAnd T3 × △ P2 is the minimum natural number of integer, and PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T3Pmthe/D3 is determined as a frame reduction processing unit.
9. The method of claim 8, wherein the step of determining a target video frame from the at least one group of video frames based on the reduced frame number and the reduced frame processing unit comprises:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
determining T3 x △ P2/D3 video frames from the group of video frames as target video frames.
10. The method of claim 7, wherein the step of calculating a frame reduction processing unit based on the target parameter and the number of reduced frames comprises:
calculating PmAnd △ P2, wherein said P is a greatest common divisor D4mFor the target parameter, the △ P2 is the reduced frame number;
mixing T4Pmthe/D4 is determined as a frame reduction processing unit, wherein the T4 is the unit which can enable the T4Pmthe/D4 and the T4 × △ P2/D4 are the minimum natural numbers of integers at the same time.
11. The method of claim 10, wherein the step of determining a target video frame from the at least one group of video frames based on the reduced frame number and the reduced frame processing unit comprises:
determining T4 x △ P2/D4 video frames from the group of video frames as target video frames.
12. The method according to any one of claims 1-11, further comprising:
coding the target video after the timestamp adjustment is completed to obtain a target adjustment video;
storing and/or outputting the target adjusted video.
13. An apparatus for adjusting video playback speed, the apparatus comprising:
the first determining module is used for determining a target playing speed corresponding to a speed adjusting instruction when the playing speed adjusting instruction for the target video is detected;
a second determining module, configured to determine an initial frame rate of the target video, and use a product of the initial frame rate and the target play speed as a target parameter of the target video;
the first processing module is used for processing the target video according to a preset frame number adjusting rule corresponding to a target size relationship, wherein the target size relationship is the size relationship between the target parameter and a preset target frame rate;
the adjusting module is used for adjusting the timestamp of the video frame contained in the processed target video according to the preset target frame rate so as to play the adjusted target video according to the preset target frame rate;
the first processing module comprises:
the first processing submodule is used for increasing the number of video frames in the target video according to the preset frame number adjusting rule when the target parameter is smaller than the preset target frame rate;
the second processing submodule is used for reducing the number of video frames in the target video according to the preset frame number adjusting rule when the target parameter is larger than the preset target frame rate;
and the third processing submodule is used for keeping the number of the video frames in the target video unchanged when the target parameter is equal to a preset target frame rate.
14. The apparatus of claim 13, wherein the first processing sub-module comprises:
the first calculating unit is used for calculating the frame adding quantity per second, wherein the frame adding quantity is equal to the difference value between the preset target frame rate and the target parameter;
the second calculating unit is used for calculating the frame adding processing unit according to the target parameters and the frame adding quantity;
a first dividing unit configured to divide the target video into at least one video frame group based on the framing processing unit;
a first determination unit configured to determine a target video frame from the at least one video frame group based on the number of framed frames and the framing processing unit;
and the frame adding unit is used for adding a transition video frame after each determined target video frame, wherein the transition video frame is a video frame generated based on the target video frame.
15. The apparatus according to claim 14, wherein the second computing unit is specifically configured to:
calculate T1PmAnd a greatest common divisor D1 of T1 × △ P1, wherein T1 is such that T1 × PmAnd T1 × △ P1 is the minimum natural number of integer, and PmFor the target parameter, the △ P1 is the number of frames;
mixing T1Pmthe/D1 is determined as a framing processing unit.
16. The apparatus according to claim 15, wherein the first determining unit is specifically configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a first frame number to be added is less than or equal to the frame adding processing unit, wherein the first frame number to be added is T1 × △ P1/D1;
when the judgment result is yes, determining the current first video frames to be added as target video frames from the video frame group;
and when the judgment result is negative, determining all the video frames contained in the video frame group as first target video frames, determining the difference value between the current first number of frames to be added and the frame adding processing unit as a new first number of frames to be added, judging whether the current first number of frames to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames of the current first number of frames to be added from the video frame group as second target video frames, determining all the determined first target video frames and the determined second target video frames as target video frames, and if not, returning to the step of determining all the video frames contained in the video frame group as first target video frames.
17. The apparatus according to claim 14, wherein the second computing unit is specifically configured to:
calculating PmAnd △ P1, wherein said P is a greatest common divisor D2mFor the target parameter, the △ P1 is the number of frames;
mixing T2Pmthe/D2 is determined as a framing processing unit, wherein the T2 is the processing unit capable of enabling the T2Pmthe/D2 and the T2 × △ P1/D2 are the minimum natural numbers of integers at the same time.
18. The apparatus according to claim 17, wherein the first determining unit is specifically configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
judging whether a second frame number to be added is less than or equal to the frame adding processing unit, wherein the second frame number to be added is T2 × △ P1/D2;
when the judgment result is yes, determining the current second video frames to be added in number from the video frame group as target video frames;
and when the judgment result is negative, determining all the video frames contained in the video frame group as third target video frames, determining the difference value between the current second frame number to be added and the frame adding processing unit as a new second frame number to be added, judging whether the current second frame number to be added is less than or equal to the frame adding processing unit, if so, determining all the video frames with the current second frame number to be added from the video frame group as fourth target video frames, determining all the determined third target video frames and the fourth target video frames as target video frames, and if not, returning to execute the step of determining all the video frames contained in the video frame group as third target video frames.
19. The apparatus of claim 13, wherein the second processing sub-module comprises:
the third calculating unit is used for calculating the frame reduction quantity per second, wherein the frame reduction quantity is equal to the difference value of the target parameter and the preset target frame rate;
the fourth calculating unit is used for calculating a frame reduction processing unit according to the target parameter and the frame reduction quantity;
a second dividing unit for dividing the target video into at least one video frame group based on the frame reduction processing unit;
a second determining unit for determining a target video frame from the at least one video frame group based on the reduced frame number and the reduced frame processing unit;
and the frame reducing unit is used for deleting the target video frame.
20. The apparatus according to claim 19, wherein the fourth computing unit is specifically configured to:
calculate T3PmAnd a greatest common divisor D3 of T3 × △ P2, wherein T3 is such that T3 × PmAnd T3 × △ P2 is the minimum natural number of integer, and PmFor the target parameter, the △ P2 is the reduced frame number;
mixing T3Pmthe/D3 is determined as a frame reduction processing unit.
21. The apparatus according to claim 20, wherein the second determining unit is specifically configured to:
for each of the at least one group of video frames, determining a target video frame in the group of video frames as follows:
determining T3 x △ P2/D3 video frames from the group of video frames as target video frames.
22. The apparatus according to claim 19, wherein the fourth computing unit is specifically configured to:
calculating PmAnd △ P2, wherein said P is a greatest common divisor D4mFor the target parameter, the △ P2 is the reduced frame number;
mixing T4Pmthe/D4 is determined as a frame reduction processing unit, wherein the T4 is the unit which can enable the T4Pmthe/D4 and the T4 × △ P2/D4 are the minimum natural numbers of integers at the same time.
23. The apparatus according to claim 22, wherein the second determining submodule is specifically configured to:
determining T4 x △ P2/D4 video frames from the group of video frames as target video frames.
24. The apparatus according to any one of claims 13-23, further comprising:
the encoding module is used for encoding the target video after the timestamp adjustment is completed to obtain a target adjustment video;
and the second processing module is used for storing and/or outputting the target adjustment video.
CN201710140357.3A 2017-03-10 2017-03-10 Video playing speed adjusting method and device Active CN108574874B (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201710140357.3A CN108574874B (en) 2017-03-10 2017-03-10 Video playing speed adjusting method and device
US16/492,654 US11217279B2 (en) 2017-03-10 2018-03-01 Method and device for adjusting video playback speed
EP18763940.6A EP3595324A4 (en) 2017-03-10 2018-03-01 Method and device for adjusting video playback speed
PCT/CN2018/077766 WO2018161843A1 (en) 2017-03-10 2018-03-01 Method and device for adjusting video playback speed

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710140357.3A CN108574874B (en) 2017-03-10 2017-03-10 Video playing speed adjusting method and device

Publications (2)

Publication Number Publication Date
CN108574874A CN108574874A (en) 2018-09-25
CN108574874B true CN108574874B (en) 2020-07-03

Family

ID=63447276

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710140357.3A Active CN108574874B (en) 2017-03-10 2017-03-10 Video playing speed adjusting method and device

Country Status (4)

Country Link
US (1) US11217279B2 (en)
EP (1) EP3595324A4 (en)
CN (1) CN108574874B (en)
WO (1) WO2018161843A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110087130A (en) * 2019-05-29 2019-08-02 维沃移动通信有限公司 A kind of video broadcasting method and terminal device
CN110290421A (en) * 2019-08-01 2019-09-27 北京达佳互联信息技术有限公司 Frame per second method of adjustment, device, computer equipment and storage medium
CN113556505B (en) * 2020-04-23 2022-11-25 杭州海康威视数字技术股份有限公司 Data processing method and device, electronic equipment and readable storage medium
CN111405362B (en) * 2020-04-23 2022-11-15 成都极米科技股份有限公司 Video output method, video output device, video equipment and computer readable storage medium
CN113825019B (en) * 2020-06-19 2022-11-11 北京字节跳动网络技术有限公司 Video variable-speed playing method and device, electronic equipment and computer readable medium
CN113163260B (en) * 2021-03-09 2023-03-24 北京百度网讯科技有限公司 Video frame output control method and device and electronic equipment
CN113923495B (en) * 2021-09-08 2024-01-12 北京奇艺世纪科技有限公司 Video playing method, system, electronic equipment and storage medium
CN116684668B (en) * 2023-08-03 2023-10-20 湖南马栏山视频先进技术研究院有限公司 Self-adaptive video frame processing method and playing terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104394426A (en) * 2014-12-10 2015-03-04 福建星网锐捷网络有限公司 Rate playing method and device of stream media
CN104602117A (en) * 2015-01-31 2015-05-06 华为技术有限公司 Double-speed video playing method and device
CN104639978A (en) * 2015-02-13 2015-05-20 上海小蚁科技有限公司 Multimedia processing method and device
CN105049914A (en) * 2015-07-07 2015-11-11 深圳Tcl数字技术有限公司 Picture frame playing method and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7027713B1 (en) * 1999-11-30 2006-04-11 Sharp Laboratories Of America, Inc. Method for efficient MPEG-2 transport stream frame re-sequencing
US7237254B1 (en) * 2000-03-29 2007-06-26 Microsoft Corporation Seamless switching between different playback speeds of time-scale modified data streams
US8214516B2 (en) * 2006-01-06 2012-07-03 Google Inc. Dynamic media serving infrastructure
US8407747B1 (en) * 2012-03-13 2013-03-26 Google Inc. Adaptive trick play streaming
US9269395B2 (en) * 2012-08-10 2016-02-23 Canon Kabushiki Kaisha Display control apparatus, display apparatus, and method for controlling the same
JP5847752B2 (en) * 2013-03-29 2016-01-27 株式会社東芝 Movie playback device
US9712867B2 (en) * 2013-09-16 2017-07-18 Avago Technologies General Ip (Singapore) Pte. Ltd. Application specific policy implementation and stream attribute modification in audio video (AV) media

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104394426A (en) * 2014-12-10 2015-03-04 福建星网锐捷网络有限公司 Rate playing method and device of stream media
CN104602117A (en) * 2015-01-31 2015-05-06 华为技术有限公司 Double-speed video playing method and device
CN104639978A (en) * 2015-02-13 2015-05-20 上海小蚁科技有限公司 Multimedia processing method and device
CN105049914A (en) * 2015-07-07 2015-11-11 深圳Tcl数字技术有限公司 Picture frame playing method and device

Also Published As

Publication number Publication date
WO2018161843A1 (en) 2018-09-13
EP3595324A4 (en) 2020-06-10
EP3595324A1 (en) 2020-01-15
CN108574874A (en) 2018-09-25
US11217279B2 (en) 2022-01-04
US20210142825A1 (en) 2021-05-13

Similar Documents

Publication Publication Date Title
CN108574874B (en) Video playing speed adjusting method and device
US11582497B2 (en) Methods, systems, processors and computer code for providing video clips
US10930318B2 (en) Gapless video looping
US20160219279A1 (en) EXPERIENCE OR &#34;SENTIO&#34; CODECS, AND METHODS AND SYSTEMS FOR IMPROVING QoE AND ENCODING BASED ON QoE EXPERIENCES
Hemmati et al. Game as video: Bit rate reduction through adaptive object encoding
CN110446072B (en) Video stream switching method, electronic device and storage medium
US20070217505A1 (en) Adaptive Decoding Of Video Data
US11563915B2 (en) Media content presentation
KR20200026327A (en) Selection of resolutions for seamless resolution switching of multimedia content
CN108307248B (en) Video broadcasting method, calculates equipment and storage medium at device
US7660512B2 (en) Systems and methods for managing frame rates during multimedia playback
CN107493478B (en) Method and device for setting coding frame rate
CN114245198B (en) Method and device for processing media content, electronic equipment and storage medium
CN110677728B (en) Method, device and equipment for playing video and storage medium
US20130262293A1 (en) Variable charging of audience member temporal viewing of a live video chat performance
CN112738571B (en) Method and device for determining streaming media parameters
US10630768B1 (en) Content-based media compression
CN116958331B (en) Sound and picture synchronization adjusting method and device and electronic equipment
CN115118921B (en) Method and system for video screen-combining self-adaptive output in cloud conference
CN115623248B (en) Data processing method, frame rate adjustment method, device, equipment and computer medium
US20220193553A1 (en) Systems and methods for embedded video streams
WO2021171362A1 (en) Vr video encoding parameter calculation device, vr video encoding parameter calculation method, and program
Wang et al. Experimental study of video fusion for multi-view video streaming in mobile media cloud
JP2022039452A (en) Reception terminal, distribution server, reception method and reception program
CN115665482A (en) Video rendering method and device, computer equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant