WO2021026785A1 - Video processing method and apparatus, and storage medium - Google Patents

Video processing method and apparatus, and storage medium Download PDF

Info

Publication number
WO2021026785A1
WO2021026785A1 PCT/CN2019/100452 CN2019100452W WO2021026785A1 WO 2021026785 A1 WO2021026785 A1 WO 2021026785A1 CN 2019100452 W CN2019100452 W CN 2019100452W WO 2021026785 A1 WO2021026785 A1 WO 2021026785A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
speed
video
original
speed adjustment
Prior art date
Application number
PCT/CN2019/100452
Other languages
French (fr)
Chinese (zh)
Inventor
李菊梅
蒋松艳
Original Assignee
深圳市大疆创新科技有限公司
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 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2019/100452 priority Critical patent/WO2021026785A1/en
Priority to CN201980033825.4A priority patent/CN112154670A/en
Publication of WO2021026785A1 publication Critical patent/WO2021026785A1/en

Links

Images

Classifications

    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/172Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
    • 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
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects

Definitions

  • the present invention relates to the field of image processing technology, and in particular to a video processing method, device and storage medium.
  • the video speed adjustment method in the prior art is often a single speed adjustment for the entire video, that is, the entire video is edited and played at 2x speed or 0.5x speed, which cannot meet the individual needs of users.
  • the embodiments of the present invention provide a video processing method, device, and storage medium, which are used to solve the problem in the prior art that only a single speed adjustment can be performed for the entire video and cannot meet the individual needs of users.
  • the first aspect of the embodiments of the present invention is to provide a video processing method, including:
  • the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed corresponding to the speed adjustment initial frame, the The target speed corresponding to the end frame of speed adjustment;
  • the second aspect of the present invention is to provide a video processing device, including:
  • Memory used to store computer programs
  • the processor is configured to run a computer program stored in the memory to achieve: acquiring video speed adjustment information, the video speed adjustment information including: the frame position of the speed adjustment initial frame in the original video, and the speed adjustment end frame of the original video Frame position, and the initial speed corresponding to the initial frame of speed adjustment, and the target speed corresponding to the end frame of speed adjustment; determine the corresponding frame of each frame in the target video in the original video according to the video speed adjustment information Position, wherein the target video is a video obtained by adjusting the speed of the original video; the target video is acquired according to the frame position of each frame in the target video corresponding to the original video.
  • the third aspect of the present invention is to provide a computer-readable storage medium, the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, the program instructions are used in the first aspect The video processing method described.
  • the video speed adjustment information is obtained, and the corresponding frame position of each frame in the target video in the original video is determined according to the video speed adjustment information, and then according to the target video
  • Each frame in the original video corresponds to the position of the frame in the original video, so as to obtain the target video after the speed adjustment process, which can realize the variable speed adjustment of the video, improve the display effect of the target video, and meet the user's need for video speed adjustment. Individual needs.
  • the fourth aspect of the present invention is to provide a video processing method, including:
  • the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed corresponding to the speed adjustment initial frame, the The target speed corresponding to the end frame of speed adjustment;
  • the fifth aspect of the present invention is to provide a video processing device, including:
  • Memory used to store computer programs
  • the processor is configured to run a computer program stored in the memory to achieve: acquiring video speed adjustment information, the video speed adjustment information including: the frame position of the speed adjustment initial frame in the original video, and the speed adjustment end frame of the original video Frame position, and the initial speed corresponding to the initial frame of speed adjustment, and the target speed corresponding to the end frame of speed adjustment; determine the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information,
  • the speed adjustment parameter includes a speed adjustment start time, an original time length, and a target time length after speed adjustment; and the target video is acquired according to the speed adjustment parameter.
  • the sixth aspect of the present invention is to provide a computer-readable storage medium, the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, and the program instructions are used in the fourth aspect.
  • the video processing method provided in this embodiment obtains video speed adjustment information, determines the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information, and obtains all speed adjustment parameters according to the speed adjustment parameter.
  • the variable speed adjustment of the video can be realized, the display effect of the target video is improved, and the individual needs of users for video speed adjustment can be met.
  • FIG. 1 is a schematic flowchart of a video processing method provided by an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of determining the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information according to an embodiment of the present invention
  • Figure 3 is an embodiment of the present invention for determining the corresponding frame position of each frame in the target video in the original video according to the original frame position corresponding to the part of the video frame, the adjusted frame position and the playback speed Flow chart one;
  • FIG. 4 is a schematic flow chart of determining the original frame position, the adjusted frame position, and the playback speed corresponding to some video frames in the original video according to the video speed adjustment information according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram 1 of the process of obtaining the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed according to an embodiment of the present invention
  • FIG. 6 is a second schematic diagram of the process of obtaining the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed according to an embodiment of the present invention
  • FIG. 7 is an embodiment of the present invention to determine the original frame position and speed adjustment corresponding to the speed adjustment intermediate frame at least partly according to the original frame position corresponding to the speed adjustment initial frame, the speed adjustment frame position and the playback speed Schematic diagram of the flow of post frame position and playback speed;
  • FIG. 8 is an embodiment of the present invention for determining the corresponding frame position of each frame in the target video in the original video according to the original frame position corresponding to the partial video frame, the adjusted frame position, and the playback speed.
  • FIG. 9 is a schematic flowchart of another video processing method provided by an embodiment of the present invention.
  • FIG. 10 is a schematic flowchart of determining the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information according to an embodiment of the present invention
  • FIG. 11 is a schematic diagram of a scene of a video processing method provided by an application embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention.
  • FIG. 13 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention.
  • the video speed adjustment method in the prior art is often a single speed adjustment for the entire video, that is, the entire The video is edited and played at 2x speed or 0.5x speed, which cannot meet the individual needs of users.
  • the embodiments of the present invention provide a video processing method, device, and storage medium, which are used to solve the problem that the prior art can only perform a single speed adjustment for the entire video, and cannot meet the individual needs of users. .
  • the video processing method provided by the embodiment of the present invention can be used to process aerial video.
  • the user can remotely control the unmanned aerial vehicle through the control terminal to shoot the target scene while the unmanned aerial vehicle is hovering or moving.
  • the video captured by the unmanned aerial vehicle can be transmitted to the control terminal through the wireless communication link, and further ,
  • the control terminal is equipped with an application program (APP) that can edit the video.
  • the APP can adjust the speed of the aerial video taken by the unmanned aerial vehicle.
  • the user can select the frame position of the speed adjustment initial frame and the frame position of the speed adjustment end frame, and the initial speed corresponding to the speed adjustment initial frame and the target speed corresponding to the speed adjustment end frame.
  • the speed adjustment initial frame may be the 60th frame of the original aerial video
  • the speed adjustment end frame may be the 600th frame of the original aerial video.
  • the initial speed may be 1x speed
  • the target speed may be 2x speed.
  • the video processing method provided by the embodiment of the present invention can obtain a speed-regulated target video whose playback speed gradually changes from 1x speed to 2x speed. Different from the prior art in which the entire video is played at twice the speed, the embodiment of the present invention can realize the variable speed adjustment of the video, improve the display effect of the target video, and meet the individual needs of users for video speed adjustment.
  • FIG. 1 is a schematic flowchart of a video processing method provided by an embodiment of the present invention; referring to FIG. 1, this embodiment provides a video processing method.
  • the execution body of the method is a video processing device, which can be It is conceivable that the processing device can be implemented as software, or a combination of software and hardware. Specifically, the method may include:
  • the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed and speed adjustment end frame corresponding to the speed adjustment initial frame The corresponding target speed.
  • the video speed adjustment information may be speed adjustment information for all original videos, or may also be speed adjustment information for part of the original videos.
  • the speed adjustment initial frame in the video speed adjustment information is the first frame in the original video
  • the speed adjustment end frame is the original video Last frame
  • the speed control initial frame in the video speed control information can be the first frame in the original video
  • the speed control end frame can be the middle of the original video Frame
  • the speed adjustment initial frame in the video speed adjustment information is the first intermediate frame in the original video
  • the speed adjustment end frame can be the second intermediate frame or the last frame in the original video, where the second intermediate frame corresponds
  • the frame position of is greater than the frame position corresponding to the first intermediate frame.
  • this embodiment does not limit the specific acquisition method of video speed adjustment information.
  • the user can input video adjustment parameters for the original video and adjust the parameters according to the video.
  • the video speed adjustment information can be determined; or, the user can perform an operation on the original video input, and determine the frame position of the speed adjustment initial frame in the original video and the frame position of the speed adjustment end frame in the original video according to the performed operation; After obtaining the frame positions of the speed adjustment initial frame and the speed adjustment end frame in the original video, you can configure the speed of the speed adjustment initial frame and the speed adjustment end frame to obtain the initial speed and speed adjustment corresponding to the speed adjustment initial frame The target speed corresponding to the end frame.
  • those skilled in the art can also use other methods to obtain the video speed adjustment information, as long as the accuracy and reliability of the acquisition of the video speed adjustment information can be ensured, which will not be repeated here.
  • S2 Determine the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information, where the target video is a video after speed adjustment of the original video.
  • the video speed adjustment information can be analyzed and processed, so that the frame position of each frame in the target video corresponding to the original video can be obtained.
  • the frame position of the speed adjustment initial frame is 60 frames
  • the frame position of the speed adjustment end frame is 70 frames
  • the initial speed corresponding to the speed adjustment initial frame is 1x speed
  • the target speed corresponding to the speed adjustment end frame is 2x speed
  • taking the 67th frame in the target video as an example, through the analysis and processing of the above video speed adjustment information, it can be determined that the 67th frame in the target video corresponds to the 69th frame in the original video, that is, the frame in the target video
  • the 67th frame corresponds to the 69th frame in the original video.
  • the corresponding frame After obtaining the corresponding frame position of each frame in the target video in the original video, the corresponding frame can be obtained through the corresponding frame position of each frame in the target video in the original video, and all the obtained frames constitute In addition to the target video, further, the target video can be displayed.
  • the corresponding frame position of each frame in the target video in the original video is determined according to the video speed adjustment information, and then according to the position of each frame in the target video in the original video.
  • the corresponding frame position in the video so as to obtain the target video after the speed adjustment process.
  • each frame or every few frames in the target video corresponds to a different playback speed, thus realizing the variable speed adjustment of the video and improving
  • the display effect of the target video meets the individual needs of users for video speed adjustment.
  • Fig. 2 is a schematic flow chart of determining the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information provided by an embodiment of the present invention; on the basis of the above embodiment, continue to refer to Fig. 2.
  • determining the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information may include:
  • S21 According to the video speed adjustment information, determine the original frame position, the speed adjusted frame position and the playback speed corresponding to some video frames in the original video.
  • Some video frames include the speed adjustment initial frame, the speed adjustment initial frame and the speed adjustment end The speed-adjusted intermediate frame between frames.
  • the initial speed corresponding to the speed adjustment initial frame and the target speed corresponding to the speed adjustment end frame may be the same or different.
  • part of the video frames in the original video can also include several speed-adjusting intermediate frames between the speed-adjusting initial frame and the speed-adjusting end frame; for the speed-adjusting intermediate frame, the initial speed corresponding to the initial frame
  • the speeds of several speed adjustment intermediate frames may be the same as or different from the initial speeds corresponding to the speed adjustment initial frame.
  • the initial speed corresponding to the existing speed adjustment initial frame and the target speed corresponding to the speed adjustment end frame are both 1x speed.
  • the speed of the speed intermediate frame is different from the initial speed, and changes gradually; for example, the playback speed of the initial frame, several intermediate frames, and the end frame of the speed adjustment are: 1x speed, 1.2x speed, 1.4x speed, 1.5x speed, 1.3 times speed, 1.1 times speed, 1 times speed, that is, the speed of some intermediate frames of speed adjustment gradually increases first and then gradually decreases.
  • the initial speed corresponding to the speed adjustment initial frame is 1x speed
  • the end speed corresponding to the speed adjustment end frame is 2x speed.
  • the speed of several speed-adjusting intermediate frames can be greater than the initial speed and lower than the ending speed, for example: 1.2 times, 1.4 times, 1.5 times, 1.8 times, 1.9 times, that is, the speeds of several speed-adjusting intermediate frames are gradually increasing.
  • the video speed adjustment information can be analyzed and processed first, so that the original frames corresponding to some video frames in the original video can be obtained
  • This part of the video frame may include: the speed adjustment initial frame, and one or more speed adjustment intermediate frames between the speed adjustment initial frame and the speed adjustment end frame.
  • determining the original frame position, the adjusted frame position, and the playback speed corresponding to some video frames in the original video may include:
  • a method can realize the acquisition of the original frame position and speed adjustment corresponding to the speed adjustment initial frame.
  • the following frame position and playback speed methods include:
  • the frame position of the speed-adjusted initial frame in the original video is directly determined as the original frame position corresponding to the speed-adjusted initial frame.
  • the adjustment can be determined according to the frame position of the speed-adjusted initial frame and the initial speed corresponding to the speed-adjusted initial frame.
  • the speed-adjusted frame position corresponding to the speed initial frame specifically, the ratio of the frame position of the speed-adjusted initial frame to the initial speed corresponding to the speed-adjusted initial frame in the original video can be obtained, and the ratio is determined as the speed-adjusted initial frame.
  • the initial speed corresponding to the speed-adjusting initial frame may be a preset default speed, or may also be a playback speed designated or configured by the user. After the initial speed corresponding to the initial frame of the speed adjustment is obtained, the initial speed corresponding to the initial frame of the speed adjustment can be directly determined as the playback speed corresponding to the initial frame of the speed adjustment.
  • the above method can be used to determine the speed-adjusted frame position of the initial speed-adjusted frame. For example, when the total length of the original video is 90 frames, the frame position of the speed adjustment initial frame is 60 frames, and the frame position of the speed adjustment end frame is 70 frames, the original video is divided into 3 videos by the video speed adjustment information Segments: the first video segment: 1-59 frames, the second video segment: 60-70 frames, and the second video segment: 71-90 frames.
  • the speed of the video frame before the initial frame of the speed adjustment is the playback speed of the first frame in the original video
  • the initial speed corresponding to the 60th frame is 2x speed
  • the speed is the playback speed of the first frame, that is, when the speed is 1x
  • the position of the adjusted frame corresponding to the initial frame of the speed adjustment is related to the playback speed of the first frame.
  • the following methods can be used to determine the position of the frame after the speed adjustment of the initial frame.
  • the frame position of the speed-adjusted initial frame in the original video is directly determined as the original frame position corresponding to the speed-adjusted initial frame.
  • the initial speed corresponding to the speed-adjusting initial frame may be a preset default speed, or may also be a playback speed designated or configured by the user. After the initial speed corresponding to the initial frame of the speed adjustment is obtained, the initial speed corresponding to the initial frame of the speed adjustment can be directly determined as the playback speed corresponding to the initial frame of the speed adjustment.
  • step S2111 and steps S2112 and S2113 in this embodiment is not limited to the order shown by the serial number, that is, steps S2112 and S2113 can also be performed before step S2111, or step S2112 , S2113 can also be executed simultaneously with step S2111.
  • step S2114 and steps S2115 and S2116 is not limited to the order shown by the serial number. That is, steps S2115 and S2116 can also be executed before step S2114, or steps S2115 and S2116 can also be executed before step S2114. Simultaneous execution.
  • S212 Determine the original frame position, the speed-adjusted frame position, and the playing speed corresponding to the speed-adjusted intermediate frame at least partly according to the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed.
  • the adjustment can be determined based at least in part on the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed.
  • Frame position and playback speed; and the original frame positions corresponding to other speed-adjusted intermediate frames after the first speed-adjusted intermediate frame, the frame position after speed-adjustment, and the playback speed can be based on the original frame of the first speed-adjusted intermediate frame
  • the position, frame position and playback speed after speed adjustment are determined.
  • the original frame position corresponding to the speed-adjusted intermediate frame is determined at least partly based on the original frame position corresponding to the speed-adjusted initial frame, the post-speed-adjusted frame position, and the playback speed.
  • the frame position and playback speed after speed adjustment can include:
  • S2121 Determine the frame position of the frame to be processed in the original video at least partially according to the original frame position and the playback speed corresponding to the speed-regulated initial frame.
  • the frame to be processed is located between the speed adjustment initial frame and the speed adjustment end frame; after obtaining the original frame position and playback speed corresponding to the speed adjustment initial frame, the original frame position and the playback speed corresponding to the speed adjustment initial frame can be at least partially
  • the playback speed determines the frame position of the frame to be processed in the original video.
  • the above “determine the frame position of the frame to be processed in the original video based at least in part on the original frame position and playback speed corresponding to the speed-regulated initial frame” means that the original frame position and the playback speed corresponding to the speed-regulated initial frame
  • the playback speed determines the frame position corresponding to the first frame to be processed adjacent to the initial frame to be processed; and the frame positions corresponding to other frames to be processed after the first frame to be processed can be based on the first frame to be processed
  • the original frame position and playback speed are determined.
  • the original frame position corresponding to the speed adjustment initial frame is org_pos0
  • the playback speed is speed
  • the first frame adjacent to the speed adjustment initial frame to be processed can be determined according to the original frame position and playback speed corresponding to the speed adjustment initial frame
  • the frame position corresponding to the frame: org_pos1 org_pos0+speed
  • the frame positions of multiple frames to be processed in the original video can be obtained.
  • the sum value of org_pos+speed is not an integer
  • the sum value can be rounded, and the rounding method can be rounding down, rounding up, or using other rounding algorithms. More preferably, the sum value can be rounded down, so that the frame positions of multiple frames to be processed can be obtained.
  • S2122 Determine the interpolation speed of the frame to be processed according to the frame position of the frame to be processed in the original video, the frame position of the initial frame of speed adjustment in the original video, the frame position of the end frame of speed adjustment in the original video, and the initial speed and target speed.
  • the frame position of the frame to be processed in the original video After obtaining the frame position of the frame to be processed, the frame position of the frame to be processed in the original video, the frame position of the initial frame of the speed adjustment in the original video, the frame position of the end frame of the speed adjustment in the original video, as well as the initial speed and target
  • the speed is analyzed and processed, so that the interpolation speed of the frame to be processed can be determined.
  • the frame position of the initial frame of speed adjustment is 60 frames
  • the frame position of the end frame of speed adjustment is 70 frames
  • the initial speed is 1x speed
  • the target speed 2x speed
  • the frame position of the frame to be processed is 65 frames
  • the interpolation speed of frame 65 is Double speed.
  • the frame position of the frame to be processed is frame 67
  • the interpolation speed of the 67th frame can be obtained according to the above formula as Double speed.
  • the interpolation speed of the frame to be processed can be analyzed and identified to determine whether the interpolation speed of the frame to be processed meets preset conditions, where the preset conditions include: the interpolation speed of the frame to be processed and The difference in the playback speed corresponding to the previous frame of the frame to be processed is greater than or equal to the preset threshold; the preset threshold here can be set arbitrarily according to different application scenarios and application requirements, for example: when the initial speed is greater than the target speed, the preset threshold Set the threshold as the first preset threshold, that is, the first preset threshold is the minimum adjustment granularity used to implement slow adjustment of the video; when the initial speed is less than the target speed, the preset threshold is different from the first preset The second preset threshold of the threshold is set, that is, the second preset threshold is the minimum adjustment granularity used to realize rapid adjustment of the video.
  • the preset conditions include: the interpolation speed of the frame to be processed and The difference in the playback speed corresponding to the previous frame of the frame to be
  • slow adjustment and fast adjustment can be included.
  • speed ⁇ 1.0 you can set a speed adjustment interval every 0.25, such as: 0%-25%, 25%-50%, 50%-75%, 75%-100%;
  • fast speed Adjust (speed>1.0) you can adjust the interval every 1.0, such as: 100% ⁇ 200%, 200% ⁇ 300%...700% ⁇ 800%.
  • each adjustment interval can be further refined by 8 particles, that is, for a slow video, the smallest particle is 1/32, and the smallest particle for slow adjustment of the original video is the first preview.
  • Set a threshold for fast videos, the smallest particle is 1/8, and the smallest particle for fast adjustment of the original video is the second preset threshold.
  • the result of analyzing and identifying the interpolation speed of the frame to be processed is: when the interpolation speed of the frame to be processed does not meet the preset condition, that is, the difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed If the value is less than the preset threshold, the frame to be processed is discarded, that is, the original frame position, the frame position after speed adjustment, and the playback speed corresponding to the frame to be processed are not calculated.
  • the result of analyzing and identifying the interpolation speed of the frame to be processed is: when the interpolation speed of the frame to be processed meets the preset condition, that is, the difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed If it is greater than or equal to the preset threshold, the frame to be processed can be used as the speed adjustment intermediate frame, and the original frame position corresponding to the frame to be processed, the frame position after speed adjustment, and the playback speed can be obtained. It should be noted that the frame to be processed corresponds to The playback speed of can be determined according to the interpolation speed of the frame to be processed and a preset threshold.
  • the following formula can be used to determine the playback speed corresponding to the video frame:
  • V is the playback speed corresponding to the video frame
  • V p is the interpolation speed
  • is the preset threshold
  • "round()" is the rounding function.
  • the preset threshold is 1/32 of the first preset threshold
  • the preset threshold is 1/8 of the second preset threshold, then the playback speed corresponding to the video frame is determined:
  • the speed-adjusting intermediate frame whose interpolation speed meets the preset conditions can be accurately and quickly identified, and the original frame position, the speed-adjusted frame position and the playback speed corresponding to the speed-adjusting intermediate frame can be determined according to the interpolation speed.
  • the speed adjustment intermediate frame refers to at least a part of the video frame between the speed adjustment initial frame and the speed adjustment end frame.
  • the speed adjustment intermediate frame is a part of the part of the video frame. Therefore, the The accuracy and reliability of obtaining the corresponding original frame position, frame position after speed adjustment, and playback speed.
  • S22 Determine the corresponding frame position of each frame in the target video in the original video according to the original frame position, the speed-adjusted frame position, and the playback speed corresponding to some video frames.
  • the original frame position, the adjusted frame position and the playback speed corresponding to some video frames can be analyzed and processed to determine The corresponding frame position of each frame in the target video in the original video.
  • an achievable way is based on the original frame position corresponding to some video frames, the frame position after speed adjustment and Play speed, determine the corresponding frame position of each frame in the target video in the original video, including:
  • S221 Associatively store the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set.
  • the original frame position, the adjusted frame position, and the playback speed of each video frame in some video frames After obtaining the original frame position, the adjusted frame position, and the playback speed of each video frame in some video frames, the original frame position, the adjusted frame position and the playback speed of each video frame can be changed By performing associative storage, an association relationship set can be obtained, and the association relationship set includes an association relationship corresponding to each video frame in the partial video frames.
  • the frame position corresponding to each frame in the target video in the original video can be determined according to the association relationship set.
  • the association relationship set the first association relationship and the second association relationship corresponding to the position of the video frame may be determined.
  • the first association relationship is adjacent to the second association relationship, and each frame in the target video is The corresponding frame position is greater than or equal to the first speed-adjusted frame position corresponding to the first association relationship, and smaller than the second speed-adjusted frame position corresponding to the second association relationship; then, the first association relationship is used to determine the target video The corresponding frame position of each frame in the original video.
  • the frame position of the initial frame of speed adjustment is 60 frames
  • the frame position of the end frame of speed adjustment is 70 frames
  • the initial speed corresponding to the initial frame of speed adjustment is 1x speed
  • the end frame of speed adjustment corresponds to The target speed is 2 times speed.
  • the association relationship set includes the original frame position corresponding to each video frame, the association relationship between the frame position after speed adjustment and the playback speed (original frame Position, frame position after speed adjustment, playback speed), for example, the association relationship includes: (60,60,1), (62,62,1.25), (64.5,64,1.375), (65.875,65,1.5), (67.375,66,1.75), (69.125,67,1.875), (71,68,2).
  • the frame position of the playing frame is the 63rd frame
  • it can be based on the frame to be played in the target video Analyze and compare the frame position with all speed-adjusted frame positions in the association relationship, so that the first association relationship and the second association relationship corresponding to this playback frame can be found, that is, the 63 frames are in the first association relationship (62 /62/1.25) and the second association relationship (64.5/64/1.375) frames), and then obtain the three values (org_pos/speed_pos/speed) stored in association in the first association relationship, where org_pos is 62, The speed_pos is 62, and the speed is 1.25.
  • the association relationship set determine the corresponding frame position of each frame in the target video in the original video, which effectively ensures the accuracy and reliability of the determination of the corresponding frame position of each frame in the target video in the original video, and then can be based on this
  • the frame position plays the target video.
  • each frame of the target video is in the original video according to the original frame position corresponding to some video frames, the frame position after speed adjustment, and the playback speed.
  • the corresponding frame positions include:
  • the frame position corresponding to the currently played frame in the target video can be obtained, and the frame interval corresponding to the currently played frame can be determined by the frame position.
  • the frame position corresponding to the current playback frame is frame 67
  • the frame interval corresponding to the 67 frame can be obtained as (66, 68), where 66 is the interval start frame and 68 is the interval end frame ;
  • the frame position 67 in the frame, the original frame position 67.375 corresponding to the start frame of the interval, the frame position 66 after the speed adjustment and the playback speed 1.75 determine the current playback frame 67 in the target video, and the corresponding frame position in the original video is 69 frames
  • the original position of the current playing frame in the video can be obtained according to org_pos+
  • the target video can be determined according to the frame position To play.
  • determining the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to some video frames in the original video in this embodiment further includes:
  • S213 Determine the original frame position, the speed-adjusted frame position, and the playback speed corresponding to the first frame.
  • the first frame in the original video will also be the first frame in the target video after the speed adjustment, that is, the original frame position and the speed adjustment frame position corresponding to the first frame can be directly obtained, for example, the first frame
  • the corresponding original frame position and the frame position after speed adjustment are all 0, and the playback speed corresponding to the first frame can be a preset default speed, a configured speed or a user-specified playback speed.
  • part of the video frame also includes the speed adjustment end frame; at this time, in this example, determine the original frame position and speed adjustment corresponding to some video frames in the original video.
  • Back frame position and playback speed including:
  • S214 Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the end frame of the speed adjustment.
  • the original frame position corresponding to the speed adjustment end frame can be determined according to the video length.
  • the original frame position corresponding to the speed adjustment end frame is 70.
  • the playback speed corresponding to the last frame may be the target speed that the speed adjustment end frame needs to achieve, or it may be other speeds that are default or pre-configured.
  • the total length of the original video, the original frame position corresponding to the frame before the last frame, the frame position after speed adjustment, and the playback speed can be obtained, and then according to the original
  • the total length of the video, the original frame position corresponding to the frame before the last frame, the frame position after speed adjustment, and the playback speed determine the frame position after speed adjustment corresponding to the last frame.
  • the following formula can be used to determine the frame position after the speed adjustment corresponding to the last frame:
  • speed_pos_end speed_pos+(length-org_pos)/speed
  • speed_pos_end is the speed-adjusted frame position corresponding to the last frame
  • speed_pos is the speed-adjusted frame position corresponding to the frame before the last frame
  • length is the total length of the original video
  • org_pos is the frame before the last frame.
  • the original frame position, speed is the playback speed corresponding to one frame after the end frame of the speed adjustment.
  • the original video has a total of 70 frames
  • the initial frame of the speed adjustment is the 60th frame in the original video
  • the end frame of the speed adjustment is the 70th frame in the original video.
  • some video frames also include a frame after the speed adjustment end frame and the last frame in the original video; wherein, the frame after the speed adjustment end frame can be Adjacent or not adjacent to the end frame of the speed control.
  • determine the original frame position, the frame position after speed adjustment, and the playback speed corresponding to some video frames in the original video including:
  • S215 Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to a frame after the speed adjustment end frame.
  • the original frame position of the current frame is determined as the frame after the speed adjustment end frame, where the frame position of the frame after the speed adjustment end frame in the original video is based on the last frame of the speed adjustment intermediate frame
  • the original video has a total of 90 frames
  • the initial frame of the speed adjustment is the 60th frame in the original video
  • the end frame of the speed adjustment is the 70th frame in the original video
  • the last frame of the intermediate frame of the speed adjustment corresponds to the (original frame position)
  • the frame position after the speed adjustment, the playback speed) is (69.125, 67, 1.875)
  • the target speed corresponding to the speed adjustment end frame may be determined as the playback speed corresponding to a frame after the speed adjustment end frame.
  • S216 Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the last frame.
  • the original frame position corresponding to the last frame may be determined according to the video length, for example, the original frame position corresponding to the last frame is 90.
  • the playback speed corresponding to the last frame may be the target speed that the speed adjustment end frame needs to achieve, or it may be other speeds that are default or pre-configured.
  • the total length of the original video, the original frame position corresponding to the frame after the speed adjustment end frame, the frame position after speed adjustment and the playback speed can be obtained, and then according to the original video
  • the total length, the original frame position corresponding to the frame after the speed adjustment end frame, the adjusted frame position and the playback speed determine the adjusted frame position corresponding to the last frame.
  • the following formula can be used to determine the frame position after the speed adjustment corresponding to the last frame:
  • speed_pos_end speed_pos+(length-org_pos)/speed
  • speed_pos_end is the speed-adjusted frame position corresponding to the last frame
  • speed_pos is the speed-adjusted frame position corresponding to a frame after the speed adjustment end frame
  • length is the total length of the original video
  • org_pos is one frame after the speed adjustment end frame.
  • the position of the original frame corresponding to the frame, and speed is the playback speed corresponding to one frame after the end frame of the speed adjustment.
  • the original video has a total of 90 frames
  • the initial frame of the speed adjustment is the 60th frame in the original video
  • the end frame of the speed adjustment is the 70th frame in the original video
  • the frame after the end of the speed adjustment corresponds to the (original frame position)
  • the frame position after speed adjustment, the playback speed) is (71,68,2)
  • record the last frame (90, 77.5, 2).
  • FIG. 9 is a schematic flowchart of another video processing method provided by an embodiment of the present invention. referring to FIG. 9, this embodiment provides another video processing method, and the execution subject of the method is a video processing device ,
  • the processing device may be implemented as software or a combination of software and hardware.
  • the application environment of the video processing method provided in this embodiment is different from the application environment of the video processing method corresponding to FIG. 1, and the application environment of the video processing method corresponding to FIG.
  • the constituted application environment, the application environment of the video processing method provided in this embodiment may include an application environment constituted based on the IOS system.
  • the method may include:
  • the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed and speed adjustment end frame corresponding to the speed adjustment initial frame The corresponding target speed.
  • step S101 in this embodiment are similar to the specific implementation manner and implementation effect of step S1 in the foregoing embodiment.
  • the foregoing statement content please refer to the foregoing statement content, which is not repeated here.
  • S102 Determine the speed adjustment parameter corresponding to the target video after the speed adjustment of the original video according to the video speed adjustment information, where the speed adjustment parameter includes the speed adjustment start time, the original time length, and the target time length after the speed adjustment.
  • the speed adjustment parameter corresponding to the target video after the speed adjustment of the original video is determined according to the video speed adjustment information may include:
  • S1021 According to the video speed adjustment information, determine the original frame position, the speed adjusted frame position, and the playback speed of some video frames in the original video.
  • Some video frames include the speed adjustment initial frame and the speed adjustment initial frame and the speed adjustment end frame Adjust the speed between intermediate frames.
  • step S1021 in this embodiment are similar to the specific implementation manner and implementation effect of step S21 in the foregoing embodiment.
  • S1022 Associatively store the original frame position, the speed-adjusted frame position, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set.
  • step S1022 in this embodiment are similar to the specific implementation manner and implementation effect of step S221 in the foregoing embodiment.
  • the foregoing statement content please refer to the foregoing statement content, which will not be repeated here.
  • S1023 Determine the speed adjustment parameter corresponding to the target video after the speed adjustment of the original video according to the association relationship set.
  • the preset processing algorithm can be used to analyze and process the association relationship set, so that the speed adjustment parameter corresponding to the target video after the original video speed adjustment can be determined.
  • the speed adjustment parameter includes the speed adjustment start time , Original duration and target duration after speed adjustment.
  • the target video can be obtained according to the speed adjustment parameters, thereby achieving stable and effective playback of the target video after the speed adjustment processing.
  • the embodiment of the present invention is equivalent to dividing the entire video into multiple video segments, and each video segment corresponds to a different playback speed, thereby realizing variable speed regulation of the video as a whole.
  • the video processing method provided in this embodiment obtains video speed adjustment information, determines the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information, and obtains the target video according to the speed adjustment parameter, thereby realizing the speed change Speed adjustment improves the display effect of the target video and meets the individual needs of users for video speed adjustment.
  • this application embodiment provides a video processing method.
  • the execution body of the method is a video processing device.
  • the processing device executes the video processing method, it may include a video processing method.
  • the process of acquisition and video processing specifically:
  • step0 Get the video data to be processed.
  • the video data of the target object can be acquired through the camera on the drone.
  • an airship/unmanned vehicle and a camera can be used to obtain the video data for the target object; or the remote control car and a 360° camera can be used to obtain the video data for the target object; or the camera linkage technology can be used to obtain the video data.
  • the video data for the target object can be acquired through the camera on the drone.
  • an airship/unmanned vehicle and a camera can be used to obtain the video data for the target object; or the remote control car and a 360° camera can be used to obtain the video data for the target object; or the camera linkage technology can be used to obtain the video data.
  • step2 The processing device that transmits the video data to, and the processing device processes the video data.
  • the processing device may be a mobile phone, a tablet computer, a desktop computer, etc., a terminal device that can process video data.
  • the video data can be processed.
  • the video data can be adjusted slowly or quickly; among them, for the slow adjustment (speed ⁇ 1.0), an interval of 0.25, such as 0 % ⁇ 25%, 25% ⁇ 50%, 50% ⁇ 75%, 75% ⁇ 100%; for fast adjustment (speed>1.0), every 1.0 interval, such as 100% ⁇ 200%, 200% ⁇ 300%. . . 700% ⁇ 800%.
  • 8 particles can be further refined, that is, for slow videos, the smallest particle is 1/32, and for fast videos, the smallest particle is 1/8.
  • the initial frame of speed adjustment A point is the 60th frame
  • the speed is 1x speed
  • the end frame of speed adjustment B is the 70th frame
  • the speed is 2x speed as an example.
  • org_pos(i) is the corresponding original frame position of the i-th frame
  • speed_pos(i) is the frame position of the i-th frame after speed adjustment
  • org_speed is the interpolation speed obtained by linear interpolation
  • slow Speed adjustment: speed round(org_speed*32)/32
  • the method includes the following steps:
  • step2.1 Through linear interpolation, the interpolation speed of each frame from frame 60 to frame 70 can be 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2. This step is optional, and the interpolation speed of the speed-adjusting intermediate frame can also be obtained in the subsequent steps.
  • the above processing points are rounded. In order to ensure the quality and efficiency of data processing, the above processing points can be rounded down. 63 frames to be processed can be obtained. At this time, the obtained 63 frames are the video frames skipped by the previous calculation.
  • step 2.13 In addition, for the first frame in the original video, the association relationship of the first frame can be recorded as (0, 0, 1).
  • the arrays stored so far are (0,0,1); (60,60,1); (62,62,1.25); (64.5,64,1.375); (65.875,65,1.5); (67.375,66, 1.75); (69.125,67,1.875); (71,68,2); (90,77.5,2).
  • the playback speed is different, which can increase the playback effect of the video.
  • the playback effect of the video can be gradually accelerated or changed gradually. Slow, or make the playback effect of the video gradually speed up first, then gradually slow down, etc., so that the playback effect of the video has been greatly improved and improved to meet the individual needs of users.
  • step2.14 When playing the video, when the application system of the processing device is the Android system, the time stamp of the currently played frame can be obtained, and then the time stamp is sent to the decoder, so that the corresponding display can be obtained frame.
  • the example is 62/62/1.25.
  • the current playback frame is 67, 67 is between 66 (67.375, 66, 1.75) and 68 (71, 68, 2). Therefore, according to the formula org_pos+(pos-speed_pos)*speed, the current playback frame is obtained
  • the current playback frame is 70 frames, 70 is between 68 (71, 68, 2) and 77.5 (90, 77.5, 2). Therefore, according to the formula org_pos+(pos-speed_pos)*speed, the current playback frame is obtained
  • step2.15 When playing the video, when the application system of the processing device is the ios system, you can calculate the start time of each interval, the original duration and the target after the speed adjustment according to the interval of the recording array. Time length, the speed adjustment start time, original time length, and target time length after speed adjustment are sent to the corresponding interface as speed adjustment parameters, and then the decoder can automatically return to what is needed after speed adjustment according to the received speed adjustment parameters Video frame.
  • FIG. 12 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention; the video processing apparatus may include: one or more first processors 21 and one or more first memories 22.
  • the first memory 22 is used to store a program for executing the video processing method provided in the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11.
  • the first processor 21 is configured to execute a program stored in the first memory 22. specific,
  • the program includes one or more computer instructions, where one or more computer instructions can implement the following steps when executed by the first processor 21:
  • the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and The initial speed corresponding to the initial frame of the speed adjustment and the target speed corresponding to the end frame of the speed adjustment; determine the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information, where the target video is to adjust the original video Speeded up video; Obtain the target video according to the corresponding frame position of each frame in the target video in the original video.
  • the structure of the video processing apparatus may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.
  • the first processor 21 is further configured to: according to the video speed adjustment information, determine the original frame position, the speed adjusted frame position, and the playback speed corresponding to some video frames in the original video, and some video frames include the speed adjustment initial Frame, the intermediate frame between the initial frame and the end frame; according to the original frame position corresponding to the part of the video frame, the frame position after the speed adjustment and the playback speed, it is determined that each frame in the target video is in the original The corresponding frame position in the video.
  • the first processor 21 is further configured to: associate and store the original frame position, the frame position after speed adjustment, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set; Set, determine the corresponding frame position of each frame in the target video in the original video.
  • the first processor 21 is further configured to: obtain the original frame position corresponding to the speed-adjusted initial frame, the post-speed-adjusted frame position, and the playback speed; at least partly according to the original frame position and the speed-adjusted initial frame. Determine the position of the frame after speed adjustment and the playback speed, determine the original frame position corresponding to the middle frame of speed adjustment, the position of the frame after speed adjustment, and the playback speed.
  • the first processor 21 is further configured to: determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video; and according to the frame position and adjustment of the speed adjustment initial frame in the original video
  • the initial speed corresponding to the speed initial frame is determined to determine the position of the adjusted frame corresponding to the initial frame of speed adjustment; the playback speed corresponding to the initial frame of speed adjustment is determined according to the initial speed corresponding to the initial frame of speed adjustment.
  • the first processor 21 is further configured to: determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video; according to the frame position of the speed adjustment initial frame in the original video and the original video The playback speed of the first frame in the middle, determine the frame position after the speed adjustment corresponding to the initial frame of the speed adjustment; determine the playback speed corresponding to the initial frame of the speed adjustment according to the initial speed corresponding to the speed adjustment initial frame.
  • the first processor 21 is further configured to: determine the frame position of the frame to be processed in the original video at least in part according to the original frame position and the playback speed corresponding to the initial frame of the speed adjustment; according to the frame of the frame to be processed in the original video The position, the frame position of the initial frame of the speed adjustment in the original video, the frame position of the end frame of the speed adjustment in the original video, as well as the initial speed and target speed, determine the interpolation speed of the frame to be processed; when the interpolation speed of the frame to be processed meets the preset conditions
  • the frame to be processed is used as an intermediate frame for speed adjustment, and the original frame position, the frame position after speed adjustment, and the playback speed corresponding to the frame to be processed are obtained; otherwise, the frame to be processed is discarded.
  • the preset condition includes: the difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed is greater than or equal to a preset threshold.
  • the playback speed of the frame to be processed is determined according to the interpolation speed of the frame to be processed and a preset threshold.
  • the preset threshold when the initial speed is greater than the target speed, the preset threshold is a first preset threshold, and when the initial speed is less than the target speed, the preset threshold is a second preset threshold different from the first preset threshold.
  • the first processor 21 is further configured to: determine the original frame position corresponding to the first frame and the speed-adjusted frame Position and playback speed.
  • the speed adjustment end frame is the last frame of the original video
  • some of the video frames also include the speed adjustment end frame
  • the first processor 21 is also used for determining the original frame position corresponding to the speed adjustment end frame, and the speed adjustment Post frame position and playback speed.
  • the first processor 21 is further configured to: determine The position of the original frame, the position of the frame after the speed adjustment, and the playback speed of the frame after the end of the speed adjustment frame; the original frame position, the position of the frame after the speed adjustment, and the playback speed corresponding to the last frame are determined.
  • the frame position of a frame in the original video after the speed adjustment end frame is determined according to the original frame position and the playback speed corresponding to the last frame of the speed adjustment intermediate frame.
  • the first processor 21 is further configured to: obtain the frame interval corresponding to each frame in the target video, the interval start frame and the interval end frame of the frame interval are two adjacent frames in the partial video frame; The frame position of each frame in the video in the target video, the original frame position corresponding to the start frame of the interval, the frame position after speed adjustment, and the playback speed are determined to determine the corresponding frame position of each frame in the target video in the original video.
  • the device shown in FIG. 12 can execute the methods of the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11.
  • parts that are not described in detail in this embodiment please refer to the related descriptions of the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11.
  • the implementation process and technical effects of this technical solution please refer to the description in the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11, and will not be repeated here.
  • an embodiment of the present invention provides a computer-readable storage medium.
  • the storage medium is a computer-readable storage medium.
  • the computer-readable storage medium stores program instructions. 11 video processing methods.
  • FIG. 13 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention
  • the video processing apparatus may include: one or more second processors 41 and one or more second memories 42.
  • the second memory 42 is used to store a program for executing the video processing method provided in the embodiment shown in FIG. 9-11.
  • the first processor 41 is configured to execute a program stored in the second memory 42. specific,
  • the program includes one or more computer instructions, and when one or more computer instructions are executed by the second processor 41, the following steps can be implemented:
  • the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and The initial speed corresponding to the initial frame of the speed adjustment and the target speed corresponding to the end frame of the speed adjustment; the speed adjustment parameters corresponding to the target video after the original video speed adjustment are determined according to the video speed adjustment information.
  • the speed adjustment parameters include the speed adjustment start time and original duration And the target duration after speed adjustment; according to the speed adjustment parameters, the target video is obtained.
  • the structure of the video processing apparatus may further include a second communication interface 43 for the electronic device to communicate with other devices or a communication network.
  • the second processor 41 is further configured to: according to the video speed adjustment information, determine the original frame position, the speed adjusted frame position, and the playback speed corresponding to some video frames in the original video, and some video frames include the speed adjustment initial frame And the speed adjustment intermediate frame located between the speed adjustment initial frame and the speed adjustment end frame; the original frame position, the speed adjustment frame position and the playback speed corresponding to each video frame in the partial video frame are associated and stored to obtain the association Relationship set: According to the association relationship set, determine the speed adjustment parameter corresponding to the target video after the original video speed adjustment.
  • the device shown in FIG. 13 can execute the method of the embodiment shown in FIG. 9-11.
  • parts that are not described in detail in this embodiment please refer to the related description of the embodiment shown in FIG. 9-11.
  • an embodiment of the present invention provides a computer-readable storage medium, the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, and the program instructions are used to implement the video shown in FIGS. 9-11. ⁇ Treatment methods.
  • the disclosed video processing device and method can be implemented in other ways.
  • the embodiments of the remote control device described above are merely illustrative.
  • the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components. Can be combined or integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, remote control devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present invention essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to make a computer processor (processor) execute all or part of the steps of the method described in each embodiment of the present invention.
  • the aforementioned storage media include: U disk, mobile hard disk, Read-Only Memory (ROM), Random Access Memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes.

Abstract

Provided are a video processing method and apparatus, and a storage medium. The method comprises: acquiring video speed regulation information, wherein the video speed regulation information comprises: a frame position of a speed regulation initial frame in an original video, a frame position of a speed regulation end frame in the original video, an initial speed corresponding to the speed regulation initial frame, and a target speed corresponding to the speed regulation end frame; determining, according to the video speed regulation information, a corresponding frame position, in the original video, of each frame in a target video, wherein the target video is a video obtained after the original video is subjected to speed regulation; and acquiring the target video according to the corresponding frame position, in the original video, of each frame in the target video. The target video after speed regulation processing can be stably acquired by means of acquiring video speed regulation information, and playing speeds corresponding to each frame or every several frames in the target video are different, so that variable speed regulation is realized, the display effect of a video is enhanced, and personalized requirements of a user for video speed regulation are met.

Description

视频的处理方法、装置和存储介质Video processing method, device and storage medium 技术领域Technical field
本发明涉及图像处理技术领域,尤其涉及一种视频的处理方法、装置和存储介质。The present invention relates to the field of image processing technology, and in particular to a video processing method, device and storage medium.
背景技术Background technique
在视频编辑领域中,经常需要对视频进行调速以获得慢动作或者快动作的播放效果。现有技术中的视频调速方式往往是针对视频的整体进行单一的调速,也即整个视频以2倍速或者0.5倍速进行编辑和播放,无法满足用户的个性化需求。In the field of video editing, it is often necessary to adjust the speed of the video to obtain slow motion or fast motion playback effects. The video speed adjustment method in the prior art is often a single speed adjustment for the entire video, that is, the entire video is edited and played at 2x speed or 0.5x speed, which cannot meet the individual needs of users.
发明内容Summary of the invention
本发明实施例提供了一种视频的处理方法、装置和存储介质,用于解决现有技术中存在的只能针对视频的整体进行单一调速,无法满足用户的个性化需求的问题。The embodiments of the present invention provide a video processing method, device, and storage medium, which are used to solve the problem in the prior art that only a single speed adjustment can be performed for the entire video and cannot meet the individual needs of users.
本发明实施例的第一方面是为了提供一种视频的处理方法,包括:The first aspect of the embodiments of the present invention is to provide a video processing method, including:
获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置、以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;Acquire video speed adjustment information, the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed corresponding to the speed adjustment initial frame, the The target speed corresponding to the end frame of speed adjustment;
根据所述视频调速信息确定目标视频中的每一帧在所述原始视频中对应的帧位置,其中,所述目标视频是对所述原始视频进行调速后的视频;Determining, according to the video speed adjustment information, a frame position corresponding to each frame in the target video in the original video, wherein the target video is a video obtained by adjusting the speed of the original video;
根据所述目标视频中的每一帧在原始视频中对应的帧位置,获取所述目标视频。Obtain the target video according to the corresponding frame position of each frame in the target video in the original video.
本发明的第二方面是为了提供一种视频的处理装置,包括:The second aspect of the present invention is to provide a video processing device, including:
存储器,用于存储计算机程序;Memory, used to store computer programs;
处理器,用于运行所述存储器中存储的计算机程序以实现:获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置、以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;根据所述视频调速信息确定目标视频中的每一帧在 所述原始视频中对应的帧位置,其中,所述目标视频是对所述原始视频进行调速后的视频;根据所述目标视频中的每一帧在原始视频中对应的帧位置,获取所述目标视频。The processor is configured to run a computer program stored in the memory to achieve: acquiring video speed adjustment information, the video speed adjustment information including: the frame position of the speed adjustment initial frame in the original video, and the speed adjustment end frame of the original video Frame position, and the initial speed corresponding to the initial frame of speed adjustment, and the target speed corresponding to the end frame of speed adjustment; determine the corresponding frame of each frame in the target video in the original video according to the video speed adjustment information Position, wherein the target video is a video obtained by adjusting the speed of the original video; the target video is acquired according to the frame position of each frame in the target video corresponding to the original video.
本发明的第三方面是为了提供一种计算机可读存储介质,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于第一方面所述的视频的处理方法。The third aspect of the present invention is to provide a computer-readable storage medium, the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, the program instructions are used in the first aspect The video processing method described.
本实施例提供的视频的处理方法,通过获取视频调速信息,根据所述视频调速信息确定目标视频中的每一帧在所述原始视频中对应的帧位置,而后根据所述目标视频中的每一帧在原始视频中对应的帧位置,从而获取到经过调速处理后的目标视频,从而可以实现视频的变速调速,提高了目标视频的显示效果,满足了用户对视频调速的个性化需求。In the video processing method provided in this embodiment, the video speed adjustment information is obtained, and the corresponding frame position of each frame in the target video in the original video is determined according to the video speed adjustment information, and then according to the target video Each frame in the original video corresponds to the position of the frame in the original video, so as to obtain the target video after the speed adjustment process, which can realize the variable speed adjustment of the video, improve the display effect of the target video, and meet the user's need for video speed adjustment. Individual needs.
本发明的第四方面是为了提供一种视频的处理方法,包括:The fourth aspect of the present invention is to provide a video processing method, including:
获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;Acquire video speed adjustment information, the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed corresponding to the speed adjustment initial frame, the The target speed corresponding to the end frame of speed adjustment;
根据所述视频调速信息确定所述原始视频调速后的目标视频对应的调速参数,所述调速参数包括调速起始时间、原始时长和调速后的目标时长;Determining, according to the video speed adjustment information, a speed adjustment parameter corresponding to the target video after the speed adjustment of the original video, the speed adjustment parameter including a speed adjustment start time, an original time length, and a target time length after speed adjustment;
根据所述调速参数,获取所述目标视频。Obtain the target video according to the speed adjustment parameter.
本发明的第五方面是为了提供一种视频的处理装置,包括:The fifth aspect of the present invention is to provide a video processing device, including:
存储器,用于存储计算机程序;Memory, used to store computer programs;
处理器,用于运行所述存储器中存储的计算机程序以实现:获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;根据所述视频调速信息确定所述原始视频调速后的目标视频对应的调速参数,所述调速参数包括调速起始时间、原始时长和调速后的目标时长;根据所述调速参数,获取所述目标视频。The processor is configured to run a computer program stored in the memory to achieve: acquiring video speed adjustment information, the video speed adjustment information including: the frame position of the speed adjustment initial frame in the original video, and the speed adjustment end frame of the original video Frame position, and the initial speed corresponding to the initial frame of speed adjustment, and the target speed corresponding to the end frame of speed adjustment; determine the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information, The speed adjustment parameter includes a speed adjustment start time, an original time length, and a target time length after speed adjustment; and the target video is acquired according to the speed adjustment parameter.
本发明的第六方面是为了提供一种计算机可读存储介质,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于第四方面所述的视频的处理方法。The sixth aspect of the present invention is to provide a computer-readable storage medium, the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, and the program instructions are used in the fourth aspect. The video processing method described.
本实施例提供的视频的处理方法,通过获取视频调速信息,根据所述视 频调速信息确定所述原始视频调速后的目标视频对应的调速参数,根据所述调速参数,获取所述目标视频,从而可以实现视频的变速调速,提高了目标视频的显示效果,满足了用户对视频调速的个性化需求。The video processing method provided in this embodiment obtains video speed adjustment information, determines the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information, and obtains all speed adjustment parameters according to the speed adjustment parameter. According to the target video, the variable speed adjustment of the video can be realized, the display effect of the target video is improved, and the individual needs of users for video speed adjustment can be met.
附图说明Description of the drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described here are used to provide a further understanding of the application and constitute a part of the application. The exemplary embodiments and descriptions of the application are used to explain the application and do not constitute an improper limitation of the application. In the attached picture:
图1为本发明实施例提供的一种视频的处理方法的流程示意图;FIG. 1 is a schematic flowchart of a video processing method provided by an embodiment of the present invention;
图2为本发明实施例提供的根据所述视频调速信息确定目标视频中的每一帧在所述原始视频中对应的帧位置的流程示意图;2 is a schematic flowchart of determining the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information according to an embodiment of the present invention;
图3为本发明实施例提供的根据所述部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一帧在原始视频中对应的帧位置的流程示意图一;Figure 3 is an embodiment of the present invention for determining the corresponding frame position of each frame in the target video in the original video according to the original frame position corresponding to the part of the video frame, the adjusted frame position and the playback speed Flow chart one;
图4为本发明实施例提供的根据所述视频调速信息,确定所述原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度的流程示意图;4 is a schematic flow chart of determining the original frame position, the adjusted frame position, and the playback speed corresponding to some video frames in the original video according to the video speed adjustment information according to an embodiment of the present invention;
图5为本发明实施例提供的获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度的流程示意图一;FIG. 5 is a schematic diagram 1 of the process of obtaining the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed according to an embodiment of the present invention;
图6为本发明实施例提供的获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度的流程示意图二;6 is a second schematic diagram of the process of obtaining the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed according to an embodiment of the present invention;
图7为本发明实施例提供的至少部分地根据所述调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述调速中间帧对应的原始帧位置、调速后帧位置和播放速度的流程示意图;FIG. 7 is an embodiment of the present invention to determine the original frame position and speed adjustment corresponding to the speed adjustment intermediate frame at least partly according to the original frame position corresponding to the speed adjustment initial frame, the speed adjustment frame position and the playback speed Schematic diagram of the flow of post frame position and playback speed;
图8为本发明实施例提供的根据所述部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一帧在原始视频中对应的帧位置的流程示意图二;FIG. 8 is an embodiment of the present invention for determining the corresponding frame position of each frame in the target video in the original video according to the original frame position corresponding to the partial video frame, the adjusted frame position, and the playback speed. Flow chart two;
图9为本发明实施例提供的另一种视频的处理方法的流程示意图;FIG. 9 is a schematic flowchart of another video processing method provided by an embodiment of the present invention;
图10为本发明实施例提供的根据所述视频调速信息确定所述原始视频调速后的目标视频对应的调速参数的流程示意图;FIG. 10 is a schematic flowchart of determining the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information according to an embodiment of the present invention;
图11为本发明应用实施例提供的一种视频的处理方法的场景示意图;11 is a schematic diagram of a scene of a video processing method provided by an application embodiment of the present invention;
图12为本发明实施例提供的一种视频的处理装置的结构示意图;FIG. 12 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention;
图13为本发明实施例提供的一种视频的处理装置的结构示意图。FIG. 13 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention.
具体实施方式detailed description
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field of the present invention. The terms used in the description of the present invention herein are only for the purpose of describing specific embodiments, and are not intended to limit the present invention.
在视频编辑领域中,经常需要对视频进行调速以获得慢动作或者快动作的播放效果,然而,现有技术中的视频调速方式往往是针对视频的整体进行单一的调速,也即整个视频以2倍速或者0.5倍速进行编辑和播放,无法满足用户的个性化需求。基于此,本发明实施例提供了一种视频的处理方法、装置和存储介质,用于解决现有技术中存在的只能针对视频的整体进行单一调速,无法满足用户的个性化需求的问题。In the field of video editing, it is often necessary to adjust the video speed to obtain slow motion or fast-motion playback effects. However, the video speed adjustment method in the prior art is often a single speed adjustment for the entire video, that is, the entire The video is edited and played at 2x speed or 0.5x speed, which cannot meet the individual needs of users. Based on this, the embodiments of the present invention provide a video processing method, device, and storage medium, which are used to solve the problem that the prior art can only perform a single speed adjustment for the entire video, and cannot meet the individual needs of users. .
本发明实施例提供的视频的处理方法可以用于处理航拍视频。示例的,用户可通过控制终端遥控无人飞行器,以在无人飞行器悬停或运动的过程中对目标场景进行拍摄,无人飞行器拍摄的视频可通过无线通讯链路传输至控制终端,进一步地,控制终端安装有可对视频进行编辑的应用程序(APP),该APP可对无人飞行器拍摄所得的航拍视频进行变速调速。示例的,用户可选择调速初始帧的帧位置和调速结束帧的帧位置,以及调速初始帧对应的初始速度和调速结束帧对应的目标速度。例如调速初始帧可以是原始航拍视频的第60帧,调速结束帧可以是原始航拍视频的第600帧,初始速度可以是1倍速,目标速度可以是2倍速。通过本发明实施例提供的视频处理方法可以获得播放速度从1倍速逐渐变化到2倍速的调速后的目标视频。区别于整个视频均以2倍速进行播放的现有技术,本发明实施例可以实现视频的变速调速,提高了目标视频的显示效果,满足了用户对视频调速的个性化需求。The video processing method provided by the embodiment of the present invention can be used to process aerial video. For example, the user can remotely control the unmanned aerial vehicle through the control terminal to shoot the target scene while the unmanned aerial vehicle is hovering or moving. The video captured by the unmanned aerial vehicle can be transmitted to the control terminal through the wireless communication link, and further , The control terminal is equipped with an application program (APP) that can edit the video. The APP can adjust the speed of the aerial video taken by the unmanned aerial vehicle. For example, the user can select the frame position of the speed adjustment initial frame and the frame position of the speed adjustment end frame, and the initial speed corresponding to the speed adjustment initial frame and the target speed corresponding to the speed adjustment end frame. For example, the speed adjustment initial frame may be the 60th frame of the original aerial video, and the speed adjustment end frame may be the 600th frame of the original aerial video. The initial speed may be 1x speed, and the target speed may be 2x speed. The video processing method provided by the embodiment of the present invention can obtain a speed-regulated target video whose playback speed gradually changes from 1x speed to 2x speed. Different from the prior art in which the entire video is played at twice the speed, the embodiment of the present invention can realize the variable speed adjustment of the video, improve the display effect of the target video, and meet the individual needs of users for video speed adjustment.
下面结合附图,对本发明的一些实施方式作详细说明。在各实施例之间不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Hereinafter, some embodiments of the present invention will be described in detail with reference to the accompanying drawings. Provided that there is no conflict between the various embodiments, the following embodiments and the features in the embodiments can be combined with each other.
图1为本发明实施例提供的一种视频的处理方法的流程示意图;参考附图1所示,本实施例提供了一种视频的处理方法,该方法的执行主体为视频的处理装置,可以想到的是,处理装置可以实现为软件、或者软件和硬件的组合。具体的,该方法可以包括:FIG. 1 is a schematic flowchart of a video processing method provided by an embodiment of the present invention; referring to FIG. 1, this embodiment provides a video processing method. The execution body of the method is a video processing device, which can be It is conceivable that the processing device can be implemented as software, or a combination of software and hardware. Specifically, the method may include:
S1:获取视频调速信息,视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置、以及调速初始帧对应的初始速度、调速结束帧对应的目标速度。S1: Obtain video speed adjustment information. The video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed and speed adjustment end frame corresponding to the speed adjustment initial frame The corresponding target speed.
其中,视频调速信息可以是针对全部的原始视频的调速信息,或者,也可以是针对部分的原始视频的调速信息。举例来说,在视频调速信息是针对全部的原始视频的调速信息时,视频调速信息中的调速初始帧即为原始视频中的首帧,调速结束帧即为原始视频中的末帧;在视频调速信息是针对部分的原始视频的调速信息时,视频调速信息中的调速初始帧可以为原始视频中的首帧,调速结束帧可以为原始视频中的中间帧;或者,视频调速信息中的调速初始帧为原始视频中的第一中间帧,调速结束帧可以为原始视频中的第二中间帧或者末帧,其中,第二中间帧所对应的帧位置要大于第一中间帧所对应的帧位置。Wherein, the video speed adjustment information may be speed adjustment information for all original videos, or may also be speed adjustment information for part of the original videos. For example, when the video speed adjustment information is the speed adjustment information for all original videos, the speed adjustment initial frame in the video speed adjustment information is the first frame in the original video, and the speed adjustment end frame is the original video Last frame; when the video speed control information is for part of the original video speed control information, the speed control initial frame in the video speed control information can be the first frame in the original video, and the speed control end frame can be the middle of the original video Frame; or, the speed adjustment initial frame in the video speed adjustment information is the first intermediate frame in the original video, and the speed adjustment end frame can be the second intermediate frame or the last frame in the original video, where the second intermediate frame corresponds The frame position of is greater than the frame position corresponding to the first intermediate frame.
此外,本实施例对于视频调速信息的具体获取方式不做限定,本领域技术人员可以根据具体的应用需求和设计需求进行设置,例如:用户可以针对原始视频输入视频调节参数,根据视频调节参数可以确定视频调速信息;或者,用户可以针对原始视频输入执行操作,根据执行操作确定视频调速信息包括的原始视频中调速初始帧的帧位置和原始视频中调速结束帧的帧位置;在获取到原始视频中调速初始帧和调速结束帧的帧位置之后,可以针对调速初始帧和调速结束帧的速度进行配置,从而可以获得调速初始帧对应的初始速度和调速结束帧对应的目标速度。当然的,本领域技术人员也可以采用其他的方式来获取视频调速信息,只要能够保证视频调速信息获取的准确可靠性即可,在此不再赘述。In addition, this embodiment does not limit the specific acquisition method of video speed adjustment information. Those skilled in the art can set it according to specific application requirements and design requirements. For example, the user can input video adjustment parameters for the original video and adjust the parameters according to the video. The video speed adjustment information can be determined; or, the user can perform an operation on the original video input, and determine the frame position of the speed adjustment initial frame in the original video and the frame position of the speed adjustment end frame in the original video according to the performed operation; After obtaining the frame positions of the speed adjustment initial frame and the speed adjustment end frame in the original video, you can configure the speed of the speed adjustment initial frame and the speed adjustment end frame to obtain the initial speed and speed adjustment corresponding to the speed adjustment initial frame The target speed corresponding to the end frame. Of course, those skilled in the art can also use other methods to obtain the video speed adjustment information, as long as the accuracy and reliability of the acquisition of the video speed adjustment information can be ensured, which will not be repeated here.
S2:根据视频调速信息确定目标视频中的每一帧在原始视频中对应的帧位置,其中,目标视频是对原始视频进行调速后的视频。S2: Determine the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information, where the target video is a video after speed adjustment of the original video.
在获取到视频调速信息之后,可以对视频调速信息进行分析处理,从而 可以获得目标视频中的每一帧在原始视频对应的帧位置。举例来说:原始视频中调速初始帧的帧位置为60帧,调速结束帧的帧位置为70帧,调速初始帧对应的初始速度为1倍速,调速结束帧对应的目标速度为2倍速;以目标视频中的第67帧为例,通过对上述视频调速信息的分析处理,可以确定目标视频中的第67帧与原始视频中的第69帧相对应,即目标视频中的第67帧在原始视频对应的帧位置为第69帧。After obtaining the video speed adjustment information, the video speed adjustment information can be analyzed and processed, so that the frame position of each frame in the target video corresponding to the original video can be obtained. For example: in the original video, the frame position of the speed adjustment initial frame is 60 frames, the frame position of the speed adjustment end frame is 70 frames, the initial speed corresponding to the speed adjustment initial frame is 1x speed, and the target speed corresponding to the speed adjustment end frame is 2x speed; taking the 67th frame in the target video as an example, through the analysis and processing of the above video speed adjustment information, it can be determined that the 67th frame in the target video corresponds to the 69th frame in the original video, that is, the frame in the target video The 67th frame corresponds to the 69th frame in the original video.
当然的,本领域技术人员也可以采用其他的方式来确定目标视频中的每一帧在原始视频中对应的帧位置,只要能够保证对目标视频中的每一帧在原始视频中对应的帧位置进行确定的准确可靠性即可,在此不再赘述。Of course, those skilled in the art can also use other methods to determine the corresponding frame position of each frame in the target video in the original video, as long as it can ensure that each frame in the target video corresponds to the frame position in the original video. It is sufficient to determine the accuracy and reliability, and will not be repeated here.
S3:根据目标视频中的每一帧在原始视频中对应的帧位置,获取目标视频。S3: Obtain the target video according to the corresponding frame position of each frame in the target video in the original video.
在获取到目标视频中每一帧在原始视频中对应的帧位置之后,可以通过目标视频中的每一帧在原始视频中对应的帧位置获取到相对应的帧,所获得的所有帧即构成了目标视频,进一步地,可以对目标视频进行显示。After obtaining the corresponding frame position of each frame in the target video in the original video, the corresponding frame can be obtained through the corresponding frame position of each frame in the target video in the original video, and all the obtained frames constitute In addition to the target video, further, the target video can be displayed.
本实施例提供的视频的处理方法,通过获取视频调速信息,根据视频调速信息确定目标视频中的每一帧在原始视频中对应的帧位置,而后根据目标视频中的每一帧在原始视频中对应的帧位置,从而获取到经过调速处理后的目标视频,其中,目标视频中的每一帧或每几帧所对应的播放速度不同,从而实现了视频的变速调速,提高了目标视频的显示效果,满足了用户对视频调速的个性化需求。In the video processing method provided in this embodiment, by acquiring video speed adjustment information, the corresponding frame position of each frame in the target video in the original video is determined according to the video speed adjustment information, and then according to the position of each frame in the target video in the original video. The corresponding frame position in the video, so as to obtain the target video after the speed adjustment process. Among them, each frame or every few frames in the target video corresponds to a different playback speed, thus realizing the variable speed adjustment of the video and improving The display effect of the target video meets the individual needs of users for video speed adjustment.
图2为本发明实施例提供的根据视频调速信息确定目标视频中的每一帧在原始视频中对应的帧位置的流程示意图;在上述实施例的基础上,继续参考附图2所示,本实施例中的根据视频调速信息确定目标视频中的每一帧在原始视频中对应的帧位置可以包括:Fig. 2 is a schematic flow chart of determining the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information provided by an embodiment of the present invention; on the basis of the above embodiment, continue to refer to Fig. 2. In this embodiment, determining the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information may include:
S21:根据视频调速信息,确定原始视频中的部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,部分视频帧包括调速初始帧、位于调速初始帧与调速结束帧之间的调速中间帧。S21: According to the video speed adjustment information, determine the original frame position, the speed adjusted frame position and the playback speed corresponding to some video frames in the original video. Some video frames include the speed adjustment initial frame, the speed adjustment initial frame and the speed adjustment end The speed-adjusted intermediate frame between frames.
其中,对于调速初始帧和调速结束帧而言,调速初始帧对应的初始速度和调速结束帧对应的目标速度可以相同或者不同。此时,原始视频中的部分视频帧还可以包括位于调速初始帧与调速结束帧之间的若干调速中间帧;而对于调速中间帧而言,在调速初始帧对应的初始速度与调速结束帧对应的目 标速度相同时,若干调速中间帧的速度可以与调速初始帧对应的初始速度相同或者不同。举例来说:现有调速初始帧对应的初始速度与调速结束帧对应的目标速度均为1倍速,一种可实现的方式,位于调速初始帧与调速结束帧之间的若干调速中间帧的速度与初始速度不同,且逐渐变化;例如:调速初始帧、若干调速中间帧、以及调速结束帧的播放速度依次为:1倍速、1.2倍速、1.4倍速、1.5倍速、1.3倍速、1.1倍速、1倍速,即若干调速中间帧的速度为先逐渐增大、后逐渐减小的变化趋势。Among them, for the speed adjustment initial frame and the speed adjustment end frame, the initial speed corresponding to the speed adjustment initial frame and the target speed corresponding to the speed adjustment end frame may be the same or different. At this time, part of the video frames in the original video can also include several speed-adjusting intermediate frames between the speed-adjusting initial frame and the speed-adjusting end frame; for the speed-adjusting intermediate frame, the initial speed corresponding to the initial frame When the target speed corresponding to the speed adjustment end frame is the same, the speeds of several speed adjustment intermediate frames may be the same as or different from the initial speeds corresponding to the speed adjustment initial frame. For example: the initial speed corresponding to the existing speed adjustment initial frame and the target speed corresponding to the speed adjustment end frame are both 1x speed. An achievable way is to set several adjustments between the speed adjustment initial frame and the speed adjustment end frame. The speed of the speed intermediate frame is different from the initial speed, and changes gradually; for example, the playback speed of the initial frame, several intermediate frames, and the end frame of the speed adjustment are: 1x speed, 1.2x speed, 1.4x speed, 1.5x speed, 1.3 times speed, 1.1 times speed, 1 times speed, that is, the speed of some intermediate frames of speed adjustment gradually increases first and then gradually decreases.
在调速初始帧对应的初始速度与调速结束帧对应的目标速度不同时,例如:调速初始帧对应的初始速度为1倍速,调速结束帧对应的结束速度为2倍速,此时,若干调速中间帧的速度可以大于初始速度,且小于结束倍速,例如:1.2倍速、1.4倍速、1.5倍速、1.8倍速、1.9倍速,即若干调速中间帧的速度为逐渐增大的变化趋势。When the initial speed corresponding to the speed adjustment initial frame is different from the target speed corresponding to the speed adjustment end frame, for example, the initial speed corresponding to the speed adjustment initial frame is 1x speed, and the end speed corresponding to the speed adjustment end frame is 2x speed. At this time, The speed of several speed-adjusting intermediate frames can be greater than the initial speed and lower than the ending speed, for example: 1.2 times, 1.4 times, 1.5 times, 1.8 times, 1.9 times, that is, the speeds of several speed-adjusting intermediate frames are gradually increasing.
另外,为了能够准确地确定目标视频中的每一帧在原始视频中对应的帧位置,可以先对视频调速信息进行分析处理,从而可以获取到原始视频中的部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,该部分视频帧可以包括:调速初始帧、位于调速初始帧与调速结束帧之间的一个或多个调速中间帧。具体的,参考附图4所示,本实施例中的根据视频调速信息,确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度可以包括:In addition, in order to accurately determine the corresponding frame position of each frame in the target video in the original video, the video speed adjustment information can be analyzed and processed first, so that the original frames corresponding to some video frames in the original video can be obtained The position, the position of the frame after the speed adjustment, and the playback speed. This part of the video frame may include: the speed adjustment initial frame, and one or more speed adjustment intermediate frames between the speed adjustment initial frame and the speed adjustment end frame. Specifically, referring to FIG. 4, in this embodiment, according to the video speed adjustment information, determining the original frame position, the adjusted frame position, and the playback speed corresponding to some video frames in the original video may include:
S211:获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度。S211: Acquire the original frame position, the adjusted speed frame position, and the playback speed corresponding to the speed adjusted initial frame.
其中,在获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度时,参考附图5所示,一种可实现获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度的方式包括:Among them, when obtaining the original frame position corresponding to the speed adjustment initial frame, the frame position after the speed adjustment, and the playback speed, referring to Figure 5, a method can realize the acquisition of the original frame position and speed adjustment corresponding to the speed adjustment initial frame. The following frame position and playback speed methods include:
2111:根据原始视频中调速初始帧的帧位置,确定调速初始帧所对应的原始帧位置。2111: Determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video.
具体的,将调速初始帧在原始视频中的帧位置直接确定为调速初始帧所对应的原始帧位置。Specifically, the frame position of the speed-adjusted initial frame in the original video is directly determined as the original frame position corresponding to the speed-adjusted initial frame.
2112:根据原始视频中调速初始帧的帧位置和调速初始帧所对应的初始速度,确定调速初始帧所对应的调速后帧位置。2112: Determine the frame position after the speed adjustment corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video and the initial speed corresponding to the speed adjustment initial frame.
其中,在获取到原始视频中调速初始帧的帧位置(调速初始帧所对应的原始帧位置)之后,可以根据调速初始帧的帧位置和调速初始帧所对应的初 始速度确定调速初始帧所对应的调速后帧位置,具体的,可以获取原始视频中调速初始帧的帧位置与调速初始帧所对应的初始速度的比值,将该比值确定为调速初始帧所对应的调速后帧位置。Among them, after obtaining the frame position of the speed-adjusted initial frame in the original video (the original frame position corresponding to the speed-adjusted initial frame), the adjustment can be determined according to the frame position of the speed-adjusted initial frame and the initial speed corresponding to the speed-adjusted initial frame. The speed-adjusted frame position corresponding to the speed initial frame, specifically, the ratio of the frame position of the speed-adjusted initial frame to the initial speed corresponding to the speed-adjusted initial frame in the original video can be obtained, and the ratio is determined as the speed-adjusted initial frame. The corresponding frame position after speed adjustment.
举例来说:原始视频中调速初始帧的帧位置为60帧,调速初始帧所对应的初始速度为1倍速,则可以确定调速初始帧所对应的调速后帧位置为60帧/1=60帧;在原始视频中调速初始帧的帧位置为60帧,调速初始帧所对应的初始速度为2倍速,则可以确定调速初始帧所对应的调速后帧位置为60帧/2=30帧;在原始视频中调速初始帧的帧位置为60帧,调速初始帧所对应的初始速度为0.5倍速,则可以确定调速初始帧所对应的调速后帧位置为60帧/0.5=120帧。For example: the frame position of the speed-adjusted initial frame in the original video is 60 frames, and the initial speed corresponding to the speed-adjusted initial frame is 1x speed, then it can be determined that the speed-adjusted frame position corresponding to the speed-adjusted initial frame is 60 frames/ 1=60 frames; in the original video, the frame position of the speed-adjusted initial frame is 60 frames, and the initial speed corresponding to the speed-adjusted initial frame is 2 times the speed, then the speed-adjusted frame position corresponding to the speed-adjusted initial frame can be determined to be 60 Frame/2 = 30 frames; in the original video, the frame position of the initial frame of the speed adjustment is 60 frames, and the initial speed corresponding to the initial frame of the speed adjustment is 0.5 times the speed, then the frame position after the speed adjustment corresponding to the initial frame of the speed adjustment can be determined It is 60 frames/0.5=120 frames.
2113:根据调速初始帧所对应的初始速度,确定调速初始帧对应的播放速度。2113: Determine the playback speed corresponding to the initial frame of the adjustable speed according to the initial speed corresponding to the initial frame of the adjustable speed.
其中,调速初始帧所对应的初始速度可以是预先设置的默认速度,或者也可以是用户指定或者配置的播放速度。在获取到调速初始帧所对应的初始速度之后,可以直接将调速初始帧所对应的初始速度确定为调速初始帧对应的播放速度。Wherein, the initial speed corresponding to the speed-adjusting initial frame may be a preset default speed, or may also be a playback speed designated or configured by the user. After the initial speed corresponding to the initial frame of the speed adjustment is obtained, the initial speed corresponding to the initial frame of the speed adjustment can be directly determined as the playback speed corresponding to the initial frame of the speed adjustment.
当调速初始帧之前的视频帧的速度均为调速初始帧对应的初始速度时,可采用以上方式确定调速初始帧的调速后帧位置。举例来说,在原始视频的总长度为90帧,调速初始帧的帧位置为60帧,调速结束帧的帧位置为70帧时,该原始视频被视频调速信息划分为3个视频段:第一视频段:1-59帧、第二视频段:60-70帧和第二视频段:71-90帧。对于上述第一视频段而言,在第60帧所对应的初始速度为2倍速,且1-59帧所对应的播放速度与第60帧所对应的初始速度相同时,那么,由于第一段视频中的每一帧对应的播放速度也为2倍速,那么,可采用以上方式确定调速初始帧的调速后帧位置,即调速初始帧对应的调速后帧位置可为60/2=30帧。When the speeds of the video frames before the speed-adjusted initial frame are all the initial speeds corresponding to the speed-adjusted initial frame, the above method can be used to determine the speed-adjusted frame position of the initial speed-adjusted frame. For example, when the total length of the original video is 90 frames, the frame position of the speed adjustment initial frame is 60 frames, and the frame position of the speed adjustment end frame is 70 frames, the original video is divided into 3 videos by the video speed adjustment information Segments: the first video segment: 1-59 frames, the second video segment: 60-70 frames, and the second video segment: 71-90 frames. For the first video segment above, when the initial speed corresponding to the 60th frame is 2x speed, and the playback speed corresponding to frames 1-59 is the same as the initial speed corresponding to the 60th frame, then, because the first segment The playback speed corresponding to each frame in the video is also 2x speed, then the above method can be used to determine the speed-adjusted frame position of the speed-adjusted initial frame, that is, the speed-adjusted frame position corresponding to the speed-adjusted initial frame can be 60/2 = 30 frames.
然而当调速初始帧之前的视频帧的速度均为原始视频中第一帧的播放速度时,举例来说,第60帧所对应的初始速度为2倍速,且1-59帧所对应的播放速度均为第一帧的播放速度,即1倍速时,那么,调速初始帧所对应的调速后帧位置与第一帧的播放速度相关。参考图6所示,可采用以下方式确定调速初始帧的调速后帧位置。However, when the speed of the video frame before the initial frame of the speed adjustment is the playback speed of the first frame in the original video, for example, the initial speed corresponding to the 60th frame is 2x speed, and the playback corresponding to frames 1-59 The speed is the playback speed of the first frame, that is, when the speed is 1x, then the position of the adjusted frame corresponding to the initial frame of the speed adjustment is related to the playback speed of the first frame. With reference to Figure 6, the following methods can be used to determine the position of the frame after the speed adjustment of the initial frame.
2114:根据原始视频中调速初始帧的帧位置,确定调速初始帧对应的原 始帧位置。2114: Determine the original frame position corresponding to the speed-adjusted initial frame according to the frame position of the speed-adjusted initial frame in the original video.
具体的,将调速初始帧在原始视频中的帧位置直接确定为调速初始帧所对应的原始帧位置。Specifically, the frame position of the speed-adjusted initial frame in the original video is directly determined as the original frame position corresponding to the speed-adjusted initial frame.
2115:根据原始视频中调速初始帧的帧位置和原始视频中第一帧的播放速度,确定调速初始帧所对应的调速后帧位置。2115: Determine the adjusted frame position corresponding to the adjusted initial frame according to the frame position of the adjusted initial frame in the original video and the playback speed of the first frame in the original video.
举例来说:原始视频中调速初始帧的帧位置为60帧,第一帧的播放速度为1倍速,则可以确定调速初始帧所对应的调速后帧位置为60帧/1=60帧;在原始视频中调速初始帧的帧位置为60帧,第一帧的播放速度为2倍速,则可以确定调速初始帧所对应的调速后帧位置为60帧/2=30帧;在原始视频中调速初始帧的帧位置为60帧,第一帧的播放速度为0.5倍速,则可以确定调速初始帧所对应的调速后帧位置为60帧/0.5=120帧。For example: the frame position of the speed-adjusted initial frame in the original video is 60 frames, and the playback speed of the first frame is 1x speed, then it can be determined that the speed-adjusted frame position corresponding to the speed-adjusted initial frame is 60 frames/1=60 Frame; in the original video, the frame position of the initial frame of the speed adjustment is 60 frames, and the playback speed of the first frame is 2 times the speed, then the adjusted frame position corresponding to the initial frame of the speed adjustment can be determined as 60 frames/2=30 frames ; In the original video, the frame position of the speed-adjusted initial frame is 60 frames, and the playback speed of the first frame is 0.5 times the speed, then it can be determined that the speed-adjusted frame position corresponding to the speed-adjusted initial frame is 60 frames/0.5=120 frames.
2116:根据调速初始帧所对应的初始速度,确定调速初始帧对应的播放速度。2116: According to the initial speed corresponding to the initial frame of speed adjustment, determine the playback speed corresponding to the initial frame of speed adjustment.
其中,调速初始帧所对应的初始速度可以是预先设置的默认速度,或者也可以是用户指定或者配置的播放速度。在获取到调速初始帧所对应的初始速度之后,可以直接将调速初始帧所对应的初始速度确定为调速初始帧对应的播放速度。Wherein, the initial speed corresponding to the speed-adjusting initial frame may be a preset default speed, or may also be a playback speed designated or configured by the user. After the initial speed corresponding to the initial frame of the speed adjustment is obtained, the initial speed corresponding to the initial frame of the speed adjustment can be directly determined as the playback speed corresponding to the initial frame of the speed adjustment.
需要说明的是,本实施例中的步骤S2111与步骤S2112、S2113之间的执行顺序并不限于序号所显示的顺序,也即,步骤S2112、S2113也可以在步骤S2111之前执行,或者,步骤S2112、S2113也可以与步骤S2111同时执行。相类似,步骤S2114与步骤S2115、S2116之间的执行顺序并不限于序号所显示的顺序,也即,步骤S2115、S2116也可以在步骤S2114之前执行,或者,步骤S2115、S2116也可以与步骤S2114同时执行。It should be noted that the order of execution between step S2111 and steps S2112 and S2113 in this embodiment is not limited to the order shown by the serial number, that is, steps S2112 and S2113 can also be performed before step S2111, or step S2112 , S2113 can also be executed simultaneously with step S2111. Similarly, the order of execution between step S2114 and steps S2115 and S2116 is not limited to the order shown by the serial number. That is, steps S2115 and S2116 can also be executed before step S2114, or steps S2115 and S2116 can also be executed before step S2114. Simultaneous execution.
S212:至少部分地根据调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定调速中间帧对应的原始帧位置、调速后帧位置和播放速度。S212: Determine the original frame position, the speed-adjusted frame position, and the playing speed corresponding to the speed-adjusted intermediate frame at least partly according to the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed.
在获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度之后,可以至少部分地根据调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定调速中间帧对应的原始帧位置、调速后帧位置和播放速度。需要说明的是,上述的“至少部分地根据调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定调速中间帧对应的原始帧位置、调速后帧位置和播放速度”是指可以根据调速初始帧所对应的原始帧位置、调速后帧位置和 播放速度确定与调速初始帧相邻的第一个调速中间帧对应的原始帧位置、调速后帧位置和播放速度;而位于第一个调速中间帧之后的其他调速中间帧所对应的原始帧位置、调速后帧位置和播放速度则可以根据第一个调速中间帧的原始帧位置、调速后帧位置和播放速度进行确定。After obtaining the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed, the adjustment can be determined based at least in part on the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed. The original frame position corresponding to the speed intermediate frame, the frame position after speed adjustment, and the playback speed. It should be noted that the above "determine the original frame position corresponding to the speed-adjusted intermediate frame, the position of the speed-adjusted frame, and the playback speed according to the original frame position corresponding to the speed-adjusted initial frame, the frame position after the speed-adjustment, and the playback speed at least in part. "Speed" means that the original frame position corresponding to the first speed-adjusted intermediate frame adjacent to the speed-adjusted initial frame can be determined according to the original frame position corresponding to the speed-adjusted initial frame, the post-speed-adjusted frame position, and the playback speed. Frame position and playback speed; and the original frame positions corresponding to other speed-adjusted intermediate frames after the first speed-adjusted intermediate frame, the frame position after speed-adjustment, and the playback speed can be based on the original frame of the first speed-adjusted intermediate frame The position, frame position and playback speed after speed adjustment are determined.
具体的,参考附图7所示,本实施例中的至少部分地根据调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定调速中间帧对应的原始帧位置、调速后帧位置和播放速度可以包括:Specifically, referring to FIG. 7, in this embodiment, the original frame position corresponding to the speed-adjusted intermediate frame is determined at least partly based on the original frame position corresponding to the speed-adjusted initial frame, the post-speed-adjusted frame position, and the playback speed. The frame position and playback speed after speed adjustment can include:
S2121:至少部分地根据调速初始帧对应的原始帧位置和播放速度,确定原始视频中待处理帧的帧位置。S2121: Determine the frame position of the frame to be processed in the original video at least partially according to the original frame position and the playback speed corresponding to the speed-regulated initial frame.
其中,待处理帧位于调速初始帧与调速结束帧之间;在获取调速初始帧所对应的原始帧位置和播放速度之后,可以至少部分地根据调速初始帧对应的原始帧位置和播放速度,确定原始视频中待处理帧的帧位置。需要说明的是,上述的“至少部分地根据调速初始帧对应的原始帧位置和播放速度,确定原始视频中待处理帧的帧位置”是指可以根据调速初始帧对应的原始帧位置和播放速度确定与调速初始帧相邻的第一个待处理帧对应的帧位置;而位于第一个待处理帧之后的其他待处理帧所对应的帧位置则可以根据第一个待处理帧的原始帧位置和播放速度进行确定。Among them, the frame to be processed is located between the speed adjustment initial frame and the speed adjustment end frame; after obtaining the original frame position and playback speed corresponding to the speed adjustment initial frame, the original frame position and the playback speed corresponding to the speed adjustment initial frame can be at least partially The playback speed determines the frame position of the frame to be processed in the original video. It should be noted that the above “determine the frame position of the frame to be processed in the original video based at least in part on the original frame position and playback speed corresponding to the speed-regulated initial frame” means that the original frame position and the playback speed corresponding to the speed-regulated initial frame The playback speed determines the frame position corresponding to the first frame to be processed adjacent to the initial frame to be processed; and the frame positions corresponding to other frames to be processed after the first frame to be processed can be based on the first frame to be processed The original frame position and playback speed are determined.
举例来说:调速初始帧对应的原始帧位置为org_pos0,播放速度为speed,而后可以根据调速初始帧对应的原始帧位置和播放速度确定与调速初始帧相邻的第一个待处理帧对应的帧位置:org_pos1=org_pos0+speed,而后可以根据第一个待处理帧对应的帧位置org_pos1和播放速度speed1确定相邻的第二个待处理帧对应的帧位置org_pos2=org_pos1+speed1,依次类推,可以获得原始视频中多个待处理帧的帧位置。For example: the original frame position corresponding to the speed adjustment initial frame is org_pos0, and the playback speed is speed, and then the first frame adjacent to the speed adjustment initial frame to be processed can be determined according to the original frame position and playback speed corresponding to the speed adjustment initial frame The frame position corresponding to the frame: org_pos1=org_pos0+speed, and then the frame position org_pos2=org_pos1+speed1 corresponding to the second adjacent frame to be processed can be determined according to the frame position org_pos1 corresponding to the first frame to be processed and the playback speed speed1, By analogy, the frame positions of multiple frames to be processed in the original video can be obtained.
需要注意的是,在org_pos+speed的和值不是整数时,可以对和值进行取整处理,取整方式可以为向下取整、向上取整或者利用其它取整算法进行取整均可,较为优选的,可以对和值采用向下取整操作,从而可以获取到多个待处理帧的帧位置。It should be noted that when the sum value of org_pos+speed is not an integer, the sum value can be rounded, and the rounding method can be rounding down, rounding up, or using other rounding algorithms. More preferably, the sum value can be rounded down, so that the frame positions of multiple frames to be processed can be obtained.
S2122:根据原始视频中待处理帧的帧位置、原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及初始速度、目标速度,确定待处理帧的插值速度。S2122: Determine the interpolation speed of the frame to be processed according to the frame position of the frame to be processed in the original video, the frame position of the initial frame of speed adjustment in the original video, the frame position of the end frame of speed adjustment in the original video, and the initial speed and target speed.
在获取到待处理帧的帧位置之后,可以对原始视频中待处理帧的帧位置、原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及初 始速度、目标速度进行分析处理,从而可以确定待处理帧的插值速度。举例来说:原始视频中调速初始帧的帧位置为60帧、调速结束帧的帧位置为70帧,初始速度为1倍速,目标速度为2倍速,待处理帧的帧位置为65帧时,则可以根据公式:
Figure PCTCN2019100452-appb-000001
Figure PCTCN2019100452-appb-000002
也即,第65帧的插值速度为
Figure PCTCN2019100452-appb-000003
倍速。相类似,在待处理帧的帧位置为67帧时,则可以根据上述公式获得第67帧的插值速度为
Figure PCTCN2019100452-appb-000004
倍速。
After obtaining the frame position of the frame to be processed, the frame position of the frame to be processed in the original video, the frame position of the initial frame of the speed adjustment in the original video, the frame position of the end frame of the speed adjustment in the original video, as well as the initial speed and target The speed is analyzed and processed, so that the interpolation speed of the frame to be processed can be determined. For example: in the original video, the frame position of the initial frame of speed adjustment is 60 frames, the frame position of the end frame of speed adjustment is 70 frames, the initial speed is 1x speed, the target speed is 2x speed, and the frame position of the frame to be processed is 65 frames When, you can use the formula:
Figure PCTCN2019100452-appb-000001
Figure PCTCN2019100452-appb-000002
That is, the interpolation speed of frame 65 is
Figure PCTCN2019100452-appb-000003
Double speed. Similarly, when the frame position of the frame to be processed is frame 67, the interpolation speed of the 67th frame can be obtained according to the above formula as
Figure PCTCN2019100452-appb-000004
Double speed.
S2123:当待处理帧的插值速度满足预设条件时,则将待处理帧作为调速中间帧,并获取待处理帧对应的原始帧位置、调速后帧位置和播放速度;否则,则将待处理帧丢弃。S2123: When the interpolation speed of the frame to be processed meets the preset condition, the frame to be processed is used as the speed adjustment intermediate frame, and the original frame position, the frame position after speed adjustment, and the playback speed corresponding to the frame to be processed are obtained; otherwise, Pending frames are discarded.
在获取到待处理帧的插值速度之后,可以对待处理帧的插值速度进行分析识别,以判断待处理帧的插值速度是否满足预设条件,其中,预设条件包括:待处理帧的插值速度与待处理帧的前一帧对应的播放速度的差值大于或等于预设阈值;这里的预设阈值可以根据不同的应用场景和应用需求进行任意设置,例如:当初始速度大于目标速度时,预设阈值为第一预设阈值,也即,该第一预设阈值是用于实现对视频进行慢速调节的最小调节粒度;当初始速度小于目标速度时,预设阈值为不同于第一预设阈值的第二预设阈值,也即,该第二预设阈值是用于实现对视频进行快速调节的最小调节粒度。After the interpolation speed of the frame to be processed is obtained, the interpolation speed of the frame to be processed can be analyzed and identified to determine whether the interpolation speed of the frame to be processed meets preset conditions, where the preset conditions include: the interpolation speed of the frame to be processed and The difference in the playback speed corresponding to the previous frame of the frame to be processed is greater than or equal to the preset threshold; the preset threshold here can be set arbitrarily according to different application scenarios and application requirements, for example: when the initial speed is greater than the target speed, the preset threshold Set the threshold as the first preset threshold, that is, the first preset threshold is the minimum adjustment granularity used to implement slow adjustment of the video; when the initial speed is less than the target speed, the preset threshold is different from the first preset The second preset threshold of the threshold is set, that is, the second preset threshold is the minimum adjustment granularity used to realize rapid adjustment of the video.
通常情况下,在对原始视频进行调速处理时,可以包括慢速调节和快速调节。举例来说:对于慢速调节(速度<1.0),可以每0.25一个调速间隔,如:0%~25%、25%~50%、50%~75%、75%~100%;对于快速调节(速度>1.0),可以每1.0一个调速间隔,如:100%~200%、200%~300%......700%~800%。针对上述的每个间隔,可以将每个调节间隔再细化8个颗粒,也就是对于慢速视频,最小颗粒是1/32,该对原始视频进行慢速调节的最小颗粒即为第一预设阈值;对于快速视频,最小颗粒是1/8,该对原始视频进行快速调节的最小颗粒即为第二预设阈值。Normally, when adjusting the speed of the original video, slow adjustment and fast adjustment can be included. For example: for slow speed adjustment (speed<1.0), you can set a speed adjustment interval every 0.25, such as: 0%-25%, 25%-50%, 50%-75%, 75%-100%; for fast speed Adjust (speed>1.0), you can adjust the interval every 1.0, such as: 100%~200%, 200%~300%...700%~800%. For each of the above intervals, each adjustment interval can be further refined by 8 particles, that is, for a slow video, the smallest particle is 1/32, and the smallest particle for slow adjustment of the original video is the first preview. Set a threshold; for fast videos, the smallest particle is 1/8, and the smallest particle for fast adjustment of the original video is the second preset threshold.
可以想到的是,对原始视频进行慢速调节和快速调节的具体粒度并不限于上述举例说明,本领域技术人员还可以根据具体的应用需求和设计需求来任意调节慢速调节和快速调节的信息;其中,考虑到设备对视频信息的处理性能,快速调节的最高倍速可为8倍速。It is conceivable that the specific granularity of slow adjustment and fast adjustment of the original video is not limited to the above examples. Those skilled in the art can also adjust the information of slow adjustment and fast adjustment arbitrarily according to specific application requirements and design requirements. ; Among them, taking into account the equipment's processing performance of video information, the highest speed of fast adjustment can be 8 times.
在对待处理帧的插值速度进行分析识别的结果为:待处理帧的插值速度 不满足预设条件时,也即,待处理帧的插值速度与待处理帧的前一帧对应的播放速度的差值小于预设阈值,则将待处理帧丢弃,即不计算该待处理帧所对应的原始帧位置、调速后帧位置和播放速度。The result of analyzing and identifying the interpolation speed of the frame to be processed is: when the interpolation speed of the frame to be processed does not meet the preset condition, that is, the difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed If the value is less than the preset threshold, the frame to be processed is discarded, that is, the original frame position, the frame position after speed adjustment, and the playback speed corresponding to the frame to be processed are not calculated.
在对待处理帧的插值速度进行分析识别的结果为:待处理帧的插值速度满足预设条件时,也即,待处理帧的插值速度与待处理帧的前一帧对应的播放速度的差值大于或等于预设阈值,则可以将待处理帧作为调速中间帧,并获取待处理帧对应的原始帧位置、调速后帧位置和播放速度,需要注意的是,上述的待处理帧对应的播放速度是可以根据待处理帧的插值速度和预设阈值确定得到。具体的,根据插值速度和预设阈值,可以利用以下公式,确定与视频帧相对应的播放速度:
Figure PCTCN2019100452-appb-000005
其中,V为与视频帧相对应的播放速度,V p为插值速度,λ为预设阈值,“round()”为取整函数。举例来说,在预设阈值为第一预设阈值1/32时,那么,确定与视频帧相对应的播放速度:
Figure PCTCN2019100452-appb-000006
在预设阈值为第二预设阈值1/8时,那么,确定与视频帧相对应的播放速度:
Figure PCTCN2019100452-appb-000007
The result of analyzing and identifying the interpolation speed of the frame to be processed is: when the interpolation speed of the frame to be processed meets the preset condition, that is, the difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed If it is greater than or equal to the preset threshold, the frame to be processed can be used as the speed adjustment intermediate frame, and the original frame position corresponding to the frame to be processed, the frame position after speed adjustment, and the playback speed can be obtained. It should be noted that the frame to be processed corresponds to The playback speed of can be determined according to the interpolation speed of the frame to be processed and a preset threshold. Specifically, according to the interpolation speed and the preset threshold, the following formula can be used to determine the playback speed corresponding to the video frame:
Figure PCTCN2019100452-appb-000005
Among them, V is the playback speed corresponding to the video frame, V p is the interpolation speed, λ is the preset threshold, and "round()" is the rounding function. For example, when the preset threshold is 1/32 of the first preset threshold, then determine the playback speed corresponding to the video frame:
Figure PCTCN2019100452-appb-000006
When the preset threshold is 1/8 of the second preset threshold, then the playback speed corresponding to the video frame is determined:
Figure PCTCN2019100452-appb-000007
通过上述方法,可以准确、快速地识别出插值速度满足预设条件的调速中间帧,并可以根据插值速度确定调速中间帧所对应的原始帧位置、调速后帧位置和播放速度,可以想到的是,调速中间帧是指位于调速初始帧和调速结束帧之间的至少一部分视频帧,该调速中间帧是部分视频帧的一部分,因此,也保证了对部分视频帧所对应的原始帧位置、调速后帧位置和播放速度进行获取的准确可靠性。Through the above method, the speed-adjusting intermediate frame whose interpolation speed meets the preset conditions can be accurately and quickly identified, and the original frame position, the speed-adjusted frame position and the playback speed corresponding to the speed-adjusting intermediate frame can be determined according to the interpolation speed. It is thought that the speed adjustment intermediate frame refers to at least a part of the video frame between the speed adjustment initial frame and the speed adjustment end frame. The speed adjustment intermediate frame is a part of the part of the video frame. Therefore, the The accuracy and reliability of obtaining the corresponding original frame position, frame position after speed adjustment, and playback speed.
S22:根据部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定目标视频中的每一帧在原始视频中对应的帧位置。S22: Determine the corresponding frame position of each frame in the target video in the original video according to the original frame position, the speed-adjusted frame position, and the playback speed corresponding to some video frames.
在获取到部分视频帧所对应的原始帧位置、调速后帧位置和播放速度之后,可以对部分视频帧所对应的原始帧位置、调速后帧位置和播放速度进行分析处理,从而可以确定目标视频中每一帧在原始视频中对应的帧位置,具体的,参考附图3所示,一种可实现的方式为,根据部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定目标视频中的每一帧在原始视频中对应的帧位置,包括:After obtaining the original frame position, the adjusted frame position and the playback speed corresponding to some video frames, the original frame position, the adjusted frame position and the playback speed corresponding to the partial video frame can be analyzed and processed to determine The corresponding frame position of each frame in the target video in the original video. Specifically, referring to Fig. 3, an achievable way is based on the original frame position corresponding to some video frames, the frame position after speed adjustment and Play speed, determine the corresponding frame position of each frame in the target video in the original video, including:
S221:将部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储,获得关联关系集合。S221: Associatively store the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set.
在获取到部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度之后,可以将每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储,从而可以获得关联关系集合,该关联关系集合中 包括与部分视频帧中的每个视频帧所对应的关联关系。After obtaining the original frame position, the adjusted frame position, and the playback speed of each video frame in some video frames, the original frame position, the adjusted frame position and the playback speed of each video frame can be changed By performing associative storage, an association relationship set can be obtained, and the association relationship set includes an association relationship corresponding to each video frame in the partial video frames.
S222:根据关联关系集合,确定目标视频中的每一帧在原始视频中对应的帧位置。S222: Determine the frame position corresponding to each frame in the target video in the original video according to the association relationship set.
在获取到关联关系集合之后,可以根据关联关系集合来确定目标视频中每一帧在原始视频中对应的帧位置。具体的,可以在关联关系集合中,确定与视频帧位置相对应的第一关联关系和第二关联关系,第一关联关系与第二关联关系相邻,并且,目标视频中的每一帧所对应的帧位置大于或等于第一关联关系所对应的第一调速后帧位置,且小于第二关联关系所对应的第二调速后帧位置;而后,利用第一关联关系确定目标视频中的每一帧在原始视频中对应的帧位置。After the association relationship set is obtained, the frame position corresponding to each frame in the target video in the original video can be determined according to the association relationship set. Specifically, in the association relationship set, the first association relationship and the second association relationship corresponding to the position of the video frame may be determined. The first association relationship is adjacent to the second association relationship, and each frame in the target video is The corresponding frame position is greater than or equal to the first speed-adjusted frame position corresponding to the first association relationship, and smaller than the second speed-adjusted frame position corresponding to the second association relationship; then, the first association relationship is used to determine the target video The corresponding frame position of each frame in the original video.
举例来说:针对视频长度为90帧,调速初始帧的帧位置为60帧,调速结束帧的帧位置为70帧,调速初始帧对应的初始速度为1倍速,调速结束帧对应的目标速度为2倍速,针对上述的视频信息,可以获得关联关系集合,关联关系集合中包括有每个视频帧所对应的原始帧位置、调速后帧位置和播放速度的关联关系(原始帧位置,调速后帧位置,播放速度),例如,关联关系包括:(60,60,1)、(62,62,1.25)、(64.5,64,1.375)、(65.875,65,1.5)、(67.375,66,1.75)、(69.125,67,1.875)、(71,68,2)。For example: for a video length of 90 frames, the frame position of the initial frame of speed adjustment is 60 frames, the frame position of the end frame of speed adjustment is 70 frames, the initial speed corresponding to the initial frame of speed adjustment is 1x speed, and the end frame of speed adjustment corresponds to The target speed is 2 times speed. For the above-mentioned video information, an association relationship set can be obtained. The association relationship set includes the original frame position corresponding to each video frame, the association relationship between the frame position after speed adjustment and the playback speed (original frame Position, frame position after speed adjustment, playback speed), for example, the association relationship includes: (60,60,1), (62,62,1.25), (64.5,64,1.375), (65.875,65,1.5), (67.375,66,1.75), (69.125,67,1.875), (71,68,2).
在对目标视频进行播放时,获取当前播放帧所对应的帧位置,假设播放帧的帧位置为第63帧,根据上述建立的关联关系集合中的所有关联关系,可以根据目标视频中待播放帧的帧位置与关联关系中的所有调速后帧位置进行分析比较,从而可以查找到此播放帧所对应的第一关联关系和第二关联关系,即63帧就介于第一关联关系(62/62/1.25)和第二关联关系(64.5/64/1.375)帧之间),而后,获取第一关联关系中关联存储的三个值(org_pos/speed_pos/speed),其中,org_pos为62,speed_pos为62,speed为1.25,而后,利用公式org_pos+(pos-speed_pos)*speed获得当前播放帧在视频中的原始位置,也即,当前63帧的播放帧所对应的原始帧位置为:62+(63-62)*1.25=63.25,下取整后为63帧。When playing the target video, get the frame position corresponding to the current playing frame. Assuming that the frame position of the playing frame is the 63rd frame, according to all the association relationships in the above-established association relationship set, it can be based on the frame to be played in the target video Analyze and compare the frame position with all speed-adjusted frame positions in the association relationship, so that the first association relationship and the second association relationship corresponding to this playback frame can be found, that is, the 63 frames are in the first association relationship (62 /62/1.25) and the second association relationship (64.5/64/1.375) frames), and then obtain the three values (org_pos/speed_pos/speed) stored in association in the first association relationship, where org_pos is 62, The speed_pos is 62, and the speed is 1.25. Then, use the formula org_pos+(pos-speed_pos)*speed to obtain the original position of the current playback frame in the video, that is, the original frame position corresponding to the current 63 frames of playback is: 62+ (63-62)*1.25=63.25, which is 63 frames after rounding down.
根据关联关系集合,确定目标视频中的每一帧在原始视频中对应的帧位置,有效地保证了目标视频中每一帧在原始视频中对应的帧位置确定的准确可靠性,而后可以根据该帧位置对目标视频进行播放。According to the association relationship set, determine the corresponding frame position of each frame in the target video in the original video, which effectively ensures the accuracy and reliability of the determination of the corresponding frame position of each frame in the target video in the original video, and then can be based on this The frame position plays the target video.
另外,参考附图8所示,另一种可实现的方式为,根据部分视频帧所对应 的原始帧位置、调速后帧位置和播放速度,确定目标视频中的每一帧在原始视频中对应的帧位置,包括:In addition, referring to Figure 8, another achievable way is to determine that each frame of the target video is in the original video according to the original frame position corresponding to some video frames, the frame position after speed adjustment, and the playback speed. The corresponding frame positions include:
S223:获取目标视频中的每一帧对应的帧区间,帧区间的区间起始帧和区间结束帧为部分视频帧中相邻的两帧。S223: Acquire a frame interval corresponding to each frame in the target video, and the interval start frame and the interval end frame of the frame interval are two adjacent frames in the partial video frames.
S224:根据目标视频中的每一帧在目标视频中的帧位置、区间起始帧对应的原始帧位置、调速后帧位置和播放速度,确定目标视频中的每一帧在原始视频中对应的帧位置。S224: Determine that each frame in the target video corresponds to the original video according to the frame position of each frame in the target video, the original frame position corresponding to the start frame of the interval, the frame position after speed adjustment, and the playback speed The frame position.
具体的,在对目标视频进行播放时,可以获取目标视频中当前播放帧所对应的帧位置,通过该帧位置可以确定与当前播放帧所对应的帧区间。举例来说:在当前播放帧所对应的帧位置为67帧时,则可以获取该67帧所对应的帧区间为(66,68),其中,66为区间起始帧,68为区间结束帧;而后,可以可以获取区间起始帧(66帧)所对应的原始帧位置(67.375)、调速后帧位置(66)和播放速度(1.75),根据目标视频中的每一帧在目标视频中的帧位置67帧、区间起始帧对应的原始帧位置67.375、调速后帧位置66和播放速度1.75,确定目标视频中的当前播放帧67帧在原始视频中对应的帧位置为69帧,具体的,可以根据org_pos+(pos-speed_pos)*speed获得当前播放帧在视频中的原始位置,也即,当前播放帧67帧在原始视频中对应的帧位置为:67.375+(67-66)*1.75=69.125,下取整后为69帧,从而确定并可以解码原始视频中的第69帧图像。Specifically, when the target video is played, the frame position corresponding to the currently played frame in the target video can be obtained, and the frame interval corresponding to the currently played frame can be determined by the frame position. For example: when the frame position corresponding to the current playback frame is frame 67, the frame interval corresponding to the 67 frame can be obtained as (66, 68), where 66 is the interval start frame and 68 is the interval end frame ; Then, you can get the original frame position (67.375), the frame position (66) and the playback speed (1.75) corresponding to the start frame (66 frames) of the interval, according to each frame of the target video in the target video The frame position 67 in the frame, the original frame position 67.375 corresponding to the start frame of the interval, the frame position 66 after the speed adjustment and the playback speed 1.75, determine the current playback frame 67 in the target video, and the corresponding frame position in the original video is 69 frames Specifically, the original position of the current playing frame in the video can be obtained according to org_pos+(pos-speed_pos)*speed, that is, the corresponding frame position of the current playing frame 67 in the original video is: 67.375+(67-66) *1.75=69.125, it is 69 frames after rounding down to determine and decode the 69th frame of the original video.
通过获取目标视频中的每一帧对应的帧区间,而后根据目标视频中的每一帧在目标视频中的帧位置、区间起始帧对应的原始帧位置、调速后帧位置和播放速度,确定目标视频中的每一帧在原始视频中对应的帧位置,有效地保证了目标视频中每一帧在原始视频中对应的帧位置确定的准确可靠性,而后可以根据该帧位置对目标视频进行播放。By obtaining the frame interval corresponding to each frame in the target video, and then according to the frame position of each frame in the target video in the target video, the original frame position corresponding to the start frame of the interval, the frame position after speed adjustment, and the playback speed, Determine the corresponding frame position of each frame in the target video in the original video, effectively ensuring the accuracy and reliability of the determination of the corresponding frame position of each frame in the target video in the original video, and then the target video can be determined according to the frame position To play.
在上述实施例的基础上,为了能够快速、准确地确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,当调速初始帧并非原始视频的第一帧时,此时的部分视频帧还可以包括第一帧,该第一帧即为原始视频中的首个视频帧。进而,本实施例中的确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,还包括:On the basis of the above embodiment, in order to be able to quickly and accurately determine the original frame position, the adjusted frame position and the playback speed of some video frames in the original video, when the adjusted initial frame is not the first frame of the original video At this time, some of the video frames may also include the first frame, and the first frame is the first video frame in the original video. Furthermore, determining the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to some video frames in the original video in this embodiment further includes:
S213:确定第一帧对应的原始帧位置、调速后帧位置和播放速度。S213: Determine the original frame position, the speed-adjusted frame position, and the playback speed corresponding to the first frame.
其中,原始视频中的第一帧也会是调速后的目标视频中的第一帧,也即 第一帧对应的原始帧位置和调速后帧位置可以直接获取到,例如,第一帧对应的原始帧位置、调速后帧位置均为0,而第一帧对应的播放速度可以为预先设置的默认速度、配置速度或者用户指定的播放速度均可。Among them, the first frame in the original video will also be the first frame in the target video after the speed adjustment, that is, the original frame position and the speed adjustment frame position corresponding to the first frame can be directly obtained, for example, the first frame The corresponding original frame position and the frame position after speed adjustment are all 0, and the playback speed corresponding to the first frame can be a preset default speed, a configured speed or a user-specified playback speed.
进一步的,当调速结束帧为原始视频的最末帧时,部分视频帧还包括调速结束帧;此时,本实例中的确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,还包括:Further, when the speed adjustment end frame is the last frame of the original video, part of the video frame also includes the speed adjustment end frame; at this time, in this example, determine the original frame position and speed adjustment corresponding to some video frames in the original video. Back frame position and playback speed, including:
S214:确定调速结束帧对应的原始帧位置、调速后帧位置和播放速度。S214: Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the end frame of the speed adjustment.
其中,当调速结束帧为原始视频的最末帧时,可以根据视频长度确定调速结束帧对应的原始帧位置,例如,调速结束帧对应的原始帧位置为70。而最末帧对应的播放速度可以为调速结束帧所需要达到的目标速度,或者也可以是默认或者预先配置的其他速度。示例的,在确定最末帧对应的调速后帧位置时,可以获取原始视频的总长度、最末帧前的一帧对应的原始帧位置、调速后帧位置和播放速度,而后根据原始视频的总长度、最末帧前的一帧对应的原始帧位置、调速后帧位置和播放速度确定最末帧对应的调速后帧位置。具体的,可以利用以下公式来确定最末帧对应的调速后帧位置:Wherein, when the speed adjustment end frame is the last frame of the original video, the original frame position corresponding to the speed adjustment end frame can be determined according to the video length. For example, the original frame position corresponding to the speed adjustment end frame is 70. The playback speed corresponding to the last frame may be the target speed that the speed adjustment end frame needs to achieve, or it may be other speeds that are default or pre-configured. For example, when determining the frame position after the speed adjustment corresponding to the last frame, the total length of the original video, the original frame position corresponding to the frame before the last frame, the frame position after speed adjustment, and the playback speed can be obtained, and then according to the original The total length of the video, the original frame position corresponding to the frame before the last frame, the frame position after speed adjustment, and the playback speed determine the frame position after speed adjustment corresponding to the last frame. Specifically, the following formula can be used to determine the frame position after the speed adjustment corresponding to the last frame:
speed_pos_end=speed_pos+(length-org_pos)/speed;speed_pos_end=speed_pos+(length-org_pos)/speed;
其中,speed_pos_end为最末帧对应的调速后帧位置,speed_pos为最末帧前的一帧对应的调速后帧位置,length为原始视频的总长度,org_pos为最末帧前的一帧对应的原始帧位置,speed为调速结束帧后的一帧对应的播放速度。Among them, speed_pos_end is the speed-adjusted frame position corresponding to the last frame, speed_pos is the speed-adjusted frame position corresponding to the frame before the last frame, length is the total length of the original video, and org_pos is the frame before the last frame. The original frame position, speed is the playback speed corresponding to one frame after the end frame of the speed adjustment.
举例来说,原始视频共有70帧,调速初始帧为原始视频中的第60帧,调速结束帧为原始视频中的第70帧,最末帧前的一帧对应的(原始帧位置,调速后帧位置,播放速度)为(69.125,67,1.875),length=70,则speed_pos+(length-org_pos)/speed=67+(70-69.125)/1.875=67.46(约),则记录最后结束点(70/67.46/1.875)。For example, the original video has a total of 70 frames, the initial frame of the speed adjustment is the 60th frame in the original video, and the end frame of the speed adjustment is the 70th frame in the original video. The frame before the last frame corresponds to (original frame position, Frame position after speed adjustment, playback speed) is (69.125,67,1.875), length=70, then speed_pos+(length-org_pos)/speed=67+(70-69.125)/1.875=67.46 (approximately), then record the last End point (70/67.46/1.875).
进一步的,当调速结束帧并非原始视频的最末帧时,部分视频帧还包括原始视频中位于调速结束帧后的一帧以及最末帧;其中,调速结束帧后的一帧可以与调速结束帧相邻或者不相邻。此时,确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,还包括:Further, when the speed adjustment end frame is not the last frame of the original video, some video frames also include a frame after the speed adjustment end frame and the last frame in the original video; wherein, the frame after the speed adjustment end frame can be Adjacent or not adjacent to the end frame of the speed control. At this time, determine the original frame position, the frame position after speed adjustment, and the playback speed corresponding to some video frames in the original video, including:
S215:确定调速结束帧后的一帧对应的原始帧位置、调速后帧位置和播放速度。S215: Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to a frame after the speed adjustment end frame.
由于部分视频帧包括调速结束帧后的一帧,因此,需要确定调速结束帧 后的一帧对应的原始帧位置、调速后帧位置和播放速度。具体的,在获取上述关联关系集合的过程中,可以实时地判断关联关系集合中当前帧的原始帧位置是否超过了调速结束帧所对应的帧位置,在当前帧的原始帧位置大于调速结束帧所对应的帧位置时,则可以将当前帧确定为调速结束帧后的一帧,其中,调速结束帧后的一帧在原始视频中的帧位置是根据调速中间帧的最后一帧对应的原始帧位置和播放速度确定得到的,例如:当前帧的原始帧位置=调速中间帧的最后一帧对应的原始帧位置+播放速度。举例来说,原始视频共有90帧,调速初始帧为原始视频中的第60帧,调速结束帧为原始视频中的第70帧,调速中间帧的最后一帧对应的(原始帧位置,调速后帧位置,播放速度)为(69.125,67,1.875),则调速结束帧后的一帧的原始帧位置=调速中间帧的最后一帧对应的原始帧位置+播放速度=69.125+1.875=71。Since some video frames include a frame after the end frame of the speed adjustment, it is necessary to determine the original frame position, the position of the frame after the speed adjustment, and the playback speed corresponding to the frame after the end frame of the speed adjustment. Specifically, in the process of obtaining the above-mentioned association relationship set, it can be judged in real time whether the original frame position of the current frame in the association relationship set exceeds the frame position corresponding to the end frame of the speed adjustment, and the original frame position of the current frame is greater than the speed adjustment When the frame position corresponding to the end frame is determined, the current frame can be determined as the frame after the speed adjustment end frame, where the frame position of the frame after the speed adjustment end frame in the original video is based on the last frame of the speed adjustment intermediate frame The original frame position corresponding to a frame and the playback speed are determined, for example: the original frame position of the current frame = the original frame position corresponding to the last frame of the speed-adjusting intermediate frame + the playback speed. For example, the original video has a total of 90 frames, the initial frame of the speed adjustment is the 60th frame in the original video, the end frame of the speed adjustment is the 70th frame in the original video, and the last frame of the intermediate frame of the speed adjustment corresponds to the (original frame position) , The frame position after the speed adjustment, the playback speed) is (69.125, 67, 1.875), then the original frame position of the frame after the speed adjustment end frame = the original frame position corresponding to the last frame of the speed adjustment intermediate frame + the playback speed = 69.125+1.875=71.
进一步的,可以将调速结束帧所对应的目标速度确定为调速结束帧后的一帧所对应的播放速度。而后,可以根据位于调速中间帧的最后一帧的调速后帧位置确定调速结束帧后的一帧的调速后位置,即speed_posi+1=speed_posi+1,其中,speed_posi+1为调速结束帧后的一帧的调速后位置,speed_posi为调速中间帧的最后一帧的调速后帧位置。如此,则记录调速结束帧后的一帧(71,68,2)。Further, the target speed corresponding to the speed adjustment end frame may be determined as the playback speed corresponding to a frame after the speed adjustment end frame. Then, the post-speed-adjustment position of the frame after the speed-adjustment end frame can be determined according to the post-speed-adjustment frame position of the last frame in the intermediate frame of the speed adjustment, that is, speed_posi+1=speed_posi+1, where speed_posi+1 is The speed-adjusted position of the frame after the end of speed frame, speed_posi is the speed-adjusted frame position of the last frame of the speed-adjusted intermediate frame. In this way, a frame (71, 68, 2) after the frame where the speed adjustment ends is recorded.
S216:确定最末帧对应的原始帧位置、调速后帧位置和播放速度。S216: Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the last frame.
具体的,在确定最末帧对应的原始帧位置时,可以根据视频长度确定最末帧对应的原始帧位置,例如,最末帧对应的原始帧位置为90。而最末帧对应的播放速度可以为调速结束帧所需要达到的目标速度,或者也可以是默认或者预先配置的其他速度。在确定最末帧对应的调速后帧位置时,可以获取原始视频的总长度、调速结束帧后的一帧对应的原始帧位置、调速后帧位置和播放速度,而后根据原始视频的总长度、调速结束帧后的一帧对应的原始帧位置、调速后帧位置和播放速度确定最末帧对应的调速后帧位置。具体的,可以利用以下公式来确定最末帧对应的调速后帧位置:Specifically, when determining the original frame position corresponding to the last frame, the original frame position corresponding to the last frame may be determined according to the video length, for example, the original frame position corresponding to the last frame is 90. The playback speed corresponding to the last frame may be the target speed that the speed adjustment end frame needs to achieve, or it may be other speeds that are default or pre-configured. When determining the frame position after the speed adjustment corresponding to the last frame, the total length of the original video, the original frame position corresponding to the frame after the speed adjustment end frame, the frame position after speed adjustment and the playback speed can be obtained, and then according to the original video The total length, the original frame position corresponding to the frame after the speed adjustment end frame, the adjusted frame position and the playback speed determine the adjusted frame position corresponding to the last frame. Specifically, the following formula can be used to determine the frame position after the speed adjustment corresponding to the last frame:
speed_pos_end=speed_pos+(length-org_pos)/speed;speed_pos_end=speed_pos+(length-org_pos)/speed;
其中,speed_pos_end为最末帧对应的调速后帧位置,speed_pos为调速结束帧后的一帧对应的调速后帧位置,length为原始视频的总长度,org_pos为调速结束帧后的一帧对应的原始帧位置,speed为调速结束帧后的一帧对应的播放速度。Among them, speed_pos_end is the speed-adjusted frame position corresponding to the last frame, speed_pos is the speed-adjusted frame position corresponding to a frame after the speed adjustment end frame, length is the total length of the original video, and org_pos is one frame after the speed adjustment end frame. The position of the original frame corresponding to the frame, and speed is the playback speed corresponding to one frame after the end frame of the speed adjustment.
举例来说,原始视频共有90帧,调速初始帧为原始视频中的第60帧,调速结束帧为原始视频中的第70帧,调速结束帧后的一帧对应的(原始帧位置,调速后帧位置,播放速度)为(71,68,2),则speed_pos_end=speed_pos+(length-org_pos)/speed=68+(90-71)/2=77.5,记录最后一帧(90,77.5,2)。For example, the original video has a total of 90 frames, the initial frame of the speed adjustment is the 60th frame in the original video, the end frame of the speed adjustment is the 70th frame in the original video, and the frame after the end of the speed adjustment corresponds to the (original frame position) , The frame position after speed adjustment, the playback speed) is (71,68,2), then speed_pos_end=speed_pos+(length-org_pos)/speed=68+(90-71)/2=77.5, record the last frame (90, 77.5, 2).
通过上述方式确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,有效地保证了对部分视频帧对应的原始帧位置、调速后帧位置和播放速度进行获取的准确可靠性,并且,可以想到的是,由于是对部分视频帧的原始帧位置、调速后帧位置和播放速度进行计算和存储,有效地提高了数据处理的速度和质量,降低了数据处理所需要占用的数据资源,并且也降低了所占用的存储区间。Determine the original frame position, the adjusted frame position and the playback speed of the original video by the above method, which effectively guarantees the acquisition of the original frame position, the adjusted frame position and the playback speed of the partial video frame The accuracy and reliability of data processing, and, it is conceivable that, because the original frame position of some video frames, the frame position after speed adjustment and the playback speed are calculated and stored, the speed and quality of data processing are effectively improved, and the data is reduced. Processing the data resources that need to be occupied, and also reduces the storage area occupied.
图9为本发明实施例提供的另一种视频的处理方法的流程示意图;参考附图9所示,本实施例提供了另一种视频的处理方法,该方法的执行主体为视频的处理装置,该处理装置可以实现为软件、或者软件和硬件的组合。需要说明的是,本实施例所提供的视频的处理方法与上述图1所对应的视频的处理方法的应用环境不同,上述图1所对应的视频的处理方法的应用环境可以包括基于安卓系统所构成的应用环境,本实施例中提供的视频的处理方法的应用环境可以包括基于IOS系统所构成的应用环境。FIG. 9 is a schematic flowchart of another video processing method provided by an embodiment of the present invention; referring to FIG. 9, this embodiment provides another video processing method, and the execution subject of the method is a video processing device , The processing device may be implemented as software or a combination of software and hardware. It should be noted that the application environment of the video processing method provided in this embodiment is different from the application environment of the video processing method corresponding to FIG. 1, and the application environment of the video processing method corresponding to FIG. The constituted application environment, the application environment of the video processing method provided in this embodiment may include an application environment constituted based on the IOS system.
具体的,该方法可以包括:Specifically, the method may include:
S101:获取视频调速信息,视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及调速初始帧对应的初始速度、调速结束帧对应的目标速度。S101: Obtain video speed adjustment information. The video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed and speed adjustment end frame corresponding to the speed adjustment initial frame The corresponding target speed.
其中,本实施例中步骤S101的具体实现方式和实现效果与上述实施例中步骤S1的具体实现方式和实现效果相类似,具体可参考上述陈述内容,在此不再赘述。Among them, the specific implementation manner and implementation effect of step S101 in this embodiment are similar to the specific implementation manner and implementation effect of step S1 in the foregoing embodiment. For details, please refer to the foregoing statement content, which is not repeated here.
S102:根据视频调速信息确定原始视频调速后的目标视频对应的调速参数,调速参数包括调速起始时间、原始时长和调速后的目标时长。S102: Determine the speed adjustment parameter corresponding to the target video after the speed adjustment of the original video according to the video speed adjustment information, where the speed adjustment parameter includes the speed adjustment start time, the original time length, and the target time length after the speed adjustment.
在获取到视频调速信息之后,可以对视频调速信息进行分析处理,从而可以获取到原始视频调速后的目标视频对应的调速参数,具体的,参考附图10所示,本实施例中的根据视频调速信息确定原始视频调速后的目标视频对应的调速参数可以包括:After the video speed adjustment information is obtained, the video speed adjustment information can be analyzed and processed, so that the speed adjustment parameters corresponding to the target video after the original video speed adjustment can be obtained. Specifically, referring to FIG. 10, this embodiment The speed adjustment parameter corresponding to the target video after the speed adjustment of the original video is determined according to the video speed adjustment information may include:
S1021:根据视频调速信息,确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,部分视频帧包括调速初始帧和位于调速初始帧和调速结束帧之间的调速中间帧。S1021: According to the video speed adjustment information, determine the original frame position, the speed adjusted frame position, and the playback speed of some video frames in the original video. Some video frames include the speed adjustment initial frame and the speed adjustment initial frame and the speed adjustment end frame Adjust the speed between intermediate frames.
其中,本实施例中步骤S1021的具体实现方式和实现效果与上述实施例中步骤S21的具体实现方式和实现效果相类似,具体可参考上述陈述内容,在此不再赘述。Among them, the specific implementation manner and implementation effect of step S1021 in this embodiment are similar to the specific implementation manner and implementation effect of step S21 in the foregoing embodiment. For details, reference may be made to the foregoing statements, and details are not repeated here.
S1022:将部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储以获得关联关系集合。S1022: Associatively store the original frame position, the speed-adjusted frame position, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set.
其中,本实施例中步骤S1022的具体实现方式和实现效果与上述实施例中步骤S221的具体实现方式和实现效果相类似,具体可参考上述陈述内容,在此不再赘述。Among them, the specific implementation manner and implementation effect of step S1022 in this embodiment are similar to the specific implementation manner and implementation effect of step S221 in the foregoing embodiment. For details, please refer to the foregoing statement content, which will not be repeated here.
S1023:根据关联关系集合,确定原始视频调速后的目标视频对应的调速参数。S1023: Determine the speed adjustment parameter corresponding to the target video after the speed adjustment of the original video according to the association relationship set.
在获取到关联关系集合之后,可以利用预设的处理算法对关联关系集合进行分析处理,从而可以确定原始视频调速后的目标视频对应的调速参数,该调速参数包括调速起始时间、原始时长和调速后的目标时长。After obtaining the association relationship set, the preset processing algorithm can be used to analyze and process the association relationship set, so that the speed adjustment parameter corresponding to the target video after the original video speed adjustment can be determined. The speed adjustment parameter includes the speed adjustment start time , Original duration and target duration after speed adjustment.
以(org_pos,speed_pos,speed)表示上述关联关系为例,其中,org_pos为原始帧位置、speed_pos为调速后帧位置,speed为播放速度。取相邻两组(org_pos1,speed_pos1,speed1)(org_pos2,speed_pos2,speed2),根据起始帧位置org_pos1可得到调速起始时间,根据org_pos2与org_pos1的差可得到原始时长,根据org_pos2与org_pos1的差与speed1的比值可以得到调速后的目标时长。如此,每相邻两组关联关系可得到一组对应的调速参数。Take (org_pos, speed_pos, speed) as an example to represent the above association relationship, where org_pos is the original frame position, speed_pos is the frame position after speed adjustment, and speed is the playback speed. Take the two adjacent groups (org_pos1, speed_pos1, speed1) (org_pos2, speed_pos2, speed2). According to the starting frame position org_pos1, the speed adjustment start time can be obtained, and the original time length can be obtained according to the difference between org_pos2 and org_pos1. According to the difference between org_pos2 and org_pos1 The ratio of the difference to speed1 can get the target time after speed adjustment. In this way, a set of corresponding speed control parameters can be obtained for each adjacent two sets of association relationships.
S103:根据调速参数,获取目标视频。S103: Obtain the target video according to the speed adjustment parameter.
在获取到调速参数之后,可以根据调速参数获取目标视频,从而实现了对调速处理后的目标视频进行稳定、有效地播放。After the speed adjustment parameters are obtained, the target video can be obtained according to the speed adjustment parameters, thereby achieving stable and effective playback of the target video after the speed adjustment processing.
本发明实施例相当于把整个视频划分为多个视频段,每个视频段对应的播放速度不同,从而在整体上实现视频的变速调速。The embodiment of the present invention is equivalent to dividing the entire video into multiple video segments, and each video segment corresponds to a different playback speed, thereby realizing variable speed regulation of the video as a whole.
本实施例提供的视频的处理方法,通过获取视频调速信息,根据视频调速信息确定原始视频调速后的目标视频对应的调速参数,根据调速参数,获取目标视频,从而实现了变速调速,提高了目标视频的显示效果,满足了用户对视频调速的个性化需求。The video processing method provided in this embodiment obtains video speed adjustment information, determines the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information, and obtains the target video according to the speed adjustment parameter, thereby realizing the speed change Speed adjustment improves the display effect of the target video and meets the individual needs of users for video speed adjustment.
具体应用时,参考附图11所示,本应用实施例提供了一种视频的处理方法,该方法的执行主体为视频的处理装置,在该处理装置执行该视频的处理方法时,可以包括视频采集和视频处理的过程,具体的:For specific applications, referring to FIG. 11, this application embodiment provides a video processing method. The execution body of the method is a video processing device. When the processing device executes the video processing method, it may include a video processing method. The process of acquisition and video processing, specifically:
step0:获取待处理的视频数据。step0: Get the video data to be processed.
具体的,通过无人机上的拍摄装置可以获取目标对象的视频数据。或者,可以利用飞艇/无人车加拍摄装置来获取到针对目标对象的视频数据;或者,还可以通过遥控汽车加360°摄像头来获取到针对目标对象的视频数据;或者采用摄像头联动技术来获取到针对目标对象的视频数据。Specifically, the video data of the target object can be acquired through the camera on the drone. Alternatively, an airship/unmanned vehicle and a camera can be used to obtain the video data for the target object; or the remote control car and a 360° camera can be used to obtain the video data for the target object; or the camera linkage technology can be used to obtain the video data. To the video data for the target object.
step2:将视频数据传输到的处理装置,处理装置对视频数据进行处理。step2: The processing device that transmits the video data to, and the processing device processes the video data.
其中,处理装置可以为手机、平板电脑、台式电脑等等可以对视频数据进行处理的终端设备。在处理装置获得视频数据之后,可以对视频数据进行处理,具体的,可以对视频数据进慢速调节或者快速调节;其中,对于慢速调节(速度<1.0),可以每0.25一个间隔,如0%~25%,25%~50%,50%~75%,75%~100%;对于快速调节(速度>1.0),每1.0一个间隔,如100%~200%,200%~300%......700%~800%。进一步的,对于每个间隔,可以再细化8个颗粒,也就是对于慢速视频,最小颗粒是1/32,对于快速视频,最小颗粒是1/8。为了便于理解,以原始视频的长度为90帧,调速初始帧A点为第60帧,速度为1倍速,调速结束帧B点为第70帧,速度为2倍速为例进行说明,并且,为了便于说明,定义以下参数:org_pos(i)为第i帧的对应的原始帧位置,speed_pos(i)为第i帧的调速后帧位置,org_speed为通过线性插值获得的插值速度,慢速调节:speed=round(org_speed*32)/32,快速调节,speed=round(org_speed*8)/8,其中,round为取整函数。Among them, the processing device may be a mobile phone, a tablet computer, a desktop computer, etc., a terminal device that can process video data. After the processing device obtains the video data, the video data can be processed. Specifically, the video data can be adjusted slowly or quickly; among them, for the slow adjustment (speed <1.0), an interval of 0.25, such as 0 %~25%, 25%~50%, 50%~75%, 75%~100%; for fast adjustment (speed>1.0), every 1.0 interval, such as 100%~200%, 200%~300%. ..... 700%~800%. Furthermore, for each interval, 8 particles can be further refined, that is, for slow videos, the smallest particle is 1/32, and for fast videos, the smallest particle is 1/8. For ease of understanding, take the original video with a length of 90 frames, the initial frame of speed adjustment A point is the 60th frame, the speed is 1x speed, the end frame of speed adjustment B is the 70th frame, and the speed is 2x speed as an example. For ease of description, define the following parameters: org_pos(i) is the corresponding original frame position of the i-th frame, speed_pos(i) is the frame position of the i-th frame after speed adjustment, org_speed is the interpolation speed obtained by linear interpolation, slow Speed adjustment: speed=round(org_speed*32)/32, fast adjustment, speed=round(org_speed*8)/8, where round is the rounding function.
具体的,该方法包括以下步骤:Specifically, the method includes the following steps:
step2.1:通过线性插值,可以得到从第60帧到第70帧之间的每一帧的插值速度为1、1.1、1.2、1.3、1.4、1.5、1.6、1.7、1.8、1.9、2。此步骤为可选,也可在后续步骤中获取调速中间帧的插值速度。step2.1: Through linear interpolation, the interpolation speed of each frame from frame 60 to frame 70 can be 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2. This step is optional, and the interpolation speed of the speed-adjusting intermediate frame can also be obtained in the subsequent steps.
step2.2:对于第60帧,原视频帧位置org_pos=60,插值速度org_speed=1,此时假设从第1~59帧的速度与第60帧的速度相同,均为1倍速,进而可以获得调速后的帧位置speed_pos=org_pos/org_speed=60/1=60,speed=org_speed=1,此时可以获取到org_pos、speed_pos和speed,其中,为了减少中间计算过程中的进度损失,speed_pos可以为double类型,中间计 算过程不做取整计算。关联存储上述参数,即获得关联关系(60,60,1),并进入下一个处理点为org_pos(60)+speed(60)=60+1=61。step2.2: For the 60th frame, the original video frame position org_pos=60 and the interpolation speed org_speed=1. At this time, assuming that the speed from the 1st to 59th frames is the same as the 60th frame, both are 1x speed, and then we can get The frame position after speed adjustment speed_pos=org_pos/org_speed=60/1=60, speed=org_speed=1, org_pos, speed_pos, and speed can be obtained at this time. In order to reduce the progress loss in the intermediate calculation process, speed_pos can be Double type, rounding calculation is not done during the intermediate calculation. The above parameters are stored in association, that is, the association relationship (60, 60, 1) is obtained, and the next processing point is org_pos(60)+speed(60)=60+1=61.
step2.3:对于第61帧,原视频帧位置org_pos(61)=org_pos(60)+speed=60+1=61,插值速度org_speed=1.1,speed_pos(61)=speed_pos(60)+1=60+1=61,获取插值速度与speed(60)之间的差值为0.1,将0.1与对视频进行快速调节的最小颗粒1/8进行比较,0.1小于1/8,因此,并不对此帧(61帧)进行关联存储,并进入下一个处理点是org_pos(61)+speed(60)=61+1=62。step2.3: For the 61st frame, the original video frame position org_pos(61)=org_pos(60)+speed=60+1=61, interpolation speed org_speed=1.1, speed_pos(61)=speed_pos(60)+1=60 +1=61, get the difference between the interpolation speed and speed(60) as 0.1, compare 0.1 with 1/8 of the smallest particle for quick adjustment of the video, 0.1 is less than 1/8, so this frame is not (61 frames) for associated storage, and the next processing point is org_pos(61)+speed(60)=61+1=62.
step2.4:对于第62帧,原视频帧位置org_pos(62)=org_pos(61)+speed=61+1=62,插值速度org_speed=1.2,获取到插值速度与上一个存储的速度speed(60)之间的差值为1.2-1=0.2,将0.2与对视频进行快速调节的最小颗粒1/8进行比较,0.2大于1/8,因为用户可调节的速度一定在上述预先规划好的细化颗粒上,假如不在颗粒上,则需要将speed归到最近的颗粒速度上,因此,根据公式speed(62)=round(org_speed*8)/8=1.25,speed_pos(62)=speed_pos(61)+1=62,关联存储(62,62,1.25),并进入下一个处理点是org_pos(62)+speed(62)=62+1.25=63.25。step2.4: For the 62nd frame, the original video frame position org_pos(62)=org_pos(61)+speed=61+1=62, the interpolation speed org_speed=1.2, get the interpolation speed and the last stored speed speed(60 The difference between) is 1.2-1=0.2. Compare 0.2 with 1/8 of the smallest particle for fast adjustment of the video, 0.2 is greater than 1/8, because the user-adjustable speed must be within the above-mentioned pre-planned fine If it is not on the particle, the speed needs to be attributed to the nearest particle speed. Therefore, according to the formula speed(62)=round(org_speed*8)/8=1.25, speed_pos(62)=speed_pos(61) +1=62, store (62, 62, 1.25) associative, and enter the next processing point is org_pos(62)+speed(62)=62+1.25=63.25.
step2.5:对于第63帧(63.25向下取整),原视频帧位置org_pos(63)=org_pos(62)+speed(62)=63.25,插值速度org_speed=1.3,speed_pos=62+1=63,获取到插值速度与上一个存储的速度speed(62)之间的差值为0.05,0.05小于1/8,因此并不对此帧进行关联存储,并进入下一个处理点是org_pos(63)+speed(62)=63.25+1.25=64.5。step2.5: For the 63rd frame (63.25 rounded down), the original video frame position org_pos(63)=org_pos(62)+speed(62)=63.25, interpolation speed org_speed=1.3, speed_pos=62+1=63 , The difference between the obtained interpolation speed and the last stored speed speed(62) is 0.05, which is less than 1/8, so this frame is not stored associative, and the next processing point is org_pos(63)+ speed(62)=63.25+1.25=64.5.
其中,针对下一个处理点为63.25帧时,由于不存在63.25帧,因此对上述处理点进行取整操作,为了保证数据处理的质量和效率,可以对上述处理点进行向下取整操作,从而可以获得待处理的63帧,此时,获取到的63帧是之前计算跳过的视频帧。Among them, when the next processing point is 63.25 frames, since there is no 63.25 frame, the above processing points are rounded. In order to ensure the quality and efficiency of data processing, the above processing points can be rounded down. 63 frames to be processed can be obtained. At this time, the obtained 63 frames are the video frames skipped by the previous calculation.
step2.6:对于第64帧(64.5向下取整),原视频帧位置org_pos(64)=org_pos(63)+speed(62)=63.25+1.25=64.5,插值速度org_speed=1.4,获取到插值速度与上一个存储的速度speed(62)之间的差值为0.15,0.15大于1/8,则根据公式speed(64)=round(org_speed*8)/8=1.375,speed_pos=63+1=64,关联存储(64.5,64,1.375),并进入下一个处理点是org_pos(64)+speed(64)=64.5+1.375=65.875。step2.6: For the 64th frame (64.5 rounded down), the original video frame position org_pos(64)=org_pos(63)+speed(62)=63.25+1.25=64.5, interpolation speed org_speed=1.4, get the interpolation value The difference between the speed and the last stored speed speed(62) is 0.15, 0.15 is greater than 1/8, according to the formula speed(64)=round(org_speed*8)/8=1.375, speed_pos=63+1= 64. Associative storage (64.5, 64, 1.375), and entering the next processing point is org_pos(64)+speed(64)=64.5+1.375=65.875.
step2.7:对于第65帧(65.875向下取整),原视频帧位置org_pos(65)= org_pos(64)+speed(64)=64.5+1.375=65.875,插值速度org_speed=1.5,获取到插值速度与上一个存储的速度speed(64)之间的差值为0.125,0.125=1/8,则根据公式speed=round(org_speed*8)/8=1.5,speed_pos=64+1=65,关联存储(65.875,65,1.5),并进入下一个处理点是org_pos(65)+speed(65)=65.875+1.5=67.375。step2.7: For the 65th frame (65.875 rounded down), the original video frame position org_pos(65)=org_pos(64)+speed(64)=64.5+1.375=65.875, interpolation speed org_speed=1.5, get the interpolation value The difference between the speed and the last stored speed speed(64) is 0.125, 0.125=1/8, then according to the formula speed=round(org_speed*8)/8=1.5, speed_pos=64+1=65, associated Store (65.875,65,1.5), and enter the next processing point is org_pos(65)+speed(65)=65.875+1.5=67.375.
step2.8:对于第67帧(67.375向下取整),原视频帧位置org_pos(67)=org_pos(65)+speed(65)=65.875+1.5=67.375,插值速度org_speed=1.7,获取到插值速度与上一个存储的速度speed(65)之间的差值为0.2,0.2大于1/8,则根据公式speed=round(org_speed*8)/8=1.75,speed_pos=65+1=66,关联存储(67.375,66,1.75),并进入下一个处理点是org_pos(67)+speed(67)=67.375+1.75=69.125。step2.8: For the 67th frame (67.375 rounded down), the original video frame position org_pos(67)=org_pos(65)+speed(65)=65.875+1.5=67.375, interpolation speed org_speed=1.7, get the interpolation value The difference between the speed and the last stored speed speed(65) is 0.2. If 0.2 is greater than 1/8, then according to the formula speed=round(org_speed*8)/8=1.75, speed_pos=65+1=66, the association Store (67.375,66,1.75) and enter the next processing point is org_pos(67)+speed(67)=67.375+1.75=69.125.
step2.10:对于第69帧(69.125向下取整),原视频帧位置org_pos(69)=org_pos(67)+speed(67)=67.375+1.75=69.125,插值速度org_speed=1.9,获取到插值速度与上一个存储的速度speed(67)之间的差值为0.15,0.15大于1/8,则根据公式speed=round(org_speed*8)/8=1.875,speed_pos=66+1=67,关联存储(69.125,67,1.875),并进入下一个处理点是org_pos(69)+speed(69)=69.125+1.875=71。step2.10: For the 69th frame (69.125 rounded down), the original video frame position org_pos(69)=org_pos(67)+speed(67)=67.375+1.75=69.125, interpolation speed org_speed=1.9, get the interpolation value The difference between the speed and the last stored speed speed(67) is 0.15, 0.15 is greater than 1/8, then according to the formula speed=round(org_speed*8)/8=1.875, speed_pos=66+1=67, associated Store (69.125, 67, 1.875) and enter the next processing point is org_pos(69)+speed(69)=69.125+1.875=71.
step2.11:对于第71帧,原视频帧位置org_pos(71)=org_pos(69)+speed(69)=69.125+1.875=71,该帧所对应的原视频帧位置超过B点,此时,可以确定org_speed=2,speed_pos=67+1=68,关联存储(71,68,2)。step2.11: For the 71st frame, the original video frame position org_pos(71)=org_pos(69)+speed(69)=69.125+1.875=71, the original video frame position corresponding to this frame exceeds point B, at this time, It can be determined that org_speed=2, speed_pos=67+1=68, and associated storage (71, 68, 2).
step2.12:针对原始视频中的最后一帧,该最后一帧对应的调速后的帧位置可以利用公式speed_pos(71)+(length-org_pos(71))/speed(71)来计算,从而可以获得speed_pos=68+(90-71)/2=77.5,所以记录最后一帧的关联关系为(90,77.5,2)。step2.12: For the last frame in the original video, the frame position after the speed adjustment corresponding to the last frame can be calculated using the formula speed_pos(71)+(length-org_pos(71))/speed(71), thus It is possible to obtain speed_pos=68+(90-71)/2=77.5, so the association relationship of the last frame recorded is (90, 77.5, 2).
需要说明的是,如果原视频只有70帧,即此时的调速结束帧B点即为原始视频的最末帧,此时,计算到原视频帧位置org_pos=org_pos+speed=69.125+1.875=71,超过B点时,则获取上一存储点的三个值为(69.125,67,1.875),整个视频的帧数length=70,此时,利用以下公式speed_pos+(length-org_pos)/speed=67+(70-69.125)/1.875=67.46(约),则记录最后结束点值(70,67.46,1.875)。It should be noted that if the original video has only 70 frames, that is, point B of the end frame of speed adjustment at this time is the last frame of the original video. At this time, the original video frame position org_pos=org_pos+speed=69.125+1.875= 71. When point B is exceeded, the three values of the last storage point are (69.125, 67, 1.875), and the number of frames of the entire video is length=70. At this time, use the following formula speed_pos+(length-org_pos)/speed= 67+(70-69.125)/1.875=67.46 (approximately), then record the final end point value (70, 67.46, 1.875).
step2.13:另外,针对原始视频中的第一帧而言,可以记录该第一帧的 关联关系为(0,0,1)。step 2.13: In addition, for the first frame in the original video, the association relationship of the first frame can be recorded as (0, 0, 1).
至此存储的数组有(0,0,1);(60,60,1);(62,62,1.25);(64.5,64,1.375);(65.875,65,1.5);(67.375,66,1.75);(69.125,67,1.875);(71,68,2);(90,77.5,2)。The arrays stored so far are (0,0,1); (60,60,1); (62,62,1.25); (64.5,64,1.375); (65.875,65,1.5); (67.375,66, 1.75); (69.125,67,1.875); (71,68,2); (90,77.5,2).
其中,通过上述所记录的数组数据可知,对于视频中的多个视频帧而言,其播放速度不相同,从而可以增加的视频的播放效果,例如:可以使得视频的播放效果逐渐加快或者逐渐变慢,或者,使得视频的播放效果先是逐渐加快、而后逐渐变慢等等,使得视频的播放效果得到了大大的提升和改进,满足了用户的个性化需求。Among them, from the above recorded array data, it can be seen that for multiple video frames in the video, the playback speed is different, which can increase the playback effect of the video. For example, the playback effect of the video can be gradually accelerated or changed gradually. Slow, or make the playback effect of the video gradually speed up first, then gradually slow down, etc., so that the playback effect of the video has been greatly improved and improved to meet the individual needs of users.
另外,无论针对什么类型、什么长度的视频而言,利用本应用实施例中的处理方法,最多只需要存储96个关联存储值,就可以计算出任何一个视频加速后需要显示的视频是哪一帧。例如:针对调速初始帧到调速结束帧是从60帧到600帧,从速度1加速到2的原始视频而言,也只需要记录7~8个关联存储值就可以。这样,有效地提高了数组获取的质量和效率,减少了为了获取数组而对数据进行计算的复杂度和困难度,降低了数组所需要占用的存储空间。In addition, no matter what type and length of video, using the processing method in this application embodiment, only 96 associated storage values need to be stored at most, and which video needs to be displayed after any video acceleration can be calculated. frame. For example, for the original video whose speed adjustment initial frame to speed adjustment end frame is from 60 to 600 frames, and accelerated from speed 1 to 2, only 7 to 8 associated storage values need to be recorded. In this way, the quality and efficiency of array acquisition are effectively improved, the complexity and difficulty of calculating data in order to acquire the array are reduced, and the storage space required by the array is reduced.
进一步的,在获取到上述数组之后,还可以包括以下步骤:Further, after obtaining the above-mentioned array, the following steps may also be included:
step2.14:在对视频进行播放时,当处理装置的应用系统为安卓android系统时,则可以获取到当前播放帧的时间戳,而后将时间戳发送给解码器,从而可以获得显示相对应的帧。step2.14: When playing the video, when the application system of the processing device is the Android system, the time stamp of the currently played frame can be obtained, and then the time stamp is sent to the decoder, so that the corresponding display can be obtained frame.
例如:可以获取当前播放帧pos(假设播放第63帧,即播放调速后的目标视频中的第63帧时),根据上述建立的数组,查找到此播放帧所在的调速后帧位置的间隔(结合上面例子,63就介于62(62/62/1.25)和64(64.5/64/1.375)帧之间),并取出间隔开始位置三个值(org_pos/speed_pos/speed),结合上面例子则是62/62/1.25,根据公式org_pos+(pos-speed_pos)*speed可以获得当前播放帧在视频中的原始位置,即63帧所对应的原视频帧位置为62+(63-62)*1.25=63.25,对63.25进行下取整后,获得原视频帧位置为63帧,并解码原始视频中的第63帧图像。For example: you can get the current playback frame pos (assuming that the 63rd frame is played, that is, when the 63rd frame in the target video after speed adjustment is played), according to the array established above, find the position of the speed-adjusted frame where the playback frame is located Interval (combined with the above example, 63 is between 62 (62/62/1.25) and 64 (64.5/64/1.375) frames), and take out the three values (org_pos/speed_pos/speed) at the beginning of the interval, and combine the above The example is 62/62/1.25. According to the formula org_pos+(pos-speed_pos)*speed, the original position of the current playing frame in the video can be obtained, that is, the original video frame position corresponding to 63 frames is 62+(63-62)* 1.25=63.25, after rounding down 63.25, the original video frame position is obtained as 63 frames, and the 63rd frame image in the original video is decoded.
又如,当前播放帧为67帧,67介于66(67.375,66,1.75)和68(71,68,2)之间,因此,根据公式org_pos+(pos-speed_pos)*speed获得当前播放帧在视频中的原始位置为67.375+(67-66)*1.75=69.125,下取整后为69帧, 解码原视频中的第69帧图像。For another example, the current playback frame is 67, 67 is between 66 (67.375, 66, 1.75) and 68 (71, 68, 2). Therefore, according to the formula org_pos+(pos-speed_pos)*speed, the current playback frame is obtained The original position in the video is 67.375+(67-66)*1.75=69.125, which is 69 frames after rounding down, and the 69th frame image in the original video is decoded.
又如,当前播放帧为70帧,70介于68(71,68,2)和77.5(90,77.5,2)之间,因此,根据公式org_pos+(pos-speed_pos)*speed获得当前播放帧在视频中的原始位置为71+(70-68)*2=75,解码原视频中的第75帧图像。For another example, the current playback frame is 70 frames, 70 is between 68 (71, 68, 2) and 77.5 (90, 77.5, 2). Therefore, according to the formula org_pos+(pos-speed_pos)*speed, the current playback frame is obtained The original position in the video is 71+(70-68)*2=75, and the 75th frame image in the original video is decoded.
又如,当前播放帧为4帧,4介于(0,0,1)和(60,60,1)之间,因此,根据公式org_pos+(pos-speed_pos)*speed获得当前播放帧在视频中的原始位置0+(4-0)*1=4,解码原视频中的第4帧图像。For another example, the current playback frame is 4 frames, and 4 is between (0,0,1) and (60,60,1). Therefore, according to the formula org_pos+(pos-speed_pos)*speed to obtain the current playback frame in the video The original position of 0+(4-0)*1=4, decode the 4th frame of the original video.
step2.15:在对视频进行播放时,当处理装置的应用系统为ios系统时,则可以根据上述记录数组间隔,计算出每个间隔的调速起始时间、原始时长和调速后的目标时长,将调速起始时间、原始时长和调速后的目标时长作为调速参数发送给相对应的接口,进而,解码器可根据所接收到的调速参数自动返回调速后所需要的视频帧。step2.15: When playing the video, when the application system of the processing device is the ios system, you can calculate the start time of each interval, the original duration and the target after the speed adjustment according to the interval of the recording array. Time length, the speed adjustment start time, original time length, and target time length after speed adjustment are sent to the corresponding interface as speed adjustment parameters, and then the decoder can automatically return to what is needed after speed adjustment according to the received speed adjustment parameters Video frame.
图12为本发明实施例提供的一种视频的处理装置的结构示意图;该视频的处理装置可以包括:一个或多个第一处理器21和一个或多个第一存储器22。其中,第一存储器22用于存储用于执行上述图1-图8、图11所示实施例中提供的视频的处理方法的程序。第一处理器21被配置为用于执行第一存储器22中存储的程序。具体的,FIG. 12 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention; the video processing apparatus may include: one or more first processors 21 and one or more first memories 22. Wherein, the first memory 22 is used to store a program for executing the video processing method provided in the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11. The first processor 21 is configured to execute a program stored in the first memory 22. specific,
程序包括一条或多条计算机指令,其中,一条或多条计算机指令被第一处理器21执行时能够实现如下步骤:The program includes one or more computer instructions, where one or more computer instructions can implement the following steps when executed by the first processor 21:
用于运行第一存储器22中存储的计算机程序以实现:获取视频调速信息,视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置、以及调速初始帧对应的初始速度、调速结束帧对应的目标速度;根据视频调速信息确定目标视频中的每一帧在原始视频中对应的帧位置,其中,目标视频是对原始视频进行调速后的视频;根据目标视频中的每一帧在原始视频中对应的帧位置,获取目标视频。It is used to run the computer program stored in the first memory 22 to achieve: obtain video speed adjustment information, the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and The initial speed corresponding to the initial frame of the speed adjustment and the target speed corresponding to the end frame of the speed adjustment; determine the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information, where the target video is to adjust the original video Speeded up video; Obtain the target video according to the corresponding frame position of each frame in the target video in the original video.
其中,该视频的处理装置的结构中还可以包括第一通信接口23,用于电子设备与其他设备或通信网络通信。Wherein, the structure of the video processing apparatus may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.
进一步的,第一处理器21,还用于:根据视频调速信息,确定原始视频中的部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,部分视频帧包括调速初始帧、位于调速初始帧与调速结束帧之间的调速中间帧;根据部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定目标视频 中的每一帧在原始视频中对应的帧位置。Further, the first processor 21 is further configured to: according to the video speed adjustment information, determine the original frame position, the speed adjusted frame position, and the playback speed corresponding to some video frames in the original video, and some video frames include the speed adjustment initial Frame, the intermediate frame between the initial frame and the end frame; according to the original frame position corresponding to the part of the video frame, the frame position after the speed adjustment and the playback speed, it is determined that each frame in the target video is in the original The corresponding frame position in the video.
进一步的,第一处理器21,还用于:将部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储,获得关联关系集合;根据关联关系集合,确定目标视频中的每一帧在原始视频中对应的帧位置。Further, the first processor 21 is further configured to: associate and store the original frame position, the frame position after speed adjustment, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set; Set, determine the corresponding frame position of each frame in the target video in the original video.
进一步的,第一处理器21,还用于:获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度;至少部分地根据调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定调速中间帧对应的原始帧位置、调速后帧位置和播放速度。Further, the first processor 21 is further configured to: obtain the original frame position corresponding to the speed-adjusted initial frame, the post-speed-adjusted frame position, and the playback speed; at least partly according to the original frame position and the speed-adjusted initial frame. Determine the position of the frame after speed adjustment and the playback speed, determine the original frame position corresponding to the middle frame of speed adjustment, the position of the frame after speed adjustment, and the playback speed.
进一步的,第一处理器21,还用于:根据原始视频中调速初始帧的帧位置,确定调速初始帧所对应的原始帧位置;根据原始视频中调速初始帧的帧位置和调速初始帧所对应的初始速度,确定调速初始帧所对应的调速后帧位置;根据调速初始帧所对应的初始速度,确定调速初始帧对应的播放速度。Further, the first processor 21 is further configured to: determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video; and according to the frame position and adjustment of the speed adjustment initial frame in the original video The initial speed corresponding to the speed initial frame is determined to determine the position of the adjusted frame corresponding to the initial frame of speed adjustment; the playback speed corresponding to the initial frame of speed adjustment is determined according to the initial speed corresponding to the initial frame of speed adjustment.
进一步的,第一处理器21,还用于:根据原始视频中调速初始帧的帧位置,确定调速初始帧对应的原始帧位置;根据原始视频中调速初始帧的帧位置和原始视频中第一帧的播放速度,确定调速初始帧所对应的调速后帧位置;根据调速初始帧所对应的初始速度,确定调速初始帧对应的播放速度。Further, the first processor 21 is further configured to: determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video; according to the frame position of the speed adjustment initial frame in the original video and the original video The playback speed of the first frame in the middle, determine the frame position after the speed adjustment corresponding to the initial frame of the speed adjustment; determine the playback speed corresponding to the initial frame of the speed adjustment according to the initial speed corresponding to the speed adjustment initial frame.
进一步的,第一处理器21,还用于:至少部分地根据调速初始帧对应的原始帧位置和播放速度,确定原始视频中待处理帧的帧位置;根据原始视频中待处理帧的帧位置、原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及初始速度、目标速度,确定待处理帧的插值速度;当待处理帧的插值速度满足预设条件时,则将待处理帧作为调速中间帧,并获取待处理帧对应的原始帧位置、调速后帧位置和播放速度;否则,则将待处理帧丢弃。Further, the first processor 21 is further configured to: determine the frame position of the frame to be processed in the original video at least in part according to the original frame position and the playback speed corresponding to the initial frame of the speed adjustment; according to the frame of the frame to be processed in the original video The position, the frame position of the initial frame of the speed adjustment in the original video, the frame position of the end frame of the speed adjustment in the original video, as well as the initial speed and target speed, determine the interpolation speed of the frame to be processed; when the interpolation speed of the frame to be processed meets the preset conditions When the frame is adjusted, the frame to be processed is used as an intermediate frame for speed adjustment, and the original frame position, the frame position after speed adjustment, and the playback speed corresponding to the frame to be processed are obtained; otherwise, the frame to be processed is discarded.
其中,预设条件包括:待处理帧的插值速度与待处理帧的前一帧对应的播放速度的差值大于或等于预设阈值。待处理帧的播放速度是根据待处理帧的插值速度和预设阈值确定得到的。The preset condition includes: the difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed is greater than or equal to a preset threshold. The playback speed of the frame to be processed is determined according to the interpolation speed of the frame to be processed and a preset threshold.
进一步的,当初始速度大于目标速度时,预设阈值为第一预设阈值,当初始速度小于目标速度时,预设阈值为不同于第一预设阈值的第二预设阈值。Further, when the initial speed is greater than the target speed, the preset threshold is a first preset threshold, and when the initial speed is less than the target speed, the preset threshold is a second preset threshold different from the first preset threshold.
进一步的,当调速初始帧并非原始视频的第一帧时,部分视频帧还包括第一帧;第一处理器21,还用于:确定第一帧对应的原始帧位置、调速后帧 位置和播放速度。Further, when the speed-adjusted initial frame is not the first frame of the original video, some of the video frames also include the first frame; the first processor 21 is further configured to: determine the original frame position corresponding to the first frame and the speed-adjusted frame Position and playback speed.
进一步的,当调速结束帧为原始视频的最末帧时,部分视频帧还包括调速结束帧;第一处理器21,还用于:确定调速结束帧对应的原始帧位置、调速后帧位置和播放速度。Further, when the speed adjustment end frame is the last frame of the original video, some of the video frames also include the speed adjustment end frame; the first processor 21 is also used for determining the original frame position corresponding to the speed adjustment end frame, and the speed adjustment Post frame position and playback speed.
进一步的,当调速结束帧并非原始视频的最末帧时,部分视频帧还包括原始视频中位于调速结束帧后的一帧以及最末帧;第一处理器21,还用于:确定调速结束帧后的一帧对应的原始帧位置、调速后帧位置和播放速度;确定最末帧对应的原始帧位置、调速后帧位置和播放速度。Further, when the speed adjustment end frame is not the last frame of the original video, some video frames also include a frame after the speed adjustment end frame and the last frame in the original video; the first processor 21 is further configured to: determine The position of the original frame, the position of the frame after the speed adjustment, and the playback speed of the frame after the end of the speed adjustment frame; the original frame position, the position of the frame after the speed adjustment, and the playback speed corresponding to the last frame are determined.
其中,位于调速结束帧后的一帧在原始视频中的帧位置是根据调速中间帧的最后一帧对应的原始帧位置和播放速度确定得到的。Wherein, the frame position of a frame in the original video after the speed adjustment end frame is determined according to the original frame position and the playback speed corresponding to the last frame of the speed adjustment intermediate frame.
进一步的,第一处理器21,还用于:获取目标视频中的每一帧对应的帧区间,帧区间的区间起始帧和区间结束帧为部分视频帧中相邻的两帧;根据目标视频中的每一帧在目标视频中的帧位置、区间起始帧对应的原始帧位置、调速后帧位置和播放速度,确定目标视频中的每一帧在原始视频中对应的帧位置。Further, the first processor 21 is further configured to: obtain the frame interval corresponding to each frame in the target video, the interval start frame and the interval end frame of the frame interval are two adjacent frames in the partial video frame; The frame position of each frame in the video in the target video, the original frame position corresponding to the start frame of the interval, the frame position after speed adjustment, and the playback speed are determined to determine the corresponding frame position of each frame in the target video in the original video.
图12所示装置可以执行图1-图8、图11所示实施例的方法,本实施例未详细描述的部分,可参考对图1-图8、图11所示实施例的相关说明。该技术方案的执行过程和技术效果参见图1-图8、图11所示实施例中的描述,在此不再赘述。The device shown in FIG. 12 can execute the methods of the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11. For parts that are not described in detail in this embodiment, please refer to the related descriptions of the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11. For the implementation process and technical effects of this technical solution, please refer to the description in the embodiments shown in FIG. 1 to FIG. 8 and FIG. 11, and will not be repeated here.
另外,本发明实施例提供了一种计算机可读存储介质,存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,程序指令用于实现上述图1-图8、图11的视频的处理方法。In addition, an embodiment of the present invention provides a computer-readable storage medium. The storage medium is a computer-readable storage medium. The computer-readable storage medium stores program instructions. 11 video processing methods.
图13为本发明实施例提供的一种视频的处理装置的结构示意图;该视频的处理装置可以包括:一个或多个第二处理器41和一个或多个第二存储器42。其中,第二存储器42用于存储用于执行上述图9-图11所示实施例中提供的视频的处理方法的程序。第一处理器41被配置为用于执行第二存储器42中存储的程序。具体的,FIG. 13 is a schematic structural diagram of a video processing apparatus provided by an embodiment of the present invention; the video processing apparatus may include: one or more second processors 41 and one or more second memories 42. Wherein, the second memory 42 is used to store a program for executing the video processing method provided in the embodiment shown in FIG. 9-11. The first processor 41 is configured to execute a program stored in the second memory 42. specific,
程序包括一条或多条计算机指令,其中,一条或多条计算机指令被第二处理器41执行时能够实现如下步骤:The program includes one or more computer instructions, and when one or more computer instructions are executed by the second processor 41, the following steps can be implemented:
用于运行第二存储器42中存储的计算机程序以实现:获取视频调速信息,视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束 帧的帧位置,以及调速初始帧对应的初始速度、调速结束帧对应的目标速度;根据视频调速信息确定原始视频调速后的目标视频对应的调速参数,调速参数包括调速起始时间、原始时长和调速后的目标时长;根据调速参数,获取目标视频。It is used to run the computer program stored in the second memory 42 to achieve: obtain video speed adjustment information, the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and The initial speed corresponding to the initial frame of the speed adjustment and the target speed corresponding to the end frame of the speed adjustment; the speed adjustment parameters corresponding to the target video after the original video speed adjustment are determined according to the video speed adjustment information. The speed adjustment parameters include the speed adjustment start time and original duration And the target duration after speed adjustment; according to the speed adjustment parameters, the target video is obtained.
其中,该视频的处理装置的结构中还可以包括第二通信接口43,用于电子设备与其他设备或通信网络通信。Wherein, the structure of the video processing apparatus may further include a second communication interface 43 for the electronic device to communicate with other devices or a communication network.
进一步的,第二处理器41,还用于:根据视频调速信息,确定原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,部分视频帧包括调速初始帧和位于调速初始帧和调速结束帧之间的调速中间帧;将部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储以获得关联关系集合;根据关联关系集合,确定原始视频调速后的目标视频对应的调速参数。Further, the second processor 41 is further configured to: according to the video speed adjustment information, determine the original frame position, the speed adjusted frame position, and the playback speed corresponding to some video frames in the original video, and some video frames include the speed adjustment initial frame And the speed adjustment intermediate frame located between the speed adjustment initial frame and the speed adjustment end frame; the original frame position, the speed adjustment frame position and the playback speed corresponding to each video frame in the partial video frame are associated and stored to obtain the association Relationship set: According to the association relationship set, determine the speed adjustment parameter corresponding to the target video after the original video speed adjustment.
图13所示装置可以执行图9-图11所示实施例的方法,本实施例未详细描述的部分,可参考对图9-图11所示实施例的相关说明。该技术方案的执行过程和技术效果参见图9-图11所示实施例中的描述,在此不再赘述。The device shown in FIG. 13 can execute the method of the embodiment shown in FIG. 9-11. For parts that are not described in detail in this embodiment, please refer to the related description of the embodiment shown in FIG. 9-11. For the implementation process and technical effects of this technical solution, please refer to the description in the embodiment shown in FIG. 9 to FIG. 11, which will not be repeated here.
另外,本发明实施例提供了一种计算机可读存储介质,存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,程序指令用于实现上述图9-图11的视频的处理方法。In addition, an embodiment of the present invention provides a computer-readable storage medium, the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, and the program instructions are used to implement the video shown in FIGS. 9-11.的处理方法。 Treatment methods.
以上各个实施例中的技术方案、技术特征在与本相冲突的情况下均可以单独,或者进行组合,只要未超出本领域技术人员的认知范围,均属于本申请保护范围内的等同实施例。The technical solutions and technical features in each of the above embodiments can be singly or combined in case of conflict with the present invention. As long as they do not exceed the cognitive scope of those skilled in the art, they all belong to the equivalent embodiments within the protection scope of this application. .
在本发明所提供的几个实施例中,应该理解到,所揭露的视频的处理装置和方法,可以通过其它的方式实现。例如,以上所描述的遥控装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,遥控装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present invention, it should be understood that the disclosed video processing device and method can be implemented in other ways. For example, the embodiments of the remote control device described above are merely illustrative. For example, the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components. Can be combined or integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, remote control devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方, 或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得计算机处理器(processor)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁盘或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of the present invention essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to make a computer processor (processor) execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage media include: U disk, mobile hard disk, Read-Only Memory (ROM), Random Access Memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes.
以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only the embodiments of the present invention, and do not limit the scope of the present invention. Any equivalent structure or equivalent process transformation made by using the content of the description and drawings of the present invention, or directly or indirectly applied to other related technologies In the same way, all fields are included in the scope of patent protection of the present invention.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: It is still possible to modify the technical solutions described in the foregoing embodiments, or equivalently replace some or all of the technical features; these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention range.

Claims (36)

  1. 一种视频的处理方法,其特征在于,包括:A video processing method, characterized by comprising:
    获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置、以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;Acquire video speed adjustment information, the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed corresponding to the speed adjustment initial frame, the The target speed corresponding to the end frame of speed adjustment;
    根据所述视频调速信息确定目标视频中的每一帧在所述原始视频中对应的帧位置,其中,所述目标视频是对所述原始视频进行调速后的视频;Determining, according to the video speed adjustment information, a frame position corresponding to each frame in the target video in the original video, wherein the target video is a video obtained by adjusting the speed of the original video;
    根据所述目标视频中的每一帧在原始视频中对应的帧位置,获取所述目标视频。Obtain the target video according to the corresponding frame position of each frame in the target video in the original video.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述视频调速信息确定目标视频中的每一帧在所述原始视频中对应的帧位置,包括:The method according to claim 1, wherein the determining the corresponding frame position of each frame in the target video in the original video according to the video speed adjustment information comprises:
    根据所述视频调速信息,确定所述原始视频中的部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,所述部分视频帧包括调速初始帧、位于所述调速初始帧与所述调速结束帧之间的调速中间帧;According to the video speed adjustment information, determine the original frame position, the speed-adjusted frame position and the playback speed corresponding to some video frames in the original video. The part of the video frame includes the speed-adjusted initial frame and is located in the speed-adjusted frame. An intermediate frame for speed adjustment between the initial frame and the end frame for speed adjustment;
    根据所述部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一帧在原始视频中对应的帧位置。Determine the frame position corresponding to each frame in the target video in the original video according to the original frame position, the adjusted frame position and the playback speed corresponding to the partial video frames.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一帧在原始视频中对应的帧位置,包括:The method according to claim 2, wherein the determining that each frame of the target video is in the original video according to the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the partial video frames Corresponding frame positions in, including:
    将所述部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储,获得关联关系集合;Storing the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to each video frame in the partial video frames in association to obtain an association relationship set;
    根据所述关联关系集合,确定所述目标视频中的每一帧在原始视频中对应的帧位置。According to the set of association relations, the frame position corresponding to each frame in the target video in the original video is determined.
  4. 根据权利要求2或3所述的方法,其特征在于,所述根据所述视频调速信息,确定所述原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,包括:The method according to claim 2 or 3, wherein the determining the original frame position, the adjusted frame position and the playback speed corresponding to some video frames in the original video according to the video speed adjustment information, include:
    获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度;Get the original frame position corresponding to the initial frame of speed adjustment, the position of the frame after speed adjustment, and the playback speed;
    至少部分地根据所述调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述调速中间帧对应的原始帧位置、调速后帧位置和播放速度。Determine the original frame position, the adjusted frame position, and the playing speed corresponding to the adjusted intermediate frame at least partly according to the original frame position corresponding to the adjusted initial frame, the adjusted frame position, and the playing speed.
  5. 根据权利要求4所述的方法,其特征在于,所述获取调速初始帧所对 应的原始帧位置、调速后帧位置和播放速度,包括:The method according to claim 4, wherein the obtaining the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the initial frame of the speed adjustment includes:
    根据所述原始视频中调速初始帧的帧位置,确定所述调速初始帧所对应的原始帧位置;Determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video;
    根据所述原始视频中调速初始帧的帧位置和所述调速初始帧所对应的初始速度,确定所述调速初始帧所对应的调速后帧位置;Determine the speed-adjusted frame position corresponding to the speed-adjusted initial frame according to the frame position of the speed-adjusted initial frame in the original video and the initial speed corresponding to the speed-adjusted initial frame;
    根据所述调速初始帧所对应的初始速度,确定所述调速初始帧对应的播放速度。Determine the playback speed corresponding to the speed-adjusted initial frame according to the initial speed corresponding to the speed-adjusted initial frame.
  6. 根据权利要求4所述的方法,其特征在于,所述获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,包括:The method according to claim 4, wherein the obtaining the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the initial frame of speed adjustment includes:
    根据所述原始视频中调速初始帧的帧位置,确定所述调速初始帧对应的原始帧位置;Determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video;
    根据所述原始视频中调速初始帧的帧位置和所述原始视频中第一帧的播放速度,确定所述调速初始帧所对应的调速后帧位置;Determine the speed-adjusted frame position corresponding to the speed-adjusted initial frame according to the frame position of the speed-adjusted initial frame in the original video and the playback speed of the first frame in the original video;
    根据所述调速初始帧所对应的初始速度,确定所述调速初始帧对应的播放速度。Determine the playback speed corresponding to the speed-adjusted initial frame according to the initial speed corresponding to the speed-adjusted initial frame.
  7. 根据权利要求4所述的方法,其特征在于,至少部分地根据所述调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述调速中间帧对应的原始帧位置、调速后帧位置和播放速度,包括:The method according to claim 4, wherein the original frame corresponding to the speed-adjusting intermediate frame is determined at least partly based on the original frame position corresponding to the speed-adjusting initial frame, the frame position after the speed-adjusting, and the playback speed. Position, frame position after speed adjustment and playback speed, including:
    至少部分地根据所述调速初始帧对应的原始帧位置和播放速度,确定所述原始视频中待处理帧的帧位置;Determine the frame position of the frame to be processed in the original video at least partly according to the original frame position and the playback speed corresponding to the speed-regulated initial frame;
    根据原始视频中待处理帧的帧位置、原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及所述初始速度、所述目标速度,确定所述待处理帧的插值速度;Determine the frame to be processed according to the frame position of the frame to be processed in the original video, the frame position of the initial frame of speed adjustment in the original video, the frame position of the end frame of speed adjustment in the original video, and the initial speed and the target speed. The interpolation speed;
    当所述待处理帧的插值速度满足预设条件时,则将所述待处理帧作为调速中间帧,并获取所述待处理帧对应的原始帧位置、调速后帧位置和播放速度;否则,则将所述待处理帧丢弃。When the interpolation speed of the frame to be processed satisfies a preset condition, use the frame to be processed as an intermediate frame for speed adjustment, and obtain the original frame position, the frame position after speed adjustment, and the playback speed corresponding to the frame to be processed; Otherwise, the frame to be processed is discarded.
  8. 根据权利要求7所述的方法,其特征在于,所述预设条件包括:The method according to claim 7, wherein the preset condition comprises:
    所述待处理帧的插值速度与所述待处理帧的前一帧对应的播放速度的差值大于或等于预设阈值。The difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed is greater than or equal to a preset threshold.
  9. 根据权利要求8所述的方法,其特征在于,所述待处理帧的播放速度是根据所述待处理帧的插值速度和所述预设阈值确定得到的。The method according to claim 8, wherein the playback speed of the frame to be processed is determined according to the interpolation speed of the frame to be processed and the preset threshold.
  10. 根据权利要求7或8所述的方法,其特征在于,当所述初始速度大于所述目标速度时,所述预设阈值为第一预设阈值,当所述初始速度小于所述目标速度时,所述预设阈值为不同于所述第一预设阈值的第二预设阈值。The method according to claim 7 or 8, wherein when the initial speed is greater than the target speed, the preset threshold is a first preset threshold, and when the initial speed is less than the target speed , The preset threshold value is a second preset threshold value different from the first preset threshold value.
  11. 根据权利要求4所述的方法,其特征在于,当所述调速初始帧并非所述原始视频的第一帧时,所述部分视频帧还包括所述第一帧;The method according to claim 4, wherein when the speed adjustment initial frame is not the first frame of the original video, the partial video frame further includes the first frame;
    所述确定所述原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,还包括:The determining the original frame position, the speed-adjusted frame position, and the playback speed corresponding to some video frames in the original video further includes:
    确定所述第一帧对应的原始帧位置、调速后帧位置和播放速度。Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the first frame.
  12. 根据权利要求4所述的方法,其特征在于,当所述调速结束帧为所述原始视频的最末帧时,所述部分视频帧还包括所述调速结束帧;The method according to claim 4, wherein when the speed adjustment end frame is the last frame of the original video, the partial video frame further comprises the speed adjustment end frame;
    所述确定所述原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,还包括:The determining the original frame position, the frame position after speed adjustment, and the playback speed corresponding to some video frames in the original video further includes:
    确定所述调速结束帧对应的原始帧位置、调速后帧位置和播放速度。Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the speed adjustment end frame.
  13. 根据权利要求12所述的方法,其特征在于,当所述调速结束帧并非所述原始视频的最末帧时,所述部分视频帧还包括所述原始视频中位于所述调速结束帧后的一帧以及所述最末帧;The method according to claim 12, wherein when the speed adjustment end frame is not the last frame of the original video, the partial video frame further includes the speed adjustment end frame in the original video The next frame and the last frame;
    所述确定所述原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,还包括:The determining the original frame position, the frame position after speed adjustment, and the playback speed corresponding to some video frames in the original video further includes:
    确定所述调速结束帧后的一帧对应的原始帧位置、调速后帧位置和播放速度;Determining the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to a frame after the speed adjustment end frame;
    确定所述最末帧对应的原始帧位置、调速后帧位置和播放速度。Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the last frame.
  14. 根据权利要求13所述的方法,其特征在于,所述位于所述调速结束帧后的一帧在所述原始视频中的帧位置是根据所述调速中间帧的最后一帧对应的原始帧位置和播放速度确定得到的。The method according to claim 13, wherein the frame position in the original video of the frame after the speed adjustment end frame is based on the original frame corresponding to the last frame of the speed adjustment intermediate frame. Frame position and playback speed are determined.
  15. 根据权利要求2或3所述的方法,其特征在于,所述根据所述部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一帧在原始视频中对应的帧位置,包括:The method according to claim 2 or 3, characterized in that, according to the original frame position corresponding to the part of the video frame, the frame position after speed adjustment, and the playback speed, it is determined that each frame in the target video is The corresponding frame position in the original video, including:
    获取所述目标视频中的每一帧对应的帧区间,所述帧区间的区间起始帧和区间结束帧为所述部分视频帧中相邻的两帧;Acquiring a frame interval corresponding to each frame in the target video, where the interval start frame and the interval end frame of the frame interval are two adjacent frames in the partial video frames;
    根据所述目标视频中的每一帧在目标视频中的帧位置、所述区间起始帧对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一 帧在原始视频中对应的帧位置。According to the frame position of each frame in the target video in the target video, the original frame position corresponding to the start frame of the interval, the frame position after speed adjustment, and the playback speed, it is determined that each frame in the target video is The corresponding frame position in the original video.
  16. 一种视频的处理方法,其特征在于,包括:A video processing method, characterized by comprising:
    获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;Acquire video speed adjustment information, the video speed adjustment information includes: the frame position of the speed adjustment initial frame in the original video, the frame position of the speed adjustment end frame in the original video, and the initial speed corresponding to the speed adjustment initial frame, the The target speed corresponding to the end frame of speed adjustment;
    根据所述视频调速信息确定所述原始视频调速后的目标视频对应的调速参数,所述调速参数包括调速起始时间、原始时长和调速后的目标时长;Determining, according to the video speed adjustment information, a speed adjustment parameter corresponding to the target video after the speed adjustment of the original video, the speed adjustment parameter including a speed adjustment start time, an original time length, and a target time length after speed adjustment;
    根据所述调速参数,获取所述目标视频。Obtain the target video according to the speed adjustment parameter.
  17. 根据权利要求16所述的方法,其特征在于,所述根据所述视频调速信息确定所述原始视频调速后的目标视频对应的调速参数,包括:The method according to claim 16, wherein the determining the speed adjustment parameter corresponding to the target video after the speed adjustment of the original video according to the video speed adjustment information comprises:
    根据所述视频调速信息,确定所述原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,所述部分视频帧包括调速初始帧和位于调速初始帧和调速结束帧之间的调速中间帧;According to the video speed adjustment information, determine the original frame position, the speed-adjusted frame position, and the playback speed corresponding to some video frames in the original video. The part of the video frame includes the speed-adjusted initial frame and the initial frame and the speed-adjusted initial frame. The speed control intermediate frame between the speed control end frames;
    将所述部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储以获得关联关系集合;Associatively storing the original frame position, the speed-adjusted frame position, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set;
    根据所述关联关系集合,确定所述原始视频调速后的目标视频对应的调速参数。According to the set of association relations, a speed adjustment parameter corresponding to the target video after the speed adjustment of the original video is determined.
  18. 一种视频的处理装置,其特征在于,包括:A video processing device, characterized in that it comprises:
    存储器,用于存储计算机程序;Memory, used to store computer programs;
    处理器,用于运行所述存储器中存储的计算机程序以实现:获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置、以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;根据所述视频调速信息确定目标视频中的每一帧在所述原始视频中对应的帧位置,其中,所述目标视频是对所述原始视频进行调速后的视频;根据所述目标视频中的每一帧在原始视频中对应的帧位置,获取所述目标视频。The processor is configured to run a computer program stored in the memory to achieve: acquiring video speed adjustment information, the video speed adjustment information including: the frame position of the speed adjustment initial frame in the original video, and the speed adjustment end frame of the original video Frame position, and the initial speed corresponding to the initial frame of speed adjustment, and the target speed corresponding to the end frame of speed adjustment; determine the corresponding frame of each frame in the target video in the original video according to the video speed adjustment information Position, wherein the target video is a video obtained by adjusting the speed of the original video; the target video is acquired according to the frame position of each frame in the target video corresponding to the original video.
  19. 根据权利要求18所述的装置,其特征在于,所述处理器,还用于:The device according to claim 18, wherein the processor is further configured to:
    根据所述视频调速信息,确定所述原始视频中的部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,所述部分视频帧包括调速初始帧、位于所述调速初始帧与所述调速结束帧之间的调速中间帧;According to the video speed adjustment information, determine the original frame position, the speed-adjusted frame position and the playback speed corresponding to some video frames in the original video. The part of the video frame includes the speed-adjusted initial frame and is located in the speed-adjusted frame. An intermediate frame for speed adjustment between the initial frame and the end frame for speed adjustment;
    根据所述部分视频帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一帧在原始视频中对应的帧位置。Determine the frame position corresponding to each frame in the target video in the original video according to the original frame position, the adjusted frame position and the playback speed corresponding to the partial video frames.
  20. 根据权利要求19所述的装置,其特征在于,所述处理器,还用于:The device according to claim 19, wherein the processor is further configured to:
    将所述部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储,获得关联关系集合;Storing the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to each video frame in the partial video frames in association to obtain an association relationship set;
    根据所述关联关系集合,确定所述目标视频中的每一帧在原始视频中对应的帧位置。According to the set of association relations, the frame position corresponding to each frame in the target video in the original video is determined.
  21. 根据权利要求19或20所述的装置,其特征在于,所述处理器,还用于:The device according to claim 19 or 20, wherein the processor is further configured to:
    获取调速初始帧所对应的原始帧位置、调速后帧位置和播放速度;Get the original frame position corresponding to the initial frame of speed adjustment, the position of the frame after speed adjustment, and the playback speed;
    至少部分地根据所述调速初始帧所对应的原始帧位置、调速后帧位置和播放速度,确定所述调速中间帧对应的原始帧位置、调速后帧位置和播放速度。Determine the original frame position, the adjusted frame position, and the playing speed corresponding to the adjusted intermediate frame at least partly according to the original frame position corresponding to the adjusted initial frame, the adjusted frame position, and the playing speed.
  22. 根据权利要求21所述的装置,其特征在于,所述处理器,还用于:The device according to claim 21, wherein the processor is further configured to:
    根据所述原始视频中调速初始帧的帧位置,确定所述调速初始帧所对应的原始帧位置;Determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video;
    根据所述原始视频中调速初始帧的帧位置和所述调速初始帧所对应的初始速度,确定所述调速初始帧所对应的调速后帧位置;Determine the speed-adjusted frame position corresponding to the speed-adjusted initial frame according to the frame position of the speed-adjusted initial frame in the original video and the initial speed corresponding to the speed-adjusted initial frame;
    根据所述调速初始帧所对应的初始速度,确定所述调速初始帧对应的播放速度。Determine the playback speed corresponding to the speed-adjusted initial frame according to the initial speed corresponding to the speed-adjusted initial frame.
  23. 根据权利要求21所述的装置,其特征在于,所述处理器,还用于:The device according to claim 21, wherein the processor is further configured to:
    根据所述原始视频中调速初始帧的帧位置,确定所述调速初始帧对应的原始帧位置;Determine the original frame position corresponding to the speed adjustment initial frame according to the frame position of the speed adjustment initial frame in the original video;
    根据所述原始视频中调速初始帧的帧位置和所述原始视频中第一帧的播放速度,确定所述调速初始帧所对应的调速后帧位置;Determine the speed-adjusted frame position corresponding to the speed-adjusted initial frame according to the frame position of the speed-adjusted initial frame in the original video and the playback speed of the first frame in the original video;
    根据所述调速初始帧所对应的初始速度,确定所述调速初始帧对应的播放速度。Determine the playback speed corresponding to the speed-adjusted initial frame according to the initial speed corresponding to the speed-adjusted initial frame.
  24. 根据权利要求21所述的装置,其特征在于,所述处理器,还用于:The device according to claim 21, wherein the processor is further configured to:
    至少部分地根据所述调速初始帧对应的原始帧位置和播放速度,确定所述原始视频中待处理帧的帧位置;Determine the frame position of the frame to be processed in the original video at least partly according to the original frame position and the playback speed corresponding to the speed-regulated initial frame;
    根据原始视频中待处理帧的帧位置、原始视频中调速初始帧的帧位置、 原始视频中调速结束帧的帧位置,以及所述初始速度、所述目标速度,确定所述待处理帧的插值速度;Determine the frame to be processed according to the frame position of the frame to be processed in the original video, the frame position of the initial frame of speed adjustment in the original video, the frame position of the end frame of speed adjustment in the original video, as well as the initial speed and the target speed The interpolation speed;
    当所述待处理帧的插值速度满足预设条件时,则将所述待处理帧作为调速中间帧,并获取所述待处理帧对应的原始帧位置、调速后帧位置和播放速度;否则,则将所述待处理帧丢弃。When the interpolation speed of the frame to be processed satisfies a preset condition, use the frame to be processed as an intermediate frame for speed adjustment, and obtain the original frame position, the frame position after speed adjustment, and the playback speed corresponding to the frame to be processed; Otherwise, the frame to be processed is discarded.
  25. 根据权利要求24所述的装置,其特征在于,所述预设条件包括:The device according to claim 24, wherein the preset condition comprises:
    所述待处理帧的插值速度与所述待处理帧的前一帧对应的播放速度的差值大于或等于预设阈值。The difference between the interpolation speed of the frame to be processed and the playback speed corresponding to the previous frame of the frame to be processed is greater than or equal to a preset threshold.
  26. 根据权利要求25所述的装置,其特征在于,所述待处理帧的播放速度是根据所述待处理帧的插值速度和所述预设阈值确定得到的。The device according to claim 25, wherein the playback speed of the frame to be processed is determined according to the interpolation speed of the frame to be processed and the preset threshold.
  27. 根据权利要求25或26所述的装置,其特征在于,当所述初始速度大于所述目标速度时,所述预设阈值为第一预设阈值,当所述初始速度小于所述目标速度时,所述预设阈值为不同于所述第一预设阈值的第二预设阈值。The device according to claim 25 or 26, wherein when the initial speed is greater than the target speed, the preset threshold is a first preset threshold, and when the initial speed is less than the target speed , The preset threshold value is a second preset threshold value different from the first preset threshold value.
  28. 根据权利要求21所述的装置,其特征在于,当所述调速初始帧并非所述原始视频的第一帧时,所述部分视频帧还包括所述第一帧;The device according to claim 21, wherein when the speed-adjusted initial frame is not the first frame of the original video, the partial video frame further includes the first frame;
    所述处理器,还用于:确定所述第一帧对应的原始帧位置、调速后帧位置和播放速度。The processor is further configured to determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the first frame.
  29. 根据权利要求21所述的装置,其特征在于,当所述调速结束帧为所述原始视频的最末帧时,所述部分视频帧还包括所述调速结束帧;The device according to claim 21, wherein when the speed adjustment end frame is the last frame of the original video, the partial video frame further comprises the speed adjustment end frame;
    所述处理器,还用于:确定所述调速结束帧对应的原始帧位置、调速后帧位置和播放速度。The processor is further configured to determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the speed adjustment end frame.
  30. 根据权利要求29所述的装置,其特征在于,当所述调速结束帧并非所述原始视频的最末帧时,所述部分视频帧还包括所述原始视频中位于所述调速结束帧后的一帧以及所述最末帧;所述处理器,还用于:The apparatus according to claim 29, wherein when the speed adjustment end frame is not the last frame of the original video, the partial video frame further includes the original video at the speed adjustment end frame The next frame and the last frame; the processor is further configured to:
    确定所述调速结束帧后的一帧对应的原始帧位置、调速后帧位置和播放速度;Determining the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to a frame after the speed adjustment end frame;
    确定所述最末帧对应的原始帧位置、调速后帧位置和播放速度。Determine the original frame position, the frame position after the speed adjustment, and the playback speed corresponding to the last frame.
  31. 根据权利要求30所述的装置,其特征在于,所述位于所述调速结束帧后的一帧在所述原始视频中的帧位置是根据所述调速中间帧的最后一帧对应的原始帧位置和播放速度确定得到的。The device according to claim 30, wherein the frame position in the original video of the frame after the speed adjustment end frame is based on the original video corresponding to the last frame of the speed adjustment intermediate frame. Frame position and playback speed are determined.
  32. 根据权利要求19或20所述的装置,其特征在于,所述处理器,还用 于:The device according to claim 19 or 20, wherein the processor is further used for:
    获取所述目标视频中的每一帧对应的帧区间,所述帧区间的区间起始帧和区间结束帧为所述部分视频帧中相邻的两帧;Acquiring a frame interval corresponding to each frame in the target video, where the interval start frame and the interval end frame of the frame interval are two adjacent frames in the partial video frames;
    根据所述目标视频中的每一帧在目标视频中的帧位置、所述区间起始帧对应的原始帧位置、调速后帧位置和播放速度,确定所述目标视频中的每一帧在原始视频中对应的帧位置。According to the frame position of each frame in the target video in the target video, the original frame position corresponding to the start frame of the interval, the frame position after speed adjustment, and the playback speed, it is determined that each frame in the target video is The corresponding frame position in the original video.
  33. 一种视频的处理装置,其特征在于,包括:A video processing device, characterized in that it comprises:
    存储器,用于存储计算机程序;Memory, used to store computer programs;
    处理器,用于运行所述存储器中存储的计算机程序以实现:获取视频调速信息,所述视频调速信息包括:原始视频中调速初始帧的帧位置、原始视频中调速结束帧的帧位置,以及所述调速初始帧对应的初始速度、所述调速结束帧对应的目标速度;根据所述视频调速信息确定所述原始视频调速后的目标视频对应的调速参数,所述调速参数包括调速起始时间、原始时长和调速后的目标时长;根据所述调速参数,获取所述目标视频。The processor is configured to run a computer program stored in the memory to achieve: acquiring video speed adjustment information, the video speed adjustment information including: the frame position of the speed adjustment initial frame in the original video, and the speed adjustment end frame of the original video Frame position, and the initial speed corresponding to the initial frame of speed adjustment, and the target speed corresponding to the end frame of speed adjustment; determine the speed adjustment parameter corresponding to the target video after the original video speed adjustment according to the video speed adjustment information, The speed adjustment parameter includes a speed adjustment start time, an original time length, and a target time length after speed adjustment; and the target video is acquired according to the speed adjustment parameter.
  34. 根据权利要求33所述的装置,其特征在于,所述处理器,还用于:The device according to claim 33, wherein the processor is further configured to:
    根据所述视频调速信息,确定所述原始视频中的部分视频帧对应的原始帧位置、调速后帧位置和播放速度,所述部分视频帧包括调速初始帧和位于调速初始帧和调速结束帧之间的调速中间帧;According to the video speed adjustment information, determine the original frame position, the speed-adjusted frame position, and the playback speed corresponding to some video frames in the original video. The part of the video frame includes the speed-adjusted initial frame and the initial frame and the speed-adjusted initial frame. The speed control intermediate frame between the speed control end frames;
    将所述部分视频帧中的每个视频帧所对应的原始帧位置、调速后帧位置和播放速度进行关联存储以获得关联关系集合;Associatively storing the original frame position, the speed-adjusted frame position, and the playback speed corresponding to each video frame in the partial video frames to obtain an association relationship set;
    根据所述关联关系集合,确定所述原始视频调速后的目标视频对应的调速参数。According to the set of association relations, a speed adjustment parameter corresponding to the target video after the speed adjustment of the original video is determined.
  35. 一种计算机可读存储介质,其特征在于,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于实现权利要求1-15中任意一项所述的视频的处理方法。A computer-readable storage medium, wherein the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, and the program instructions are used to implement any one of claims 1-15 The video processing method described in item.
  36. 一种计算机可读存储介质,其特征在于,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于实现权利要求16-17中任意一项所述的视频的处理方法。A computer-readable storage medium, wherein the storage medium is a computer-readable storage medium, the computer-readable storage medium stores program instructions, and the program instructions are used to implement any one of claims 16-17 The video processing method described in item.
