This application is filed based upon and claims priority to Chinese Patent Application No. 202010411677.X, filed on May 14, 2020, the entire content of which is incorporated herein by reference for all purposes.
The present disclosure relates to the field of video processing, and more particularly, to a video processing method and apparatus, and a storage medium.
In a relevant art, images are processed according to jitter conditions during a video recording process, thereby reducing the jitter of videos. For anti jitter processing of image data, a gyroscope sensor on an electronic device is generally used to acquire gyroscope data (Gyro data) of the electronic device in the video recording process to process image data for each image frame of the video, thereby achieving the anti jitter purpose. In order to perform the anti jitter processing on the video, image data included in a period of video and corresponding Gyro data need to be cached, which occupies a large amount of memory. Moreover, there is a need for the anti jitter processing on frame image data of the video during the video recording process, which increases the power consumption and heating of the electronic device. Therefore, it is desirable to provide a video processing method with small memory occupation and low power consumption.
According to a first aspect of the present disclosure, a video processing method is provided, which may be applied to an electronic device in a video recording process, and may include: image data for an Nth image frame of a video to be recorded is acquired, the N being a positive integer greater than or equal to 1; the acquired image data for the Nth image frame is encoded to obtain encoded data for the Nth image frame; x frames of parameter data of a motion parameter of the electronic device that are relevant to the Nth image frame are acquired according to a preset rule, the x being a positive integer greater than or equal to 1; an anti jitter processing policy for the Nth image frame is determined according to the acquired x frames of parameter data of the motion parameter of the electronic device; and the encoded data for the Nth image frame and the anti jitter processing policy for the Nth image frame are stored as a video file for the Nth image frame.
According to a second aspect of the present disclosure, a video processing method is provided, which may be applied to an electronic device. The processing method may be applied to a video playing process, and may include: a video file for an Nth image frame is acquired, the N being a positive integer greater than or equal to 1; encoded data for the Nth image frame is acquired from the video file for the Nth image frame; the encoded data for the Nth image frame is decoded to obtain image data for the Nth image frame; an anti jitter processing policy for the Nth image frame is acquired from the video file for the Nth image frame; and anti jitter processing is performed on the Nth image frame according to the anti-jitter processing policy for the Nth image frame to obtain an updated Nth image frame after the anti jitter processing.
According to a third aspect of the present disclosure, a video processing apparatus is provided, which may include: a processor; and a memory configured to store instructions executable by the processor. The processor may be configured to: acquire image data for an Nth image frame of a video to be recorded, the N being a positive integer greater than or equal to 1; encode the acquired image data for the Nth image frame to obtain encoded data for the Nth image frame; acquire, according to a preset rule, x frames of parameter data of a motion parameter of an electronic device that are relevant to the Nth image frame, the x being a positive integer greater than or equal to 1; determine an anti jitter processing policy for the Nth image frame according to the acquired x frames of parameter data of the motion parameter of the electronic device; and store the encoded data for the Nth image frame and the anti jitter processing policy for the Nth image frame as a video file for the Nth image frame.
It is to be understood that the above general descriptions and detailed descriptions below are only exemplary and explanatory and not intended to limit the present disclosure.
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise represented. The implementations set forth in the following description of examples do not represent all implementations consistent with the present disclosure. Instead, they are merely examples of apparatuses and methods consistent with aspects related to the present disclosure as recited in the appended claims.
The present disclosure relates to a video processing method. In a relevant processing method, anti jitter processing is performed on a video in a video recording stage, as illustrated in
According to a video processing method provided by the present disclosure, acquired image data for each image frame of a video to be recorded may directly be encoded to form encoded data for each image frame, parameter data of a motion parameter of an electronic device for performing the anti jitter processing on each image frame may be acquired, and an anti jitter processing policy for each image frame is determined according to the acquired parameter data of the motion parameter of the electronic device for performing the anti jitter processing on each image frame. In a video recording stage, the encoded data for each image frame of the video to be recorded and the corresponding anti jitter processing policy are stored as the corresponding frames of video files. In the video processing method provided by the present disclosure, only the parameter data of the motion parameter of the electronic device for correspondingly performing the anti jitter processing on each image frame may be cached in the video recording stage, and the corresponding number of image data may unnecessarily be cached, thereby reducing the memory occupation of the electronic device. Moreover, according to the video processing method provided by the present disclosure, the anti jitter processing is unnecessarily performed on the video to be recorded, such that the power consumption of the electronic device in the video recording process is reduced, and the heating state of the electronic product is reduced.
An embodiment of the present disclosure provides a video processing method. The video processing method is applied to an electronic device.
At S11, image data for an Nth image frame of a video to be recorded is acquired, and the N is a positive integer greater than or equal to 1.
At S12, the acquired image data for the Nth image frame is encoded to obtain encoded data for the Nth image frame.
At S13, x frames of parameter data of a motion parameter of an electronic device that are relevant to the Nth frame are acquired according to a preset rule, and the x is a positive integer greater than or equal to 1.
At S14, an anti jitter processing policy for the Nth image frame is determined according to the acquired x frames of parameter data of the motion parameter of the electronic device.
At S15, the encoded data for the Nth image frame and the anti jitter processing policy for the Nth image frame are stored as a video file for the Nth image frame.
The method is applied to the electronic device, such as a mobile phone, a portable android device (PAD), a tablet computer, and the like. When recording the video, the electronic device acquires the image data for the Nth image frame, and encodes the image data for the Nth image frame to obtain the encoded data for the Nth image frame. The x frames of parameter data of the motion parameter of the electronic device that are relevant to the Nth frame are acquired according to the preset rule; the anti jitter processing policy for the Nth image frame is determined according to the acquired x frames of parameter data of the motion parameter of the electronic device; and the encoded data for the Nth image frame and the anti-jitter processing policy for the Nth image frame are stored as the video file for the Nth image frame. The motion parameter of the electronic device refers to a motion parameter of the electronic device that affects the video recording in the video recording process. The motion parameter may include any motion parameter affecting the video recording, and may, for example, include at least one of: a motion direction parameter, a motion velocity parameter or a motion manner parameter. The parameter data of the motion parameter may be gyroscope data, i.e., the Gyro data.
According to the video processing method provided by the present disclosure, the corresponding number of image data may unnecessarily be cached in a video recording stage, thereby reducing the occupation of a memory of the electronic device. Moreover, the anti jitter processing is unnecessarily performed on the video to be recorded in the video recording stage, such that the power consumption of the electronic device in the video recording process is reduced, and the heating state of electronic product is reduced.
An embodiment of the present disclosure provides a video processing method.
At S131, the x frames of parameter data of the motion parameter of the electronic device that are relevant to the Nth image frame are acquired according to either of following manners.
In a first manner, nth to (n+X−1)th frames of parameter data of the motion parameter of the electronic device that are corresponding to Nth to (N+X−1) frames of images are continuously acquired, and the X is a positive integer greater than or equal to 1.
In a second manner, according to an equal time interval from the Nth frame, the x frames of parameter data of the motion parameter of the electronic device that are corresponding to X frames of images are backwardly acquired, and the X is a positive integer greater than or equal to 1.
In the first manner, in order to accurately perform the anti jitter processing on the Nth image frame, the nth to (n+X−1)th frames of parameter data of the motion parameter of the electronic device that are corresponding to the Nth to (N+X−1)th frames of images are continuously and backwardly acquired along the time sequence from the Nth image frame, and the anti jitter processing policy for the Nth image frame is determined according to the acquired nth to (n+X−1)th frames of parameter data of the motion parameter of the electronic device. The X is equal to the x, and the nth to (n+X−1)th frames of parameter data of the motion parameter of the electronic device is the x frames of parameter data of the motion parameter of the electronic device.
In the second manner, in order to further reduce the cached data, on the basis of ensuring that the anti jitter policy for the Nth image frame can be accurately determined, the x frames of parameter data of the motion parameter of the electronic device that are corresponding to the X frames of images are backwardly acquired along the time sequence according to the equal time interval, and the anti jitter processing policy for the Nth image frame is determined according to the acquired X frames of parameter data of the motion parameter of the electronic device.
The present disclosure provides a video processing method, as illustrated in
At S141, anti jitter parameter data for the Nth image frame is determined according to the acquired x frames of parameter data of the motion parameter of the electronic device.
In the present disclosure, the anti jitter parameter data for the Nth image frame may be determined according to the acquired x frames of parameter data of the motion parameter of the electronic device, such that the anti jitter processing may be performed on each acquired image frame of the video according to the anti jitter parameter data. The anti-jitter parameter data may include any parameter for performing the anti jitter processing on each image frame of the video, and may, for example, include the image data for the Nth image frame, a cutting region, a rotation angle, an image correction parameter, and the like.
An embodiment of the present disclosure provides a video processing method. The video processing method is applied to an electronic device.
At S21, a video file for an Nth image frame is acquired, and the N is a positive integer greater than or equal to 1.
At S22, encoded data for the Nth image frame is acquired from the video file for the Nth image frame.
At S23, the encoded data for the Nth image frame is decoded to obtain image data for the Nth image frame.
At S24, an anti jitter processing policy for the Nth image frame is acquired from the video file for the Nth image frame.
At S25, anti-jitter processing is performed on the Nth image frame according to the anti jitter processing policy for the Nth image frame to obtain an updated Nth image frame after the anti jitter processing.
In the video playing process, in the video processing method provided by the present disclosure, the video file for the Nth image frame is acquired, and the encoded data for the Nth image frame is acquired from the video file for the Nth image frame; the encoded data for the Nth image frame is decoded to obtain the image data for the Nth image frame; the anti-jitter processing policy for the Nth image frame is acquired from the video file for the Nth image frame; and the anti jitter processing is performed on the Nth image frame according to the anti jitter processing policy for the Nth image frame to obtain the updated Nth image frame after the anti jitter processing. In the video processing method provided by the present disclosure, by providing the video anti jitter processing in the video playing stage, the anti-jitter processing is unnecessarily performed on each image frame of the video to be recorded in a video recording stage, such that the power consumption of the electronic device in the video recording process is reduced, and the heating state of electronic product is reduced.
The present disclosure provides a video processing method, as illustrated in
At S241, anti jitter parameter data for the Nth image frame is acquired from the video file for the Nth image frame.
In the present disclosure, the anti jitter parameter data for the Nth image frame may be acquired from the video file for the Nth image frame. The anti jitter parameter data may include any parameter for performing the anti jitter processing on each image frame of the video, and may, for example, include the image data for the Nth image frame, a cutting region, a rotation angle, an image correction parameter, and the like.
At S251, the anti jitter processing is performed on the Nth image frame according to the anti jitter parameter data for the Nth image frame.
Any manner capable of performing the anti jitter processing on the Nth image frame according to the anti jitter parameter data for the Nth image frame in the related art may be used, for example, according to the anti jitter parameter data for the Nth image frame, the anti jitter processing may be performed on the Nth image frame by cutting, rotating and twisting the Nth image frame and the like.
The Nth image frame after the anti jitter processing may be transmitted to a display module for next steps of processing and displaying.
In an example of the present disclosure, a video processing apparatus is provided. As illustrated in
The first acquisition module 901 is configured to acquire image data for an Nth image frame of a video to be recorded, and the N is a positive integer greater than or equal to 1.
The encoding module 902 is configured to encode the acquired image data for the Nth image frame to obtain encoded data for the Nth image frame.
The second acquisition module 903 is configured to acquire, according to a preset rule, x frames of parameter data of a motion parameter of an electronic device that are relevant to the Nth image frame, and the x is a positive integer greater than or equal to 1.
The determination module 904 is configured to determine an anti jitter processing policy for the Nth image frame according to the acquired x frames of parameter data of the motion parameter of the electronic device.
The storage module 905 is configured to store the encoded data for the Nth image frame and the anti jitter processing policy for the Nth image frame as a video file for the Nth image frame.
The second acquisition module 903 is configured to acquire, according to either of following manners, the x frames of parameter data of the motion parameter of the electronic device that are relevant to the Nth image frame.
In a first manner, nth to (n+X−1)th frames of parameter data of the motion parameter of the electronic device that are corresponding to Nth to (N+X−1) frames of images are continuously acquired, and the X is a positive integer greater than or equal to 1.
In a second manner, according to an equal time interval from the Nth frame, the x frames of parameter data of the motion parameter of the electronic device that are corresponding to X frames of images are backwardly acquired, and the X is a positive integer greater than or equal to 1.
The parameter data of the motion relevant parameter of the electronic device include at least one of: parameter data of a motion direction parameter, parameter data of a motion velocity parameter, or parameter data of a motion manner parameter.
The determination module 904 is configured to determine anti jitter parameter data for the Nth image frame according to the acquired x frames of parameter data of the motion parameter of the electronic device.
In an example of the present disclosure, a video processing apparatus is provided. As illustrated in
The third acquisition module 1001 is configured to acquire a video file for an Nth image frame, and the N is a positive integer greater than or equal to 1.
The fourth acquisition module 1002 is configured to acquire encoded data for the Nth image frame from the video file for the Nth image frame.
The decoding module 1003 is configured to decode the encoded data for the Nth image frame to obtain image data for the Nth image frame.
The fourth acquisition module 1002 is configured to acquire an anti jitter processing policy for the Nth image frame from the video file for the Nth image frame.
The anti jitter processing module 1004 is configured to perform anti jitter processing on the Nth image frame according to the anti jitter processing policy for the Nth image frame to obtain an Nth image frame after the anti jitter processing.
The fourth acquisition module 1002 is configured to acquire anti jitter parameter data for the Nth image frame from the video file for the Nth image frame.
The anti jitter processing module 1004 is configured to perform the anti jitter processing on the Nth image frame according to the anti jitter parameter data for the Nth image frame.
For the apparatus in the above embodiments, the specific manner for the operation executed by each module has been described in detail in the embodiments related to the method, and is not repeated herein.
Referring to
The processing component 1102 typically controls overall operations of the apparatus 1100, such as the operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 1102 may include one or more processors 1120 to execute instructions to perform all or part of the steps in the above described methods. Moreover, the processing component 1102 may include one or more modules which facilitate interaction between the processing component 1102 and other components. For instance, 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 the operation of the apparatus 1100. Examples of such data include instructions for any applications or methods operated on the apparatus 1100, contact data, phonebook data, messages, pictures, video, etc. The memory 1104 may be implemented by any type of volatile or non-volatile memory devices, or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, and a magnetic or optical disk.
The power component 1106 provides power for various components of the apparatus 1100. The power component 1106 may include a power management system, one or more power supplies, and other components associated with generation, management and distribution of power for the apparatus 1100.
The multimedia component 1108 includes a screen providing an output interface between the apparatus 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 the TP, the screen may be implemented as a touch screen to receive an input signal from the user. The TP includes one or more touch sensors to sense touches, swipes and gestures on the TP. The touch sensors may not only sense a boundary of a touch or swipe action, but also detect a period of time and a pressure associated with the touch or swipe action. In some embodiments, the multimedia component 1108 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the apparatus 1100 is in an operation mode, such as a photographing mode or a video mode. Each of the front camera and the rear camera may be a fixed optical lens system or have focusing and optical zooming capabilities.
The audio component 1110 is configured to output and/or input an audio signal. For example, the audio component 1110 includes a microphone (MIC) configured to receive an external audio signal when the apparatus 1100 is in an operation mode, such as a call mode, a recording mode and a voice recognition mode. The received audio signal may further be stored in the memory 1104 or sent via the communication component 1116. In some embodiments, the audio component 1110 further includes a speaker configured to output the audio signal.
The I/O interface 1112 provides an interface between the processing component 1102 and peripheral interface modules, such as a keyboard, a click wheel, buttons and the like. The buttons may include, but are not limited to, a home button, a volume button, a starting button and a locking button.
The sensor component 1114 includes one or more sensors configured to provide status assessments in various aspects for the apparatus 1100. For instance, the sensor component 1114 may detect an on/off status of the apparatus 1100 and relative positioning of components, such as a display and small keyboard of the apparatus 1100, and the sensor component 1114 may further detect a change in a position of the apparatus 1100 or a component of the apparatus 1100, presence or absence of contact between the user and the apparatus 1100, orientation or acceleration/deceleration of the apparatus 1100 and a change in temperature of the apparatus 1100. The sensor component 1114 may include a proximity sensor configured to detect presence of an object nearby without any physical contact. The sensor component 1114 may also include a light sensor, such as a complementary metal oxide semiconductor (CMOS) or charge coupled device (CCD) image sensor, configured for use in an imaging application. In some embodiments, the sensor component 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 communication-standard-based wireless network, such as a wireless fidelity (WiFi) network, a 2nd-generation (2G) or 3rd-generation (3G) network or a combination thereof. In an example, the communication component 1116 receives a broadcast signal or broadcast associated information from an external broadcast management system via a broadcast channel. In an example, the communication component 1116 further includes a near field communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on a radio frequency identification (RFID) technology, an infrared data association (IrDA) technology, an ultra-wide band (UWB) technology, a Bluetooth (BT) technology, and other technologies.
In an example, 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, and is configured to execute the above described methods.
In an example, there is also provided anon-transitory computer-readable storage medium including instructions, such as included in the memory 1104, executable by the processing component 1120 of the apparatus 1100 for performing the above methods. For example, the non-transitory computer-readable storage medium may be a read only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disc, an optical data storage device, and the like.
Anon-transitory computer-readable storage medium is provided, instructions in the storage medium are executed by a processor of a mobile terminal, to cause the mobile terminal to perform the video processing method, which may include: image data for an Nth image frame of a video to be recorded is acquired, the N being a positive integer greater than or equal to 1; the acquired image data for the Nth image frame is encoded to obtain encoded data for the Nth image frame; x frames of parameter data of a motion parameter of an electronic device that are relevant to the Nth image frame are acquired according to a preset rule, the x being a positive integer greater than or equal to 1; an anti jitter processing policy for the Nth image frame is determined according to the acquired x frames of parameter data of the motion parameter of the electronic device; and the encoded data for the Nth image frame and the anti-jitter processing policy for the Nth image frame are stored as a video file for the Nth image frame.
Anon-transitory computer-readable storage medium is provided, instructions in the storage medium are executed by a processor of a mobile terminal, to cause the mobile terminal to perform the video processing method, which may include: a video file for an Nth image frame is acquired, the N being a positive integer greater than or equal to 1; encoded data for the Nth image frame is acquired from the video file for the Nth image frame; the encoded data for the Nth image frame is decoded to obtain image data for the Nth image frame; an anti-jitter processing policy for the Nth image frame is acquired from the video file for the Nth image frame; and anti jitter processing is performed on the Nth image frame according to the anti jitter processing policy for the Nth image frame to obtain an updated Nth image frame after the anti jitter processing.
Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the present disclosure disclosed here. This application is intended to cover any variations, uses, or adaptations of the present disclosure following the general principles thereof and including such departures from the present disclosure as come within known or customary practice in the art. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
It will be appreciated that the present disclosure is not limited to the exact construction that has been described above and illustrated in the accompanying drawings, and that various modifications and changes may be made without departing from the scope thereof. It is intended that the scope of the present disclosure only be limited by the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
202010411677.X | May 2020 | CN | national |