Video processing method and device, computer equipment and storage medium
By determining the maximum and global resolution of videos in short video applications and adjusting the video resolution to achieve uniform global resolution processing, the preview problem during video splicing was solved, improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-03-13
AI Technical Summary
Because the resolutions of videos in short video applications are inconsistent, video splicing processes can result in videos being excessively shrunk, enlarged, or filled with black/white borders, affecting the user's preview experience.
The resolution and aspect ratio of the video to be processed are obtained from the server, the maximum resolution and global resolution are determined, and the video resolution is adjusted to achieve uniform global resolution processing.
This solves the problem of excessively shrinking, enlarging, or filling the video with black/white borders in the video preview, improving the user preview experience.
Smart Images

Figure CN121665036A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a video processing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the rapid development of short video technology, the variety of short video applications has also gradually increased. Users can process videos using these applications, with video splicing being a commonly used technique.
[0003] Video stitching involves combining multiple videos to create a composite video. However, due to inconsistent video resolutions and potentially different video types (including both landscape and portrait videos), the resulting composite video may exhibit issues during previewing, such as some videos being excessively shrunk, enlarged, or filled with black / white borders, severely impacting the user's preview experience. Summary of the Invention
[0004] Therefore, it is necessary to provide a video processing method, apparatus, computer equipment, and storage medium that can effectively improve the video processing effect in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a video processing method. Applied to a server, the method includes:
[0006] In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed;
[0007] Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0008] The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed;
[0009] Each video to be processed is processed according to the processing request and the global resolution.
[0010] In one embodiment, determining the global resolution based on the maximum resolution and the aspect ratio of each video to be processed includes:
[0011] The resolution of the longest side is determined based on the relationship between the maximum resolution and the preset resolution threshold.
[0012] Determine the maximum aspect ratio based on the aspect ratio of each video to be processed;
[0013] The global resolution is determined based on the maximum aspect ratio and the resolution of the longest side.
[0014] In one embodiment, the global resolution is determined based on the maximum aspect ratio, the longest side resolution, and the aspect ratio of each video to be processed, including:
[0015] Based on the maximum aspect ratio, determine the first target direction corresponding to the resolution of the longest side; where the first target direction is either the width direction or the height direction.
[0016] Based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, the resolution of the short side in the second target direction is determined; wherein, the second target direction is different from the first target direction;
[0017] The resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are used as the global resolution.
[0018] In one embodiment, determining the first target direction corresponding to the longest side resolution based on the maximum aspect ratio includes:
[0019] When the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction;
[0020] When the maximum aspect ratio is no greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction.
[0021] In one embodiment, the number of preset resolution thresholds is two or more; determining the longest side resolution based on the relationship between the maximum resolution and the preset resolution thresholds includes:
[0022] Based on the relationship between the maximum resolution and each preset resolution threshold, the resolution with the longest side is selected from the candidate resolution values.
[0023] In one embodiment, each video to be processed is processed according to the processing request and the global resolution, including:
[0024] When processing a video merging request, the video resolution of each video to be processed is adjusted based on the global resolution.
[0025] The adjusted videos are then merged to obtain the target video.
[0026] In one embodiment, the method further includes:
[0027] Perform blank edge detection on the video cover frame of the target video;
[0028] If blank edges are detected, the video cover frame is cropped according to the global resolution and the aspect ratio of the video to be processed corresponding to the video cover frame.
[0029] In one embodiment, the video resolution includes width resolution and height resolution; determining the maximum resolution based on the video resolution of each video to be processed includes:
[0030] For each video to be processed, the resolution quantization value of the video to be processed is determined based on the product of the resolution in the width direction and the resolution in the height direction.
[0031] The maximum resolution is the video resolution of the video to be processed, as indicated by the highest resolution quantization value.
[0032] In one embodiment, the video resolution includes width resolution and height resolution; determining the aspect ratio of each video to be processed based on its video resolution includes:
[0033] For each video to be processed, the aspect ratio of the video is determined based on the ratio between the resolution in the height direction and the resolution in the width direction.
[0034] Secondly, this application provides a video processing method. Applied to a client, the method includes:
[0035] Send a processing request to the server for at least two videos to be processed; wherein the processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed according to the processing request and the global resolution.
[0036] In one embodiment, sending a processing request to the server for at least two videos to be processed includes:
[0037] Display the video selection interface;
[0038] In response to the selection of at least two videos to be processed in the video selection interface, a processing request for at least two videos to be processed is sent to the server.
[0039] Thirdly, this application also provides a video processing apparatus. Configured in a server, the apparatus includes:
[0040] The acquisition module is used to acquire the video resolution of each video to be processed in response to a processing request for at least two videos to be processed;
[0041] The first determining module is used to determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0042] The second determining module is used to determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed;
[0043] The processing module is used to process each video to be processed according to the processing request and the global resolution.
[0044] Fourthly, this application also provides a video processing apparatus. Configured in a client, the apparatus includes:
[0045] The sending module is used to send processing requests for at least two videos to be processed to the server. The processing requests are used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed according to the processing requests and the global resolution.
[0046] Fifthly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0047] In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed;
[0048] Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0049] The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed;
[0050] Each video to be processed is processed according to the processing request and the global resolution.
[0051] Sixthly, this application also provides another computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0052] Send a processing request to the server for at least two videos to be processed; wherein the processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed according to the processing request and the global resolution.
[0053] Seventhly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0054] In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed;
[0055] Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0056] The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed;
[0057] Each video to be processed is processed according to the processing request and the global resolution.
[0058] Eighthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0059] Send a processing request to the server for at least two videos to be processed; wherein the processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed according to the processing request and the global resolution.
[0060] Ninthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0061] In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed;
[0062] Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0063] The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed;
[0064] Each video to be processed is processed according to the processing request and the global resolution.
[0065] In a tenth aspect, this application also provides another computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0066] Send a processing request to the server for at least two videos to be processed; wherein the processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed according to the processing request and the global resolution.
[0067] The aforementioned video processing method, apparatus, computer equipment, and storage medium, in response to processing requests for at least two videos to be processed, acquire the video resolution of each video to be processed. Based on the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed. Based on the maximum resolution and the aspect ratio of each video to be processed, determine the global resolution. Based on the processing request and the global resolution, process each video to be processed. In this application, when the server receives processing requests for two or more videos to be processed, it acquires the video resolution of each video to be processed. Then, based on the maximum resolution and the aspect ratio of each video to be processed, it determines the global resolution. Based on the processing request and the global resolution, it processes each video to be processed, ensuring that the resolution of the processed videos is the global resolution. This effectively solves the problem in the prior art where some videos are excessively shrunk, enlarged, or filled with black / white borders when previewing videos to be processed, thus improving the user preview experience. Attached Figure Description
[0068] Figure 1 This is a diagram illustrating the application environment of the video processing method provided in this embodiment.
[0069] Figure 2 This is a flowchart illustrating the first video processing method provided in this embodiment;
[0070] Figure 3 This is a schematic diagram illustrating the principle of the video selection interface provided in this embodiment;
[0071] Figure 4 This is a schematic diagram of the first method for determining global resolution provided in this embodiment;
[0072] Figure 5 This is a schematic diagram of the second method for determining global resolution provided in this embodiment;
[0073] Figure 6 This is a flowchart illustrating the process of processing each video to be processed in this embodiment;
[0074] Figure 7 This is a flowchart illustrating the process of determining the maximum resolution provided in this embodiment;
[0075] Figure 8This is a flowchart illustrating the second video processing method provided in this embodiment;
[0076] Figure 9 This is a flowchart illustrating the third video processing method provided in this embodiment;
[0077] Figure 10 This is a structural block diagram of the first video processing device provided in this embodiment;
[0078] Figure 11 This is a structural block diagram of the second video processing device provided in this embodiment;
[0079] Figure 12 This is an internal structural diagram of the computer device provided in this embodiment. Detailed Implementation
[0080] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0081] With the rapid development of short video technology, the variety of short video applications has also gradually increased. Users can process videos using these applications, with video splicing being a commonly used technique.
[0082] Video stitching involves combining multiple videos to create a composite video. However, due to inconsistent video resolutions and potentially different video types (including both landscape and portrait videos), the resulting composite video may exhibit issues during previewing, such as some videos being excessively shrunk, enlarged, or filled with black / white borders, severely impacting the user's preview experience.
[0083] The video processing method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the server responds to a client's processing request for at least two videos, obtaining the video resolution of each video. Based on the video resolutions of each video, the server determines the maximum resolution and the aspect ratio of each video. Based on the maximum resolution and the aspect ratio of each video, the server determines the global resolution. Finally, the server processes each video according to the processing request and the global resolution.
[0084] In this context, the server refers to the server that provides processing services for the video to be processed. It can be a standalone server or a server cluster. Specifically, the server can be the server-side device corresponding to the short video application, which can receive processing requests for the video to be processed initiated by the client installed on the client.
[0085] A client is a user-side device used to send processing requests for the video to be processed to the server device. The user-side device is configured with a client application to send the processing request and the corresponding video to be processed to the server. Clients can be smart devices such as mobile phones and computers, or smart wearable devices such as smartwatches and smart bracelets.
[0086] In one embodiment, a video processing method is provided, in which the method is applied to Figure 1 Let's take the server-side as an example to illustrate, such as... Figure 2 As shown, it includes the following steps:
[0087] S201, in response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed.
[0088] Here, "video to be processed" refers to the video segment that needs to be processed. "Processing request" refers to a request message sent when there is a need to process two videos to be processed. "Video resolution" refers to the number of pixels contained in a video frame.
[0089] In this embodiment, one possible implementation is that the user sends a processing request for the video to be processed to the server through the client, as follows: Figure 3 As shown, in response to a user's video selection operation via the video selection interface on the client, the selected video is displayed. In response to a processing operation on the selected video, the selected video is designated as the video to be processed, and a processing request carrying the video to be processed is sent to the server. For example, as... Figure 3 As shown, Figure 3 The image shown is the video selection interface. In response to the user's selection of candidate videos displayed in the interface, the selected video is shown. In response to processing operations on the selected video, such as clicking "Next," the client treats the selected video as the video to be processed and sends a processing request containing the video to the server.
[0090] In this embodiment, another optional implementation where the user sends a processing request for the video to be processed to the server via a client is as follows: the client sends the processing request to the server via the client; wherein, the processing request carries the video identifier of the video to be processed. After receiving the processing request, the server retrieves the video to be processed corresponding to the video identifier from the database based on the video identifier.
[0091] In this embodiment, another optional implementation where the user sends a processing request for the video to be processed to the server through the client is as follows: in response to the user's triggering operation on the video processing control, the client obtains the video to be processed from the target area of the application (e.g., the video storage area) and sends a processing request for the video to be processed to the server.
[0092] Optionally, in this embodiment, the processing request can be a video merging request, a video preview request, a video display request, etc.
[0093] In this embodiment, one optional implementation method for the server to obtain the video resolution of each video to be processed is to obtain the video metadata of each video to be processed, and then obtain the video resolution of each video to be processed based on the video metadata.
[0094] Another optional implementation method for the server to obtain the video resolution of each video to be processed in this embodiment is to send the videos to be processed to an intelligent analysis tool, which then outputs the video resolution of each video. The intelligent analysis tool can be a video analysis model.
[0095] In this embodiment, another optional implementation for the server to obtain the video resolution of each video to be processed is as follows: After receiving the video to be processed, the server stores it in the target area. Then, it calls FFmpeg or a related library to parse the video to obtain its video resolution.
[0096] S202, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0097] The maximum resolution refers to the highest video resolution among all the videos to be processed, for example, 1920*1080. The aspect ratio refers to the ratio of the video's height to its width.
[0098] In this embodiment, one possible implementation for determining the maximum resolution based on the video resolution of each video to be processed is to obtain the video resolution of each video to be processed, sort the video resolutions of each video to be processed, and based on the sorting result, take the video resolution with the largest resolution as the maximum resolution.
[0099] In this embodiment, another optional implementation method for determining the maximum resolution based on the video resolution of each video to be processed is to input the video resolution of each video to be processed into the intelligent analysis model, and then have the intelligent analysis model output the maximum resolution.
[0100] In this embodiment, one possible implementation for determining the aspect ratio of each video to be processed based on its video resolution is as follows: for each video to be processed, the aspect ratio is determined based on the ratio between the resolution in the height direction and the resolution in the width direction.
[0101] In this embodiment, another optional implementation method for determining the aspect ratio of each video to be processed based on its video resolution is to input the video resolution of each video to be processed into the intelligent analysis model, and then have the intelligent analysis model output the aspect ratio of each video to be processed.
[0102] S203, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed.
[0103] Global resolution refers to the uniform resolution of the final output video, that is, the video resolution of all videos to be processed.
[0104] As an optional implementation of this application, the maximum resolution and the aspect ratio of each video to be processed are input into a trained neural network model, and the neural network model outputs the global resolution.
[0105] Another optional implementation of this application involves determining the long side resolution and short side resolution based on the maximum resolution. The direction of the long side resolution and the direction of the short side resolution are determined based on the aspect ratio of the video. For example, if the direction of the long side resolution is the height direction and the direction of the short side resolution is the width direction, then the final global resolution is the long side resolution in the height direction and the short side resolution in the width direction.
[0106] It should be noted that if there is only one video to be processed, then the video resolution of that video will be used as the global resolution.
[0107] S204 processes each video to be processed based on the processing request and the global resolution.
[0108] Optionally, in this embodiment, when the processing request is a preview request, each video to be processed is previewed based on the global resolution. The preview order of each video to be processed is the same as the order in which the user selects the videos in the video selection interface.
[0109] The aforementioned video processing method, in response to processing requests for at least two videos to be processed, obtains the video resolution of each video to be processed. Based on the video resolution of each video to be processed, it determines the maximum resolution and the aspect ratio of each video to be processed. Based on the maximum resolution and the aspect ratio of each video to be processed, it determines the global resolution. Based on the processing request and the global resolution, it processes each video to be processed. In this application, when the server receives processing requests for two or more videos to be processed, it obtains the video resolution of each video to be processed. Then, based on the maximum resolution and the aspect ratio of each video to be processed, it determines the global resolution. Based on the processing request and the global resolution, it processes each video to be processed, ensuring that the resolution of the processed videos is the global resolution. This effectively solves the problem in existing technologies where some videos are excessively shrunk, enlarged, or filled with black / white borders when previewing videos to be processed, thus improving the user preview experience.
[0110] In one embodiment, to more accurately determine the resolution of the longest side, such as Figure 4 As shown, one optional implementation of determining the global resolution in S203 based on the maximum resolution and the aspect ratio of each video to be processed includes:
[0111] S401, determine the resolution of the longest side based on the relationship between the maximum resolution and the preset resolution threshold.
[0112] As an optional implementation of this application, the maximum resolution and a preset resolution threshold are input into a trained video analysis model, and the video analysis model outputs the longest side resolution. The video analysis model can be a trained neural network model.
[0113] As another optional implementation of this application, if the maximum resolution is greater than a preset resolution threshold, the first resolution is determined as the longest side resolution. If the maximum resolution is not greater than the preset resolution threshold, the second resolution is determined as the longest resolution.
[0114] In another optional implementation of this application, the number of preset resolution thresholds is two or more. Based on this, the longest side resolution is selected from the candidate resolution values according to the relationship between the maximum resolution and each preset resolution threshold. Specifically, the preset resolution thresholds include a first resolution threshold and a second resolution threshold, wherein the first resolution threshold is greater than the second resolution threshold. When the maximum resolution is greater than the first resolution threshold, the first resolution is selected from the candidate resolutions as the longest side resolution; for example, assuming the first resolution threshold is 720*1280, then the first resolution is 1920. When the maximum resolution is not greater than the first resolution threshold but greater than the second resolution threshold, the second resolution is selected from the candidate resolutions as the longest side resolution; for example, assuming the first resolution threshold is 720*1280 and the second resolution threshold is 540*960, then the second resolution is 1280. When the maximum resolution is not greater than the second resolution threshold, a third resolution is selected from the candidate resolutions as the longest side resolution. For example, assuming the second resolution threshold is 540*960, then the third resolution is 960.
[0115] S402, determine the maximum aspect ratio based on the aspect ratio of each video to be processed.
[0116] Among them, the maximum aspect ratio refers to the largest aspect ratio among all video aspect ratios.
[0117] As an optional implementation of this application, the aspect ratios of each video to be processed are sorted, and the largest aspect ratio is determined based on the sorting result, which is then used as the maximum aspect ratio.
[0118] S403 determines the global resolution based on the maximum aspect ratio and the resolution of the longest side.
[0119] As an optional implementation of this application, the maximum aspect ratio and the resolution of the longest side are input into the video analysis model, and the video analysis model outputs the global resolution.
[0120] Another optional implementation of this application involves determining the global height resolution and global width resolution based on the maximum aspect ratio and the resolution of the longest side. The global height resolution and global width resolution are then used as the global resolution.
[0121] In this embodiment, the longest side resolution is determined based on the relationship between the maximum resolution and a preset resolution threshold. The maximum aspect ratio is determined based on the aspect ratio of each video to be processed. The global resolution is then determined based on the maximum aspect ratio and the longest side resolution. This embodiment improves the accuracy of the determined global resolution, thereby enhancing the preview effect of the processed videos and increasing user satisfaction.
[0122] In one embodiment, to further improve the accuracy of the determined global resolution and optimize the processing effect of each video to be processed, such as... Figure 5 As shown, the optional implementation methods for determining the global resolution based on the maximum aspect ratio, the longest side resolution, and the aspect ratio of each video to be processed include:
[0123] S501, based on the maximum aspect ratio, determine the first target direction corresponding to the resolution of the longest side.
[0124] The first target direction is either the width direction or the height direction.
[0125] As an optional implementation of this application, when the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction.
[0126] As another optional implementation of this application, when the maximum aspect ratio is not greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction.
[0127] S502, based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, determine the resolution of the short side in the second target direction.
[0128] The second target direction is different from the first target direction; if the first target direction is the width direction, then the second target direction is the height direction; if the first target direction is the height direction, then the second target direction is the width direction.
[0129] In a first optional implementation of this embodiment, the ratio of the longest side resolution to the maximum aspect ratio is used as the short side resolution. A second target direction is determined based on the first target direction. Optionally, in this embodiment, if the first target direction is the height direction, it is determined whether the maximum aspect ratio is greater than the first ratio (e.g., 16 / 9). If it is not greater, the ratio of the longest side resolution to the maximum aspect ratio is used as the short side resolution; if it is greater, the ratio of the longest side resolution to the first ratio is used as the short side resolution. Optionally, in this embodiment, if the first target direction is the width direction, it is determined whether the maximum aspect ratio is less than the second ratio (e.g., 9 / 16). If it is not less, the ratio of the longest side resolution to the maximum aspect ratio is used as the short side resolution; if it is less, the ratio of the longest side resolution to the second ratio is used as the short side resolution. If the first target direction is the height direction, the second target direction is determined to be the width direction; if the first target direction is the width direction, the second target direction is determined to be the height direction.
[0130] The second optional implementation of this embodiment involves determining the short-side resolution in the second target direction based on the maximum aspect ratio, the longest side resolution, the first target direction, and the aspect ratio of each video to be processed. Specifically, the second target direction is determined based on the maximum aspect ratio. Specifically, if the maximum aspect ratio is greater than 1, the first target direction corresponding to the longest side resolution is determined as the height direction; if the maximum aspect ratio is not greater than 1, the first target direction corresponding to the longest side resolution is determined as the width direction. The short-side resolution of each video to be processed in the second target direction is determined based on the longest side resolution and the aspect ratio of each video to be processed. Specifically, for each video to be processed, the ratio of the longest side resolution to the aspect ratio of that video to be processed is used as the short-side resolution of that video in the second target direction, and so on, until the short-side resolution of all videos to be processed in the second target direction is determined.
[0131] S503 uses the resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction as the global resolution.
[0132] Based on the first implementation method in step S502 above, the resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are used as the global resolution. Assuming the first target direction is the height direction and the resolution of the longest side is 1920; and the second target direction is the width direction and the resolution of the shortest side is 720, then the global resolution is 1920*720.
[0133] Based on the second implementation of step S502 above, for each video to be processed, the resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are used as the global resolution of the video to be processed. In this embodiment, each video to be processed has a corresponding global resolution, so that the real scene of the video to be processed can be displayed during preview.
[0134] In this embodiment, a first target direction corresponding to the longest side resolution is determined based on the maximum aspect ratio; wherein, the first target direction is either the width direction or the height direction. The short side resolution in a second target direction is determined based on the maximum aspect ratio, the longest side resolution, and the first target direction; wherein, the second target direction is different from the first target direction. The longest side resolution in the first target direction and the short side resolution in the second target direction are used as the global resolution. Based on this embodiment, the accuracy of the determined global resolution is further improved, ensuring that when previewing each video to be processed based on the global resolution, there will be no excessive scaling, scaling, or excessive black and white borders, thus improving the video processing effect and the video display effect in multi-video scenarios.
[0135] In one embodiment, to better suit real-world application scenarios, such as... Figure 6 As shown, one possible implementation method for processing each video to be processed based on the processing request and the global resolution includes:
[0136] S601, when processing a video merging request, adjusts the video resolution of each video to be processed based on the global resolution.
[0137] As an optional implementation of this application, when the global resolution is the same for all videos to be processed, the video resolution of each video to be processed is adjusted based on the global resolution so that the video resolution of each video to be processed is the global resolution.
[0138] As another optional implementation of this application, if each video to be processed has a corresponding global resolution, the global resolution of each video to be processed is obtained. Based on the global resolution, the video resolution of the video to be processed is adjusted so that the video resolution of the video to be processed is the global resolution.
[0139] S602, merge the adjusted videos to obtain the target video.
[0140] As an optional implementation of this application, the adjusted videos to be processed are merged using a video processing tool to obtain the target video. The video processing tool can be a video processing program or a standalone video processing device.
[0141] Based on the above embodiments, another optional implementation of the video processing method involves detecting blank edges on the video cover frame of the target video. If blank edges are detected, the video cover frame is cropped according to the global resolution and the aspect ratio of the video to be processed corresponding to the video cover frame. One optional implementation involves cropping the video cover frame while maintaining the video aspect ratio until at least one edge is free of blank edges; the resolution of the cropped video cover frame is then adjusted based on the global resolution to match the global resolution. Another optional implementation involves cropping the video cover frame while maintaining the global resolution to obtain a first cover frame. While maintaining the video aspect ratio, the video cover frame is then cropped again to obtain a second cover frame. The blank width of the first and second cover frames is obtained, and the cover frame with the narrowest blank width is selected as the final video cover frame. Another alternative implementation involves obtaining the aspect ratio of the preview window, and cropping the video cover frame based on the global resolution and the aspect ratio of the preview window, so that the cropped video cover frame fills the preview window as much as possible while maintaining the global resolution.
[0142] It should be noted that another optional implementation method for cropping the video cover frame is to crop the video cover frame based on the global resolution. Specifically, while keeping the resolution of the video cover frame at the global resolution, the blank areas of the video cover frame are cropped.
[0143] In this embodiment, when the processing request is a video merging request, the video resolution of each video to be processed is adjusted based on the global resolution. The adjusted videos are then merged to obtain the target video. This ensures that the target video does not exhibit situations where some videos are suddenly excessively shrunk, enlarged, or have excessively wide black / white borders, thus improving the user's browsing experience of the target video.
[0144] In one embodiment, to more accurately determine the maximum resolution, such as Figure 7 As shown, an optional implementation method for determining the maximum resolution based on the video resolution of each video to be processed includes:
[0145] S701, for each video to be processed, determine the resolution quantization value of the video to be processed based on the product of the resolution in the width direction and the resolution in the height direction.
[0146] Optionally, in this embodiment, for each video to be processed, the product of the width resolution and the height resolution of the video to be processed is used as the resolution quantization value of the video to be processed.
[0147] S702 takes the video resolution of the video to be processed, which is pointed to by the largest resolution quantization value, as the maximum resolution.
[0148] Optionally, in this embodiment, each video to be processed is sorted according to the resolution quantization value, and the video resolution of the video to be processed pointed to by the largest resolution quantization value is taken as the maximum resolution.
[0149] In this embodiment, for each video to be processed, a resolution quantization value is determined based on the product of the width and height resolutions of the video. The video resolution pointed to by the largest resolution quantization value is taken as the maximum resolution. This embodiment makes the determined maximum resolution more accurate, thereby improving the video processing effect.
[0150] In one embodiment, a video processing method is provided, in which the method is applied to Figure 1 Let's take the client in the example of this as an example. Figure 8 As shown, it includes the following steps:
[0151] S801 sends a processing request to the server for at least two videos to be processed.
[0152] The processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed based on the processing request and the global resolution.
[0153] As an optional implementation of this application, the client can package at least two videos to be processed selected by the user into a processing request and send a processing request for the at least two videos to be processed to the server.
[0154] Another optional implementation of this application embodiment is to display a video selection interface. In response to a selection operation of at least two videos to be processed in the video selection interface, a processing request for the at least two videos to be processed is sent to the server. The video selection interface can be an interactive application's video selection interface, displaying some videos or images uploaded by the user. Optionally, the selection operation in this embodiment can be a response to a user's selection operation of at least two videos to be processed, displaying the selected at least two videos to be processed, and a response to a confirmation control in the video selection interface (e.g., a confirmation button). Figure 3 The triggering operation of the "Next" control shown executes a selection operation on at least two videos to be processed in the video selection interface. Optionally, the selection operation in this embodiment can also be a response to the selection operation on candidate videos in the video selection interface, where the at least two videos to be processed pointed to by the selection operation are used as the selection operation on at least two videos to be processed.
[0155] Optionally, in some embodiments, an optional implementation of a video processing method is to receive a target video sent by a server and, in response to a playback operation for the target video, play the target video based on the global resolution.
[0156] In one embodiment, such as Figure 8 As shown, an optional implementation of a video processing method in this embodiment includes:
[0157] S901, in response to a processing request for at least two videos to be processed, obtains the video resolution of each video to be processed.
[0158] S902, for each video to be processed, determine the resolution quantization value of the video to be processed based on the product of the resolution in the width direction and the resolution in the height direction.
[0159] S903 uses the video resolution of the video to be processed, which is pointed to by the largest resolution quantization value, as the maximum resolution.
[0160] S904: Based on the relationship between the maximum resolution and each preset resolution threshold, select the longest side resolution from the candidate resolution values.
[0161] S905: For each video to be processed, determine the aspect ratio of the video to be processed based on the ratio between the resolution in the height direction and the resolution in the width direction.
[0162] S906: Determine the maximum aspect ratio based on the aspect ratio of each video to be processed.
[0163] S907: When the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction; when the maximum aspect ratio is not greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction. The first target direction can be either the width direction or the height direction.
[0164] S908, based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, determine the resolution of the short side in the second target direction. The second target direction is different from the first target direction.
[0165] S909 uses the resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction as the global resolution.
[0166] S910, when processing a video merging request, adjusts the video resolution of each video to be processed based on the global resolution.
[0167] S911 merges the adjusted videos to obtain the target video.
[0168] S912 performs blank edge detection on the video cover frame of the target video.
[0169] S913, when a blank edge is detected, performs cropping of the video cover frame according to the global resolution and the aspect ratio of the video to be processed corresponding to the video cover frame.
[0170] In this embodiment, in response to processing requests for at least two videos to be processed, the video resolution of each video to be processed is obtained. Based on the video resolution of each video to be processed, the maximum resolution and the aspect ratio of each video to be processed are determined. Based on the maximum resolution and the aspect ratio of each video to be processed, the global resolution is determined. Based on the processing request and the global resolution, each video to be processed is processed. In this application, when the server receives processing requests for two or more videos to be processed, it obtains the video resolution of each video to be processed. Then, based on the maximum resolution and the aspect ratio of each video to be processed, the global resolution is determined. Based on the processing request and the global resolution, each video to be processed is processed so that the resolution of the processed videos is the global resolution. This effectively solves the problem in the prior art where some videos are excessively shrunk, enlarged, or filled with black / white borders when previewing videos to be processed, thus improving the user preview experience.
[0171] Based on the same inventive concept, this application also provides a video processing apparatus for implementing the video processing method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, specific limitations in the following embodiment of the video processing apparatus can be found in the limitations of the video processing method described above, and will not be repeated here.
[0172] In one embodiment, such as Figure 10 As shown, a video processing apparatus 1 is provided, the apparatus comprising:
[0173] The acquisition module 11 is used to acquire the video resolution of each video to be processed in response to a processing request for at least two videos to be processed;
[0174] The first determining module 12 is used to determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0175] The second determining module 13 is used to determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed;
[0176] Processing module 14 is used to process each video to be processed according to the processing request and the global resolution.
[0177] In one embodiment, the second determining module is further specifically used for:
[0178] The resolution of the longest side is determined based on the relationship between the maximum resolution and the preset resolution threshold.
[0179] Determine the maximum aspect ratio based on the aspect ratio of each video to be processed;
[0180] The global resolution is determined based on the maximum aspect ratio and the resolution of the longest side.
[0181] In one embodiment, the second determining module is further specifically used for:
[0182] Based on the maximum aspect ratio, determine the first target direction corresponding to the resolution of the longest side; where the first target direction is either the width direction or the height direction.
[0183] Based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, the resolution of the short side in the second target direction is determined; wherein, the second target direction is different from the first target direction;
[0184] The resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are used as the global resolution.
[0185] In one embodiment, the second determining module is further specifically used for:
[0186] When the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction;
[0187] When the maximum aspect ratio is not greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction. In one embodiment, the number of preset resolution thresholds is two or more; the second determining module is further specifically used for:
[0188] Based on the relationship between the maximum resolution and each preset resolution threshold, the resolution with the longest side is selected from the candidate resolution values.
[0189] In one embodiment, the processing module is further specifically used for:
[0190] When processing a video merging request, the video resolution of each video to be processed is adjusted based on the global resolution.
[0191] The adjusted videos are then merged to obtain the target video.
[0192] In one embodiment, a video processing apparatus 1 further includes:
[0193] The detection module is used to detect blank edges on the video cover frame of the target video.
[0194] The cropping module is used to crop the video cover frame based on the global resolution and the aspect ratio of the video to be processed when blank edges are detected.
[0195] In one embodiment, the first determining module is further specifically used for:
[0196] For each video to be processed, the resolution quantization value of the video to be processed is determined based on the product of the resolution in the width direction and the resolution in the height direction.
[0197] The maximum resolution is the video resolution of the video to be processed, as indicated by the highest resolution quantization value.
[0198] In one embodiment, the video resolution includes width resolution and height resolution; the first determining module is further specifically used for:
[0199] For each video to be processed, the aspect ratio of the video is determined based on the ratio between the resolution in the height direction and the resolution in the width direction.
[0200] In one embodiment, such as Figure 11 As shown, a video processing apparatus 2 is provided, the apparatus comprising:
[0201] The sending module 21 is used to send processing requests for at least two videos to be processed to the server. The processing requests are used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed based on the processing requests and the global resolution.
[0202] In one embodiment, the sending module 21 is further specifically used for:
[0203] Display the video selection interface;
[0204] In response to the selection of at least two videos to be processed in the video selection interface, a processing request for at least two videos to be processed is sent to the server.
[0205] Each module in the aforementioned video processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0206] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 12 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores video processing data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a video processing method.
[0207] Those skilled in the art will understand that Figure 12The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0208] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0209] In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed;
[0210] Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0211] The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed;
[0212] Each video to be processed is processed according to the processing request and the global resolution.
[0213] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, including:
[0214] The resolution of the longest side is determined based on the relationship between the maximum resolution and the preset resolution threshold.
[0215] Determine the maximum aspect ratio based on the aspect ratio of each video to be processed;
[0216] The global resolution is determined based on the maximum aspect ratio and the resolution of the longest side.
[0217] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the global resolution based on the maximum aspect ratio, the longest side resolution, and the video aspect ratio of each video to be processed, including:
[0218] Based on the maximum aspect ratio, determine the first target direction corresponding to the resolution of the longest side; where the first target direction is either the width direction or the height direction.
[0219] Based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, the resolution of the short side in the second target direction is determined; wherein, the second target direction is different from the first target direction;
[0220] The resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are used as the global resolution.
[0221] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the first target direction corresponding to the resolution of the longest side based on the maximum aspect ratio, including:
[0222] When the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction;
[0223] When the maximum aspect ratio is no greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction.
[0224] In one embodiment, when the processor executes the computer program, it further performs the following steps: the number of preset resolution thresholds is two or more; determining the resolution of the longest side based on the relationship between the maximum resolution and the preset resolution thresholds, including:
[0225] Based on the relationship between the maximum resolution and each preset resolution threshold, the resolution with the longest side is selected from the candidate resolution values.
[0226] In one embodiment, when the processor executes the computer program, it further performs the following steps: processing each video to be processed according to the processing request and the global resolution, including:
[0227] When processing a video merging request, the video resolution of each video to be processed is adjusted based on the global resolution.
[0228] The adjusted videos are then merged to obtain the target video.
[0229] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0230] Perform blank edge detection on the video cover frame of the target video;
[0231] If blank edges are detected, the video cover frame is cropped according to the global resolution and the aspect ratio of the video to be processed corresponding to the video cover frame.
[0232] In one embodiment, when the processor executes the computer program, it further performs the following steps: the video resolution includes width resolution and height resolution; determining the maximum resolution based on the video resolution of each video to be processed, including:
[0233] For each video to be processed, the resolution quantization value of the video to be processed is determined based on the product of the resolution in the width direction and the resolution in the height direction.
[0234] The maximum resolution is the video resolution of the video to be processed, as indicated by the highest resolution quantization value.
[0235] In one embodiment, when the processor executes the computer program, it further performs the following steps: the video resolution includes width resolution and height resolution; determining the aspect ratio of each video to be processed based on its video resolution, including:
[0236] For each video to be processed, the aspect ratio of the video is determined based on the ratio between the resolution in the height direction and the resolution in the width direction.
[0237] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0238] Send a processing request to the server for at least two videos to be processed; wherein the processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed according to the processing request and the global resolution.
[0239] In one embodiment, when the processor executes the computer program, it further performs the following steps: sending a processing request to a server for at least two videos to be processed, including:
[0240] Display the video selection interface;
[0241] In response to the selection of at least two videos to be processed in the video selection interface, a processing request for at least two videos to be processed is sent to the server.
[0242] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0243] In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed;
[0244] Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0245] The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed;
[0246] Each video to be processed is processed according to the processing request and the global resolution.
[0247] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, including:
[0248] The resolution of the longest side is determined based on the relationship between the maximum resolution and the preset resolution threshold.
[0249] Determine the maximum aspect ratio based on the aspect ratio of each video to be processed;
[0250] The global resolution is determined based on the maximum aspect ratio and the resolution of the longest side.
[0251] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining the global resolution based on the maximum aspect ratio, the longest side resolution, and the video aspect ratio of each video to be processed, including:
[0252] Based on the maximum aspect ratio, determine the first target direction corresponding to the resolution of the longest side; where the first target direction is either the width direction or the height direction.
[0253] Based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, the resolution of the short side in the second target direction is determined; wherein, the second target direction is different from the first target direction;
[0254] The resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are used as the global resolution.
[0255] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining a first target direction corresponding to the resolution of the longest side based on the maximum aspect ratio, including:
[0256] When the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction;
[0257] When the maximum aspect ratio is no greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction.
[0258] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: having two or more preset resolution thresholds; determining the resolution of the longest side based on the relationship between the maximum resolution and the preset resolution thresholds, including:
[0259] Based on the relationship between the maximum resolution and each preset resolution threshold, the resolution with the longest side is selected from the candidate resolution values.
[0260] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: processing each video to be processed according to a processing request and a global resolution, including:
[0261] When processing a video merging request, the video resolution of each video to be processed is adjusted based on the global resolution.
[0262] The adjusted videos are then merged to obtain the target video.
[0263] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0264] Perform blank edge detection on the video cover frame of the target video;
[0265] If blank edges are detected, the video cover frame is cropped according to the global resolution and the aspect ratio of the video to be processed corresponding to the video cover frame.
[0266] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: the video resolution includes width resolution and height resolution; determining the maximum resolution based on the video resolution of each video to be processed, including:
[0267] For each video to be processed, the resolution quantization value of the video to be processed is determined based on the product of the resolution in the width direction and the resolution in the height direction.
[0268] The maximum resolution is the video resolution of the video to be processed, as indicated by the highest resolution quantization value.
[0269] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: the video resolution includes width resolution and height resolution; determining the aspect ratio of each video to be processed based on its video resolution, including:
[0270] For each video to be processed, the aspect ratio of the video is determined based on the ratio between the resolution in the height direction and the resolution in the width direction.
[0271] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0272] Send a processing request to the server for at least two videos to be processed; wherein the processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed according to the processing request and the global resolution.
[0273] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: sending processing requests to a server for at least two videos to be processed, including:
[0274] Display the video selection interface;
[0275] In response to the selection of at least two videos to be processed in the video selection interface, a processing request for at least two videos to be processed is sent to the server.
[0276] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0277] In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed;
[0278] Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed.
[0279] The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed;
[0280] Each video to be processed is processed according to the processing request and the global resolution.
[0281] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, including:
[0282] The resolution of the longest side is determined based on the relationship between the maximum resolution and the preset resolution threshold.
[0283] Determine the maximum aspect ratio based on the aspect ratio of each video to be processed;
[0284] The global resolution is determined based on the maximum aspect ratio and the resolution of the longest side.
[0285] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining the global resolution based on the maximum aspect ratio, the longest side resolution, and the video aspect ratio of each video to be processed, including:
[0286] Based on the maximum aspect ratio, determine the first target direction corresponding to the resolution of the longest side; where the first target direction is either the width direction or the height direction.
[0287] Based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, the resolution of the short side in the second target direction is determined; wherein, the second target direction is different from the first target direction;
[0288] The resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are used as the global resolution.
[0289] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining a first target direction corresponding to the resolution of the longest side based on the maximum aspect ratio, including:
[0290] When the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction;
[0291] When the maximum aspect ratio is no greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction.
[0292] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: having two or more preset resolution thresholds; determining the resolution of the longest side based on the relationship between the maximum resolution and the preset resolution thresholds, including:
[0293] Based on the relationship between the maximum resolution and each preset resolution threshold, the resolution with the longest side is selected from the candidate resolution values.
[0294] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: processing each video to be processed according to a processing request and a global resolution, including:
[0295] When processing a video merging request, the video resolution of each video to be processed is adjusted based on the global resolution.
[0296] The adjusted videos are then merged to obtain the target video.
[0297] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0298] Perform blank edge detection on the video cover frame of the target video;
[0299] If blank edges are detected, the video cover frame is cropped according to the global resolution and the aspect ratio of the video to be processed corresponding to the video cover frame.
[0300] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based video processing logic devices, etc., and are not limited to these.
[0301] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0302] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A video processing method, characterized in that, Applied to the server side, the method includes: In response to a processing request for at least two videos to be processed, obtain the video resolution of each video to be processed; Determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed. The global resolution is determined based on the maximum resolution and the aspect ratio of each video to be processed; Each video to be processed is processed according to the processing request and the global resolution.
2. The method according to claim 1, characterized in that, The step of determining the global resolution based on the maximum resolution and the aspect ratio of each video to be processed includes: The resolution of the longest side is determined based on the relationship between the maximum resolution and the preset resolution threshold. Determine the maximum aspect ratio based on the aspect ratio of each video to be processed; The global resolution is determined based on the maximum aspect ratio and the resolution of the longest side.
3. The method according to claim 2, characterized in that, The step of determining the global resolution based on the maximum aspect ratio, the longest side resolution, and the aspect ratio of each video to be processed includes: Based on the maximum aspect ratio, a first target direction corresponding to the resolution of the longest side is determined; wherein, the first target direction is either the width direction or the height direction; Based on the maximum aspect ratio, the resolution of the longest side, and the first target direction, the resolution of the short side in the second target direction is determined; wherein, the second target direction is different from the first target direction; The resolution of the longest side in the first target direction and the resolution of the shortest side in the second target direction are taken as the global resolution.
4. The method according to claim 3, characterized in that, The step of determining the first target direction corresponding to the longest side resolution based on the maximum aspect ratio includes: When the maximum aspect ratio is greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the height direction; If the maximum aspect ratio is not greater than 1, the first target direction corresponding to the resolution of the longest side is determined as the width direction.
5. The method according to claim 2, characterized in that, The number of preset resolution thresholds is two or more; the determination of the longest side resolution based on the relationship between the maximum resolution and the preset resolution thresholds includes: Based on the relationship between the maximum resolution and each of the preset resolution thresholds, the resolution with the longest side is selected from the candidate resolution values.
6. The method according to claim 1, characterized in that, The step of processing each video to be processed according to the processing request and the global resolution includes: When the processing request is a video merging request, the video resolution of each video to be processed is adjusted based on the global resolution; The adjusted videos are then merged to obtain the target video.
7. The method according to claim 6, characterized in that, The method further includes: Perform blank edge detection on the video cover frame of the target video; If blank edges are detected, the video cover frame is cropped according to the global resolution and the aspect ratio of the video to be processed corresponding to the video cover frame.
8. The method according to claim 1, characterized in that, The video resolution includes both width resolution and height resolution; Determine the maximum resolution based on the video resolution of each video to be processed, including: For each video to be processed, the resolution quantization value of the video to be processed is determined based on the product of the resolution in the width direction and the resolution in the height direction. The maximum resolution is the video resolution of the video to be processed, as indicated by the highest resolution quantization value.
9. The method according to claim 1, characterized in that, The video resolution includes both width resolution and height resolution; Based on the video resolution of each video to be processed, determine the aspect ratio of each video to be processed, including: For each video to be processed, the aspect ratio of the video to be processed is determined based on the ratio between the resolution in the height direction and the resolution in the width direction.
10. A video processing method, characterized in that, Applied to a client, the method includes: Send a processing request to the server for at least two videos to be processed; wherein the processing request is used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed based on the processing request and the global resolution.
11. The method according to claim 10, characterized in that, Sending processing requests to the server for at least two videos to be processed includes: Display the video selection interface; In response to the selection of at least two videos to be processed in the video selection interface, a processing request for at least two videos to be processed is sent to the server.
12. A video processing apparatus, characterized in that, Configured in the server, the device includes: The acquisition module is used to acquire the video resolution of each video to be processed in response to a processing request for at least two videos to be processed; The first determining module is used to determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed. The second determining module is used to determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed; The processing module is used to process each video to be processed according to the processing request and the global resolution.
13. A video processing apparatus, characterized in that, Configured in the client, the device includes: The sending module is used to send processing requests for at least two videos to be processed to the server; wherein the processing requests are used to instruct the server to obtain the video resolution of each video to be processed, determine the maximum resolution and the aspect ratio of each video to be processed based on the video resolution of each video to be processed, determine the global resolution based on the maximum resolution and the aspect ratio of each video to be processed, and process each video to be processed based on the processing requests and the global resolution.
14. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the video processing method according to any one of claims 1 to 11.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the video processing method according to any one of claims 1 to 11.
16. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the video processing method according to any one of claims 1 to 11.