Video processing method, device, computer equipment and computer readable storage medium

By displacing, mirroring and blurring multiple videos, high-quality transition videos are generated, which solves the problem of poor video merging effect in the prior art and achieves a smoother and more natural video transition effect.

CN117729369BActive Publication Date: 2025-02-14SHUXING TECH (BEIJING) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310446558.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-24
Publication Date
2025-02-14
Estimated Expiration
2043-04-24

AI Technical Summary

Technical Problem

The prior art uses simple splicing when merging multiple videos, resulting in poor merging effects.

Method used

By obtaining at least one frame of the two videos, and performing displacement and mirroring processing according to the transition direction, the transition video frame is generated and blurred, and finally the processed video frames are merged to generate high-quality transition video.

Benefits of technology

It improves the transition effect after video merging, making the video merging process more smooth and natural, and improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117729369B_ABST
    Figure CN117729369B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a video processing method, apparatus, computer equipment and computer-readable storage medium, which obtain a first video frame and a second video frame, wherein the first video frame includes the last video frame of the first video frame and the second video frame includes the first video frame of the second video frame; based on the transition direction of the first video and the second video, a first displacement operation is performed on the first image content in the first video frame, and the image area vacated after the displacement is filled based on a mirroring process to obtain a first transition video frame; based on the transition direction, a second displacement operation is performed on the second image content of the second video frame, and the image area vacated after the displacement is filled based on a mirroring process to obtain a second transition video frame; blurring is performed on the first transition video frame and the second transition video frame respectively; and the processed transition video frames are merged to obtain a transition video, and the merging effect of the first video and the second video can be improved through the transition video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a video processing method, apparatus, computer equipment and computer-readable storage medium. Background Art

[0002] With the development of network technology, the forms of content shared by people on social platforms are becoming more and more diverse, such as text, pictures, videos and any combination thereof. When a user shoots multiple videos, they can share them as multiple videos, or merge multiple videos into one video and share it as one video. Currently, multiple videos are usually merged in a simple splicing method, and the video merging effect generated by this method is poor. Summary of the invention

[0003] The embodiments of the present application provide a video processing method, apparatus, computer device and computer-readable storage medium, which improve the video merging effect by generating transition videos.

[0004] A video processing method provided in an embodiment of the present application includes:

[0005] Acquire at least one first video frame of a first video, at least one second video frame of a second video, and a transition direction between the first video and the second video, wherein the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame;

[0006] Performing a first shift operation on the first image content in the first video frame based on the transition direction, and filling at least part of the first image content into the image area vacated after the first video frame is shifted based on mirroring, to obtain a first transition video frame;

[0007] Performing a second shift operation on the second image content of the second video frame based on the transition direction, and filling at least part of the second image content into the image area vacated after the second video frame is shifted based on mirroring, to obtain a second transition video frame;

[0008] According to the transition direction, blur processing is performed on the first transition video frame and the second transition video frame to obtain a first processed transition video frame and a second processed transition video frame;

[0009] The first processed transition video frame and the second processed transition video frame are merged to obtain a transition video of the first video and the second video.

[0010] Accordingly, an embodiment of the present application further provides a video processing device, including:

[0011] An acquisition unit, configured to acquire at least one first video frame of a first video, at least one second video frame of a second video, and a transition direction between the first video and the second video, wherein the first video frame includes a last video frame of the first video frame, and the second video frame includes a first video frame of the second video frame;

[0012] A first shift unit is used to perform a first shift operation on the first image content in the first video frame based on the transition direction, and fill at least part of the first image content into the image area vacated after the first video frame is shifted based on a mirroring process, so as to obtain a first transition video frame;

[0013] A second shifting unit is used to perform a second shifting operation on the second image content of the second video frame based on the transition direction, and fill at least part of the second image content into the image area vacated after the second video frame is shifted based on a mirroring process, so as to obtain a second transition video frame;

[0014] A fuzzy processing unit, used for performing fuzzy processing on the first transition video frame and the second transition video frame according to the transition direction, to obtain a first processed transition video frame and a second processed transition video frame;

[0015] A merging unit is used to merge the first processed transition video frame and the second processed transition video frame to obtain a transition video of the first video and the second video.

[0016] In one embodiment, the first displacement unit comprises:

[0017] A displacement subunit, configured to perform a displacement operation on the first image content of the first video frame on a preset canvas based on the transition direction;

[0018] a filling subunit, configured to fill at least a portion of the first image content into an image area vacated in the preset canvas after the first video frame is shifted based on mirror processing;

[0019] The video frame acquisition subunit is used to acquire multiple frames of first transition video frames during the displacement of the first video frame, wherein each frame of the first transition video frame includes the image content and the filled image content of the first video frame in the preset canvas under different displacements.

[0020] In one embodiment, the first displacement unit comprises:

[0021] a displacement information acquisition subunit, configured to acquire a pre-configured movement rate and movement direction of performing a first displacement operation on the first video frame;

[0022] The displacement operation subunit is used to perform a first displacement operation on the first video frame based on the movement rate and the movement direction.

[0023] In one embodiment, the fuzzy processing unit includes:

[0024] A blur subunit is used to blur the first transition video frame and the second transition video frame according to the transition direction to obtain a first blurred transition video frame and a second blurred transition video frame;

[0025] A first distortion subunit is used to perform distortion processing on the first blurred transition video frame to obtain the first processed transition video frame;

[0026] The second distortion subunit is used to perform distortion processing on the second blurred transition video frame to obtain the second processed transition video frame.

[0027] In one embodiment, the first distortion subunit includes:

[0028] An offset calculation module, used for calculating an offset angle and an offset distance of each pixel in the first blurred transition video frame according to the coordinates of a preset distortion center and the coordinates of each pixel in the first blurred transition video frame;

[0029] A distortion processing module, used for performing distortion processing on the offset distance to obtain a distorted offset distance;

[0030] A coordinate calculation module, used for calculating the distorted coordinates corresponding to each pixel in the first blurred transition video frame based on the distorted offset distance and the offset angle;

[0031] The assignment module is used to assign the pixel value of each pixel in the first blurred transition video frame to the corresponding pixel indicated by the distorted coordinates to obtain the first processed transition video frame.

[0032] In one embodiment, the blurring unit comprises:

[0033] A fuzzy step length determination subunit, used for obtaining a preset transition duration, and determining the fuzzy step lengths of the first transition video frame and the second transition video frame respectively according to the transition duration;

[0034] A first processing subunit is used to perform blur processing on the first transition video frame according to the blur step size of the first transition video frame and the transition direction to obtain the first processed transition video frame;

[0035] The second processing subunit is used to perform blur processing on the second transition video frame according to the blur step size of the second transition video frame and the transition direction to obtain the second processed transition video frame.

[0036] In one embodiment, after merging the first processed transition video frame and the second processed transition video frame to obtain a transition video of the first video and the second video, the method further includes:

[0037] A merging unit, configured to merge the first video, the transition video and the second video to obtain a merged video;

[0038] A playback unit is used to play the merged video and, when the first video ends, play the transition video and switch to play the second video.

[0039] Correspondingly, an embodiment of the present application also provides a computer device, including a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any video processing method provided in the embodiment of the present application.

[0040] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, which is used to store a computer program, and the computer program is loaded by a processor to execute any video processing method provided in the embodiment of the present application.

[0041] The embodiment of the present application obtains at least one first video frame of the first video, at least one second video frame of the second video, and the transition direction of the first video and the second video, wherein the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame; performs a first displacement operation on the first image content in the first video frame based on the transition direction, and fills at least part of the image content in the first image content into the image area vacated after the displacement of the first video frame based on the mirror processing, so as to obtain a first transition video frame; performs a second displacement operation on the second image content of the second video frame based on the transition direction, and fills at least part of the image content in the second image content into the image area vacated after the displacement of the second video frame based on the mirror processing, so as to obtain a second transition video frame; blurs the first transition video frame and the second transition video frame according to the transition direction, respectively, so as to obtain a first processed transition video frame and a second processed transition video frame; merges the first processed transition video frame and the second processed transition video frame, so as to obtain a transition video between the first video and the second video.

[0042] The embodiment of the present application performs a displacement operation on the first video frame of the first video and the second video frame of the second video, so that the first transition video frame and the second transition video frame produce the displacement effect of the image content, and blurs the first transition video frame and the second transition video frame according to the transition direction to generate a transition video presenting a dynamic switching effect. The first video and the second video are merged through the transition video. The merged video has rich transition effects, which can improve the merging effect of the first video and the second video. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 is a flow chart of a video processing method provided by an embodiment of the present application;

[0045] Figure 2 is a schematic diagram of the effect of displacement operation and filling provided in an embodiment of the present application;

[0046] Figure 3 is a schematic diagram of a fuzzy curve of fuzzy processing provided in an embodiment of the present application;

[0047] Figure 4 It is a schematic diagram of the effect of blur processing provided in an embodiment of the present application;

[0048] Figure 5 is a schematic diagram of the effects of different distortion processing provided by the embodiments of the present application;

[0049] Figure 6 It is a schematic diagram of the effect of the transition video provided in the embodiment of the present application;

[0050] Figure 7 is a schematic diagram of a video processing device provided in an embodiment of the present application;

[0051] Figure 8 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0053] The embodiment of the present application provides a video processing method, apparatus, computer equipment and computer readable storage medium. The video processing apparatus can be integrated in a computer equipment, which can be a server or a terminal.

[0054] The terminal may include a mobile phone, a wearable smart device, a tablet computer, a laptop computer, a personal computer (PC), and a vehicle-mounted computer.

[0055] Among them, the server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.

[0056] It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments.

[0057] This embodiment will be described from the perspective of a video processing device. The video processing device may be integrated into a computer device, which may be a server or a terminal.

[0058] The embodiment of the present application provides a video processing method, such as Figure 1 As shown, the specific process of the video processing method can be as follows:

[0059] 101. Acquire at least one first video frame of a first video, at least one second video frame of a second video, and a transition direction between the first video and the second video, wherein the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame.

