CN109819187B - Video recording control method and device, mobile terminal and storage medium - Google Patents

Video recording control method and device, mobile terminal and storage medium Download PDF

Info

Publication number
CN109819187B
CN109819187B CN201910069621.8A CN201910069621A CN109819187B CN 109819187 B CN109819187 B CN 109819187B CN 201910069621 A CN201910069621 A CN 201910069621A CN 109819187 B CN109819187 B CN 109819187B
Authority
CN
China
Prior art keywords
image
video
picture
video image
proportion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910069621.8A
Other languages
Chinese (zh)
Other versions
CN109819187A (en
Inventor
马玉刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910069621.8A priority Critical patent/CN109819187B/en
Publication of CN109819187A publication Critical patent/CN109819187A/en
Application granted granted Critical
Publication of CN109819187B publication Critical patent/CN109819187B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Studio Devices (AREA)

Abstract

The application discloses a video recording control method, a video recording control device, a mobile terminal and a storage medium, wherein the video recording control method comprises the following steps: when an application program carries out video recording, outputting a video image acquired by a camera to the application program; acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, and the setting at least comprises compression processing; detecting whether the processed image is deformed relative to the video image; and if the image is deformed, controlling the camera to adjust the first picture proportion of the output video image to the second picture proportion of the processed image. The method can avoid content deformation of the recorded video.

Description

Video recording control method and device, mobile terminal and storage medium
Technical Field
The present application relates to the field of mobile terminal technologies, and in particular, to a method and an apparatus for controlling video recording, a mobile terminal, and a storage medium.
Background
Mobile terminals, such as mobile phones, tablet computers, etc., have become one of the most common consumer electronic products in people's daily life. With the rapid development of the technology level, the integration of the mobile terminal can realize more and more functions, such as video recording, internet surfing, games, shopping, and the like. However, when the mobile terminal records a video, the picture content in the recorded video is distorted.
Disclosure of Invention
In view of the foregoing problems, the present application provides a method and an apparatus for controlling video recording, a mobile terminal, and a storage medium, so as to avoid content distortion of the recorded video.
In a first aspect, an embodiment of the present application provides a method for controlling video recording, where the method includes: when an application program carries out video recording, outputting a video image acquired by a camera to the application program; acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, the setting at least comprises compression processing, and the compression processing is used for obtaining an image with a second picture proportion; detecting whether the processed image is deformed relative to the video image; and if the image is deformed, controlling the camera to adjust the first picture proportion of the subsequent output video image to the second picture proportion.
In a second aspect, an embodiment of the present application provides a control apparatus for video recording, where the apparatus includes: the system comprises an image output module, an image acquisition module, a deformation detection module and a proportion adjustment module, wherein the image output module is used for outputting a video image acquired by a camera to an application program when the application program carries out video recording; the image acquisition module is used for acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, the setting at least comprises compression processing, and the compression processing is used for obtaining an image with a second picture proportion; the deformation detection module is used for detecting whether the processed image deforms relative to the video image; and the proportion adjusting module is used for controlling the camera to adjust the first picture proportion of the subsequent output video image into the second picture proportion if the deformation occurs.
In a third aspect, an embodiment of the present application provides a mobile terminal, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the control method for video recording as provided in the first aspect above.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, and the program code may be called by a processor to execute the control method for video recording provided in the first aspect.
According to the scheme, when the application program records the video, the video image collected by the camera is output to the application program, the processing image transmitted to the encoder by the application program is obtained, the processing image is the image obtained by setting the video image by the application program, the setting at least comprises compression processing, the compression processing is used for obtaining the image with the second picture proportion, whether the processing image is deformed relative to the video image or not is detected, if the processing image is deformed, the camera is controlled to adjust the first picture proportion of the subsequent output video image into the second picture proportion, so that the picture proportion of the video image output by the camera is adjusted, the picture proportion of the video image output by the camera is consistent with the picture proportion of the image after the setting processing by the application program, and the deformation of the video content is avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a flow chart of a control method of video recording according to an embodiment of the present application.
Fig. 2 shows a flow chart of a control method of video recording according to another embodiment of the present application.
Fig. 3 is a flowchart illustrating step S250 of a control method for video recording according to an embodiment of the present application
Fig. 4 shows a flow chart of a control method of video recording according to yet another embodiment of the present application.
Fig. 5 shows a block diagram of a control device for video recording according to an embodiment of the present application.
Fig. 6 shows a block diagram of a distortion detection module in a control device for video recording according to an embodiment of the present application.
Fig. 7 shows a block diagram of a scaling module in a control device for video recording according to an embodiment of the present application.
Fig. 8 is a block diagram of a mobile terminal for performing a control method of video recording according to an embodiment of the present application.
Fig. 9 is a storage unit for storing or carrying program codes for implementing a control method for ear video recording according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
Currently, most mobile terminals, such as mobile phones, tablet computers, and the like, can record videos. With the increase of applications capable of recording videos, such as camera applications, live broadcast applications and the like, more and more users use video recording applications installed on mobile terminals to record videos.
The inventor finds that, through long-time research, content deformation phenomena, such as face widening in a video image, and the like, and for example, cups in the video image are elongated, often occur in a recorded video by using a video recording application installed on a mobile terminal. In view of the above problems, the inventors have studied and proposed for a long time a method, an apparatus, a mobile terminal, and a storage medium for controlling video recording according to embodiments of the present application, where when an application performs video recording, a video image captured by a camera is output to the application, a processed image output by the application to an encoder is obtained, and the processed image is obtained by performing setting processing through the application, where the setting processing at least includes compression processing, and when it is detected that the processed image is deformed relative to the video image, a first frame ratio of the video image output by the camera is controlled to be adjusted to a second frame ratio of the processed image, so that a frame ratio of the video image output by the camera is consistent with a frame ratio of the processed image during encoding, thereby avoiding deformation of frame contents and improving a video recording effect.
The following describes in detail a control method for video recording according to an embodiment of the present application.
Referring to fig. 1, an embodiment of the present application provides a video recording control method, which is applicable to a mobile terminal, and the video recording control method may include:
step S110: and when the application program carries out video recording, outputting the video image collected by the camera to the application program.
In the embodiment of the application, the condition of video recording of the application program can be detected, so that when the application program carries out video recording, the video image acquired by the camera is output to the application program. The application program may be an application program capable of recording a video, such as a live-type application program, a shooting-type application program, and the like, and the specific application program may not be limited in this embodiment of the application.
In some embodiments, the system of the mobile terminal may detect a call to the camera by the application program and a call to a class for video recording in the system, for example, when the system of the mobile terminal is an android system, a call to a MediaRecorder class may be detected. When the fact that the application program calls the camera and calls the video recording class is detected, the fact that the application program records the video can be determined.
In some embodiments, the system of the mobile terminal may also detect whether an interface for video recording is called by an application program to determine whether the application program exists for video recording. For example, when the system of the mobile terminal is an android system, it may be detected whether the mediaproject interface and the mediaproject manager interface are called. When the interface for video recording is detected to be called by the application program, the application program is determined to carry out video recording. Of course, the specific manner of recording the video by the detection application may not be limited in the embodiment of the present application.
In the embodiment of the application, when it is detected that the application performs video recording, the video image acquired by the camera may be output to the application through the system interface, so that the application may perform related processing on the video image acquired by the camera subsequently. In addition, the system of the mobile terminal may buffer the output video image, so as to determine whether the content in the video image is deformed after the application program processes the video image.
Step S120: and acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, and the setting at least comprises compression processing which is used for obtaining an image with a second picture scale.
After the video image collected by the camera is output to the application program, the detection application program can detect the processing image transmitted to the encoder after the video image is set and processed. After the application program acquires the video image acquired by the camera, the application program can perform setting processing on the video image, and after the video image is processed to obtain a processed image, the processed image needs to be transmitted to an encoder to generate a video file. The encoder may be an encoder of a software encoding method, or may be an encoder of a hardware encoding method, and the encoding method specifically adopted may not be limited.
In the embodiment of the present application, the setting processing performed by the application program on the video image at least includes compression processing. The compression process is a mechanism for reducing the file size of a computer through a specific algorithm, the compression process can compress the picture size of a video image, for example, the picture resolution of the video image is 2340 × 1080, that is, the picture ratio is 19.5:9, and the application program can compress the video image to the resolution of 1280 × 720, that is, the picture ratio is 16: 9. Of course, the setting process of the video image captured by the camera by the application program may also include other processes, for example, a beautifying process (e.g., beautifying, peeling, etc.) of image content in the video image, and the specific setting process may not be limited in this embodiment of the application.
In some embodiments, the system of the mobile terminal may monitor the processing image transmitted to the encoder by the application program after the application program performs the setting processing on the video image, so as to obtain the processing image, and determine whether the processing image is deformed before the encoder encodes the processing image to generate the video file.
Step S130: detecting whether the processed image is distorted with respect to the video image.
When the application program installed on the mobile terminal records the video, the phenomenon that the content in the recorded video is deformed can occur, so that whether the processed image is deformed relative to the video image or not can be detected after the processed image transmitted to the encoder by the application program for recording the video is obtained. Wherein the deformation includes that the content in the image is squeezed, stretched, distorted, shifted, etc. In some embodiments, it may be determined that the processed image is distorted with respect to the video image by detecting whether a background image of the processed image is distorted with respect to a background image of the video image, and whether a foreground image of the processed image is distorted with respect to a foreground image of the video image. In some embodiments, it may be determined that the processed image is distorted with respect to the video image by determining whether the size of the picture scale of the processed image is the same as the size of the picture scale of the video image, if the two are not the same. In some embodiments, it is also possible to detect whether the aspect ratio of a content element (e.g. person, building) in the processed image is the same as the aspect ratio of the content element in the video image, where aspect ratio refers to the ratio of the width to the height of the content element. Of course, the specific manner for detecting whether the processed image is deformed relative to the video image may not be limited in the embodiment of the present application.
It can be understood that, when the application program sets the video image, the compression processing is performed on the video image. When an application program compresses a video image, if the picture proportion during compression is different from that of the video image, the application program directly compresses the video image without performing operations such as cropping and the like on the video image, and then the compressed image is deformed, that is, the processed image is deformed relative to the video image. For example, if a video image with a picture ratio of 19.5:9 is compressed to a 16:9 image and the video image is directly compressed without performing processing such as cropping, the picture content will be distorted. Therefore, when the processed image transmitted to the encoder by the application program is acquired, whether the processed image is deformed relative to the cached video image can be detected, so that when the processed image is deformed relative to the encoded image, relevant adjustment and processing can be performed, and deformation of video content in a subsequently generated video file is avoided.
Step S140: and if the image is deformed, controlling the camera to adjust the first picture proportion of the subsequent output video image to the second picture proportion.
When it is detected in step S130 that the processed image is distorted with respect to the video image, relevant adjustment and processing may be performed to avoid distortion of the video content in the generated video file.
In the embodiment of the present application, since the processed image is deformed with respect to the video image, when the video image is compressed by the application program, the compressed picture ratio is different from the picture ratio of the video image, and the processed image is deformed with respect to the video image. In order to enable the video images collected by the subsequent cameras to be transmitted to the processing images after the setting processing is carried out on the video images, the processing images cannot deform relative to the video images, and the picture proportion of the video images output by the cameras can be adjusted. Specifically, the picture proportion of the video image output by the current camera is used as the first picture proportion, the second picture proportion of the obtained processed image is obtained, and the camera can be controlled to adjust the first picture proportion of the output video image to the application program, namely, the picture proportion of the video image output by the camera to the second picture proportion, so that the picture proportion of the video image output by the camera is the same as the picture proportion of the video image compressed by the application program, the processed image transmitted to the encoder for encoding is not deformed, and the deformation of the video content in the video file generated after encoding is effectively avoided.
When it is detected in step S130 that the processed image is not deformed with respect to the video image, it indicates that the processed image obtained by the application performing the setting process on the video image is not deformed with respect to the video image, so that the video image can be directly encoded and the encoded image is output to the application, and the video content in the video file generated by the application is not deformed.
It can be understood that the control is performed when the application program is recorded by the method, all the deformed processing images are not required to be processed to correct the deformation, the subsequent processing images are not deformed only by adjusting the picture proportion of the video images output by the camera, and the deformation of the processing images transmitted to the encoder for encoding is conveniently and quickly avoided, so that the video content in the video file generated after encoding is deformed.
The method for controlling video recording provided by the embodiment of the application includes that when an application program records a video, a video image collected by a camera is output to the application program, a processing image transmitted to an encoder by the application program is obtained, the processing image is an image obtained by setting and processing the video image by the application program, the setting and processing at least comprises compression processing, whether the processing image is deformed relative to the video image or not is detected, if the processing image is deformed, the camera is controlled to adjust a first picture proportion of the output video image to a second picture proportion of the processing image, so that the picture proportion of the video image output by the camera is adjusted, the picture proportion of the video image output by the camera is consistent with the picture proportion of the image set and processed by the application program, and deformation of video content is avoided.
Referring to fig. 2, another embodiment of the present application provides a video recording control method, which is applicable to a mobile terminal, and the video recording control method may include:
step S210: and when the application program carries out video recording, outputting the video image collected by the camera to the application program.
Step S220: and acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, and the setting at least comprises compression processing which is used for obtaining an image with a second picture scale.
In the embodiment of the present application, step S210 and step S220 may refer to the contents of the above embodiments, and are not described herein again.
Step S230: and acquiring a first picture proportion of the video image and a second picture proportion of the processed image.
After the processed image transmitted to the encoder by the application program for video recording is acquired, whether the processed image is deformed relative to the video image can be detected.
In the embodiment of the present application, when detecting whether the processed image is deformed relative to the video image, it may be determined whether the video image is deformed relative to the video image according to the processed image and the picture ratio of the video image. First, a first picture scale of the video image and a second picture scale of the processed image may be obtained to determine whether the video image is distorted with respect to the video image. Specifically, the picture ratio of the video image can be identified, and the picture ratio of the image can be identified, so as to obtain the first picture ratio and the second picture ratio. In some embodiments, the resolution of the video image may be identified, such that the first picture scale of the video image is derived based on the resolution of the video image, e.g., the resolution of the video image is 2340 x 1080, and the first picture scale of the video image is 19.5: 9. Similarly, a second frame rate of the processed image may be determined by identifying a resolution of the processed image and then determining the second frame rate of the processed image based on the resolution of the processed image. Of course, the manner of specifically acquiring the first picture scale of the video image and processing the second picture scale of the image in the embodiment of the present application may not be limited.
Step S240: and judging whether the first picture proportion is the same as the second picture proportion.
After acquiring the first picture proportion of the video image and the second picture proportion of the processed image, the first picture proportion and the second picture proportion may be compared to determine whether the first picture proportion and the second picture proportion are the same.
Step S250: and if the first picture proportion is different from the second picture proportion, determining that the processed image is deformed relative to the video image.
In this embodiment, when it is determined in step S240 that the first screen ratio of the video image is different from the second screen ratio of the processed image, the application program compresses the video image to an image with a different screen ratio when performing the setting process on the video image, and usually does not perform operations such as clipping process on the video image, so that the processed image is deformed relative to the video image. Therefore, if it is determined in step S240 that the first picture scale of the video image is different from the second picture scale of the processed image, it can be determined that the processed image is deformed with respect to the video image.
When it is determined in step S240 that the first frame rate of the video image is the same as the second frame rate of the processed image, it means that the application compresses the video image to an image with the same frame rate as the frame rate of the video image output by the camera during the setting process of the video image, and therefore the processed image is not deformed relative to the video image regardless of the setting process performed by the application. Therefore, if it is determined in step S240 that the first picture scale of the video image is different from the second picture scale of the processed image, it can be determined that the processed image is not deformed with respect to the video image.
In some embodiments, when it is determined in step S240 that the first picture scale of the video image is different from the second picture scale of the processed image, it may be further determined whether the scale of the picture content in the processed image is the same as the scale of the picture content in the video image, so as to accurately confirm whether the processed image is deformed relative to the video image. Therefore, referring to fig. 3, if the first picture scale of the video image is different from the second picture scale of the processed image, determining that the processed image is distorted with respect to the video image may include:
step S251: identifying a first scale of a specified object in the video image and a second scale of the specified object in the processed image if the first picture scale is not the same as the second picture scale.
In some embodiments, when it is determined in step S240 that the first picture scale of the video image is different from the second picture scale of the processed image, the picture content in the video image may be identified, and the picture content in the processed image may be identified, so as to determine the picture content in the video image and the scale of the picture content in the processed image. In particular, the first scale of the specified object in the video image may be identified, and the second scale of the specified object in the image may be processed. Wherein specifying the object may include: the mobile terminal can use the stored model or image of the designated object to identify the designated object in the video image and identify the designated object in the processed image, so as to acquire the area corresponding to the designated object in the video image and the area corresponding to the designated object in the processed image. The identified designated object in the video image is the same as the identified designated object in the processed image. In this embodiment of the application, the specific designated object may not be limited, and the mobile terminal may identify one or more objects of the designated objects in the video image and the processed image when identifying the designated object in the video image and the designated object in the processed image.
After identifying the designated object in the video image and the designated object in the processed image, the mobile terminal may then determine a first scale of the designated object in the video image and a second scale of the designated object in the processed image. In some embodiments, a first proportion of the designated objects in the video image may be determined according to a region in which the designated objects are located in the video image, where the first proportion of the designated objects may be a proportion of a size of the region in which the designated objects are located in the video image to a size of the video image. Similarly, the second proportion of the designated object in the processed image may be determined according to the area in which the designated object is located in the processed image. Of course, the manner of specifically acquiring the first scale of the specified object in the video image and processing the second scale in the image may not be limited in the embodiment of the present application.
Step S252: and judging whether the first proportion is the same as the second proportion.
After identifying the sum of the first proportion of the specified object in the video image and the second proportion of the processed image, the first proportion and the second proportion can be compared to determine whether the first proportion and the second proportion are the same.
Step S253: and if the first proportion is not the same as the second proportion, determining that the processed image is deformed relative to the video image.
In some embodiments, when it is determined in step S252 that the first ratio of the designated object in the video image is not the same as the second ratio of the designated object in the processed image, it indicates that the application program compresses the first screen ratio of the video image to the second different screen ratio when the video image is compressed by the application program, and does not clip the video image before the video image is compressed, so that the second ratio of the designated object in the processed image obtained after the application program performs the setting process on the video image is different from the first ratio of the designated object in the video image. Therefore, if it is determined that the first picture scale of the video image is different from the second picture scale of the processed image and it is determined that the first scale of the designated object in the video image is different from the second scale of the designated object in the processed image, it can be determined that the processed image is deformed with respect to the video image.
In addition, if it is determined that the first screen ratio of the video image is different from the second screen ratio of the processed image but the first ratio of the designated object in the video image is the same as the second ratio of the designated object in the processed image, this means that the application performs an operation such as cropping on the video image so that the first ratio of the designated object in the video image is the same as the second ratio of the designated object in the processed image when compressing the video image.
Step S260: and if the image is deformed, controlling the camera to adjust the first picture proportion of the subsequent output video image to the second picture proportion.
In the embodiment of the present application, when it is detected in step S250 that the processed image is deformed relative to the video image, the first screen ratio of the video image output by the camera is different from the second screen ratio to which the application compresses the video image when compressing the video image, and the application does not perform a cropping operation on the video image before compressing the video image. In order to enable the video images collected by the subsequent cameras to be transmitted to the processing images after the setting processing is carried out on the video images, the processing images cannot deform relative to the video images, and the picture proportion of the video images output by the cameras can be adjusted. Specifically, the picture proportion of the video image output by the current camera is used as the first picture proportion, the second picture proportion of the obtained processed image is obtained, and the camera can be controlled to adjust the first picture proportion of the output video image to the application program, namely, the picture proportion of the video image output by the camera to the second picture proportion, so that the picture proportion of the video image output by the camera is the same as the picture proportion of the video image compressed by the application program, the processed image transmitted to the encoder for encoding is not deformed, and the deformation of the video content in the video file generated after encoding is effectively avoided.
Step S270: and if the processed image is not deformed, encoding the processed image and outputting the encoded image to an application program.
When it is detected in step S250 that the processed image is not deformed with respect to the video image, it indicates that the processed image obtained by the application performing the setting process on the video image is not deformed with respect to the video image, so that the video image can be directly encoded and the encoded image is output to the application, and the video content in the video file generated by the application is not deformed.
It can be understood that the control is performed when the application program is recorded by the method, all the deformed processing images are not required to be processed to correct the deformation, the subsequent processing images are not deformed only by adjusting the picture proportion of the video images output by the camera, and the deformation of the processing images transmitted to the encoder for encoding is conveniently and quickly avoided, so that the video content in the video file generated after encoding is deformed. In addition, all the application programs capable of performing video recording can be controlled by the method, so that the video content in the recorded video file cannot be deformed when all the application programs capable of performing video recording perform video recording.
According to the control method for video recording provided by the embodiment of the application, when the application program records the video, the video image collected by the camera is output to the application program, then the processing image which is transmitted to the encoder after the application program sets the video image is obtained, the setting processing at least comprises compression processing, then the first picture proportion of the video image and the second picture proportion of the processing image are obtained, and the processing image is determined to deform relative to the video image by judging whether the first picture proportion is the same as the second picture proportion or not and when the first picture proportion is not the same as the second picture proportion. In addition, when it is determined that the first picture ratio is not the same as the second picture ratio, it may be further determined whether a first ratio of a designated object in the processed image is the same as a second ratio of the designated object in the video image, and when the first ratio is not the same as the second ratio, it is determined that the processed image is deformed with respect to the video image. If the processed image is deformed relative to the video image, the camera is controlled to adjust the first picture proportion of the output video image to the second picture proportion of the processed image, so that the picture proportion of the video image output by the camera is adjusted, the picture proportion of the video image output by the camera is consistent with the picture proportion of the image which is set and processed by an application program, and the deformation of the video content is avoided.
Referring to fig. 4, another embodiment of the present application provides a video recording control method, which is applicable to a mobile terminal, and the video recording control method may include:
step S310: and when the application program carries out video recording, outputting the video image collected by the camera to the application program.
Step S320: and acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, and the setting at least comprises compression processing which is used for obtaining an image with a second picture scale.
Step S330: detecting whether the processed image is distorted with respect to the video image.
In the embodiment of the present application, steps S310 to S330 may refer to the contents of the above embodiments, and are not described in detail herein.
Step S340: and if the processed image is deformed, judging whether the deformation degree of the processed image relative to the video image is greater than a set degree.
If it is detected in step S330 that the processed image is deformed relative to the video image, it may be further determined whether the degree of deformation of the processed image relative to the video image is greater than a set degree, so as to accurately determine whether the deformation of the processed image relative to the video image is caused by the application program compressing the video image.
In the embodiment of the present application, when it is detected that the processed image is deformed with respect to the video image, the degree of deformation of the processed image with respect to the video image may be determined. In some embodiments, when determining whether the processed image is distorted with respect to the video image by determining whether a first picture scale of the video image is the same as a second picture scale of the processed image and determining whether a first scale of a specified object in the video image is the same as a second scale of the specified object in the processed image, a degree of distortion of the processed image with respect to the video image may be determined based on a difference ratio of the second scale to the first scale. As one mode, an absolute value of a difference between the second ratio and the first ratio may be calculated, and then a first ratio of the absolute value to the first ratio may be calculated, and the first ratio may be used as a degree of deformation of the processed image with respect to the video image. Alternatively, an absolute value of a difference between the second picture scale and the first picture scale may be calculated, and then a second ratio of the absolute value to the first picture scale may be calculated, and the second ratio may be used as a degree of deformation of the processed image with respect to the video image. Of course, the specific way of calculating the deformation degree of the processed image relative to the video image may not be limited in the embodiment of the present application.
After the degree of deformation of the processed image relative to the video image is obtained, the degree of deformation of the processed image relative to the video image may be compared with a set degree to determine whether the degree of deformation of the processed image relative to the video image is greater than the set degree. The specific numerical value of the set degree is not limited in the embodiments of the present application, and may be, for example, 0.1 or 0.2.
It can be understood that, if the degree of deformation of the processed image relative to the video image is greater than the set degree, this indicates that the degree of deformation of the video image is greater after the application performs the setting process on the video image, so that it can be determined that, when the application performs the compression process on the video image, the video image in the first picture ratio is compressed into the image in the second picture ratio, and the compression process is performed directly without cropping the video image, so that the degree of deformation of the processed image relative to the video image is greater. If the deformation degree of the processed image relative to the video image is not greater than the setting degree, it means that the deformation degree of the video image is smaller after the application program performs the setting processing on the video image, and the deformation of the processed image may be caused by other factors, for example, caused by the application program beautifying the image content in the video image, or caused by other processing in the setting processing, rather than by the application program compressing the video image so that the first frame rate is compressed into the image of the second frame rate.
Step S350: and if the ratio is greater than the set degree, controlling the camera to adjust the first picture ratio of the subsequent output video image to the second picture ratio.
If it is determined in step S350 that the degree of deformation of the processed image relative to the video image is greater than the set degree, it indicates that the application compresses the video image with the first frame rate into the image with the second frame rate when compressing the video image, resulting in a greater degree of deformation of the processed image relative to the video image. That is to say, the first picture proportion of the video image output by the camera is different from the second picture proportion after the compression processing, and the application program does not perform operations such as cropping on the video image when the video image is compressed, so the camera can be controlled to adjust the first picture proportion of the output video image to the second picture proportion of the processed image, that is, the application program can compress the video image to the proportion, so that the application program does not crop the video image and deform the image when the video image is compressed, the processed image transmitted to the encoder for encoding can be deformed, and the deformation of the video content in the video file generated after encoding can be effectively avoided.
Step S360: and if the processed image is not greater than the set degree, performing deformation correction processing on the processed image, wherein the deformation correction processing comprises at least one of radial deformation correction processing and tangential deformation correction processing.
If it is determined in step S350 that the degree of deformation of the processed image with respect to the video image is greater than the set degree, it indicates that the deformation of the processed image is caused by other factors. In order to guarantee the effect of the recorded video content, the processed image can therefore be subjected to a corresponding deformation correction process. Specifically, the processed image is mostly squeezed, stretched, distorted, and the like with respect to the video image, but these distortions are similar to image distortions caused when the camera takes a picture. Therefore, the processed image can be corrected by at least one of the radial distortion correction process and the tangential distortion correction process performed in the image distortion caused by the camera. The specific radial deformation correction processing can be used for carrying out deformation correction on the radial deformation of the processed image according to the radial distortion model, and carrying out deformation correction on the tangential deformation of the processed image according to the tangential distortion model, so that the deformation correction on the processed image is realized.
After the processed image is corrected, the corrected processed image may be encoded to generate video content with the distortion corrected.
In addition, in the embodiment of the present application, the application program performs the processing procedure when performing video recording, that is, the video image is an image captured by a camera when the video recording starts. When the deformation degree of the processed image relative to the video image is greater than the set degree, the picture proportion of the video image output by the camera is adjusted, so that the processed image corresponding to the subsequent video image is ensured not to deform, and if the video file needs the image collected by the camera just started, the first frame or the first frames of images in the video file are in a deformed state, so that the deformation correction processing can be carried out on the processed image for judging whether to deform, and the video content of the whole video file is not deformed.
Step S370: and if the processed image is not deformed, encoding the processed image and outputting the encoded image to an application program.
When the processing image is detected not to be deformed relative to the video image, the processing image obtained after the application program performs the setting processing on the video image is indicated not to be deformed relative to the video image, so that the video image can be directly encoded, the encoded image is output to the application program, and the video content in the video file generated by the application program is not deformed.
In this embodiment of the application, after the adjusting the first picture ratio of the video image output by the camera to the second picture ratio of the processed image, the method for controlling video recording may further include:
storing the corresponding relation between the second picture proportion and the application program; and when the application program carries out video recording again, controlling the camera to adjust the first picture proportion of the output video image to the second picture proportion based on the corresponding relation.
It can be understood that the correspondence between the second picture ratio and the application program may be stored in the mobile terminal, so that after the video recording, when the application program performs the video recording again, the first picture ratio of the video image output by the camera may be directly adjusted to the second picture ratio of the processed image according to the correspondence. That is, since the application does not perform operations such as cropping when compressing the video image with the first screen ratio into the image with the second screen ratio, in order to avoid the distortion of the video content in the generated video file, the application can adjust the screen ratio of the video image output by the camera to the second screen ratio, so that the screen ratio of the video image output by the camera is the same as the screen ratio to which the application needs to compress the video image, and the distortion of the content in the image is avoided.
The control method for video recording provided by the embodiment of the application, when the application program records video, the video image collected by the camera is output to the application program, then the processing image which is transmitted to the encoder after the application program sets the video image is obtained, the setting processing at least comprises compression processing, whether the processing image is deformed relative to the video image is judged, if the processing image is deformed relative to the video image, whether the deformation degree of the processing image is greater than the setting degree is judged, if the deformation degree is greater than the setting degree, the camera is controlled to adjust the first picture proportion of the output video image to the second picture proportion of the processing image, thereby realizing the adjustment of the picture proportion of the video image output by the camera, and enabling the picture proportion of the video image output by the camera to be consistent with the picture proportion of the image after the setting processing by the application program, deformation of the video content is avoided.
Referring to fig. 5, a block diagram of a control apparatus 400 for video recording according to an embodiment of the present application is shown, where the control apparatus 400 for video recording includes: an image output module 410, an image acquisition module 420, a deformation detection module 430, and a scale adjustment module 440. The image output module 410 is configured to output a video image acquired by a camera to an application program when the application program performs video recording; the image obtaining module 420 is configured to obtain a processed image transmitted by the application program to an encoder, where the processed image is obtained by performing setting processing on the video image by the application program, where the setting processing at least includes compression processing, and the compression processing is used to obtain an image with a second picture scale; the deformation detection module 430 is configured to detect whether the processed image is deformed relative to the video image; the scale adjustment module 440 is configured to control the camera to adjust the first picture scale of the subsequently output video image to the second picture scale if the deformation occurs.
In the embodiment of the present application, please refer to fig. 6, the deformation detecting module 430 may include: a scale acquisition unit 431, a scale judgment unit 432, and a result determination unit 433. The scale acquiring unit 431 is used for acquiring a first picture scale of the video image and a second picture scale of the processing image; the ratio determining unit 432 is configured to determine whether the first picture ratio is the same as the second picture ratio; the result determining unit 433 is configured to determine that the processed image is distorted with respect to the video image if the first picture scale is different from the second picture scale.
Further, the result determining unit 433 may be specifically configured to: identifying a first scale of a specified object in the video image and a second scale of the specified object in the processed image if the first picture scale is not the same as the second picture scale; judging whether the first proportion is the same as the second proportion or not; and if the first proportion is not the same as the second proportion, determining that the processed image is deformed relative to the video image.
In the embodiment of the present application, please refer to fig. 7, the scale adjustment module 440 may include: a degree determination unit 441 and an adjustment execution unit 442. The degree judging unit 441 is used for judging whether the deformation degree of the processing image relative to the video image is greater than a set degree if the deformation occurs; the adjustment executing unit 442 is configured to control the camera to adjust the first picture ratio of the subsequently output video image to the second picture ratio if the first picture ratio is greater than the set degree.
Further, the control apparatus 400 for video recording may further include: and a distortion correction module. The distortion correction module may be configured to perform a distortion correction process on the processed image if not greater than a set degree, the distortion correction process including at least one of a radial distortion correction process and a tangential distortion correction process.
In this embodiment, the control apparatus 400 for video recording may further include: the system comprises a relation storage module and a relation calling module. The relation storage module is used for storing the corresponding relation between the second picture proportion and the application program; and the relation calling module is used for controlling the camera to adjust the first picture proportion of the output video image to the second picture proportion based on the corresponding relation when the application program carries out video recording again.
In this embodiment, the control apparatus 400 for video recording may further include: and a video coding module. The video encoding module may be configured to encode the processed image if no distortion occurs, and output the encoded image to an application.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, the coupling between the modules may be electrical, mechanical or other type of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
In summary, according to the scheme provided by the application, when the application performs video recording, a video image acquired by the camera is output to the application, a processing image transmitted from the application to the encoder is acquired, the processing image is an image obtained by setting the video image by the application, the setting at least includes compression processing, whether the processing image is deformed relative to the video image is detected, and if the processing image is deformed, the camera is controlled to adjust a first picture proportion of the output video image to a second picture proportion of the processing image, so that the picture proportion of the output video image of the camera is adjusted, the picture proportion of the output video image of the camera is consistent with the picture proportion of the image after the setting processing by the application, and the deformation of video content is avoided.
Referring to fig. 8, a block diagram of a mobile terminal according to an embodiment of the present application is shown. The mobile terminal 100 may be a smart phone, a tablet computer, an electronic book, or other mobile terminal capable of running an application. The mobile terminal 100 in the present application may include one or more of the following components: a processor 110, a memory 120, a camera 130, and one or more applications, wherein the one or more applications may be stored in the memory 120 and configured to be executed by the one or more processors 110, the one or more programs configured to perform the methods as described in the aforementioned method embodiments.
Processor 110 may include one or more processing cores. The processor 110 interfaces with various components throughout the mobile terminal 100 using various interfaces and lines, and performs various functions of the mobile terminal 100 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120 and invoking data stored in the memory 120. Alternatively, the processor 110 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 110 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 110, but may be implemented by a communication chip.
The Memory 120 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 120 may be used to store instructions, programs, code sets, or instruction sets. The memory 120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the terminal 100 in use, such as a phonebook, audio-video data, chat log data, and the like.
The camera 130 is used to capture images and pass them to the processor 110 for processing. The camera 130 may be a color camera, and the specific type of camera is not limited in the embodiment of the present application.
Referring to fig. 9, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 800 has stored therein a program code that can be called by a processor to execute the method described in the above-described method embodiments.
The computer-readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 800 includes a non-volatile computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (8)

1. A method for controlling video recording, the method comprising:
when an application program carries out video recording, outputting a video image acquired by a camera to the application program;
acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, the setting at least comprises compression processing, and the compression processing is used for obtaining an image with a second picture proportion;
detecting whether the processed image is deformed relative to the video image;
if the processed image is deformed, judging whether the deformation degree of the processed image relative to the video image is greater than a set degree;
if the ratio is greater than the set degree, controlling the camera to adjust the first picture ratio of the subsequent output video image to the second picture ratio;
and if the processed image is not greater than the set degree, performing deformation correction processing on the processed image, wherein the deformation correction processing comprises at least one of radial deformation correction processing and tangential deformation correction processing.
2. The method of claim 1, wherein said detecting whether said processed image is distorted relative to said video image comprises:
acquiring a first picture proportion of the video image and a second picture proportion of the processed image;
judging whether the first picture proportion is the same as the second picture proportion;
and if the first picture proportion is different from the second picture proportion, determining that the processed image is deformed relative to the video image.
3. The method of claim 2, wherein determining that the processed image is distorted relative to the video image if the first picture scale is not the same as the second picture scale comprises:
identifying a first scale of a specified object in the video image and a second scale of the specified object in the processed image if the first picture scale is not the same as the second picture scale;
judging whether the first proportion is the same as the second proportion or not;
and if the first proportion is not the same as the second proportion, determining that the processed image is deformed relative to the video image.
4. The method of claim 1, further comprising:
storing the corresponding relation between the second picture proportion and the application program;
and when the application program carries out video recording again, controlling the camera to adjust the first picture proportion of the output video image to the second picture proportion based on the corresponding relation.
5. The method according to any one of claims 1-4, further comprising:
and if the processed image is not deformed, encoding the processed image and outputting the encoded image to an application program.
6. A control apparatus for video recording, the apparatus comprising: an image output module, an image acquisition module, a deformation detection module, a proportion adjustment module and a distortion correction module, wherein,
the image output module is used for outputting a video image acquired by a camera to an application program when the application program carries out video recording;
the image acquisition module is used for acquiring a processing image transmitted to an encoder by the application program, wherein the processing image is obtained by setting the video image by the application program, the setting at least comprises compression processing, and the compression processing is used for obtaining an image with a second picture proportion;
the deformation detection module is used for detecting whether the processed image deforms relative to the video image;
the proportion adjusting module comprises a degree judging unit and an adjusting execution unit, wherein the degree judging unit is used for judging whether the deformation degree of the processing image relative to the video image is greater than a set degree or not if the processing image is deformed; the adjustment execution unit is used for controlling the camera to adjust the first picture proportion of the subsequent output video image into the second picture proportion if the adjustment execution unit is larger than the set degree;
the distortion correction module is used for performing deformation correction processing on the processed image if the distortion correction processing is not larger than a set degree, and the deformation correction processing comprises at least one of radial deformation correction processing and tangential deformation correction processing.
7. A mobile terminal, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any of claims 1-5.
8. A computer-readable storage medium, having stored thereon program code that can be invoked by a processor to perform the method according to any one of claims 1 to 5.
CN201910069621.8A 2019-01-24 2019-01-24 Video recording control method and device, mobile terminal and storage medium Active CN109819187B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910069621.8A CN109819187B (en) 2019-01-24 2019-01-24 Video recording control method and device, mobile terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910069621.8A CN109819187B (en) 2019-01-24 2019-01-24 Video recording control method and device, mobile terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109819187A CN109819187A (en) 2019-05-28
CN109819187B true CN109819187B (en) 2021-10-22

Family

ID=66603201

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910069621.8A Active CN109819187B (en) 2019-01-24 2019-01-24 Video recording control method and device, mobile terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109819187B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988664B (en) * 2020-09-01 2022-09-20 广州酷狗计算机科技有限公司 Video processing method, video processing device, computer equipment and computer-readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102447887A (en) * 2011-10-14 2012-05-09 深圳市先河系统技术有限公司 Method and device for changing image length-width ratio in video signals of security system
CN102984494A (en) * 2012-12-06 2013-03-20 北京小米科技有限责任公司 Video communication method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015002555A (en) * 2013-06-18 2015-01-05 船井電機株式会社 Recording device and recording method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102447887A (en) * 2011-10-14 2012-05-09 深圳市先河系统技术有限公司 Method and device for changing image length-width ratio in video signals of security system
CN102984494A (en) * 2012-12-06 2013-03-20 北京小米科技有限责任公司 Video communication method and device

Also Published As

Publication number Publication date
CN109819187A (en) 2019-05-28

Similar Documents

Publication Publication Date Title
CN109685726B (en) Game scene processing method and device, electronic equipment and storage medium
CN109151573B (en) Video enhancement control method and device and electronic equipment
CN110839129A (en) Image processing method and device and mobile terminal
JP7295950B2 (en) Video enhancement control method, device, electronic device and storage medium
CN106303157B (en) Video noise reduction processing method and video noise reduction processing device
EP3644599B1 (en) Video processing method and apparatus, electronic device, and storage medium
JP7169449B2 (en) Video enhancement control method, device, electronic device and storage medium
KR102528877B1 (en) Video decoding control method, device, electronic device and storage medium
WO2017202170A1 (en) Method and device for video compression and electronic device
CN110149554B (en) Video image processing method and device, electronic equipment and storage medium
CN112399123B (en) Video definition adjusting method and device, electronic equipment and storage medium
CN109618228B (en) Video enhancement control method and device and electronic equipment
CN109587558B (en) Video processing method, video processing device, electronic equipment and storage medium
CN104580907A (en) Anti-shake photographing method and device
WO2022151852A1 (en) Image processing method, apparatus, and system, electronic device, and storage medium
CN109819187B (en) Video recording control method and device, mobile terminal and storage medium
CN109587555B (en) Video processing method and device, electronic equipment and storage medium
CN109587561B (en) Video processing method and device, electronic equipment and storage medium
CN109151574B (en) Video processing method, video processing device, electronic equipment and storage medium
WO2020107970A1 (en) Video decoding method and apparatus, electronic device, and storage medium
CN109120979B (en) Video enhancement control method and device and electronic equipment
CN114584781A (en) Video compression method and device and computer readable storage medium
CN112801932A (en) Image display method, image display device, electronic equipment and storage medium
CN108933945B (en) GIF picture compression method, device and storage medium
CN109218803B (en) Video enhancement control method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant