Video processing method and device and storage medium

文档序号:1925539 发布日期:2021-12-03 浏览:22次 中文

阅读说明:本技术 视频的处理方法、装置及存储介质 (Video processing method and device and storage medium ) 是由 张凯 于 2020-05-14 设计创作,主要内容包括:本公开是关于一种视频的处理方法、装置及存储介质。所述视频的处理方法包括:获取待录制视频的第N帧图像的图像数据,其中N为大于等于1的正整数;对所获取的第N帧图像的图像数据进行编码,得到第N帧图像的编码数据;按照预设规则获取与第N帧图像相关的x帧所述电子设备的运动参数的参数数据,其中x为大于等于1的正整数;根据所获取的x帧所述电子设备的运动参数的参数数据,确定第N帧图像的防抖处理策略;将所述第N图像的编码数据和所述第N帧图像的防抖处理策略存储为所述第N帧图像的视频文件。本公开所提供的视频处理方法,在视频录制阶段,不需要缓存相应数量的图像数据,降低了电子设备的内存的占用。(The disclosure relates to a video processing method, a video processing device and a storage medium. The video processing method comprises the following steps: acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1; encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image; acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1; determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames; and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image. According to the video processing method, in the video recording stage, the image data with the corresponding quantity does not need to be cached, and the occupation of the memory of the electronic equipment is reduced.)

1. A video processing method is applied to electronic equipment, and is characterized in that the processing method is applied to a video recording process, and the processing method comprises the following steps:

acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1;

encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image.

2. The method for processing the video according to claim 1, wherein the parameter data of the motion parameters of the electronic device of the x frames related to the image of the nth frame is obtained according to one of the following modes:

the first method is as follows: continuously acquiring the parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the images from the nth frame to the (N + X-1) th frame, wherein X is a positive integer greater than or equal to 1;

the second method comprises the following steps: and from the Nth frame, acquiring the parameter data of the motion parameters of the electronic equipment of the X frames corresponding to the X-frame images backwards at equal time intervals, wherein X is a positive integer greater than or equal to 1.

3. The method for processing video according to claim 1, wherein the parameter data of the motion-related parameter of the electronic device comprises one or more of the following:

parameter data of motion direction parameters and parameter data of motion speed parameters; parameter data of the motion mode parameters.

4. The method for processing the video according to claim 1, wherein the determining the anti-shake processing strategy for the nth frame image according to the acquired parameter data of the motion parameters of the electronic device for the x frames comprises:

and determining anti-shake parameter data of the N frame of image according to the acquired parameter data of the motion parameters of the x frame of electronic equipment.

5. A video processing method is applied to an electronic device, and is characterized in that the processing method is applied to a video playing process, and the processing method comprises the following steps:

acquiring a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

acquiring coded data of the N frame image from the video file of the N frame image;

decoding the coded data of the Nth frame image to obtain image data of the Nth frame image;

acquiring an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and carrying out anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain the Nth frame image after anti-shake processing.

6. The method for processing the video according to claim 5, wherein the obtaining the anti-shake processing strategy of the nth frame image from the video file of the nth frame image comprises:

acquiring anti-shake parameter data of the Nth frame of image from the video file of the Nth frame of image;

the anti-shake processing of the nth frame image according to the anti-shake processing strategy of the nth frame image comprises:

and carrying out anti-shake processing on the N frame image according to the anti-shake parameter data of the N frame image.

7. A video processing apparatus, wherein the video processing apparatus is applied to a video recording process, and the video processing apparatus comprises:

the video recording device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is configured to acquire image data of an Nth frame of image of a video to be recorded, and N is a positive integer greater than or equal to 1;

the encoding module is configured to encode the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

the second acquisition module is configured to acquire parameter data of motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

the determining module is configured to determine an anti-shake processing strategy of the Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

a storage module configured to store the encoded data of the Nth image and the anti-shake processing policy of the Nth frame image as a video file of the Nth frame image.

8. The apparatus for processing video according to claim 7, wherein the second obtaining module obtains the parameter data of the motion parameter of the electronic device for x frames related to the nth frame image according to one of the following manners:

the first method is as follows: continuously acquiring the parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the images from the nth frame to the (N + X-1) th frame, wherein X is a positive integer greater than or equal to 1;

the second method comprises the following steps: and from the Nth frame, acquiring the parameter data of the motion parameters of the electronic equipment of the X frames corresponding to the X-frame images backwards at equal time intervals, wherein X is a positive integer greater than or equal to 1.

9. The apparatus for processing video according to claim 7, wherein the parameter data of the motion-related parameter of the electronic device comprises one or more of:

parameter data of motion direction parameters and parameter data of motion speed parameters; parameter data of the motion mode parameters.

10. The apparatus for processing video of claim 7, wherein the determining module is configured to:

and determining anti-shake parameter data of the N frame of image according to the acquired parameter data of the motion parameters of the x frame of electronic equipment.

11. A video processing apparatus, wherein the video processing apparatus is applied to a video playing process, and the video processing apparatus includes:

the third acquisition module is configured to acquire a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

the fourth acquisition module is configured to acquire the coded data of the N frame of image from the video file of the N frame of image;

the decoding module is configured to decode the coded data of the Nth frame of image to obtain image data of the Nth frame of image;

the fourth obtaining module is configured to obtain an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and the anti-shake processing module is configured to perform anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain an Nth frame image after the anti-shake processing.

12. The apparatus for processing video according to claim 11, wherein the fourth obtaining module is configured to:

acquiring anti-shake parameter data of the Nth frame of image from the video file of the Nth frame of image;

the anti-shake processing module is configured to:

and carrying out anti-shake processing on the N frame image according to the anti-shake parameter data of the N frame image.

13. An apparatus for processing video, comprising:

a processor;

a memory for storing processor-executable instructions;

wherein the processor is configured to:

acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1;

encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image.

14. An apparatus for processing video, comprising:

a processor;

a memory for storing processor-executable instructions;

wherein the processor is configured to:

acquiring a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

acquiring coded data of the N frame image from the video file of the N frame image;

decoding the coded data of the Nth frame image to obtain image data of the Nth frame image;

acquiring an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and carrying out anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain the Nth frame image after anti-shake processing.

15. A non-transitory computer readable storage medium having instructions therein, which when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of processing video, the method comprising:

acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1;

encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image.

16. A non-transitory computer readable storage medium having instructions therein, which when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of processing video, the method comprising:

acquiring a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

acquiring coded data of the N frame image from the video file of the N frame image;

decoding the coded data of the Nth frame image to obtain image data of the Nth frame image;

acquiring an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and carrying out anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain the Nth frame image after anti-shake processing.

Technical Field

The present disclosure relates to the field of video processing, and in particular, to a method and an apparatus for processing a video, and a storage medium.

Background

In the related art, in the video recording process, images are processed according to the jitter condition, so that the jitter of the video is reduced. The anti-shake processing of image data generally uses a Gyro sensor on an electronic device to acquire Gyro data (Gyro data) of the electronic device during video recording to process image data of each frame of image of a video, so as to achieve the anti-shake purpose. In order to perform anti-shake processing on a video, image data of images included in the video and corresponding Gyro data need to be cached for a period of time, so that a large amount of memory is occupied, anti-shake processing needs to be performed on frame image data of the video during video recording, and power consumption and heat generation of electronic equipment are increased. It is an urgent problem to provide a method for processing a video with small memory and low power consumption.

Disclosure of Invention

To overcome the problems in the related art, the present disclosure provides a method and an apparatus for processing a video, and a storage medium.

According to a first aspect of the embodiments of the present disclosure, there is provided a video processing method applied to an electronic device, where the video processing method is applied to a video recording process, and the video processing method includes:

acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1;

encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image.

Acquiring parameter data of the motion parameters of the electronic equipment of x frames related to the N frame image according to one of the following modes:

the first method is as follows: continuously acquiring the parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the images from the nth frame to the (N + X-1) th frame, wherein X is a positive integer greater than or equal to 1;

the second method comprises the following steps: and from the Nth frame, acquiring the parameter data of the motion parameters of the electronic equipment of the X frames corresponding to the X-frame images backwards at equal time intervals, wherein X is a positive integer greater than or equal to 1.

Wherein the parameter data of the motion-related parameter of the electronic device comprises one or more of:

parameter data of motion direction parameters and parameter data of motion speed parameters; parameter data of the motion mode parameters.

The determining the anti-shake processing strategy of the Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames comprises the following steps:

and determining anti-shake parameter data of the N frame of image according to the acquired parameter data of the motion parameters of the x frame of electronic equipment.

According to a second aspect of the embodiments of the present disclosure, there is provided a video processing method applied to an electronic device, where the video processing method is applied to a video playing process, and the video processing method includes:

acquiring a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

acquiring coded data of the N frame image from the video file of the N frame image;

decoding the coded data of the Nth frame image to obtain image data of the Nth frame image;

acquiring an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and carrying out anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain the Nth frame image after anti-shake processing.

The anti-shake processing strategy for acquiring the nth frame image from the video file of the nth frame image comprises the following steps:

acquiring anti-shake parameter data of the Nth frame of image from the video file of the Nth frame of image;

the anti-shake processing of the nth frame image according to the anti-shake processing strategy of the nth frame image comprises:

and carrying out anti-shake processing on the N frame image according to the anti-shake parameter data of the N frame image.

According to a third aspect of the embodiments of the present disclosure, there is provided a video processing apparatus, which is applied to a video recording process, the processing apparatus including:

the video recording device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is configured to acquire image data of an Nth frame of image of a video to be recorded, and N is a positive integer greater than or equal to 1;

the encoding module is configured to encode the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

the second acquisition module is configured to acquire parameter data of motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

the determining module is configured to determine an anti-shake processing strategy of the Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

a storage module configured to store the encoded data of the Nth image and the anti-shake processing policy of the Nth frame image as a video file of the Nth frame image.

The second acquisition module acquires the parameter data of the motion parameters of the electronic equipment of the x frame related to the N frame image according to one of the following modes:

the first method is as follows: continuously acquiring the parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the images from the nth frame to the (N + X-1) th frame, wherein X is a positive integer greater than or equal to 1;

the second method comprises the following steps: and from the Nth frame, acquiring the parameter data of the motion parameters of the electronic equipment of the X frames corresponding to the X-frame images backwards at equal time intervals, wherein X is a positive integer greater than or equal to 1.

Wherein the parameter data of the motion-related parameter of the electronic device comprises one or more of:

parameter data of motion direction parameters and parameter data of motion speed parameters; parameter data of the motion mode parameters.

Wherein the determination module is configured to:

and determining anti-shake parameter data of the N frame of image according to the acquired parameter data of the motion parameters of the x frame of electronic equipment.

According to a fourth aspect of the embodiments of the present disclosure, there is provided a processing apparatus for a video, the processing apparatus being applied to a video playing process, the processing apparatus including:

the third acquisition module is configured to acquire a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

the fourth acquisition module is configured to acquire the coded data of the N frame of image from the video file of the N frame of image;

the decoding module is configured to decode the coded data of the Nth frame of image to obtain image data of the Nth frame of image;

the fourth obtaining module is configured to obtain an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and the anti-shake processing module is configured to perform anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain an Nth frame image after the anti-shake processing.

Wherein the fourth acquisition module is configured to:

acquiring anti-shake parameter data of the Nth frame of image from the video file of the Nth frame of image;

the anti-shake processing module is configured to:

and carrying out anti-shake processing on the N frame image according to the anti-shake parameter data of the N frame image.

According to a fifth aspect of the embodiments of the present disclosure, there is provided a video processing apparatus, including:

a processor;

a memory for storing processor-executable instructions;

wherein the processor is configured to:

acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1;

encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image.

According to a sixth aspect of the embodiments of the present disclosure, there is provided a video processing apparatus, including:

a processor;

a memory for storing processor-executable instructions;

wherein the processor is configured to:

acquiring a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

acquiring coded data of the N frame image from the video file of the N frame image;

decoding the coded data of the Nth frame image to obtain image data of the Nth frame image;

acquiring an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and carrying out anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain the Nth frame image after anti-shake processing.

According to a seventh aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having instructions therein, which when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of processing video, the method comprising:

acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1;

encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image.

According to an eighth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having instructions therein, which when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of processing a video, the method comprising:

acquiring a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

acquiring coded data of the N frame image from the video file of the N frame image;

decoding the coded data of the Nth frame image to obtain image data of the Nth frame image;

acquiring an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and carrying out anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain the Nth frame image after anti-shake processing.

The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: in the video processing method provided by the disclosure, only the parameter data of the motion parameters of the electronic equipment for performing anti-shake processing corresponding to each frame image is cached in the video recording stage, and the image data with corresponding quantity does not need to be cached, so that the occupation of the memory of the electronic equipment is reduced. In addition, in the video recording stage, the video to be recorded does not need to be subjected to anti-shake processing, so that the power consumption of the electronic equipment in the video recording process is reduced, and the heating state of an electronic product is reduced.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.

Fig. 1 shows an exemplary diagram of a video processing method in the prior art;

FIG. 2 illustrates a flow chart of a method of processing video according to an exemplary embodiment;

fig. 3 illustrates a manner of acquiring parameter data of the motion parameter of the electronic device for the x frame related to the nth frame according to a preset rule in step S13 in fig. 2;