[0060] The transition direction may be the direction in which the second video appears on the display screen. For example, if the second video enters the display from the left side of the screen, and correspondingly, the first video exits the display toward the right side of the screen, the transition direction is from right to left. Optionally, the second video may also enter the display from the right side of the screen, enter the display from the top of the screen, or enter the display from the bottom of the screen, and correspondingly, the first video exits the display from the left side of the screen, exits the display from the bottom of the screen, or exits the display from the top of the screen.

[0061] The first video and the second video may be two videos played adjacently, for example, after the first video is played, the second video is played.

[0062] The first video frame may be the last video frame in the first video, or may include the last video frame and other video frames in the first video. For example, the first video frame may be the last m video frames in the first video, where m>1.

[0063] The second video frame may be the first video frame in the second video, or may include the first video frame and other video frames in the second video. For example, the second video frame may be the first n video frames in the second video, where n>1.

[0064] For example, a client page may be provided for users to upload material videos for generating transition videos. Users may upload two or more material videos, and the terminal may obtain any two adjacent videos as the first video and the second video according to the order of the material videos uploaded by the user.

[0065] Assuming that the user has uploaded video A, video B, and video C, video A can be used as the first video and video B as the second video, or video B can be used as the first video and video C as the second video, and a transition video between video A and video B and a transition video between video B and video C can be generated respectively.

[0066] 102. Perform a first shift operation on the first image content in the first video frame based on the transition direction, and fill at least part of the first image content into the image area vacated after the first video frame is shifted based on mirroring, to obtain a first transition video frame.

[0067] The first image content may be image content contained in the first video frame, and the image content may be composed of a pixel value of each pixel in the video frame.

[0068] The first displacement operation may be to move the first video frame in a transition direction.

[0069] For example, the first video frame may be moved in the transition direction. Since the initial position of the first video frame is just the position where the complete video frame can be displayed on the screen, Figure 2 As shown, the first video frame is moved in the transition direction, part of the image content of the first video frame is not displayed on the screen, and a blank image area appears. Therefore, part of the image content in the first video frame can be filled into the blank image area through mirroring.

[0070] When there is only one first video frame, multiple video frames can be acquired during the process of performing the first shift operation on the first video frame, each of which has a different moving distance, and a first transition video frame can be generated.

[0071] When there are multiple first video frames, the displacement corresponding to each first video frame may be different, and the above operation is performed on each first video frame to obtain a first transition video frame.

[0072] In one embodiment, it can be implemented by a canvas, the image content on the canvas is the content displayed on the screen, and part of the image content in the video frame that is moved out of the canvas cannot be displayed on the screen, that is, in one embodiment, the step of "performing a first displacement operation on the first image content in the first video frame based on the transition direction, and filling at least part of the image content in the first image content into the image area vacated after the first video frame is shifted based on the mirroring process to obtain a first transition video frame" may specifically include:

[0073] Performing a displacement operation on the first image content of the first video frame on the preset canvas based on the transition direction;

[0074] Filling at least a portion of the first image content into an image area left vacant in the preset canvas after the first video frame is shifted based on the mirroring process;

[0075] During the displacement process of the first video frame, a plurality of first transition video frames are obtained, wherein each first transition video frame includes the image content of the first video frame and the filled image content in the preset canvas under different displacements.

[0076] For example, a canvas can be set in advance, and the first video frame can be placed in a layer on the canvas, and then the first video frame can be moved in the transition direction. As the first video frame moves, an area covered by a layer without image content (i.e., an image area vacated in the preset canvas) will be vacated in the canvas, and the first video frame will be mirrored to fill the area without image content in the layer.

[0077] During the displacement of the first video frame, multiple transition images are obtained, which are image contents in the canvas under different displacements of the first video frame, so the size of the transition image is the same as the size of the canvas.

[0078] Moving the first video frame in the transition direction may be uniform movement or variable speed movement, and information such as the end point, movement speed, and movement direction of the first video frame may be pre-set to perform a first displacement operation on the first video frame. That is, in one embodiment, the step of "performing a first displacement operation on the first image content in the first video frame based on the transition direction" may specifically include:

[0079] Acquire a preconfigured moving speed and moving direction for performing a first displacement operation on a first video frame;

[0080] A first shift operation is performed on the first video frame based on the moving speed and the moving direction.

[0081] The moving rate may be the speed of moving the first video frame, and the moving rate may be a fixed rate or a variable rate, for example, the moving rate increases from the beginning of the transition.

[0082] For example, the developer may set the transition movement rate and movement in advance in a computer program that implements the video processing method provided in the embodiment of the present application, or provide a page to the user or operator through the client for the user or operator to set the movement rate and movement direction.

[0083] A first shift operation is performed on the first video frame according to a preconfigured moving speed and moving direction.

[0084] 103. Perform a second shift operation on the second image content of the second video frame based on the transition direction, and fill at least part of the second image content into the image area vacated after the second video frame is shifted based on mirroring, to obtain a second transition video frame.

[0085] The transition video is a transition animation between the first video and the second video. The transition video shows the dynamic effect of the first video gradually exiting and the second video gradually entering. Therefore, when there is only one frame of the second video, the second video frame can be first moved in the opposite direction of the transition direction to the end position (which can be pre-set), and then moved in the transition direction at the moving speed, creating a dynamic effect of the second video moving from far to near.

[0086] At this time, the second displacement operation includes two operations. First, the second video frame is moved to the end position, and part of the image area in the second video frame is filled into the blank image area generated by moving the second video frame, and then the filled video frame is moved in the transition direction.

[0087] In the process of the second frequency frame moving in the transition direction, multiple video frames can be acquired, each of which has a different moving distance, to obtain multiple second transition video frames.

[0088] When there are multiple second video frames, the end position corresponding to each second video frame may be different, and each second video frame is moved to the corresponding end position to obtain multiple second transition video frames.

[0089] At this time, the displacement direction of the second displacement operation is opposite to the displacement direction of the first displacement operation, and the second video frame is moved to the target position in the opposite direction of the transition direction.

[0090] In one embodiment, the duration occupied by the first transition video frame and the second transition video frame can be set according to the transition time. Assuming that the transition time is 1s and the transition direction is from right to left, then before 0.5s, the first video frame is moved to the left and fills the image area vacated by moving to the left. At 0.5s, the second video frame is moved to the right to a specified position and fills the image area vacated by moving to the left. After 0.5s, the second video frame is moved to the left. The duration of the first transition video frame and the second transition video frame generated thereby each occupies half of the transition video.

[0091] 104. Perform blur processing on the first transition video frame and the second transition video frame according to the transition direction to obtain a first processed transition video frame and a second processed transition video frame.

[0092] Step 102 and step 103 can achieve the effect of creating the position movement of the image content in the video frame, and blur processing based on the transition direction can achieve the dynamic effect of creating the rapid movement of the image content.

[0093] For example, if the transition direction is horizontal, the first transition video frame and the second transition video frame may be horizontally blurred; if the transition direction is vertical, the first transition video frame and the second transition video frame may be vertically blurred.

[0094] Optionally, different step sizes may be set in different time periods according to the duration of the transition video (i.e., the transition duration). For example, the blur degree of the transition video may be first enhanced and then weakened. That is, in one embodiment, the step of "blurring the first transition video frame and the second transition video frame according to the transition direction to obtain a first processed transition video frame and a second processed transition video frame" may specifically include:

[0095] Obtaining a preset transition duration, and determining blur steps of the first transition video frame and the second transition video frame respectively according to the transition duration;

[0096] According to the blur step length of the first transition video frame, blurring the first transition video frame to obtain a first processed transition video frame;

[0097] According to the blur step length of each second transition video frame, blur processing is performed on the second transition video frame to obtain a second processed transition video frame.

[0098] The transition time may be the video duration of the generated transition video between the first video and the second video, and the number of video frames to be acquired may be determined according to the transition time.

[0099] A blur step range can be set, for example, [0,4]. Assuming the transition time is 1s, the duration of the video containing the image content of the first video frame in the transition video can be 1 / 2s, and the duration of the video containing the image content of the second video frame can be 1 / 2s. Then the blur step gradually increases from 0 to 4 within 0-0.5s, and gradually decreases from 4 to 0 within 0.5s-1s. Optionally, the blur step can be set as follows: Figure 3 The fuzziness value curve shown sets the fuzziness step size range.

[0100] The number of video frames that need to be acquired when performing a first shift operation on a first video frame and the number of video frames that need to be acquired when performing a second shift operation on a second video frame can be determined according to the transition time.

[0101] When the first shift operation is performed on the first video frame, multiple first transition video frames can be obtained, and the blur step size of each first transition video frame can be determined according to the blur step size range. Similarly, the blur step size of each second transition video frame can be obtained.

[0102] The first transition video frame is blurred according to the blur step length of each first transition video frame to obtain a first processed transition video frame.

[0103] The second transition video frame is blurred according to the blur step length of each second transition video frame to obtain a second processed transition video frame.

[0104] Optionally, you can also set the number of iterations for the fuzzy processing. For example, you can set it to iterate 3 times, and the effect of each iteration is as follows: Figure 4 shown.

[0105] In order to achieve a better dynamic effect of rapid movement, distortion processing may be performed after blurring. That is, in one embodiment, the step of "blurring the first transition video frame and the second transition video frame according to the transition direction to obtain the first processed transition video frame and the second processed transition video frame" may specifically include:

[0106] According to the transition direction, the first transition video frame and the second transition video frame are blurred to obtain a first blurred transition video frame and a second blurred transition video frame;

[0107] Performing distortion processing on the first blurred transition video frame to obtain a first processed transition video frame;

[0108] The second blurred transition video frame is distorted to obtain a second processed transition video frame.

[0109] For example, the first transition video frame and the second transition video frame are blurred according to the transition direction to obtain a first blurred transition video frame and a second blurred transition video frame; the first blurred transition video frame is distorted to obtain a first processed transition video frame; the second blurred transition video frame is distorted to obtain a second processed transition video frame.

[0110] Distortion processing can be barrel distortion and pincushion distortion. The effects of barrel distortion and pincushion distortion can be as follows: Figure 5 As shown, a position in the middle of the first blurred transition video frame and the second blurred transition video frame can be selected as the distortion center, and the first blurred video frame and the second blurred video frame are distorted based on the distortion center. That is, in one embodiment, the step of "distorting the first blurred transition video frame to obtain a first processed transition video frame" includes:

[0111] Calculating the offset angle and offset distance of each pixel in the first blurred transition video frame according to the coordinates of the preset distortion center and the coordinates of each pixel in the first blurred transition video frame;

[0112] Performing distortion processing on the offset distance to obtain the distorted offset distance;

[0113] Based on the distorted offset distance and the offset angle, the distorted coordinates corresponding to each pixel in the first blurred transition video frame are calculated;

[0114] The pixel value of each pixel in the first blurred transition video frame is assigned to the pixel indicated by the corresponding distorted coordinates to obtain the first processed transition video frame.

[0115] For example, a distortion center (u0, v0) may be pre-set. The distortion center may be set according to the transition direction. Assuming that the transition direction is from right to left, the distortion center of the first blurred video frame may be set on the right side of the first video frame, and the distortion center of the second blurred video frame may be set on the left side of the second video frame, so that the first blurred video frame and the second blurred video frame present a barrel or pincushion distortion as a whole.

[0116] According to the coordinates (u, v) of each pixel in the first blurred transition video frame, the offset st of each pixel from the preset distortion center is calculated, and then the polar angle θ and polar radius r0 of the offset st are calculated to obtain the offset angle and offset distance r0 of each pixel in the first blurred transition video frame. The offset distance r1 after distortion is calculated according to the formula: Where r0 is the offset distance, and the parameter k controls the intensity of the distortion. When k is a positive number, barrel distortion will occur; when k is a negative number, pincushion distortion will occur; when k is 0, no distortion will occur.

[0117] When l is a negative number, the distortion is most obvious in the left area of ​​the transition video frame after the first blur, and the degree of distortion gradually decreases from the left to the right. The distortion is most obvious in the right area of ​​the transition video frame after the second blur, and the degree of distortion gradually decreases from the right to the left, presenting a pincushion distortion as a whole.

[0118] Then, according to the offset distance after distortion, the pixel coordinates after offset are calculated: u1=0+1cosθ, v1=0+1sinθ, (u1, v1) are the coordinates after distortion.

[0119] The pixel value of the pixel indicated by the coordinates (u, v) is assigned to the pixel indicated by the distorted coordinates (u1, v1), and the above process is performed on each pixel in the first blurred transition video frame to obtain the first processed transition video frame. Similarly, the second processed transition video frame can be obtained by performing the distortion process on the second blurred transition video frame.

[0120] 105. Merge the first processed transition video frame and the second processed transition video frame to obtain a transition video of the first video and the second video.

[0121] The first processed transition video frame and the second processed transition video frame obtained in steps 101-104 are merged to obtain a transition video between the first video and the second video. The effect diagram of the transition video can be shown as follows: Figure 6 As shown, a dynamic switching effect is presented in which the first video exits the screen display and the second video enters the screen display.

[0122] After obtaining the transition video, the first video, the transition video, and the second video may be merged to obtain a complete video. That is, in one embodiment, after the step of "merging the first processed transition video frame and the second processed transition video frame to obtain the transition video of the first video and the second video", the video processing method provided in the embodiment of the present application may further include:

[0123] Merge the first video, the transition video, and the second video to obtain a merged video;

[0124] When playing the merged video, when the first video ends, play the transition video and switch to the second video.

[0125] For example, the first video, the transition video and the second video can be spliced ​​into one video to obtain a merged video. When the merged video is played, the first video is played first. When the first video finishes playing, the transition video is played, and when the transition video finishes playing, the second video is switched to play.

[0126] As can be seen from the above, the embodiment of the present application obtains at least one first video frame of the first video, at least one second video frame of the second video, and the transition direction of the first video and the second video, the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame; based on the transition direction, a first displacement operation is performed on the first image content in the first video frame, and based on the mirror processing, at least part of the image content in the first image content is filled into the image area vacated after the first video frame is displaced, so as to obtain a first transition video frame; based on the transition direction, a second displacement operation is performed on the second image content of the second video frame, and based on the mirror processing, at least part of the image content in the second image content is filled into the image area vacated after the second video frame is displaced, so as to obtain a second transition video frame; according to the transition direction, the first transition video frame and the second transition video frame are blurred respectively to obtain a first processed transition video frame and a second processed transition video frame; the first processed transition video frame and the second processed transition video frame are merged to obtain a transition video of the first video and the second video.

[0127] The embodiment of the present application performs a displacement operation on the first video frame of the first video and the second video frame of the second video, so that the first transition video frame and the second transition video frame produce the displacement effect of the image content, and blurs the first transition video frame and the second transition video frame according to the transition direction to generate a transition video presenting a dynamic switching effect. The first video and the second video are merged through the transition video. The merged video has rich transition effects, which can improve the merging effect of the first video and the second video.

