Search

US-20260129282-A1 - VIDEO PROCESSING METHOD, ELECTRONIC DEVICE, AND COMPUTER-READABLE STORAGE MEDIUM

US20260129282A1US 20260129282 A1US20260129282 A1US 20260129282A1US-20260129282-A1

Abstract

A video processing method is provided. The method includes: In a video recording process, an electronic device obtains raw image data and metadata, and processes the raw image data by using an image signal processor, to obtain first video data; and when exiting video recording, obtains a first video file, and stores the first video file and the metadata, where the first video file is a video file generated by encoding the first video data. A gallery application invokes required metadata based on a video algorithm that needs to be performed, and processes the first video file to obtain a second video file, where video quality of the second video file is higher than video quality of the first video file.

Inventors

  • Lerenhan LI
  • Yinting Wang
  • Yi Lei
  • Xi Zhang
  • Huanhuan Ao

Assignees

  • HUAWEI TECHNOLOGIES CO., LTD.

Dates

Publication Date
20260507
Application Date
20251229
Priority Date
20230918

Claims (20)

  1. 1 . A method of video processing for an electronic device, the method comprising: displaying a video recording viewfinder interface of a camera application installed on the electronic device; receiving a first operation performed on the video recording viewfinder interface, and entering video recording; in a video recording process, obtaining raw image data and metadata for a video algorithm in a second processing process, and performing a first processing process on the raw image data using an image signal processor, to obtain first video data; when a second operation performed on the video recording viewfinder interface is received in the video recording process, exiting the video recording, obtaining a first video file, storing the first video file and the metadata, and updating the first video file into a gallery application installed on the electronic device, wherein the first video file is a video file generated by encoding the first video data; and performing, by the gallery application, the second processing process on the first video file by invoking the metadata based on the video algorithm in the second processing process, to obtain a second video file, and storing the second video file, wherein video quality of the second video file is higher than video quality of the first video file; wherein the second processing process comprises a first-type video algorithm or a second-type video algorithm, the first-type video algorithm is a video algorithm that has not been performed in the first processing process, and the second-type video algorithm is a video algorithm that has been performed in the first processing process but execution effect of the second-type video algorithm does not reach an optimal target effect.
  2. 2 . The method according to claim 1 , wherein performing, by the gallery application, the second processing process on the first video file comprises: performing, by the gallery application, the second processing process on the first video file when the camera application is closed by invoking the metadata based on the video algorithm in the second processing process, to obtain the second video file; when the camera application is closed, the camera application runs in a background, or a third operation performed on a first thumbnail is received; and the first thumbnail is a thumbnail of the first video file that is displayed in the video recording viewfinder interface after the second operation is received.
  3. 3 . The method according to claim 2 , wherein when the camera application is closed and the camera application runs in the background, performing, by the gallery application, the second processing process on the first video file by invoking the metadata based on the video algorithm in the second processing process, to obtain the second video file comprises: detecting a preset trigger condition; wherein the preset trigger condition comprises one of: a fourth operation performed on a second thumbnail or a trigger control, an operation of starting the gallery application, an operation of viewing or playing the first video file, an operation of sharing the first video file, an operation of editing the first video file is received, a system of the electronic device is in an idle state, or a screen of the electronic device is turned off or enters a sleep mode; and the second thumbnail is a thumbnail of the first video file that is displayed in the gallery application, and the trigger control is a control displayed in the gallery application and used to trigger video algorithm processing on the first video file.
  4. 4 . The method according to claim 1 , wherein receiving the first operation performed on the video recording viewfinder interface, and entering the video recording comprise: receiving an operation performed on a video recording mode control in the video recording viewfinder interface, and determining a video recording mode as a target recording mode; and receiving an operation performed on a recording control in the video recording viewfinder interface, and entering video recording in the target recording mode, wherein the first operation comprises the operation performed on the video recording mode control and the operation performed on the recording control.
  5. 5 . The method according to claim 4 , wherein performing, by the gallery application, the second processing process on the first video file comprises: sequentially performing, by the gallery application, a phased algorithm processing process of each target video algorithm of a plurality of target video algorithms corresponding to the target recording mode based on the first video file and the metadata according to an algorithm execution sequence of the plurality of target video algorithms, to obtain the second video file, wherein the video algorithm in the second processing process comprises the plurality of target video algorithms, and the target video algorithm is the first-type video algorithm or the second-type video algorithm.
  6. 6 . The method according to claim 5 , wherein sequentially performing, by the gallery application, the phased algorithm processing process of each target video algorithm comprises: detecting whether a preset trigger condition is met; in response to detecting that the preset trigger condition is met, performing a decoding operation on a first target video file to obtain first target video data; performing the target video algorithm on the first target video data to obtain second target video data, or invoking metadata for the target video algorithm and performing the target video algorithm on the first target video data to obtain second target video data; and performing an encoding operation on the second target video data to obtain a second target video file, and storing the second target video file; wherein the first target video file is the first video file or a second target video file in a previous phased algorithm processing process, and the first target video data is the first video data or video data obtained by decoding the second target video file in the previous phased algorithm processing process.
  7. 7 . The method according to claim 5 , wherein sequentially performing, by the gallery application, the phased algorithm processing process of each target video algorithm comprises: detecting whether a preset stop condition is met; and in response to detecting that the preset stop condition is not met, entering a phased algorithm processing process of a next target video algorithm; wherein the preset stop condition is a complete performance of the plurality of target video algorithms.
  8. 8 . The method according to claim 5 , wherein sequentially performing, by the gallery application, the phased algorithm processing process of each target video algorithm comprises: detecting whether a preset stop condition is met; and in response to detecting that the preset stop condition is met, determining a second target video file in a current phased algorithm processing process as the second video file; wherein the preset stop condition is a complete performance of the plurality of target video algorithms.
  9. 9 . The method according to claim 5 , further comprising: in response to detecting that a preset interrupt trigger condition is met in the phased algorithm processing process of the target video algorithm, stopping performing the phased algorithm processing process, storing result data that has been processed in the phased algorithm processing process, and continuing performing the phased algorithm processing process from an interrupt point based on the result data in response to detecting that a preset trigger condition is met.
  10. 10 . The method according to claim 5 , further comprising: in response to detecting that a preset interrupt trigger condition is met in the phased algorithm processing process of the target video algorithm, stopping performing the phased algorithm processing process, storing a first target video file in the phased algorithm processing process, and re-performing the phased algorithm processing process based on the first target video file in response to detecting that a preset trigger condition is met.
  11. 11 . The method according to claim 9 , wherein the preset interrupt trigger condition comprises at least one of: the electronic device is powered off, a device temperature of the electronic device is greater than a preset temperature threshold, a running memory of the electronic device is less than a preset memory threshold, or an operation indicating to interrupt processing is received.
  12. 12 . The method according to claim 5 , further comprising: when each phased algorithm processing process is sequentially performed, in response to detecting that a current phased algorithm processing process is completed, replacing a second target video file in a previous phased algorithm processing process in a storage medium with the second target video file corresponding to the current phased algorithm processing process; and displaying, by the gallery application, a thumbnail of a second target video file in each phased algorithm processing process.
  13. 13 . The method according to claim 4 , wherein: the method further comprises: displaying, by the gallery application, a third thumbnail of the first video file; and performing, by the gallery application, the second processing process on the first video file comprises: receiving a fifth operation performed on the third thumbnail, wherein the fifth operation is used to trigger the gallery application to play the first video file; in response to receiving the fifth operation, performing, by the gallery application, a decoding operation on the first video file to obtain the first video data, wherein the first video data comprises a plurality of to-be-processed image frames; for each to-be-processed image frame, sequentially performing each target video algorithm on the to-be-processed image frame according to an algorithm execution sequence by invoking metadata for the target video algorithm, to obtain a target image frame, and sending the target image frame for display; and after each target image frame is sent for display, performing, by the gallery application, an encoding operation on each target image frame to obtain the second video file, and replacing the first video file in a storage medium with the second video file.
  14. 14 . An electronic device, comprising: a processor; and a memory storing a computer program, which when executed by the processor, causes the electronic device to perform operations comprising: displaying a video recording viewfinder interface of a camera application; receiving a first operation performed on a video recording viewfinder interface, and entering video recording; in a video recording process, obtaining raw image data and metadata for a video algorithm in a second processing process, and performing a first processing process on the raw image data using an image signal processor, to obtain first video data; when a second operation performed on the video recording viewfinder interface is received in the video recording process, exiting the video recording, obtaining a first video file, storing the first video file and the metadata, and updating the first video file into a gallery application, wherein the first video file is a video file generated by encoding the first video data; and performing, by the gallery application, the second processing process on the first video file by invoking the metadata based on the video algorithm in the second processing process, to obtain a second video file, and storing the second video file, wherein video quality of the second video file is higher than video quality of the first video file; wherein the second processing process comprises a first-type video algorithm or a second-type video algorithm, the first-type video algorithm is a video algorithm that has not been performed in the first processing process, and the second-type video algorithm is a video algorithm that has been performed in the first processing process but execution effect of the second-type video algorithm does not reach an optimal target effect.
  15. 15 . A non-transitory computer-readable storage medium storing a computer program, which when executed by a processor, causes the processor to perform operations comprising: displaying a video recording viewfinder interface of a camera application; receiving a first operation performed on a video recording viewfinder interface, and entering video recording; in a video recording process, obtaining raw image data and metadata for a video algorithm in a second processing process, and performing a first processing process on the raw image data using an image signal processor, to obtain first video data; when a second operation performed on the video recording viewfinder interface is received in the video recording process, exiting the video recording, obtaining a first video file, storing the first video file and the metadata, and updating the first video file into a gallery application, wherein the first video file is a video file generated by encoding the first video data; and performing, by the gallery application, the second processing process on the first video file by invoking the metadata based on the video algorithm in the second processing process, to obtain a second video file, and storing the second video file, wherein video quality of the second video file is higher than video quality of the first video file; wherein the second processing process comprises a first-type video algorithm or a second-type video algorithm, the first-type video algorithm is a video algorithm that has not been performed in the first processing process, and the second-type video algorithm is a video algorithm that has been performed in the first processing process but execution effect of the second-type video algorithm does not reach an optimal target effect.
  16. 16 . The non-transitory computer-readable storage medium according to claim 15 , wherein performing, by the gallery application, the second processing process on the first video file comprises: performing, by the gallery application, the second processing process on the first video file when the camera application is closed by invoking the metadata based on the video algorithm in the second processing process, to obtain the second video file; when the camera application is closed, the camera application runs in a background, or a third operation performed on a first thumbnail is received; and the first thumbnail is a thumbnail of the first video file that is displayed in the video recording viewfinder interface after the second operation is received.
  17. 17 . The non-transitory computer-readable storage medium according to claim 16 , wherein when the camera application is closed and the camera application runs in the background, performing, by the gallery application, the second processing process on the first video file by invoking the metadata based on the video algorithm in the second processing process, to obtain the second video file comprises: detecting a preset trigger condition; wherein the preset trigger condition comprises one of: a fourth operation performed on a second thumbnail or a trigger control, an operation of starting the gallery application, an operation of viewing or playing the first video file, an operation of sharing the first video file, an operation of editing the first video file is received, a system of the electronic device is in an idle state, or a screen of the electronic device is turned off or enters a sleep mode; and the second thumbnail is a thumbnail of the first video file that is displayed in the gallery application, and the trigger control is a control displayed in the gallery application and used to trigger video algorithm processing on the first video file.
  18. 18 . The non-transitory computer-readable storage medium according to claim 15 , wherein receiving the first operation performed on the video recording viewfinder interface, and entering the video recording comprise: receiving an operation performed on a video recording mode control in the video recording viewfinder interface, and determining a video recording mode as a target recording mode; and receiving an operation performed on a recording control in the video recording viewfinder interface, and entering video recording in the target recording mode, wherein the first operation comprises the operation performed on the video recording mode control and the operation performed on the recording control.
  19. 19 . The non-transitory computer-readable storage medium according to claim 18 , wherein performing, by the gallery application, the second processing process on the first video file comprises: sequentially performing, by the gallery application, a phased algorithm processing process of each target video algorithm of a plurality of target video algorithms corresponding to the target recording mode based on the first video file and the metadata according to an algorithm execution sequence of the plurality of target video algorithms, to obtain the second video file, wherein the video algorithm in the second processing process comprises the plurality of target video algorithms, and the target video algorithm is the first-type video algorithm or the second-type video algorithm.
  20. 20 . The non-transitory computer-readable storage medium according to claim 19 , wherein sequentially performing, by the gallery application, the phased algorithm processing process of each target video algorithm comprises: detecting whether a preset trigger condition is met; in response to detecting that the preset trigger condition is met, performing a decoding operation on a first target video file to obtain first target video data; performing the target video algorithm on the first target video data to obtain second target video data, or invoking metadata for the target video algorithm and performing the target video algorithm on the first target video data to obtain second target video data; and performing an encoding operation on the second target video data to obtain a second target video file, and storing the second target video file; wherein the first target video file is the first video file or a second target video file in a previous phased algorithm processing process, and the first target video data is the first video data or video data obtained by decoding the second target video file in the previous phased algorithm processing process.

Description

CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation of International Application No. PCT/CN2024/112142, filed on Aug. 14, 2024, which claims priority to Chinese Patent Application No. 202311209386.2, filed on Sep. 18, 2023. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD Embodiments of this application relates to the field of image technologies, and in particular, to a video processing method, an electronic device, and a non-transitory computer-readable storage medium. BACKGROUND With continuous popularization of electronic devices such as mobile phones, recording videos by using a video recording function of the electronic devices such as the mobile phones gradually becomes a trend. Currently, in a video recording process, an electronic device like a mobile phone first shoots a raw image by using a camera, and then performs frame-by-frame processing on the raw image in real time by using an image signal processor (ISP), to obtain a processed video image. When video recording ends, the electronic device like the mobile phone may obtain a final video generated from a plurality of frames of video images. The final video is a video shot by a user. However, time of processing the raw image by the ISP is usually limited by real-time performance. As a result, quality of the video image processed by the ISP is relatively low, and consequently, quality of the video obtained by the user is relatively low. SUMMARY Embodiments of this application provide a video processing method, an electronic device, and a non-transitory computer-readable storage medium, to resolve a problem that video quality of a video shot by an existing electronic device is relatively poor. According to a first aspect, an embodiment of this application provides a video processing method, applied to an electronic device. A camera application and a gallery application are installed on the electronic device. After displaying a video recording viewfinder interface of the camera application, the electronic device receives a first operation performed on the video recording viewfinder interface, and enters video recording; in a video recording process, obtains raw image data and metadata required by a video algorithm in a second processing process, and performs a first processing process on the raw image data by using an image signal processor, to obtain first video data; and if a second operation performed on the video recording viewfinder interface is received in the video recording process, exits the video recording, obtains a first video file, stores the first video file and the metadata, and updates the first video file into the gallery application, where the first video file is a video file generated by encoding the first video data. The gallery application performs the second processing process on the first video file by invoking the metadata based on the video algorithm in the second processing process, to obtain a second video file, and stores the second video file, where video quality of the second video file is higher than video quality of the first video file. The second processing process includes a first-type video algorithm and/or a second-type video algorithm, the first-type video algorithm is a video algorithm that has not been performed in the first processing process, and the second-type video algorithm is a video algorithm that has been performed in the first processing process but whose execution effect does not reach an optimal target effect. It can be learned from the foregoing that, in this embodiment of this application, in the video recording process, the metadata required in the second processing process subsequently performed by the gallery application is collected in advance, and the first processing process is performed on the raw image data in real time by using the ISP, so that the first video file can be obtained when the video recording ends. The first video file can be viewed by a user, and a real-time requirement of video recording is met. After the first video file is obtained, the gallery application invokes the metadata to further perform the second processing process on the first video file, to obtain the second video file with higher quality. In this way, a basic-quality video (e.g., the first video file) can be obtained when the video recording ends, so that the real-time requirement is met. After the first video file is updated into the gallery application, the gallery application further performs, based on the metadata collected in advance, a video algorithm that has not been performed in the first processing process, and a video algorithm that has been performed in the first processing process but whose execution effect does not reach an optimal target effect due to real-time performance or the like, to improve video quality of the shot basic-quality video, and obtain a video with higher quality. In this way,