FIG. 4 illustrates an exemplary diagram of a method of processing video according to one exemplary embodiment;

fig. 5 is a flowchart illustrating a method for determining an anti-shake processing strategy for an nth frame image according to the acquired parameter data of the motion parameters of the x-frame electronic device in step S14 in fig. 1;

FIG. 6 illustrates a flow chart of a method of processing video according to an exemplary embodiment;

fig. 7 is a flowchart illustrating a method for acquiring an anti-shake processing policy of an nth frame image from a video file of the nth frame image in step S24 of fig. 6, and a flowchart illustrating a method for anti-shake processing of the nth frame image according to the anti-shake processing policy of the nth frame image in step S25;

fig. 8 illustrates an exemplary diagram of a method of processing video according to one exemplary embodiment. Fig. 8 illustrates an example of a method for processing a video during a video playing process;

FIG. 9 is a block diagram illustrating a video processing apparatus in accordance with an exemplary embodiment;

FIG. 10 is a block diagram illustrating a video processing apparatus in accordance with an exemplary embodiment;

fig. 11 is a block diagram showing a video processing apparatus according to an exemplary embodiment (general structure of a mobile terminal).

Detailed Description

Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.

The present disclosure relates to a method of processing video. In the related processing method, the anti-shake processing is performed on the video at the video recording stage, as shown in fig. 1, fig. 1 shows an exemplary diagram of a processing method of the video in the prior art. In the video anti-shake processing mode shown in fig. 1, the anti-shake processing of the mth frame image of the video is taken as an example for description, where t represents time, and each frame image in the video to be recorded is acquired according to the time sequence. In order to perform anti-shake processing on the M-th frame image of the video, it is necessary to continuously receive image data 101 'of the Y-frame image, image data … … of the M + 1-th frame image, and image data up to the M + Y-1-th frame image, and acquire Gyro data 102' corresponding to the continuous Y-frame image, Gyro data corresponding to the M-th frame image, Gyro data … … corresponding to the M + 1-th frame image, and Gyro data corresponding to the M + Y-1-th frame image. The M-th frame image is subjected to anti-shake processing 201 'based on the Y frame Gyro data 102' corresponding to the image data of the consecutive Y frame images. And after the anti-shake processing, encoding the image data of the M frame of image after the anti-shake processing. Then, the image data of the M +1 th frame image is subjected to anti-shake processing, the image data 103 'of the Y frame image, the image data of the M +1 th frame image, and the image data … … of the M +2 th frame image are continuously received until the image data of the M + Y frame image, and the Y frame Gyro data 104', the Gyro data corresponding to the M +1 th frame image, and the Gyro data … … corresponding to the M +2 th frame image corresponding to the continuous Y frame image are acquired until the Gyro data corresponding to the M + Y frame image. The M +1 th frame image is subjected to anti-shake processing based on Gyro data 104' corresponding to the successive Y frame images. And after the anti-shake processing, encoding the image data of the M +1 frame image after the anti-shake processing. And by parity of reasoning, the anti-shake processing of the recorded video is completed. The anti-shake processing of the video book according to the above manner requires at least storing image data of a Y frame image of a video to be recorded and corresponding Y frame Gyro data, requires a large memory, and is completed in the video recording process, so that power consumption of electronic equipment is increased, and electronic products are easy to heat.

The video processing method provided by the disclosure includes the steps of directly coding image data of each frame of image of an obtained video to be recorded to form coded data of each frame of image, obtaining parameter data of motion parameters of electronic equipment for performing anti-shake processing on each frame of image, and determining an anti-shake processing strategy for each frame of image according to the obtained parameter data of the motion parameters of the electronic equipment for performing anti-shake processing on each frame of image. And storing the coded data of each frame of image of the video to be recorded and the corresponding anti-shake processing strategy into a corresponding frame of video file in the video recording stage. In the video processing method provided by the disclosure, only the parameter data of the motion parameters of the electronic equipment for performing anti-shake processing corresponding to each frame image is cached in the video recording stage, and the image data with corresponding quantity does not need to be cached, so that the occupation of the memory of the electronic equipment is reduced. In addition, in the video recording stage, the video to be recorded does not need to be subjected to anti-shake processing, so that the power consumption of the electronic equipment in the video recording process is reduced, and the heating state of an electronic product is reduced.

The embodiment of the disclosure provides a video processing method. The video processing method is used in an electronic device, fig. 2 shows a flowchart of a video processing method according to an exemplary embodiment, and as shown in fig. 2, the video processing method is applied to a video recording process, and the video processing method includes the following steps.

In step S11, image data of an nth frame image of a video to be recorded is acquired, where N is a positive integer greater than or equal to 1;

in step S12, encoding the acquired image data of the nth frame image to obtain encoded data of the nth frame image;

in step S13, parameter data of a motion parameter of an x-frame electronic device related to an nth frame is obtained according to a preset rule, where x is a positive integer greater than or equal to 1;

in step S14, determining an anti-shake processing policy for the nth frame of image according to the acquired parameter data of the motion parameters of the x-frame electronic device;

in step S15, the encoded data of the nth image and the anti-shake processing policy of the nth frame image are stored as a video file of the nth frame image.

The method is applied to electronic equipment such as a mobile phone, a PAD, a tablet computer and the like. When the electronic equipment records the video, the image data of the Nth frame of image is obtained, and the image data of the Nth frame of image is coded to obtain the coded data of the Nth frame of image. Acquiring parameter data of motion parameters of x-frame electronic equipment related to the Nth frame according to a preset rule, and determining an anti-shake processing strategy of the Nth frame of image according to the acquired parameter data of the motion parameters of the x-frame electronic equipment; and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image. The motion parameter of the electronic device refers to a motion parameter of the electronic device that affects video recording during video recording, and the motion parameter may include any motion parameter that affects video recording, and may include one or more of the following manners, for example: the motion direction parameter, the motion speed parameter and the motion mode parameter. The parameter data of the motion parameter may be gyroscope data, Gyro data.

According to the video processing method, in the video recording stage, the image data with the corresponding quantity does not need to be cached, and the occupation of the memory of the electronic equipment is reduced. In the video recording stage, anti-shake processing is not needed for the video to be recorded, power consumption of the electronic equipment in the video recording process is reduced, and the heating state of the electronic product is reduced.

The embodiment of the disclosure provides a video processing method. Fig. 3 illustrates a manner of acquiring parameter data of the motion parameter of the electronic device for the x frame related to the nth frame according to a preset rule in step S13 in fig. 2:

in step S131, parameter data of the motion parameters of the x-frame electronic device related to the nth frame image is acquired in one of the following manners:

the first method is as follows: continuously acquiring the parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the images from the nth frame to the (N + X-1) th frame, wherein X is a positive integer greater than or equal to 1;

the second method comprises the following steps: and from the Nth frame, acquiring the parameter data of the motion parameters of the electronic equipment of the X frames corresponding to the X-frame images backwards at equal time intervals, wherein X is a positive integer greater than or equal to 1.

In the first mode, in order to accurately perform anti-shake processing on the nth frame image, the parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the nth frame to the (N + X-1) th frame are continuously acquired backwards along the time sequence from the nth frame image, and the anti-shake processing strategy of the nth frame image is determined according to the acquired parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame. Wherein, X is equal to X, and the parameter data of the motion parameters of the electronic equipment from the nth frame to the (n + X-1) th frame is the parameter data of the motion parameters of the electronic equipment of the X frame.

In the second mode, in order to further reduce the buffer data, on the basis of ensuring that the anti-shake policy for the nth frame image can be accurately determined, the parameter data of the motion parameters of the X frame electronic devices corresponding to the X frame images may be obtained backward along the time sequence at equal time intervals, and the anti-shake processing policy for the nth frame image may be determined based on the obtained parameter data of the motion parameters of the X frame electronic devices.

Fig. 4 illustrates an exemplary diagram of a method of processing video according to one exemplary embodiment. Fig. 4 shows an example of a video processing method in a video recording process. In the example shown in fig. 4, the parameter data of the motion parameters of the x-frame electronic device related to the N-th frame image is acquired in the first manner. As shown in fig. 4, each time image data of one frame of image is acquired, the image data is encoded to obtain encoded data of the frame of image. For example, after image data 101 of the nth frame image is acquired, the image data is video-encoded to obtain encoded data N, which is denoted by reference numeral 102 in fig. 4, of the nth frame image. Acquiring image data of an N +1 th frame of image, carrying out video coding on the image data to obtain coded data N +1 of the N +1 th frame of image, and carrying out video coding on each frame of image of the video to be recorded by analogy to obtain coded data of each frame of image. In order to accurately perform anti-shake processing on each frame of image in a video to be recorded, the parameter data of the motion related parameters of the X frames of electronic equipment corresponding to the X frames of images are continuously acquired backwards along the time t sequence from the frame of image. And determining an anti-shake processing strategy for each frame of image according to the obtained parameter data of the corresponding motion parameters. And storing the coded data of each frame and the anti-shake processing strategy of each frame image as a video file of each frame image. For example, after the image data of the nth frame image is acquired, the image data of the nth frame image is encoded to obtain encoded data N of the nth frame image. In order to accurately perform anti-shake processing on the nth frame of video, motion parameter data 103 of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the (N + X-1) th frame of image are continuously acquired backwards along the time t sequence from the nth frame. And determining an anti-shake processing strategy for the image of the Nth frame according to the acquired motion parameter data 103 of the electronic equipment from the nth frame to the (N + X-1) th frame. And storing the coded data N of the image of the Nth frame and the anti-shake processing strategy of the image of the Nth frame as a video file of the image of the Nth frame. After the image data of the (N + 1) th frame image is obtained, the image data of the (N + 1) th frame image is coded to obtain coded data N +1 of the (N + 1) th frame image. In order to accurately perform anti-shake processing on the N +1 th frame of video, the motion parameter data of the electronic equipment from the (N + 1) th frame to the (N + X) th frame corresponding to the (N + 1) th frame to the (N + X) th frame of image are continuously acquired backwards along the time t sequence from the (N + 1) th frame. And determining an anti-shake processing strategy for the N +1 frame image according to the acquired parameter data of the motion parameters of the electronic equipment from the N +1 frame to the N + X frame. And storing the coded data N +1 of the (N + 1) th frame image and the anti-shake processing strategy of the (N + 1) th frame image as a video file of the (N + 1) th frame image. And by analogy, all video files of the video to be recorded are obtained.

The present disclosure provides a video processing method, as shown in fig. 5, fig. 5 shows a flowchart of a method for determining an anti-shake processing strategy of an nth frame image according to acquired parameter data of motion parameters of an x-frame electronic device in step S14 in fig. 1, as shown in fig. 5, the processing method is applied to a video recording process, and the video processing method includes the following steps:

in step S141, the anti-shake parameter data of the nth frame image is determined according to the acquired parameter data of the motion parameter of the x frame electronic device.

In the disclosure, the anti-shake parameter data of the nth frame of image may be determined according to the acquired parameter data of the motion parameter of the x frame of electronic device, so that each frame of image of the acquired video may be subjected to anti-shake processing according to the anti-shake parameter data. The anti-shake parameter data may include parameters for performing anti-shake processing on each frame image of the video, and may include, for example, image data of the nth frame image, a cropping area, a rotation angle, an image correction parameter, and the like.

The embodiment of the disclosure provides a video processing method. The video processing method is used in an electronic device, fig. 6 shows a flowchart of a video processing method according to an exemplary embodiment, as shown in fig. 6, the video processing method is applied to a video playing process, and the video processing method includes the following steps.

In step S21, a video file of an nth frame image is acquired, where N is a positive integer greater than or equal to 1;

in step S22, acquiring encoded data of the nth frame image from the video file of the nth frame image;

in step S23, the encoded data of the nth frame image is decoded to obtain image data of the nth frame image;

in step S24, an anti-shake processing policy for the nth frame image is acquired from the nth frame video file;

in step S25, the image of the nth frame is subjected to anti-shake processing according to the anti-shake processing policy of the image of the nth frame, so as to obtain an image of the nth frame after the anti-shake processing.

In the process of playing the video, in the video processing method provided by the present disclosure, a video file of an nth frame image is obtained, and encoded data of the nth frame image is obtained from the video file of the nth frame image; decoding the coded data of the Nth frame of image to obtain image data of the Nth frame of image; acquiring an anti-shake processing strategy of the Nth frame of image from a video file of the Nth frame of image; and carrying out anti-shake processing on the N frame image according to the anti-shake processing strategy of the N frame image to obtain the N frame image after anti-shake processing. According to the video processing method, the anti-shake processing of the video is set in the video playing stage, and the anti-shake processing of each frame image in the video to be recorded is not needed in the video recording stage, so that the power consumption of electronic equipment in the video recording process is reduced, and the heating state of electronic products is reduced.

The present disclosure provides a video processing method, as shown in fig. 7, fig. 7 shows a flowchart of a method for acquiring an anti-shake processing policy of an nth frame image from a video file of the nth frame image in step S24 in fig. 6:

in step S241, anti-shake parameter data of the nth frame image is acquired from the video file of the nth frame image.

In the present disclosure, the anti-shake parameter data of the nth frame image may be acquired from the video file of the nth frame image. The anti-shake parameter data may include parameters for performing anti-shake processing on each frame image of the video, and may include, for example, image data of the nth frame image, a cropping area, a rotation angle, an image correction parameter, and the like.

Fig. 7 further shows a flowchart of a method for performing anti-shake processing on the nth frame image according to the anti-shake processing strategy of the nth frame image in step S25 in fig. 6:

in step S251, anti-shake processing is performed on the nth frame image according to the anti-shake parameter data of the nth frame image.

The image of the nth frame may be subjected to anti-shake processing according to any anti-shake parameter data of the image of the nth frame in the prior art, for example, the image of the nth frame may be subjected to anti-shake processing according to the anti-shake parameter data of the image of the nth frame by cutting, rotating, twisting, and the like.

The image of the Nth frame after the anti-shake processing can be transmitted to a display module for further processing and displaying.

Fig. 8 illustrates an exemplary diagram of a method of processing video according to one exemplary embodiment. Fig. 8 illustrates an example of a method for processing a video during video playing. In fig. 8, encoded data of an nth frame image is acquired from a video file 201 of the nth frame image, decoded 202, and decoded to obtain image data of the nth frame image. And performing anti-shake processing 203 on the Nth frame image corresponding to the image data of the obtained Nth frame image to obtain the Nth frame image after the anti-shake processing. And then the Nth frame of image after the anti-shake processing can be transmitted to a display module for further processing and display. And acquiring the coded data of the (N + 1) th frame image from the video file of the (N + 1) th frame image, decoding, and acquiring the image data of the (N + 1) th frame image. And performing anti-shake processing on the (N + 1) th frame image corresponding to the image data of the obtained (N + 1) th frame image to obtain the (N + 1) th frame image after the anti-shake processing. And then the (N + 1) th frame image after the anti-shake processing can be transmitted to a display module for further processing and display. By analogy, decoding and anti-shake processing of the image frames of the video in the video playing stage are completed, and subsequent processing and display are performed on the anti-shake processed image, so that the video playing is completed.

In one exemplary embodiment of the present disclosure, a video processing apparatus is provided. As shown in fig. 9, fig. 9 is a block diagram illustrating a video processing apparatus according to an exemplary embodiment. Referring to fig. 9, the apparatus includes a first obtaining module 901, an encoding module 902, a second obtaining module 903, a determining module 904, and a storing module 905.

A first obtaining module 901, configured to obtain image data of an nth frame image of a video to be recorded, where N is a positive integer greater than or equal to 1;

an encoding module 902 configured to encode the acquired image data of the nth frame image to obtain encoded data of the nth frame image;

a second obtaining module 903, configured to obtain parameter data of a motion parameter of the electronic device for x frames related to an nth frame image according to a preset rule, where x is a positive integer greater than or equal to 1;

a determining module 904 configured to determine an anti-shake processing strategy of the nth frame image according to the acquired parameter data of the motion parameters of the electronic device for the x frames;

a storage module 905 configured to store the encoded data of the nth image and the anti-shake processing policy of the nth frame image as a video file of the nth frame image.

The second obtaining module 903 obtains the parameter data of the motion parameter of the electronic device of the x frame related to the nth frame image according to one of the following manners:

the first method is as follows: continuously acquiring the parameter data of the motion parameters of the electronic equipment from the nth frame to the (N + X-1) th frame corresponding to the images from the nth frame to the (N + X-1) th frame, wherein X is a positive integer greater than or equal to 1;

the second method comprises the following steps: and from the Nth frame, acquiring the parameter data of the motion parameters of the electronic equipment of the X frames corresponding to the X-frame images backwards at equal time intervals, wherein X is a positive integer greater than or equal to 1.

Wherein the parameter data of the motion-related parameter of the electronic device comprises one or more of:

parameter data of motion direction parameters and parameter data of motion speed parameters; parameter data of the motion mode parameters.

Wherein the determining module 904 is configured to:

and determining anti-shake parameter data of the N frame of image according to the acquired parameter data of the motion parameters of the x frame of electronic equipment.

In one exemplary embodiment of the present disclosure, a video processing apparatus is provided. As shown in fig. 10, fig. 10 is a block diagram of a video processing apparatus according to an exemplary embodiment, and the processing apparatus is applied to a video playing process. Referring to fig. 10, the apparatus includes a third acquisition module 1001, a fourth acquisition module 1002, an encoding module 1003 and an anti-shake processing module 1004.

A third obtaining module 1001 configured to obtain a video file of an nth frame of image, where N is a positive integer greater than or equal to 1;