[0128] In order to better implement the video processing method provided in the embodiment of the present application, a video processing device is also provided in one embodiment. The meanings of the terms are the same as those in the above-mentioned video processing method, and the specific implementation details can refer to the description in the method embodiment.

[0129] The video processing device can be integrated into a computer device, such as Figure 7 As shown, the video processing device may include: an acquisition unit 301, a first displacement unit 302, a second displacement unit 303, a blur processing unit 304 and a merging unit 305, which are specifically as follows:

[0130] (1) An acquisition unit 301 is used to acquire at least one first video frame of a first video, at least one second video frame of a second video, and a transition direction between the first video and the second video, wherein the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame.

[0131] (2) A first shift unit 302: configured to perform a first shift operation on the first image content in the first video frame based on the transition direction, and fill at least part of the image content in the first image content into the image area vacated after the first video frame is shifted based on a mirroring process, so as to obtain a first transition video frame.

[0132] In one embodiment, the first shift unit may include a shift subunit, a filling subunit and a video frame acquisition subunit, specifically:

[0133] The displacement subunit is used to perform a displacement operation on the first image content of the first video frame on a preset canvas based on the transition direction;

[0134] A filling subunit: used for filling at least part of the image content in the first image content into the image area vacated in the preset canvas after the first video frame is shifted based on the mirror processing;

[0135] Video frame acquisition subunit: used to acquire multiple frames of first transition video frames during the displacement process of the first video frame, wherein each frame of the first transition video frame includes the image content of the first video frame in the preset canvas under different displacements and the filled image content.

[0136] In one embodiment, the first displacement unit may include a displacement information acquisition subunit and a displacement operation subunit, specifically:

[0137] The displacement information acquisition subunit is used to acquire a pre-configured movement rate and movement direction of performing a first displacement operation on the first video frame;

[0138] The displacement operation subunit is used to perform a first displacement operation on the first video frame based on the movement rate and the movement direction.

[0139] (3) A second shift unit 303: configured to perform a second shift operation on the second image content of the second video frame based on the transition direction, and fill at least part of the second image content into the image area vacated after the second video frame is shifted based on a mirroring process, so as to obtain a second transition video frame.

[0140] (4) A blur processing unit 304 is used to perform blur processing on the first transition video frame and the second transition video frame according to the transition direction to obtain a first processed transition video frame and a second processed transition video frame.

[0141] In one embodiment, the blur processing unit may include a blur subunit, a first distortion subunit and a second distortion subunit. Specifically:

[0142] A blur subunit is used to blur the first transition video frame and the second transition video frame according to the transition direction to obtain a first blurred transition video frame and a second blurred transition video frame;

[0143] A first distortion subunit: used for performing distortion processing on the first blurred transition video frame to obtain a first processed transition video frame;

[0144] The second distortion subunit is used to perform distortion processing on the second blurred transition video frame to obtain a second processed transition video frame.

[0145] In one embodiment, the first distortion subunit may include an offset calculation module, a distortion processing module, a coordinate calculation module and an assignment module, specifically:

[0146] An offset calculation module is used to calculate an offset angle and an offset distance of each pixel in the first blurred transition video frame according to the coordinates of the preset distortion center and the coordinates of each pixel in the first blurred transition video frame;

[0147] Distortion processing module: used to perform distortion processing on the offset distance to obtain the offset distance after distortion;

[0148] Coordinate calculation module: used to calculate the distorted coordinates corresponding to each pixel in the first blurred transition video frame based on the distorted offset distance and offset angle;

[0149] The assignment module is used to assign the pixel value of each pixel in the first blurred transition video frame to the corresponding pixel indicated by the distorted coordinates to obtain the first processed transition video frame.

[0150] In one embodiment, the fuzzy unit may include a fuzzy step size determining subunit, a first processing subunit and a second processing subunit, specifically:

[0151] A fuzzy step length determination subunit is used to obtain a preset transition duration, and determine the fuzzy step lengths of the first transition video frame and the second transition video frame respectively according to the transition duration;

[0152] A first processing subunit is used for performing blur processing on the first transition video frame according to the blur step length and transition direction of the first transition video frame to obtain a first processed transition video frame;

[0153] The second processing subunit is used to perform blur processing on the second transition video frame according to the blur step size and transition direction of the second transition video frame to obtain a second processed transition video frame.

[0154] (5) A merging unit 305: used to merge the first processed transition video frame and the second processed transition video frame to obtain a transition video of the first video and the second video.

[0155] In one embodiment, after merging the first processed transition video frame and the second processed transition video frame to obtain a transition video of the first video and the second video, the method may include a merging unit and a playing unit, specifically:

[0156] A merging unit: used for merging the first video, the transition video and the second video to obtain a merged video;

[0157] Playback unit: used to play the merged video, when the first video ends, play the transition video and switch to play the second video.