PCT/CN2019/100452 2019-08-13 2019-08-13 Video processing method and apparatus, and storage medium WO2021026785A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/100452 WO2021026785A1 (en) 2019-08-13 2019-08-13 Video processing method and apparatus, and storage medium
CN201980033825.4A CN112154670A (en) 2019-08-13 2019-08-13 Video processing method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/100452 WO2021026785A1 (en) 2019-08-13 2019-08-13 Video processing method and apparatus, and storage medium

Publications (1)

Publication Number Publication Date
WO2021026785A1 true WO2021026785A1 (en) 2021-02-18

Family

ID=73891558

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/100452 WO2021026785A1 (en) 2019-08-13 2019-08-13 Video processing method and apparatus, and storage medium

Country Status (2)

Country Link
CN (1) CN112154670A (en)
WO (1) WO2021026785A1 (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040179825A1 (en) * 2003-03-11 2004-09-16 Im Jin Seok Digital video record/playback apparatus and playback method thereof
CN101075949A (en) * 2006-05-15 2007-11-21 中兴通讯股份有限公司 Method for changing fluid-medium file broadcasting speed
CN101534405A (en) * 2004-03-31 2009-09-16 松下电器产业株式会社 Video recording device for recording variable frame rate, multiplexing method, video coding method, program, and recording medium
US20140003516A1 (en) * 2012-06-28 2014-01-02 Divx, Llc Systems and methods for fast video startup using trick play streams
US20140359678A1 (en) * 2013-05-30 2014-12-04 Sonic Ip, Inc. Device video streaming with trick play based on separate trick play files
US9025927B2 (en) * 2009-03-25 2015-05-05 Cyberlink Corp. Systems and methods of variable frame rate playback
CN104702975A (en) * 2015-03-24 2015-06-10 北京中熙正保远程教育技术有限公司 Flash video variable-speed playing method for remote teaching
CN104869430A (en) * 2015-05-18 2015-08-26 北京中熙正保远程教育技术有限公司 Video speed multiplication playing method and apparatus

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8170396B2 (en) * 2007-04-16 2012-05-01 Adobe Systems Incorporated Changing video playback rate
US8233772B1 (en) * 2007-04-16 2012-07-31 Adobe Systems Incorporated Generating transitions for remapping video playback time
US8978077B2 (en) * 2009-02-23 2015-03-10 Qualcomm Incorporated Video content presentation
CN102547192B (en) * 2010-12-21 2017-12-29 新奥特(北京)视频技术有限公司 A kind of method that fluid drive broadcasting and playback function are set to video image
CN104616338B (en) * 2015-01-26 2018-02-27 江苏如意通动漫产业有限公司 The consistent speed change interpolating method of space-time based on 2 D animation

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040179825A1 (en) * 2003-03-11 2004-09-16 Im Jin Seok Digital video record/playback apparatus and playback method thereof
CN101534405A (en) * 2004-03-31 2009-09-16 松下电器产业株式会社 Video recording device for recording variable frame rate, multiplexing method, video coding method, program, and recording medium
CN101075949A (en) * 2006-05-15 2007-11-21 中兴通讯股份有限公司 Method for changing fluid-medium file broadcasting speed
US9025927B2 (en) * 2009-03-25 2015-05-05 Cyberlink Corp. Systems and methods of variable frame rate playback
US20140003516A1 (en) * 2012-06-28 2014-01-02 Divx, Llc Systems and methods for fast video startup using trick play streams
US20140359678A1 (en) * 2013-05-30 2014-12-04 Sonic Ip, Inc. Device video streaming with trick play based on separate trick play files
CN104702975A (en) * 2015-03-24 2015-06-10 北京中熙正保远程教育技术有限公司 Flash video variable-speed playing method for remote teaching
CN104869430A (en) * 2015-05-18 2015-08-26 北京中熙正保远程教育技术有限公司 Video speed multiplication playing method and apparatus

Also Published As

Publication number Publication date
CN112154670A (en) 2020-12-29

Similar Documents

Publication Publication Date Title
US10372991B1 (en) Systems and methods that leverage deep learning to selectively store audiovisual content
US11582497B2 (en) Methods, systems, processors and computer code for providing video clips
US10452919B2 (en) Detecting segments of a video program through image comparisons
US10452713B2 (en) Video analysis techniques for improved editing, navigation, and summarization
US11277562B2 (en) Image stabilization using machine learning
US10623784B2 (en) Content-adaptive digital content adjustment method and system
JP2022509502A (en) Real-time video special effects system and method
CN110022498B (en) Method and device for realizing code rate switching
US20210120230A1 (en) Image encoding control method and apparatus, storage medium, and unmanned aerial vehicle
WO2023185175A1 (en) Video processing method and apparatus
CN111970565A (en) Video data processing method and device, electronic equipment and storage medium
US20140205020A1 (en) Real-time transcoding method and device
CN113709560B (en) Video editing method, device, equipment and storage medium
WO2021026785A1 (en) Video processing method and apparatus, and storage medium
US10122907B1 (en) Integration of transducer outputs in a conferencing system
WO2023207513A1 (en) Video processing method and apparatus, and electronic device
WO2019140651A1 (en) Video processing method and device
US20060080591A1 (en) Apparatus and method for automated temporal compression of multimedia content
US20120246269A1 (en) Data processing apparatus, data processing method, and computer program product
CN114650448A (en) Video recording speed and speed action adjusting method and system, storage medium and computer
JP2007306322A (en) Video reproduction control apparatus, method and program
WO2020024197A1 (en) Video processing method and apparatus, and computer readable medium
US20140150043A1 (en) Scene fragment transmitting system, scene fragment transmitting method and recording medium
KR20240037556A (en) Method, computer device, and computer program for enhancing video quality based on artificial intelligence
JP2022039452A (en) Reception terminal, distribution server, reception method and reception program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19941617

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19941617

Country of ref document: EP

Kind code of ref document: A1