a fourth obtaining module 1002, configured to obtain encoded data of an nth frame image from a video file of the nth frame image;

a decoding module 1003 configured to decode the encoded data of the nth frame image to obtain image data of the nth frame image;

the fourth obtaining module 1002 is configured to obtain an anti-shake processing policy of an nth frame image from the nth frame video file;

an anti-shake processing module 1004 configured to perform anti-shake processing on the nth frame image according to the anti-shake processing policy of the nth frame image, so as to obtain an nth frame image after the anti-shake processing.

Wherein the fourth obtaining module 1002 is configured to:

acquiring anti-shake parameter data of the Nth frame of image from the video file of the Nth frame of image;

the anti-shake processing module 1004 is configured to:

and carrying out anti-shake processing on the N frame image according to the anti-shake parameter data of the N frame image.

With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Fig. 11 is a block diagram illustrating a processing device 1100 for video according to an example embodiment. For example, the apparatus 1100 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.

Referring to fig. 11, apparatus 1100 may include one or more of the following components: a processing component 1102, a memory 1104, a power component 1106, a multimedia component 1108, an audio component 1110, an input/output (I/O) interface 1112, a sensor component 1114, and a communication component 1116.

The processing component 1102 generally controls the overall operation of the device 1100, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 1102 may include one or more processors 1120 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 1102 may include one or more modules that facilitate interaction between the processing component 1102 and other components. For example, the processing component 1102 may include a multimedia module to facilitate interaction between the multimedia component 1108 and the processing component 1102.

The memory 1104 is configured to store various types of data to support operation at the device 1100. Examples of such data include instructions for any application or method operating on device 1100, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1104 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.

Power components 1106 provide power to the various components of device 1100. The power components 1106 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the apparatus 1100.

The multimedia component 1108 includes a screen that provides an output interface between the device 1100 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1108 includes a front facing camera and/or a rear facing camera. The front-facing camera and/or the rear-facing camera may receive external multimedia data when the device 1100 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

The audio component 1110 is configured to output and/or input audio signals. For example, the audio component 1110 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 1100 is in operating modes, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 1104 or transmitted via the communication component 1116. In some embodiments, the audio assembly 1110 further includes a speaker for outputting audio signals.

The I/O interface 1112 provides an interface between the processing component 1102 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.

The sensor assembly 1114 includes one or more sensors for providing various aspects of state assessment for the apparatus 1100. For example, the sensor assembly 1114 may detect an open/closed state of the device 1100, the relative positioning of components, such as a display and keypad of the apparatus 1100, the sensor assembly 1114 may also detect a change in position of the apparatus 1100 or a component of the apparatus 1100, the presence or absence of user contact with the apparatus 1100, an orientation or acceleration/deceleration of the apparatus 1100, and a change in temperature of the apparatus 1100. The sensor assembly 1114 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1114 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1114 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

The communication component 1116 is configured to facilitate wired or wireless communication between the apparatus 1100 and other devices. The apparatus 1100 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1116 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1116 also includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

In an exemplary embodiment, the apparatus 1100 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.

In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 1104 comprising instructions, executable by the processor 1120 of the apparatus 1100 to perform the method described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.

A non-transitory computer readable storage medium having instructions therein, which when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of processing video, the method comprising:

acquiring image data of an Nth frame of image of a video to be recorded, wherein N is a positive integer greater than or equal to 1;

encoding the acquired image data of the Nth frame of image to obtain encoded data of the Nth frame of image;

acquiring the parameter data of the motion parameters of the electronic equipment of x frames related to the Nth frame of image according to a preset rule, wherein x is a positive integer greater than or equal to 1;

determining an anti-shake processing strategy of an Nth frame of image according to the acquired parameter data of the motion parameters of the electronic equipment of the x frames;

and storing the coded data of the N image and the anti-shake processing strategy of the N image as a video file of the N image.

A non-transitory computer readable storage medium having instructions therein, which when executed by a processor of a mobile terminal, enable the mobile terminal to perform a method of processing video, the method comprising:

acquiring a video file of an Nth frame of image, wherein N is a positive integer greater than or equal to 1;

acquiring coded data of the N frame image from the video file of the N frame image;

decoding the coded data of the Nth frame image to obtain image data of the Nth frame image;

acquiring an anti-shake processing strategy of an Nth frame of image from the Nth frame of video file;

and carrying out anti-shake processing on the Nth frame image according to the anti-shake processing strategy of the Nth frame image to obtain the Nth frame image after anti-shake processing.

Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.

It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

21页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:视频传输方法和设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类