[0158] As can be seen from the above, the video processing device of the embodiment of the present application obtains at least one first video frame of the first video, at least one second video frame of the second video, and the transition direction between the first video and the second video through the acquisition unit 301, the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame; the first displacement unit 302 performs a first displacement operation on the first image content in the first video frame based on the transition direction, and fills at least part of the image content in the first image content into the image area vacated after the first video frame is displaced based on the mirror processing, so as to obtain a first transition video The second shift unit 303 performs a second shift operation on the second image content of the second video frame based on the transition direction, and fills at least part of the image content in the second image content into the image area vacated after the second video frame is shifted based on the mirror processing to obtain a second transition video frame; the blur processing unit 304 performs blur processing on the first transition video frame and the second transition video frame according to the transition direction to obtain a first processed transition video frame and a second processed transition video frame; the merging unit 305 merges the first processed transition video frame and the second processed transition video frame to obtain a transition video between the first video and the second video.

[0159] The embodiment of the present application performs a displacement operation on the first video frame of the first video and the second video frame of the second video, so that the first transition video frame and the second transition video frame produce the displacement effect of the image content, and blurs the first transition video frame and the second transition video frame according to the transition direction to generate a transition video presenting a dynamic switching effect. The first video and the second video are merged through the transition video. The merged video has rich transition effects, which can improve the merging effect of the first video and the second video.

[0160] The present application also provides a computer device, which may be a terminal or a server. Figure 8 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:

[0161] The computer device may include components such as a processor 1001 with one or more processing cores, a memory 1002 with one or more computer-readable storage media, a power supply 1003, and an input unit 1004. Those skilled in the art will appreciate that Figure 8 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:

[0162] The processor 1001 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 1002 and calling data stored in the memory 1002, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 1001 may include one or more processing cores; preferably, the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and computer programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 1001.

[0163] The memory 1002 can be used to store software programs and modules. The processor 1001 executes various functional applications and data processing by running the software programs and modules stored in the memory 1002. The memory 1002 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 1002 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 1002 may also include a memory controller to provide the processor 1001 with access to the memory 1002.

[0164] The computer device also includes a power supply 1003 for supplying power to various components. Preferably, the power supply 1003 can be logically connected to the processor 1001 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 1003 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0165] The computer device may further include an input unit 1004, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0166] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically, in this embodiment, the processor 1001 in the computer device will load the executable files corresponding to the processes of one or more computer programs into the memory 1002 according to the following instructions, and the processor 1001 will run the computer programs stored in the memory 1002, thereby realizing various functions, as follows:

[0167] Acquire at least one first video frame of the first video, at least one second video frame of the second video, and a transition direction between the first video and the second video, wherein the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame;

[0168] Performing a first shift operation on the first image content in the first video frame based on the transition direction, and filling at least part of the image content in the first image content into the image area vacated after the first video frame is shifted based on the mirroring process, to obtain a first transition video frame;

[0169] Performing a second shift operation on the second image content of the second video frame based on the transition direction, and filling at least part of the second image content into the image area vacated after the second video frame is shifted based on the mirroring process, to obtain a second transition video frame;

[0170] According to the transition direction, blur processing is performed on the first transition video frame and the second transition video frame to obtain a first processed transition video frame and a second processed transition video frame;

[0171] The first processed transition video frame and the second processed transition video frame are merged to obtain a transition video of the first video and the second video.

[0172] The specific implementation of the above operations can be found in the previous embodiments and will not be described in detail here.

[0173] As can be seen from the above, the computer device of the embodiment of the present application can obtain at least one first video frame of the first video, at least one second video frame of the second video, and the transition direction of the first video and the second video, the first video frame includes the last video frame of the first video frame, and the second video frame includes the first video frame of the second video frame; based on the transition direction, a first displacement operation is performed on the first image content in the first video frame, and based on the mirror processing, at least part of the image content in the first image content is filled into the image area vacated after the first video frame is displaced, so as to obtain a first transition video frame; based on the transition direction, a second displacement operation is performed on the second image content of the second video frame, and based on the mirror processing, at least part of the image content in the second image content is filled into the image area vacated after the second video frame is displaced, so as to obtain a second transition video frame; according to the transition direction, blurring is performed on the first transition video frame and the second transition video frame respectively, so as to obtain a first processed transition video frame and a second processed transition video frame; the first processed transition video frame and the second processed transition video frame are merged to obtain a transition video of the first video and the second video.

[0174] The embodiment of the present application performs a displacement operation on the first video frame of the first video and the second video frame of the second video, so that the first transition video frame and the second transition video frame produce the displacement effect of the image content, and blurs the first transition video frame and the second transition video frame according to the transition direction to generate a transition video presenting a dynamic switching effect. The first video and the second video are merged through the transition video. The merged video has rich transition effects, which can improve the merging effect of the first video and the second video.

[0175] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementations in the above-mentioned embodiments.

[0176] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0177] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program can be loaded by a processor to execute any video processing method provided in the embodiment of the present application.

[0178] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0179] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0180] Since the computer program stored in the computer-readable storage medium can execute any one of the video processing methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the video processing methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0181] The above is a detailed introduction to a video processing method, device, computer equipment and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A video processing method, characterized in that: include: Acquire at least one first video frame of a first video, at least one second video frame of a second video, and a transition direction between the first video and the second video, wherein the first video frame includes the last video frame of the first video, and the second video frame includes the first video frame of the second video; Performing a first displacement operation on the first image content in the first video frame based on the transition direction, and filling at least part of the first image content into the image area vacated after the first video frame is shifted based on mirror processing, to obtain a first transition video frame, wherein the displacement corresponding to each first transition video frame is different; Performing a second displacement operation on the second image content of the second video frame based on the transition direction, and filling at least part of the image content of the second image content into the image area vacated after the displacement of the second video frame based on mirror processing, to obtain a second transition video frame, wherein the displacement corresponding to each second transition video frame is different, and wherein the displacement directions of the first image content in the first video frame and the second image content in the second video frame are opposite; According to the transition direction, blur processing is performed on the first transition video frame and the second transition video frame to obtain a first processed transition video frame and a second processed transition video frame; The first processed transition video frame and the second processed transition video frame are merged to obtain a transition video of the first video and the second video.

2. The method according to claim 1, characterized in that The method of performing a first shift operation on the first image content in the first video frame based on the transition direction, and filling at least part of the first image content into the image area vacated after the first video frame is shifted based on mirror processing to obtain a first transition video frame, includes: Performing a displacement operation on the first image content of the first video frame on a preset canvas based on the transition direction; Filling at least a portion of the first image content into an image area left vacant in the preset canvas after the first video frame is shifted based on mirroring processing; During the displacement of the first video frame, a plurality of first transition video frames are obtained, wherein each first transition video frame includes the image content of the first video frame in the preset canvas under different displacements and the filled image content.

3. The method according to claim 1, characterized in that The performing a first displacement operation on the first image content in the first video frame based on the transition direction includes: Acquire a preconfigured moving speed and moving direction for performing a first displacement operation on the first video frame; A first shift operation is performed on the first video frame based on the moving speed and the moving direction.

4. The method according to claim 1, characterized in that: The blurring process is performed on the first transition video frame and the second transition video frame according to the transition direction to obtain a first processed transition video and a second processed transition video frame, comprising: According to the transition direction, the first transition video frame and the second transition video frame are blurred respectively to obtain a first blurred transition video frame and a second blurred transition video frame; Performing distortion processing on the first blurred transition video frame to obtain the first processed transition video frame; The second blurred transition video frame is distorted to obtain the second processed transition video frame.

5. The method according to claim 4, characterized in that The step of performing distortion processing on the first blurred transition video frame to obtain the first processed transition video frame includes: Calculating an offset angle and an offset distance from each pixel in the first blurred transition video frame according to the coordinates of the preset distortion center and the coordinates of each pixel in the first blurred transition video frame; Performing distortion processing on the offset distance to obtain a distorted offset distance; Calculating the distorted coordinates corresponding to each pixel in the first blurred transition video frame based on the distorted offset distance and the offset angle; The pixel value of each pixel in the first blurred transition video frame is assigned to the pixel indicated by the corresponding distorted coordinates to obtain the first processed transition video frame.

6. The method according to claim 1, characterized in that The blurring process is performed on the first transition video frame and the second transition video frame according to the transition direction to obtain a first processed transition video frame and a second processed transition video frame, comprising: Obtaining a preset transition duration, and determining blur steps of the first transition video frame and the second transition video frame respectively according to the transition duration; According to the blur step length of the first transition video frame and the transition direction, blurring the first transition video frame to obtain the first processed transition video frame; The second transition video frame is blurred according to the blur step size of the second transition video frame and the transition direction to obtain the second processed transition video frame.

7. The method according to any one of claims 1 to 6, characterized in that: After merging the first processed transition video frame and the second processed transition video frame to obtain a transition video of the first video and the second video, the method further includes: Merge the first video, the transition video and the second video to obtain a merged video; When playing the merged video, when the first video ends, play the transition video and switch to play the second video.

8. A video processing device, characterized in that: include: An acquisition unit, configured to acquire at least one first video frame of a first video, at least one second video frame of a second video, and a transition direction between the first video and the second video, wherein the first video frame includes a last video frame of the first video, and the second video frame includes a first video frame of the second video; A first shift unit is used to perform a first shift operation on the first image content in the first video frame based on the transition direction, and fill at least part of the first image content into the image area vacated after the first video frame is shifted based on mirror processing, so as to obtain a first transition video frame, wherein the displacement corresponding to each first transition video frame is different; A second displacement unit is used to perform a second displacement operation on the second image content of the second video frame based on the transition direction, and fill at least part of the image content of the second image content into the image area vacated after the second video frame is shifted based on a mirroring process, so as to obtain a second transition video frame, wherein the displacement corresponding to each second transition video frame is different, and wherein the displacement directions of the first image content in the first video frame and the second image content in the second video frame are opposite; A fuzzy processing unit, used for performing fuzzy processing on the first transition video frame and the second transition video frame according to the transition direction, to obtain a first processed transition video frame and a second processed transition video frame; A merging unit is used to merge the first processed transition video frame and the second processed transition video frame to obtain a transition video of the first video and the second video.

9. A computer device, characterized in that: It comprises a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute the video processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is loaded by a processor to execute the video processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Video clip processing method and device

    CN112367481A