CN115002335B - Video processing method, apparatus, electronic device, and computer-readable storage medium - Google Patents

Video processing method, apparatus, electronic device, and computer-readable storage medium Download PDF

Info

Publication number
CN115002335B
CN115002335B CN202111438998.XA CN202111438998A CN115002335B CN 115002335 B CN115002335 B CN 115002335B CN 202111438998 A CN202111438998 A CN 202111438998A CN 115002335 B CN115002335 B CN 115002335B
Authority
CN
China
Prior art keywords
video
shooting mode
switching
shooting
video file
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
CN202111438998.XA
Other languages
Chinese (zh)
Other versions
CN115002335A (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.)
Honor Device Co Ltd
Original Assignee
Honor Device Co 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202111438998.XA priority Critical patent/CN115002335B/en
Publication of CN115002335A publication Critical patent/CN115002335A/en
Application granted granted Critical
Publication of CN115002335B publication Critical patent/CN115002335B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Television Signal Processing For Recording (AREA)

Abstract

The embodiment of the application provides a video processing method, a video processing device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: acquiring shooting mode switching operation in the process of shooting video by adopting a first shooting mode; switching the first shooting mode to the second shooting mode in response to shooting mode switching operation, and recording tag information of shooting mode switching, wherein the tag information of shooting mode switching is used for marking that the first shooting mode is switched to the second shooting mode in the video shooting process; acquiring a target video obtained by video shooting in a first shooting mode and a second shooting mode; generating a first video file based on the tag information and the target video; editing a switching process of switching a first shooting mode in the first video file to a second shooting mode in the first video file based on tag information in the first video file to obtain a second video file.

Description

Video processing method, apparatus, electronic device, and computer-readable storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a video processing method, apparatus, electronic device, and computer readable storage medium.
Background
In the related art, in order to obtain a section of video with better quality, a user needs to take video by adopting a camera function of electronic equipment to obtain a taken video; then, the user is required to manually edit the shot video by adopting the video editing function of the electronic equipment, so as to obtain the edited video. Therefore, the operation process of obtaining the video finally required by the user is complicated, resulting in poor user experience.
Disclosure of Invention
In view of this, embodiments of the present application provide a video processing method, apparatus, electronic device, and computer readable storage medium, so as to facilitate solving the problem that in order to obtain a final processed video, an operation process is complicated, resulting in poor user experience.
In a first aspect, an embodiment of the present application provides a video processing method, including:
acquiring shooting mode switching operation in the process of shooting video by adopting a first shooting mode;
switching the first shooting mode to a second shooting mode in response to the shooting mode switching operation, and recording tag information of shooting mode switching, wherein the tag information of shooting mode switching is used for marking that the first shooting mode is switched to the second shooting mode in the video shooting process;
Acquiring a target video obtained by video shooting in the first shooting mode and the second shooting mode;
generating a first video file based on the tag information and the target video;
editing a switching process of switching the first shooting mode to the second shooting mode in the first video file based on the tag information in the first video file to obtain a second video file.
Optionally, the recording the tag information of the shooting mode switching includes:
recording a switching identification of the shooting mode switching, a starting time stamp of the shooting mode switching, and an ending time stamp of the shooting mode switching, wherein the tag information comprises: the switch identification, the start timestamp and the end timestamp.
Optionally, the recording the switching identifier of the shooting mode switching, the starting timestamp of the shooting mode switching, and the ending timestamp of the shooting mode switching include:
determining a switching identification of the shooting mode switching based on the first shooting mode before the shooting mode switching and the second shooting mode after the shooting mode switching;
Triggering a switching start callback function when the shooting mode is switched, and determining a time stamp recorded by the switching start callback function as a starting time stamp of the shooting mode switching; and
triggering a switching end callback function when the shooting mode switching is ended, and determining the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching.
Optionally, the generating the first video file based on the tag information and the target video includes:
and calling a newly added tag setting interface, writing the tag information into a video information description area of the target video, and calling a stopping interface to finish the generation of the first video file.
Optionally, the editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the tag information in the first video file, and obtaining the second video file includes:
extracting the tag information in the first video file;
determining a starting time stamp and an ending time stamp of the shooting mode switching in the first video file according to the tag information;
Editing a switching process of switching the first shooting mode to the second shooting mode in the first video file based on a time period from the start time stamp to the end time stamp, and obtaining the second video file.
Optionally, the editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the time period from the start time stamp to the end time stamp, and obtaining the second video file includes:
acquiring a switching image frame;
inserting the switching image frame in the time period from the starting time stamp to the ending time stamp in the target video to obtain a processed video, and editing the processed video to obtain the second video file; or inserting the switching image frame in the time period from the start time stamp to the end time stamp in the target video in the process of editing the target video, so as to obtain the second video file.
Optionally, the acquiring the switching image frame includes:
intercepting a target image frame from a video obtained by video shooting in the first shooting mode; based on the change parameters of the first shooting mode to the second shooting mode, corresponding image parameter adjustment is carried out on the target image frame, and the switched image frame is obtained; or alternatively
And intercepting the target image frame from a video obtained by video shooting in the first shooting mode, wherein the switching image frame comprises the target image frame.
Optionally, the performing, based on the change parameter of the first shooting mode to the second shooting mode, corresponding image parameter adjustment on the target image frame to obtain the switched image frame includes:
acquiring a speed difference value between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode under the condition that the first shooting mode is switched to the second shooting mode to be switched between different shooting speeds, and performing image parameter adjustment corresponding to the speed difference value on the target image frame to obtain the switched image frame; or,
and under the condition that the first shooting mode is switched to the second shooting mode to switch between different lens focal lengths, acquiring a focal length difference value between a first shooting focal length of the first shooting mode and a second shooting focal length of the second shooting mode, and performing image parameter adjustment corresponding to the focal length difference value on the target image frame to obtain the switched image frame.
Optionally, the editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the time period from the start time stamp to the end time stamp, and obtaining the second video file includes:
acquiring a predetermined number of video image frames preceding the start time stamp;
determining a third time period based on a first time period from the start time stamp to the end time stamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is a sum of the first time period and the second time period;
extending the second time period of the preset number of video image frames to the third time period in the target video to obtain a processed video, and editing the processed video to obtain the second video file; or in the process of editing the target video, extending the second time period where the preset number of video image frames are located to the third time period in the target video to obtain the second video file.
Optionally, the editing the processed video to obtain the second video file includes:
Acquiring a preset video editing template;
and editing the processed video by adopting the preset video editing template to obtain the second video file.
Optionally, the shooting mode switching includes at least one of: switching between different lens modes, switching between fields in the same lens mode, switching between different shooting speeds and switching between different lens focal lengths.
In a second aspect, an embodiment of the present application provides a video processing apparatus, including:
the receiving module is used for acquiring shooting mode switching operation in the process of shooting video by adopting the first shooting mode;
the processing module is used for responding to the shooting mode switching operation, switching the first shooting mode into a second shooting mode and recording tag information of shooting mode switching, wherein the tag information of shooting mode switching is used for marking that the first shooting mode is switched into the second shooting mode in the video shooting process;
the acquisition module is used for acquiring a target video obtained by video shooting in the first shooting mode and the second shooting mode;
the generation module is used for generating a first video file based on the tag information and the target video;
And the editing module is used for editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the label information in the first video file to obtain a second video file.
Optionally, the processing module includes:
a recording unit, configured to record a switching identifier of the shooting mode switching, a start time stamp of the shooting mode switching, and an end time stamp of the shooting mode switching, where the tag information includes: the switch identification, the start timestamp and the end timestamp.
Optionally, the recording unit includes:
a recording subunit, configured to determine a switching identifier of the shooting mode switching based on the first shooting mode before the shooting mode switching and the second shooting mode after the shooting mode switching; triggering a switching start callback function when the shooting mode is switched, and determining a time stamp recorded by the switching start callback function as a starting time stamp of the shooting mode switching; and triggering a switching end callback function when the shooting mode switching is ended, and determining the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching.
Optionally, the generating module includes:
and the writing unit is used for calling a newly added tag setting interface, writing the tag information into a video information description area of the target video, and calling a stopping interface to finish the generation of the first video file.
Optionally, the editing module includes:
an extracting unit, configured to extract the tag information in the first video file;
a determining unit configured to determine a start time stamp and an end time stamp of the shooting mode switching in the first video file according to the tag information;
and the editing unit is used for editing a switching process of switching the first shooting mode to the second shooting mode in the first video file based on a time period from the starting time stamp to the ending time stamp, so as to obtain the second video file.
Optionally, the editing unit includes:
a first acquisition subunit configured to acquire a switching image frame;
an inserting subunit, configured to insert the switching image frame in a time period from the start time stamp to the end time stamp in the target video, obtain a processed video, and edit the processed video to obtain the second video file; or inserting the switching image frame in the time period from the start time stamp to the end time stamp in the target video in the process of editing the target video, so as to obtain the second video file.
Optionally, the first acquisition subunit includes:
a first acquisition subunit for capturing a target image frame from a video obtained by video shooting in the first shooting mode; based on the change parameters of the first shooting mode to the second shooting mode, corresponding image parameter adjustment is carried out on the target image frame, and the switched image frame is obtained; or alternatively
A first acquisition sub-unit configured to intercept the target image frame from a video obtained by video capturing in the first capturing mode, wherein the switching image frame includes the target image frame.
Optionally, the first acquisition subunit is configured to:
acquiring a speed difference value between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode under the condition that the first shooting mode is switched to the second shooting mode to be switched between different shooting speeds, and performing image parameter adjustment corresponding to the speed difference value on the target image frame to obtain the switched image frame; or,
and under the condition that the first shooting mode is switched to the second shooting mode to switch between different lens focal lengths, acquiring a focal length difference value between a first shooting focal length of the first shooting mode and a second shooting focal length of the second shooting mode, and performing image parameter adjustment corresponding to the focal length difference value on the target image frame to obtain the switched image frame.
Optionally, the editing unit includes:
a second acquisition subunit for acquiring a predetermined number of video image frames preceding the start time stamp;
a determining subunit configured to determine a third time period based on a first time period from the start time stamp to the end time stamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is a sum of the first time period and the second time period;
the processing subunit is used for extending the second time period where the preset number of video image frames are located to the third time period in the target video to obtain a processed video, and editing the processed video to obtain the second video file; or in the process of editing the target video, extending the second time period where the preset number of video image frames are located to the third time period in the target video to obtain the second video file.
Optionally, the editing unit includes:
a third obtaining subunit, configured to obtain a predetermined video editing template;
and the editing subunit is used for editing the processed video by adopting the preset video editing template to obtain the second video file.
Optionally, the shooting mode switching includes at least one of: switching between different lens modes, switching between fields in the same lens mode, switching between different shooting speeds and switching between different lens focal lengths.
In a third aspect, embodiments of the present application provide an electronic device comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the electronic device to perform the method of any of the first aspects.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium includes a stored program, where when the program runs, the program controls a device in which the computer readable storage medium is located to perform the method according to any one of the first aspects.
In a fifth aspect, embodiments of the present application provide a computer program product comprising executable instructions which, when executed on a computer, cause the computer to perform the method of any one of the first aspects above.
By adopting the technical scheme provided by the embodiment of the application, when the target video is obtained through shooting, the first video file is generated by combining the obtained target video with the tag information of shooting mode switching obtained in the process of shooting the video, so that the second video file can be obtained by automatically completing the editing of the video based on the tag information in the first video file. The user only needs to execute the shooting process, and after shooting is completed, the second video file with better quality after the shooting mode switching is processed can be obtained, and editing processing is not needed to be manually carried out on the shooting mode switching in the video, so that the second video file with better quality is automatically generated in the shooting process. Therefore, the first video file is generated by combining the tag information of shooting mode switching acquired in the process of shooting the video with the acquired target video, so that the efficiency of acquiring the video with better quality by the user is effectively improved, and the one-key-in experience of the user is met.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an electronic device according to an embodiment of the present application;
fig. 2A is a schematic diagram of a shooting scene in a front-back dual shooting mode according to an embodiment of the present application;
fig. 2B is a schematic diagram of a scene shot in a front-back picture-in-picture mode according to an embodiment of the present application;
fig. 2C is a schematic view of a post-pd mode shooting scene provided in an embodiment of the present application;
fig. 3 is a schematic diagram of a processing procedure of a video method according to an embodiment of the present application;
fig. 4 is a schematic view of a shooting mode switching scenario provided in an embodiment of the present application;
fig. 5 is a flowchart of a video processing method according to an embodiment of the present application;
fig. 6 is a schematic diagram of tag information of shooting mode switching recorded in a video shooting process according to an embodiment of the present application;
Fig. 7 is a flowchart of a method for generating tag information for switching shooting modes according to an embodiment of the present application;
FIG. 8 is a flowchart of generating a first video file based on tag information and a target video according to an embodiment of the present application;
fig. 9 is a flowchart of a video editing method in a video processing method according to an embodiment of the present application;
fig. 10 is a schematic flow chart of editing a target video in a first video file according to an embodiment of the present application;
fig. 11 is a schematic diagram of editing a shooting mode switch in a target video based on tag information according to an embodiment of the present application;
fig. 12 is a schematic diagram of editing a shooting mode switch in a target video based on tag information according to an embodiment of the present application;
fig. 13 is a schematic diagram of a video processing method according to an embodiment of the present application;
fig. 14 is a software structural block diagram of an electronic device according to an embodiment of the present application;
fig. 15 is a block diagram of a video processing apparatus according to an embodiment of the present application.
Detailed Description
For a better understanding of the technical solutions of the present application, embodiments of the present application are described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are merely some, but not all, of the embodiments of the present application. All other embodiments, based on the embodiments herein, which would be apparent to one of ordinary skill in the art without making any inventive effort, are intended to be within the scope of the present application.
The terminology used in the embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one way of describing an association of associated objects, meaning that there may be three relationships, e.g., a and/or b, which may represent: the first and second cases exist separately, and the first and second cases exist separately. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
Fig. 1 is a schematic diagram of an electronic device provided in an embodiment of the present application, as shown in fig. 1, in which fig. 1 illustrates an electronic device by taking a mobile phone 100 as an example, fig. 1 illustrates a front view and a rear view of the mobile phone 100, two front cameras 111 and 112 are configured on a front side of the mobile phone 100, and four rear cameras 121, 122, 123 and 124 are configured on a rear side of the mobile phone 100. By configuring a plurality of cameras, a plurality of shooting modes, for example, a front-shooting mode, a rear-shooting mode, a front-back double-shooting mode, and the like, can be provided for the user. The user can select a corresponding shooting mode to shoot according to the shooting scene so as to improve the user experience.
It should be understood that the illustration in fig. 1 is merely exemplary and should not be taken as limiting the scope of the present application. For example, the number and location of the cameras may be different for different handsets. In addition, the electronic device related to the embodiment of the application may be a tablet computer, a personal computer (personal computer, PC), a personal digital assistant (personal digital assistant, PDA), a smart watch, a netbook, a wearable electronic device, an augmented reality (augmented reality, AR) device, a Virtual Reality (VR) device, an in-vehicle device, a smart car, a smart sound, a robot, a smart glasses, a smart television, or the like, in addition to a mobile phone.
It should be noted that, in some possible implementations, the electronic device may also be referred to as a terminal device, a User Equipment (UE), or the like, which is not limited by the embodiments of the present application.
In some possible implementations, the shooting modes involved in the electronic device may include a single shooting mode and a multiple shooting mode. Wherein, the single shooting mode may comprise a front single shooting mode, a rear single shooting mode and the like; the multi-shot mode may include a front double shot mode, a rear double shot mode, a front-in-picture mode, a rear-in-picture mode, a front-rear in-picture mode, and the like.
In the single shooting mode, a camera is adopted for video shooting; two or more cameras are adopted to carry out video shooting in a multi-shooting mode.
Specifically, in a front single-shot mode, a front camera is adopted to shoot video; in a rear single-shot mode, a rear camera is adopted for video shooting; in a front double-shooting mode, two front cameras are adopted for video shooting; in the rear double-shot mode, two rear cameras are adopted for video shooting; in a front-back double-shooting mode, a front camera and a rear camera are adopted for video shooting; in the front-end picture-in-picture mode, adopting two front-end cameras to shoot videos, and placing pictures shot by one front-end camera in pictures shot by the other front-end camera; in the rear picture-in-picture mode, two rear cameras are adopted to carry out video shooting, and a picture shot by one rear camera is placed in a picture shot by the other rear camera; in the front and rear picture-in-picture mode, a front camera and a rear camera are adopted to carry out video shooting, and pictures shot by the front camera or the rear camera are placed in pictures shot by the rear camera or the front camera.
Fig. 2A is a schematic view of a shooting scene in a front-back dual-shooting mode, as shown in fig. 2A, in the front-back dual-shooting mode, a front camera is used to collect a foreground image, a rear camera is used to collect a rear Jing Huamian, and the foreground image and the rear image are displayed simultaneously in a display interface.
Fig. 2B is a schematic view of a scene shot in a front-back picture-in-picture mode, as shown in fig. 2B, in the front-back picture-in-picture mode, a front camera is used to collect a foreground picture, a rear camera is used to collect a background picture, and the foreground picture is placed in the background picture.
Fig. 2C is a schematic view of a scene shot in a post-picture-in-picture mode according to an embodiment of the present application, as shown in fig. 2C, in the post-picture-in-picture mode, a post-camera is used to collect a far-view picture, another post-camera is used to collect a near-view picture, and the near-view picture is placed in the far-view picture.
It should be noted that the above shooting modes are only some possible implementations listed in the embodiments of the present application, and those skilled in the art may configure other shooting modes according to actual needs, which are not particularly limited in the embodiments of the present application.
In some possible implementations, the shooting mode may also be described as a single-path mode, a two-path mode, or a multi-path mode. It can be understood that the single-path mode adopts one camera to shoot, the double-path mode adopts two cameras to shoot, and the multi-path mode adopts more than two cameras to shoot.
In some possible implementations, the shooting mode may also be described as a single view mode, a double view mode, and a picture-in-picture mode. The single scene mode can comprise a front single shot mode and a rear single shot mode; the dual-view mode may include a front dual-view mode, a rear dual-view mode, a front dual-view mode; the pip mode may include a front pip mode, a rear pip mode, and a front and rear pip mode.
During video capture, a user may need to switch capture modes. Referring to table one, some possible shooting mode switching scenarios are listed for the embodiments of the present application.
Table one:
in some possible implementations, the shooting modes involved in the electronic device may include different shooting states. Different shooting states correspond to different shooting modes. For example, photographing is performed using different photographing parameters. The different shooting parameters may be different shooting speeds, or different shooting focal lengths, or different shooting speeds and different shooting focal lengths, etc.
For example, in the case of shooting in the single shooting mode, quick shooting, slow shooting, and normal shooting may be employed. When shooting is performed in the multi-shooting mode, a certain lens can be designated to be shot quickly, shot slowly, shot normally and the like. Note that the quick shooting in the embodiment of the present application may be divided into a plurality of levels, for example, 2-time speed shooting, 1.5-time speed shooting, and the like. Slow shots may also be divided into multiple levels, such as 0.5 fold shots, 0.25 fold shots, etc. Therefore, when the electronic device adopts different speed parameters to shoot, shooting is performed in different shooting modes.
For another example, in the case of shooting in the single shooting mode, far-focus shooting, near-focus shooting, and normal shooting may be employed. When shooting is performed in the multi-shooting mode, a certain lens can be designated to adopt far-focus shooting, near-focus shooting, normal shooting and the like. Therefore, when the electronic device adopts different focal length parameters to shoot, shooting is performed in different shooting modes.
During video shooting, the user may need to switch the shooting modes. Referring to table two, some possible shooting mode switching scenarios are listed in the embodiments of the present application.
And (II) table:
in the process of video shooting, after the user adopts the shooting mode to switch shooting, shooting video is obtained. However, with this process of shooting mode switching, since a reaction of the camera of the electronic device is required, a blurring of the picture may occur in this section of shooting mode switching in the resulting shot video, resulting in discontinuity of the picture. Dark screen conditions may also occur when the reaction time is long. Therefore, in order to acquire the video with higher quality, when the video is edited in the later period, the shooting mode switching section is manually processed, and when the shooting mode switching of the video is manually processed, the processing efficiency is lower, and the user experience of quickly acquiring the video is affected.
In view of this problem, an embodiment of the present application provides a video processing method, and fig. 3 is a schematic diagram of a processing procedure of the video processing method provided in the embodiment of the present application, as shown in fig. 3, in the embodiment of the present application, in a video capturing process, when a capturing mode switching operation of a user is received, tag information (such as a switching identifier, a switching start time and a switching end time in fig. 3) of the capturing mode switching is recorded. After the target video obtained after mixing the audio and video streams of the whole shooting process is obtained, the tag information of shooting mode switching acquired in the process of shooting the video is combined with the obtained target video to generate a first video file, a user only needs to execute the shooting process, a second video file (such as a second video file filled with shooting mode switching) with better quality after the shooting mode switching is processed can be obtained after shooting is completed, editing processing on the shooting mode switching in the video is not needed manually, efficiency of acquiring the video with better quality by the user is effectively improved, and one-key experience of the user is met.
Fig. 4 is a schematic view of a shooting mode switching scene provided in an embodiment of the present application, as shown in fig. 4, a user may display, in real time, a video frame in a shooting process in a display interface in a process of shooting video by an electronic device. In addition, a shooting mode selection window is further included in the display interface, and a user can select a corresponding shooting mode in the shooting mode selection window to shoot video. For example, a front single shot mode, a rear single shot mode, a front-rear double shot mode, a front-rear picture-in-picture mode, and the like.
In the application scenario shown in fig. 4, the user first selects the pre-single-shot mode to perform video shooting, and a foreground screen is displayed in real time in the display interface 401. When the user triggers the "front and rear double-shot" control in the shooting mode selection window 402, the electronic device receives a shooting mode switching operation, and switches the front single-shot mode to the front and rear double-shot mode. In the mode switching process, the electronic device responds to the mode switching process to display a blurred picture in the display interface 401, that is, the foreground picture before switching is displayed, but the foreground picture after switching and the rear Jing Huamian are not displayed yet, and a current interruption phenomenon occurs in the display interface 401. After the switching is completed, video pictures taken in the front-rear double-shot mode, for example, a foreground picture and a background picture shown in fig. 4, are displayed in real time in the display interface 401. That is, in the front-rear double-shot mode, the acquisition of the foreground picture and the acquisition of the background picture are performed by the front camera and the rear camera, respectively, and the foreground picture and the background picture are displayed in the display interface 401, respectively.
It will be appreciated that in addition to the captured video pictures being displayed within the display interface 401 during video capture, the captured video pictures may also be encoded into a video file (e.g., an MP4 format video file), i.e., a target video, and stored in the electronic device. If the mode switching process is not processed during editing, the picture blurring situation can occur during the later playing of the obtained video file. If the process of switching the shooting modes in the target video is manually processed to obtain the video with better quality, the efficiency of obtaining the video is lower, and the experience of a user for quickly obtaining the video is affected. In the embodiment of the application, the tag information of shooting mode switching is recorded in the process of shooting video, the recorded tag information is combined with the obtained target video to generate the first video file, then the video in the first video file can be automatically edited directly according to the tag information carried in the first video file, automatic processing of shooting mode switching is achieved, video with good quality is obtained, and user one-key-in-one experience is achieved.
Fig. 5 is a flowchart of a video processing method according to an embodiment of the present application. The method can be applied to the electronic device shown in fig. 1, and as shown in fig. 5, the flow mainly comprises the following steps.
Step S501: in the process of video shooting by adopting the first shooting mode, shooting mode switching operation is acquired.
The first shooting mode related to the embodiment of the application may be any one of a front single shooting mode, a rear single shooting mode, a front double shooting mode, a rear double shooting mode, a front picture-in-picture mode, a rear picture-in-picture mode and a front picture-in-picture-after picture-in-picture mode; the first shooting mode related to the embodiment of the application may also be a shooting mode corresponding to different shooting states, for example, may be any one of a fast shooting mode, a slow shooting mode and a normal shooting mode, and may also be any one of a far-focus shooting mode, a near-focus shooting mode and a normal shooting mode. This is not particularly limited in the embodiments of the present application.
In a specific implementation, a video picture shot in the first shooting mode can be monitored, and the monitored video picture shot in the first shooting mode is sent to a display interface of the electronic equipment for display.
In practical applications, when a user may need to switch shooting modes during video shooting, a shooting mode switching operation is input in the electronic device to switch the first shooting mode to the second shooting mode. The user can input shooting mode switching operation through a touch screen, physical keys, gesture control, voice control and other modes.
The shooting mode switching in the embodiment of the present application may be any one of the above-mentioned first and second shooting mode switching scenes, which is not particularly limited in the embodiment of the present application.
Step S502: and switching the first shooting mode to the second shooting mode in response to the shooting mode switching operation, and recording tag information of the shooting mode switching, wherein the tag information of the shooting mode switching is used for marking that the first shooting mode is switched to the second shooting mode in the video shooting process.
In the embodiment of the application, in response to a shooting mode switching operation, the first shooting mode is switched to the second shooting mode, video shooting is performed in the second shooting mode, monitoring is performed on video pictures shot in the second shooting mode, and the monitored video pictures shot in the second shooting mode are sent to a display interface of the electronic equipment to be displayed.
In the embodiment of the application, in the shooting mode switching process, tag information of shooting mode switching from a first shooting mode to a second shooting mode in the video shooting process is recorded. I.e. the position where the recording shooting mode switches over during video shooting. The tag information for the shooting mode switching is mainly used for identifying the shooting mode switching process, and may include various information, for example, may include: a switching identification for identifying switching of the photographing mode, a start time point of switching of the photographing mode, and an end time point of switching of the photographing mode.
It should be noted that, the tag information of the shooting mode switch belongs to one type of information in the video tag information, for example, the video tag information may also include other information, see table three, which is some information included in the video tag in the embodiment of the present application.
Table three:
the tag information of the shooting mode switching may be transition information, speed information, and Zoom information (Zoom information by lens Zoom) in the video tag information shown in the above table three.
The recording of the tag information of the switching of the shooting mode from the first shooting mode to the second shooting mode in the video shooting process can be performed in various ways. For example, to record the switching flag of the shooting mode switching, a mode adopted before the shooting mode switching (for example, the first shooting mode described above) and a mode adopted after the shooting mode switching (for example, the second shooting mode described above) may be acquired first, and then the switching flag may be determined based on the first shooting mode before the shooting mode switching and the second shooting mode after the shooting mode switching. For another example, to record the period of time for which the shooting mode is switched, this may be achieved by way of a recording time stamp. For example, a start time stamp of the photographing mode switching, and an end time stamp of the photographing mode switching may be recorded, wherein the tag information includes: the switch identifier, the start time stamp and the end time stamp.
The switching identifier in the embodiment of the application is used for identifying switching of shooting modes. In the shooting process of a video, more than one shooting mode switch may be involved. For example, in a complete video shooting process, it may involve a shooting mode switch, i.e., a one-way shooting mode switch to a two-way shooting mode, a front-to-back shooting mode switch to a picture-in-picture shooting mode, and so on. In order to distinguish the two shooting mode switching processes, different switching identifications can be adopted to realize the two shooting mode switching processes. Different switch identifications are used to represent different shooting mode switches. And the method is convenient for subsequent reading of the tag information, and when the video is edited based on the tag information, different dynamic effects are correspondingly filled according to different shooting modes.
It should be noted that, the switching identifier may take various expression forms, for example, when a digital representation is adopted, 1 indicates that the front single-shot mode is switched to the front-back double-shot mode, 2 indicates that the front-back double-shot mode is switched to the front single-shot mode, and so on; when letter representation is adopted, A represents that the front single-shot mode is switched to the front double-shot mode, B represents that the rear single-shot mode is switched to the front double-shot mode, and the like; symbolically, @ indicates that the fast shooting mode is switched to the normal shooting mode, # indicates that the slow shooting mode is switched to the fast shooting mode, and so on.
When the starting time point and the ending time point of the shooting mode switching are recorded by means of recording a time stamp, a baseline of the recording time point may be set first, for example, a time point corresponding to a first frame image of a preview stream displayed on a display interface when the electronic device starts shooting is taken as a time baseline, and a time of starting shooting the first frame image is T0; the start time point of the shooting mode switching uses a time stamp corresponding to the last frame image before the shooting mode switching, and the end time point uses a time stamp corresponding to the first frame image after the shooting mode switching. Fig. 6 is a schematic diagram of tag information of shooting mode switching recorded in a video shooting process according to an embodiment of the present application. As shown in fig. 6, 1, which is a switching flag for switching the shooting mode, indicates that the currently executed shooting mode is switched to: the front single-shot mode is switched to the front-back double-shot mode. T1 is a time stamp corresponding to the last frame image before the shooting mode is switched at the starting time point of the shooting mode switching, and T2 is a time stamp corresponding to the first frame image after the shooting mode switching.
As an alternative embodiment, when recording the start time stamp of the shooting mode switch, and the end time stamp of the shooting mode switch, various manners may be adopted, for example, a callback function may be set for the shooting switch start, so as to obtain the start time stamp of the shooting mode switch start; and setting a callback function for the shooting switching end so as to obtain an end time stamp of the shooting mode switching end. The callback function set for shooting switching start and shooting switching end is mainly used for triggering corresponding records for shooting switching start and triggering corresponding records for shooting switching end. For example, triggering a switching start callback function when the shooting mode is switched to start, and determining a time stamp recorded by the switching start callback function as a starting time stamp of the shooting mode switching; and triggering a switching end callback function when the shooting mode switching is ended, and determining the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching. The starting time stamp of shooting mode switching and the ending time stamp of shooting mode switching are recorded in the callback function recording mode, the starting time stamp of shooting mode switching and the ending time stamp of shooting mode switching can be accurately recorded, and therefore tag information of shooting mode switching recorded in the video shooting process is more accurate.
And generating the label information for the shooting mode switching and writing the generated label information into the shot video. The following is an example.
Fig. 7 is a flowchart of a method for generating tag information for switching shooting modes according to an embodiment of the present application. As shown in fig. 7, in the embodiment of the present application, in capturing a video, tag information of video capturing mode switching involves generation of two kinds of tag information. The tag information for the shooting mode switching corresponding to the shot scene switching may be, for example, tag information for the shooting mode switching from the one-way shooting mode to the two-way shooting mode. The other is the label information of the shooting mode switch of the lens switch transition, for example, in the two-way shooting mode, the front-back picture-in-picture shooting mode (i.e. the shooting mode that the foreground picture collected by the front camera is placed in the background picture collected by the rear camera) is switched to the rear-front picture-in-picture shooting mode (i.e. the shooting mode that the background picture collected by the rear camera is placed in the foreground picture collected by the front camera).
Step S701: the electronic equipment starts a camera application, and the camera application loads a multi-mirror mode;
Step S702: in a multi-mirror mode, loading a video tag function of a camera application;
step S703: the video tag function of the camera application registers a callback function, e.g. configures a listening function for the shooting mode switch, e.g. configures a trigger condition corresponding to the callback function recording the start of the shooting mode switch and the end of the shooting mode switch. For example, by configuring a trigger condition of a switching start callback function, when the trigger condition is met, the switching start callback function records a start time stamp of shooting mode switching; and when the triggering condition is met, the switching end callback function records the ending time stamp of shooting mode switching.
Step S704: the electronic device receives a mode switching operation input by a user, where the mode switching operation is used for determining a shooting mode when the electronic device starts shooting (that is, the first shooting mode, that is, a shooting mode before the scene of the lens is switched, in this embodiment, the first shooting mode is taken as an example of a single-path shooting mode), and the mode switcher of the electronic device switches a multi-lens mode in response to the mode switching operation, so as to determine to use the first shooting mode to perform shooting;
Step S705: the mode switcher turns on the camera through the equipment factory;
step S706: the device factory and the camera capture session device create a session initiation flow;
step S707: the camera capture session callback preview stream to the mode switcher. In this embodiment, a single-path shooting mode is started, video shooting is performed by adopting the single-path shooting mode, and a video picture obtained by shooting is displayed on a display interface of the electronic device;
step S708: the mode switcher of the electronic equipment receives a shooting starting instruction input by a user, namely, a camera starts shooting in a single-way shooting mode;
step S709: in response to the start shooting instruction, a time base line of a recording TAG (TAG), that is, a start time point at which recording of a time stamp is started, is used. For example, a timestamp of the preview stream encoded first frame image may be acquired and marked as a time base line T0 of the tag record.
Step S710: the video TAG function module records a shot scene TAG and starts a time stamp T0;
step S711: the mode switch receives a (shooting) mode switching instruction input by a user, and switches the current single-path shooting mode to the double-path shooting mode in response to the mode switching instruction.
Step S712: the video TAG function module records a shot scene TAG, and the ending time stamp is the time stamp T1 of the last frame of image before mode switching;
Step S713: the video tag function module monitors the shooting mode switching operation (i.e., the switching operation of switching the single shooting mode to the two-way shooting mode), and records the current starting time stamp of the shooting mode switching and the ending time stamp of the shooting mode switching.
In particular, when the triggering condition of the configuration switch start callback function is that the last frame of image of the shooting mode before switching is monitored, the video tag function module triggers the switch start callback function to record that the timestamp of the last frame of image is the start timestamp T1 of the shooting mode switching when the last frame of image of the single-path shooting mode is monitored.
Step S714: the video tag function module monitors the shooting mode switching operation (namely, the switching operation of switching the single shooting mode into the double-path shooting mode), and records the ending time stamp of the current shooting mode switching.
If the triggering condition of the configuration switching end callback function is that the first frame image of the shooting mode after switching is monitored, when the video tag functional module monitors the first frame image of the two-way shooting mode, the switching end callback function is triggered to record that the time stamp of the first frame image is the ending time stamp T2 of the shooting mode switching.
Step S715: after the electronic equipment is switched to the two-way shooting mode, shooting is carried out by adopting the switched two-way shooting mode, and the video stream obtained after shooting by adopting the two-way shooting mode is displayed on a display interface of the electronic equipment. For example, when the two-way shooting mode is a front-back picture-in-picture shooting mode, a foreground picture acquired by the front camera is displayed on an electronically-set display interface and is placed in a background picture acquired by the rear camera.
Step S716: the mode switcher of the electronic equipment receives the lens transition instruction, and responds to the lens transition instruction, and the current front and back picture-in-picture shooting mode is switched into a back front picture-in-picture shooting mode (namely, a shooting mode that a back scene picture acquired by a back camera is arranged in a front scene picture acquired by a front camera). After the front-back picture-in-picture shooting mode is switched, a back picture acquired by the back camera is displayed on a display interface of the electronic equipment and is placed in a front picture acquired by the front camera.
Step S717: the video tag function module monitors the shooting mode switching operation (i.e., the switching operation of switching the front and rear picture-in-picture shooting modes to the rear front picture-in-picture shooting mode), and records the current starting time stamp of shooting mode switching.
In particular, when the triggering condition of the configuration switch start callback function is that the last frame of image of the shooting mode before switching is monitored, the video tag function module triggers the switch start callback function to record the timestamp of the last frame of image as the start timestamp T3 of the shooting mode switching when the last frame of image of the picture-in-picture shooting mode before and after is monitored.
Step S718: the video tag function module monitors the shooting mode switching operation (i.e., the switching operation of switching the front and rear picture-in-picture shooting modes to the rear front picture-in-picture shooting mode), and records the ending time stamp of the current shooting mode switching.
If the triggering condition of the configuration switching end callback function is that the first frame image of the shooting mode after switching is monitored, when the video tag functional module monitors the first frame image of the shooting mode in the picture-in-picture mode before switching, the triggering condition of the configuration switching end callback function triggers the switching end callback function to record that the timestamp of the first frame image is the ending timestamp T4 of the shooting mode switching.
Step S719: the electronic device receives an end shooting command input by a user, and in response to the end shooting command, the multi-mirror mode of the camera application generates a shot video (i.e., the target video may be an MP4 video) based on the shot video stream. After the video tag function module monitors the shooting ending instruction, the recorded tag information corresponding to the switching of the two shooting modes is combined with the target video to generate a first video file.
Through the processing, when the shooting mode is switched in the video shooting process, corresponding tag information is generated aiming at the shooting mode switching, and a basis is provided for writing the tag information into a video file obtained through shooting.
The shooting mode switching corresponding to the above-mentioned scene switching of the lens and the shooting mode of the transition of the lens are only one implementation, and can be applied to other mode switching.
In addition, in the above-described embodiment, only two kinds of photographing mode switching are exemplified, and the number of photographing mode switching during one video photographing may not be limited, and for example, one, three, or more may be also exemplified.
Step S503: and acquiring target videos obtained after video shooting in the first shooting mode and the second shooting mode.
In this embodiment of the present application, when shooting is performed in the first shooting mode and when shooting is performed in the second shooting mode, a mode of mixing audio and video while shooting may be adopted to obtain the target video. That is, the video image and the audio in the shooting process from the start of shooting in the first shooting mode to the end of shooting in the second shooting mode are mixed to obtain the target video.
Step S504: a first video file is generated based on the tag information and the target video.
In the embodiment of the application, after the tag information of shooting mode switching is obtained, the obtained tag information is combined with the target video obtained through shooting, and then the first video file is obtained. Therefore, the obtained first video file carries the tag information for identifying the shooting mode switching, so that the shooting mode switching process in the video shooting process can be identified according to the tag information.
In one implementation, the target video is an audio-video mixed video obtained by mixing audio-video obtained by video shooting. In step S504, combining the tag information with the target video, generating the first video file includes calling a newly added tag setting interface, writing the tag information into a video information description area of the target video, and calling a stop interface to complete the generation of the first video file.
Fig. 8 is a flowchart of generating a first video file based on tag information and a target video according to an embodiment of the present application. As shown in fig. 8, in the related art, two data tracks, an audio track and a video track, are generated during the process of capturing a video by an electronic device (a camera in the electronic device), and after the video capturing is completed, the two tracks need to be mixed and packaged to generate a final video file (e.g., an MP4 video file). In the embodiment of the application, the process of shooting video through the electronic device to generate the video file is approximately as follows:
S801, after the camera captures a video, an addTrack interface in the MediaMuxer class ((third) media mixer) may be called through transparent transmission of the first media mixer (HwMediaMuxer) and the second media mixer (HwMediaMuxer), and the audio track and the video track may be added to the MPEG4Writer class.
S802, the camera calls a start interface and a WriteSampleData interface in the mediaMuxer class to start mixing the audio and video, and a target video (for example, MP4 video) is obtained.
S803, the camera calls a setUserTag interface in the mediaMuxer class, and writes TAG information corresponding to the target video into a video information description area of the target video (the video information description area is an area stored by a field to which the TAG information belongs). For example, when the TAG information recorded is scene information, a scene identifier corresponding to the scene information (for example, an identifier corresponding to a single-mode shooting mode), a start time stamp of the scene, and an end time stamp of the scene are written into a scene field corresponding to the scene information. For another example, when the recorded TAG information is the transition information, a transition flag corresponding to the transition information (for example, a switching flag for switching from the single-mode shooting mode to the dual-mode shooting mode, a start time stamp of transition, and an end time stamp of transition) is written in a transition field corresponding to the transition information.
For example, the following codes may be used to implement the call setUserTag interface to write the tag information into the information field corresponding to the target video, that is, the tag information transmitted by the camera application is copied into the memory, and then written into the MP4 file together with other video information:
s804, the camera calls the stop interface to generate a final MP4 video file, and the obtained MP4 video file is the first video file. And the purpose of combining the label information with the target video to generate a first video file is achieved.
In the related art, generally, after audio and video mixing is performed in step S702 to obtain a target video, a stop interface (i.e., the stop interface mentioned above) is called to generate an MP4 video file. However, in order to achieve writing TAG information (i.e., TAG information corresponding to the above-mentioned shooting mode switching) recorded during video shooting into MP4 video (i.e., the above-mentioned target video), in this embodiment of the present application, setUserTag interfaces (i.e., the above-mentioned TAG setting interfaces) are newly added in MPEG4 writers and mediamuxers, and the hwmediamuxers are newly added for a camera to call, before the camera calls a stop interface, the camera first calls the setUserTag interface in the MediaMuxer through the HwMediaMuxer, and writes TAG information corresponding to the target video into a video information description area corresponding to the target video, so as to obtain the first video file.
It should be noted that, the first video file according to the embodiment of the present application may include a plurality of areas, and a plurality of different areas are used to store different contents. For example, the plurality of areas may include an information area for storing description information and a video area to which the above-indicated video information description area belongs; the video area is used to store the video stream itself (e.g., the target video).
When the tag information is combined with the target video to generate the first video file, the following method can be specifically adopted:
when the camera calls a start interface and a WriteSampleData interface in the MediaMuxer class to perform audio and video mixing to obtain an audio and video mixed stream, an encoding thread can be started to start the audio and video mixed stream, the audio and video mixed stream is sent to a preset encoder, and the preset encoder is adopted to encode the audio and video mixed stream into a video file (for example, a video file in an MP4 format). After the audio and video mixing is finished, calling a setUserTag interface in the mediaMuxer class, and writing TAG information corresponding to the target video into a video information description area (namely a field corresponding to the TAG information) of the target video. After the encoding of the audio and video mixed stream corresponding to the target video is finished, the encoding operation continues to encode the TAG information field written into the video information description area by adopting the preset encoder, the encoded TAG information is refreshed into the video file in the preset format, and after the encoding of the TAG information is finished, a stop interface is called to generate a final MP4 video file, namely a first video file.
Based on the above optional embodiment, after obtaining the tag information corresponding to the shooting mode switching, the tag information may be combined with the target video obtained by shooting to generate the first video file. The first video file thus obtained carries tag information of all shooting mode switching included in the whole shooting process. After the first video file is obtained through the camera application, the obtained first video file can be directly sent to the video editing application, or the obtained first video file can be stored locally or in a media library, and when the video editing application is based on the operation requirement of a user, the first video file is called based on the path of the file.
Step S505: editing a switching process of switching a first shooting mode to a second shooting mode in the first video file based on the label information in the first video file to obtain a second video file.
In a specific implementation, when a first video file carrying tag information is obtained, editing processing can be performed on a switching process of switching a first shooting mode in the first video file to a second shooting mode in the first video file based on the tag information in the first video file, so as to obtain an edited second video file. For example, the camera application may send the first video file obtained by shooting to the video editing application, and when the video editing application obtains the first tag file, the video editing application may decode the first tag file by using a decoder corresponding to an encoder in the camera application to obtain the target video in the first video file and tag information corresponding to the tag mode switching, and then edit a switching process of switching the first shooting mode in the first video file to the second shooting mode in the first video file based on the tag information in the first video file to obtain the second video file.
In addition, based on the tag information in the first video file, editing is performed on a switching process of switching a first shooting mode in the first video file to a second shooting mode in the first video file, and when a second video file is obtained, different video editing strategies can be adopted. Different video editing strategies edit the switching process of the first shooting mode to the second shooting mode in the first video file, so that the obtained second video file can be different.
As an alternative implementation manner, the video editing policy may be to edit the video according to a predetermined video editing template, or may be to edit a switching process of switching the first shooting mode to the second shooting mode in the first video file by randomly calling resources required by the video generating process.
Fig. 9 is a flowchart of a video editing method in a video processing method according to an embodiment of the present application. As shown in fig. 9, the video editing method includes the following steps:
step S901: starting a video editing application, displaying an interface of the video editing application on a display interface of the electronic device, displaying a selection control for identifying a video editing strategy on the interface, and comprising: the randomly generated video controls and templates generate video controls.
Step S902: and receiving a video editing strategy selection instruction input by a user, and responding to the video editing strategy selection instruction to generate a video.
Step S903: and under the condition that the video editing strategy selection instruction received by the electronic equipment is to randomly generate the video, generating the video by adopting a method for randomly generating the video. For example, when the process of switching the shooting mode is processed based on the tag information in the first video file, a random special effect processing method is adopted for processing. And obtaining the edited video based on the random processing method, and further generating the pointed second video file.
Step S904: and under the condition that the video editing strategy selection instruction received by the electronic equipment generates video for the video editing template, generating the video by adopting the preset video editing template. For example, the video in the first video file is edited based on the material configured by the predetermined video editing template, so as to obtain an edited video, and further generate the second video file. For example, when the material editing film head and film tail configured in the video editing template is adopted, the filter parameter adjustment filter configured in the video editing template is adopted to filter the video, the sticker material configured in the video editing template is adopted as the video adding sticker, the frame material configured in the video editing template is adopted as the video adding frame, and the like, and the process of switching the shooting mode is processed based on the tag information in the first video file, the processing method configured in the video editing template (for example, a method of inserting the switching image frame, a method of extending the image frame before playing the switching, and the like, which will be described in detail below) is adopted to process the shooting mode switching. And obtaining the edited video based on the random processing method, and further generating the pointed second video file.
By the processing, the first video file for editing comprises the tag information for switching the shooting modes, so that when the video in the first video file is edited, the shooting mode switching can be selectively and automatically processed based on the tag information, and the video manufacturing efficiency is high on the premise of ensuring the quality of the manufactured video.
The video editing policy just cited above is a policy of randomly generating video and a policy of generating video by a video editing template, but a combination of both or other policies of generating video may be adopted, and the present invention is not limited thereto.
As an optional embodiment, editing a switching process of switching a first shooting mode in a first video file to a second shooting mode in the first video file, to obtain a second video file may include: and under the condition that the video editing strategy comprises editing by adopting a video editing template, acquiring the video editing template, and editing a switching process of switching a first shooting mode in a first video file into a second shooting mode in the first video file by adopting the acquired video editing template to obtain a second video file. When the video editing template is adopted to edit the switching process of switching the first shooting mode in the first video file into the second shooting mode in the first video file, the calling resources in the video editing template can be flexibly and randomly selected in a certain resource library. For example, when a certain action is to be inserted in the switching process of the shooting mode, the video editing template may only set that the inserted action belongs to a certain style, and it is not necessary to determine a specific action from a plurality of actions of the certain style. By adopting the processing, even when the video editing template is adopted to edit the switching process of switching the first shooting mode into the second shooting mode in the first video file, diversified videos can be obtained, and the situation that the obtained videos are too single and poor in viewing experience is avoided.
As an alternative embodiment, when the video editing template is used to edit the switching process of the first video file from the first shooting mode to the second shooting mode in the first video file, so as to obtain the second video file, the video editing template may be selected from a plurality of video editing templates. For a video editing template, material and/or parameters configured for the template are corresponding. For example, there are materials corresponding to the head and tail of the target video, there are filter parameters corresponding to performing a filter function for the target video, there are special effect materials corresponding to the sticker configured for the target video, special effect materials configured for the target video, frame materials configured for the target video, and the like. By way of specific example, the predetermined video editing templates may include: the head and the tail of the film are used for playing preset background music, filter parameters corresponding to black and white ash are adopted in the middle 2-3 minutes of the target video, the antique effect is achieved, a sticker is added on video frame images in the 4-5 minutes of the target video, a certain special effect in a special effect resource library is played on video frame images in the 6-7 minutes of the target video, and a pure black frame is arranged for the target video. Therefore, after the video editing template is adopted for editing, the preset background music is played at the head and the tail of the video on the basis of adding a pure black frame to the original video content, a filter is introduced in 2-3 minutes to present the antique effect, a sticker is stuck on a video frame image in 4-5 minutes, and a special effect video is played in 6-7 minutes.
Based on the above-mentioned alternative embodiment, when the first video file carrying the tag information for switching the shooting mode is obtained, the switching process of switching the first shooting mode in the first video file to the second shooting mode in the first video file may be edited based on the tag information in the first video file, so as to obtain the second video file. For example, when editing the switching process of the first video file to switch the first shooting mode to the second shooting mode in the first video file according to the tag information, various modes may be adopted, for example, the following procedure may be adopted to edit the switching process of the first video file to switch the first shooting mode to the second shooting mode in the first video file.
Fig. 10 is a schematic flow chart of editing a video in a first video file according to an embodiment of the present application. As shown in fig. 10, the flow includes the steps of:
step S1001: and extracting tag information in the first video file.
As an alternative embodiment, before editing the switching process of the first video file to the second shooting mode, the information related to the target video may be read from the video information description area in the first video file, for example, the tag information written in the video shooting stage may be read from the video information description area. The video information description area may be an information description area of the target video, or may be an information area of a video tag reset for storing the tag information. In the embodiment of the present application, it is not particularly limited. It should be noted that, before editing the switching process of the first shooting mode to the second shooting mode in the first video file, other information of the video may be read from the video information description area, for example, the size of the video, the encoding mode of the video, the format of the video, etc., but the process of reading these information is similar to that of the related art, and will not be described here.
Step S1002: and determining a starting time stamp and an ending time stamp of shooting mode switching in the first video file according to the label information.
As an alternative embodiment, the relevant information of the shooting mode switch is determined based on the tag information extracted from the first video file, for example, identification information for identifying the shooting mode switch, a start time stamp of the shooting mode switch, and an end time stamp of the shooting mode switch, so as to be used for positioning the position of the switching process of the shooting mode switch in the video subsequently.
Step S1003: editing a switching process of switching a first shooting mode in the first video file to a second shooting mode in the first video file based on a time period from a start time stamp to an end time stamp to obtain a second video file.
As an alternative embodiment, the switching process of switching the first shooting mode in the first video file to the second shooting mode in the first video file is edited based on the time period from the start time stamp to the end time stamp, so as to obtain the second video file. And locating the time period corresponding to the shooting mode switching in the target video, and processing and editing the time period of the target video based on a preset video editing strategy, so that a second video file with better quality is automatically obtained.
Specifically, when editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the period from the start time stamp to the end time stamp to obtain the second video file, the processing manner of switching the shooting mode may be added to the configuration of the predetermined video editing template on the basis of editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the predetermined video editing template described above. Therefore, when editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the preset video editing template, processing the shooting mode switching by adopting the processing mode configured in the video editing template when aiming at the shooting mode switching, thereby completing the automatic production of the video and really realizing one-key slicing.
As an alternative embodiment, when editing a switching process of switching a first shooting mode in a first video file to a second shooting mode in the first video file based on a period from a start time stamp to an end time stamp to obtain a second video file, when editing the second video file by using a video editing template, a plurality of processing modes, different processing modes, and different processes for editing a video to automatically complete video production may be configured in the video editing template, which will be described below by way of example.
As an alternative embodiment, editing the video in the first video file based on the period from the start time stamp to the end time stamp, to obtain the second video file may include: acquiring a switching image frame; inserting a switching image frame in a time period from a start time stamp to an end time stamp in the target video to obtain a processed video, and editing the processed video to obtain a second video file; or, in the process of editing the target video, inserting a switching image frame in the target video from the time period from the start time stamp to the end time stamp to obtain a second video file. Through the processing, namely, the shooting mode switching process is filled in a mode of inserting the image frames in a time period corresponding to the shooting mode switching process, the condition that images are blurred in the display switching process is effectively avoided, and a user cannot perceive the switching in the follow-up video watching process.
Therefore, as an alternative embodiment, when editing the switching process of switching the first shooting mode in the first video file to the second shooting mode in the first video file based on the time period from the start time stamp to the end time stamp to obtain the second video file, the processing may be performed on the target video in the first video file to obtain the processed video based on the time period from the start time stamp to the end time stamp, and then the editing may be performed on the obtained processed video based on the video editing template to obtain the second video file. In the process of editing the target video by using the video editing template, when editing a time period from a start time stamp to an end time stamp in the target video, the time period may be processed, so as to obtain the second video file. Therefore, when the video is edited by using the video editing template, the video editing template can be used for editing the target video which is originally shot, and the video editing template can also be used for editing the processed video.
It should be noted that, whether the video is processed first and then edited to obtain the second video file, or the second video file is obtained by processing the video while editing (i.e., processing the video during the video editing process), the edited video stream may be encoded by a predetermined encoder to obtain the second video file in a predetermined encoding format.
Fig. 11 is a schematic diagram of editing a shooting mode switch in a video based on tag information, as shown in fig. 11, image frames are inserted from a time period from a start time stamp T1 to an end time stamp T2, and when such a processing manner is adopted, the original image frames shot in the first shooting mode and the image frames shot in the second shooting mode are in corresponding time periods, the original information of the original video is not affected, and the original shot video content can be most truly represented in the edited video.
As an alternative embodiment, the image frames inserted in the process of switching the shooting modes may be acquired in various manners, for example, acquiring the switching image frames may include: intercepting a target image frame from a target video obtained by video shooting in a first shooting mode; and based on the change parameters of the first shooting mode to the second shooting mode, corresponding image parameter adjustment is carried out on the target image frame, so as to obtain a switched image frame. The captured target image frame may be one frame image or a plurality of frames image. For example, when the target image frame is a frame image, the target image frame may be the last frame image obtained when the first shooting mode is adopted to perform video shooting, or may be other frame images before the last frame image, and specifically may be flexibly selected according to requirements. For example, when the target image frame is a plurality of frame images, the target image frame may be a plurality of continuous frame images taken from a video image frame obtained by performing video capturing in the first capturing mode, or may be a plurality of frame images starting from the last frame image and starting from an intermediate frame before the last frame.
When the target image frame is obtained by adjusting the corresponding image parameters based on the change parameters of the first shooting mode to the second shooting mode, for example, when the target image frame is a frame of image, the image adjustment parameters corresponding to each switching image frame in the switching process are calculated according to the shooting mode switching strategy (switching duration, switching frame rate, switching effect and the like), and the target image frame is adjusted according to the corresponding image adjustment parameters, so that the corresponding switching image frame is obtained. For another example, when the target image frame is a multi-frame image, the number of switching image frames that the multi-frame image needs to obtain respectively is calculated according to a shooting mode switching strategy (switching duration, switching frame rate, switching effect, etc.), image adjustment parameters of the corresponding number of switching image frames are calculated for each frame image in the multi-frame image respectively, and the frame image is adjusted based on the corresponding image adjustment parameters, so as to obtain the switching image frame corresponding to the frame image. And then, based on the position of each frame image in the multi-frame images, arranging the corresponding obtained switching image frames in the frame image, and obtaining all switching frame images included in the switching process of shooting mode switching.
Note that, when a mode of switching the period from the start time stamp to the end time stamp is adopted, smoothness can be achieved as long as the period in which the screen is blurred can be filled. For example, the filling may be performed by selecting the target image frame directly from the video image frame obtained by video shooting in the first shooting mode, and the method of direct filling is simple to operate, but when the generated video is played, since the target image frame is already played in the previous time, if the target image frame is played again, the picture may be repeated, so that the picture watched by the viewer is stopped. When the image frame is switched, the image parameters of the image frame of the original picture are adjusted, so that the image frame has certain similarity with the original picture, the abrupt condition caused by overlarge picture difference is avoided, and the advantage of smooth and excessive switching is realized.
As an alternative embodiment, when the target image frame is adjusted based on the change parameter of the first shooting mode to the second shooting mode, the following manner may be adopted when the switched image frame is obtained: under the condition that the first shooting mode is switched to the second shooting mode to be switched among different shooting speeds, acquiring a speed difference value between the first shooting speed of the first shooting mode and the second shooting speed of the second shooting mode, and performing image parameter adjustment corresponding to the speed difference value on the target image frame to obtain a switched image frame; or under the condition that the first shooting mode is switched to the second shooting mode to switch between different lens focal lengths, acquiring a focal length difference value between the first shooting focal length of the first shooting mode and the second shooting focal length of the second shooting mode, and performing image parameter adjustment corresponding to the focal length difference value on the target image frame to obtain a switched image frame.
For example, in the case where the first photographing mode is switched to the second photographing mode to switch between different photographing speeds, for example, the photographing speed of the first photographing mode is 2 times the photographing speed and the photographing speed of the second photographing mode is 0.5 times the photographing speed, then the photographing speed of the target image frame may be adjusted from 2 times to the normal photographing speed based on the speed difference between the photographing speed of the first photographing mode and the photographing speed of the second photographing mode, thereby obtaining the switched image frame. For another example, when the first photographing mode is switched to the second photographing mode to switch between different lens focal lengths, the photographing focal length of the first photographing mode is 1, and the photographing focal length of the second photographing mode is 0.8, the photographing focal length of the target image frame can be adjusted from 1 to 0.9 based on the focal length difference between the photographing focal length of the first photographing mode and the photographing focal length of the second photographing mode, and the switched image frame can be obtained.
It should be noted that, when the image adjustment parameters corresponding to the switching image frames are obtained, various modes may be adopted, for example, a computing module in the OpenGL renderer may be used to calculate the image adjustment parameters. In addition, the image adjustment parameters may also include a variety of types, and may include, for example, a rotation angle, a scaling, transparency, a blur degree, a displacement amount, and the like.
When the shooting mode switching in the target video is processed by adopting the mode of inserting the switching image frame, two corresponding processing modes can be adopted corresponding to the two coding modes: inserting a switching image frame into a position corresponding to the shooting mode switching process in a target video to obtain a complete video stream, and then encoding the complete video stream by adopting a preset encoder to obtain a second video file in a preset file format; and the other is that a video stream before shooting mode switching in the target video is coded by a preset coder to obtain a video file with a preset file format, when the video file is coded to a starting time stamp of shooting mode switching, the coding operation is continuously carried out on the inserted switching image frame, the coding stream corresponding to the switching image frame is updated into the file with the preset file format, when the video file is coded to an ending time position of shooting mode switching, the coding operation is continuously carried out on the video stream after shooting mode switching in the target video, and the coding stream of the video stream after shooting mode switching is continuously updated into the video file with the preset format to obtain the second video file.
As an alternative embodiment, the switching process of switching the first shooting mode in the first video file to the second shooting mode in the first video file is edited based on the time period from the start time stamp to the end time stamp, so that the second video file can be obtained by the following ways: acquiring a predetermined number of video image frames prior to a start time stamp; determining a third time period based on a first time period from the start time stamp to the end time stamp and a second time period of the predetermined number of video image frames, wherein the third time period is a sum of the first time period and the second time period; extending a second time period where a preset number of video image frames are located to a second time period in the target video to obtain a processed video, and editing the processed video to obtain a second video file; or in the process of editing the target video, extending the second time period of the preset number of video image frames to a third time period in the target video to obtain a second video file. Through the processing, namely, the playing parameters of the video image frames of the preset number are adjusted before the shooting mode is switched, the preset number of video image frames are played in an extending mode, so that the shooting mode switching process is filled, the condition that the images are blurred in the display switching process is effectively avoided, and the user can not perceive the switching in the video watching process.
As an alternative embodiment, editing the processed video to obtain the second video file includes: acquiring a preset video editing template; and editing the processed video by adopting a preset video editing template to obtain a second video file. The processed video is obtained by inserting a switching image frame in a time period from a start time stamp to an end time stamp in the target video; or extending a second time period in which a predetermined number of video image frames are located to a second time period in the target video, to obtain a video. As described above, the switching process of switching the first shooting mode to the second shooting mode in the first video file may also be edited by using the predetermined video editing template, so as to obtain the second video file.
Fig. 12 is a schematic diagram of editing a shooting mode switch in a target video based on tag information, as shown in fig. 12, a predetermined number of video image frames corresponding to a time stamp T3 from a start time stamp T1 onward, and the predetermined number of video image frames are originally played in a time period (T5-T1) from a time stamp T5 to a start time stamp T1, and are adjusted to be played in a time period (T5-T2) from a time stamp T5 to an end time stamp T2 (T5-T2), that is, by adjusting the predetermined number of video image frames from being played in the time period (T5-T1) to being played in the time period (T5-T2), because the time period (T5-T2) is greater than the time period (T5-T1), the extended playing of the predetermined number of video image frames is achieved. With such a processing method, the image is played in the switching process (T1-T2) of the shooting mode, and the image blurring or the dark screen cannot occur. In addition, in the shooting mode switching process, only the original normally played image frames are slowly played, large difference can not appear visually, the switching image frames do not need to be additionally acquired, the operation is simple, and the processing efficiency is high.
When the shooting mode switching in the target video is processed by adopting the mode of extending the play of the preset number of video image frames, two corresponding coding modes are adopted, and two corresponding processing modes are also adopted: firstly, carrying out extension play processing on the video image frames with the preset number to obtain a complete video stream, and then, encoding the complete video stream by adopting a preset encoder to obtain a second video file with a preset file format; and when the video stream is coded to the ending time position of shooting mode switching, continuing to code the video stream after the shooting mode switching in the target video, and continuing to update the code stream of the video stream after the shooting mode switching to the video file of the preset format to obtain the second video file.
Fig. 13 is a schematic diagram of a video processing method according to an embodiment of the present application. The method is applicable to the electronic device of fig. 1, and as shown in fig. 13, the video processing method includes two aspects of processing: the first aspect is mainly that a camera application starts a corresponding camera lens to perform video shooting, records tag information of shooting mode switching executed in a shooting process in real time, and combines the recorded tag information with a video obtained by shooting to generate a video file (i.e. the first video file) (the processing procedure shown in fig. 7 and fig. 8 is not described in detail here); the second aspect is mainly that the video editing application acquires a video file obtained by the camera application, and generates a video based on tag information carried in the video file. The following describes the video processing method with reference to fig. 13, and as shown in fig. 13, the video processing method includes the following procedures.
Step S1301: and (3) adopting a camera application to carry out video shooting, and recording tag information of shooting mode switching in the process of video shooting.
After the video capturing is finished, an original video captured by the camera application (for example, stored in the target video) is obtained. After the original video is obtained, the following operations may be performed: a video file is generated based on the original video in combination with the related description information of the video. The related description information of the video includes: the tag information recorded above identifies a special type tag number 0 of the video type (e.g., a double shot video), size information of the video, coding mode information of the video, and the like.
Step S1302: after the above operation is performed, the obtained first video file carrying the tag information is stored in the camera directory, that is, in a predetermined storage space of the camera application.
Step S1303: since the video in the first video file is newly captured, the camera stores the relevant description information of the newly captured video in a media provider (MediaProvider) for facilitating the subsequent provision of the relevant description information of the first video file to a requester who needs the first video file.
Step S1304: when the media provider receives the relevant description information of the first video file, a corresponding notification message is triggered, wherein the notification message is used for notifying the media database to synchronize the relevant description information of the new first video file.
Step S1305: and after receiving the notification, the media database scans and analyzes the extension meta information such as the number 0 special type tag and stores the related description information of the video in the first video file.
Step S1306: after storing and locally synchronizing the video file carrying the tag information corresponding to the shooting mode switching, the display interface of the electronic device may be skipped, for example, the shooting display interface of the camera may be skipped to a video editing interface. When the video editing interface is skipped, the path of the first video file can be carried.
Step S1307: and reading the first video file from the file memory based on the path of the first video file.
Step S1308: and reading the carried tag information from the first video file, and editing the mode switching process in the first video file based on the tag information and a preset video editing strategy to obtain a second video file. For example, a 15-30s micro-video (Vlog) clip may be generated based on a predetermined video editing template, including a music template or a background image template.
Step S1309: and storing the obtained second video file into a file memory.
Fig. 14 is a software structural block diagram of an electronic device according to an embodiment of the present application. The software architecture of the present embodiment is merely an example, and can also be applied to other operating systems. In this embodiment, the layered architecture divides the software into several layers, each of which has distinct roles and branches. The layers communicate with each other through a software interface. In some embodiments, the Android (Android) system is divided into four layers, namely an application layer, a framework layer, a hardware abstraction layer and a hardware layer from top to bottom.
The Application layer (App) may include a series of Application packages. For example, the application package may include a camera application. The application layer may be further divided into a display interface and application logic.
The display interface of the camera application includes a single view mode, a double view mode, a picture-in-picture mode, and the like. Wherein, only one shooting picture is displayed in a single scene mode; two shooting pictures are displayed in parallel in a double-view mode; two shots are displayed in the picture-in-picture mode, one shot being located in the other shot.
The application logic of the camera application comprises a switching control module, a video tag function module, a multi-shot coding module and the like. The switching control module is used for controlling the switching of shooting modes; the video tag function is used for recording tag information of shooting mode switching in the shooting mode switching process; the multi-shot coding is used for keeping coding in the shooting mode switching process to generate a video file.
The Framework layer (FWK) provides an application programming interface (application programming interface, API) and programming Framework for the application layer's applications, including some predefined functions. In fig. 14, the framework layer includes a Camera access interface (Camera 2 API), which is an Android-pushed interface for accessing a Camera device, and adopts a pipeline design to enable a data stream to flow from the Camera to the Surface. The Camera2 API includes Camera management (Camera manager) and Camera device (Camera device). The Camera manager is a management class of the Camera equipment, and can query the Camera equipment information of the equipment through the class of objects to obtain a Camera equipment object. The Camera device provides a series of fixed parameters related to the Camera device, such as basic settings and output formats.
A Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and the hardware circuitry, which aims at abstracting the hardware. The hardware interface details of a specific platform are hidden, a virtual hardware platform is provided for an operating system, so that the operating system has hardware independence, and can be transplanted on various platforms. In fig. 14, the HAL includes a Camera hardware abstraction layer (Camera HAL) including a Device (Device) 1, a Device (Device) 2, a Device (Device) 3, and the like. It is understood that the devices 1, 2, and 3 are abstract devices.
The HardWare layer (HardWare, HW) is the HardWare that is located at the lowest level of the operating system. In fig. 14, HW includes a camera device (camera device) 1, a camera device (camera device) 2, a camera device (camera device) 3, and the like. Among them, the camera device1, the camera device2, and the camera device3 may correspond to a plurality of cameras on the electronic device.
Fig. 15 is a block diagram of a video processing apparatus according to an embodiment of the present application. The video processing may be applied to the above-mentioned electronic device, as shown in fig. 15, and the video processing device includes: the device will be described below as a receiving module 1501, a processing module 1502, an obtaining module 1503, a generating module 1504 and an editing module 1505.
A receiving module 1501, configured to obtain a shooting mode switching operation in a process of performing video shooting in a first shooting mode;
a processing module 1502 connected to the receiving module 1501, configured to switch a first shooting mode to a second shooting mode in response to a shooting mode switching operation, and record tag information of the shooting mode switching, where the tag information of the shooting mode switching is used to mark that the first shooting mode is switched to the second shooting mode in a video shooting process;
an obtaining module 1503, connected to the processing module 1502, configured to obtain a target video obtained by performing video capturing in the first capturing mode and the second capturing mode;
a generating module 1504, coupled to the acquiring module 1503, for generating a first video file based on the tag information and the target video;
the editing module 1505 is connected to the generating module 1504, and is configured to edit a switching process of switching a first shooting mode in the first video file to a second shooting mode in the first video file based on the tag information in the first video file, so as to obtain a second video file.
As an alternative embodiment, the processing module 1502 includes:
A recording unit configured to record a switching identification of shooting mode switching, a start time stamp of shooting mode switching, and an end time stamp of shooting mode switching, wherein the tag information includes: a switch identification, a start time stamp, and an end time stamp.
As an alternative embodiment, the recording unit comprises:
a recording subunit, configured to determine a switching identifier of the shooting mode switching based on a first shooting mode before the shooting mode switching and a second shooting mode after the shooting mode switching; triggering a switching start callback function when the shooting mode is switched, and determining a time stamp recorded by the switching start callback function as a starting time stamp of shooting mode switching; and triggering a switching end callback function when the shooting mode switching is ended, and determining the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching.
As an alternative embodiment, the generating module 1504 includes:
and the writing unit is used for calling the newly added tag setting interface, writing tag information into the video information description area of the target video, and calling the stopping interface to finish the generation of the first video file.
As an alternative embodiment, the editing module 1505 includes:
The extracting unit is used for extracting the label information in the first video file;
a determining unit configured to determine a start time stamp and an end time stamp of shooting mode switching in the first video file according to the tag information;
and the editing unit is used for editing a switching process of switching a first shooting mode in the first video file into a second shooting mode in the first video file based on a time period from the start time stamp to the end time stamp, so as to obtain the second video file.
As an alternative embodiment, the editing unit comprises:
a first acquisition subunit configured to acquire a switching image frame;
an inserting subunit, configured to insert a switching image frame in a time period from a start time stamp to an end time stamp in the target video, obtain a processed video, and edit the processed video to obtain a second video file; or, in the process of editing the target video, inserting a switching image frame in the target video from the time period from the start time stamp to the end time stamp to obtain a second video file.
As an alternative embodiment, the first acquisition subunit comprises:
a first acquisition subunit for capturing a target image frame from a video obtained by video shooting in a first shooting mode; based on the change parameters of the first shooting mode to the second shooting mode, corresponding image parameter adjustment is carried out on the target image frame, and a switching image frame is obtained; or alternatively
A first acquisition subunit configured to intercept a target image frame from a video obtained by video capturing in a first capturing mode, wherein the switching image frame includes the target image frame.
As an alternative embodiment, the first acquisition subunit is configured to:
under the condition that the first shooting mode is switched to the second shooting mode to be switched among different shooting speeds, acquiring a speed difference value between the first shooting speed of the first shooting mode and the second shooting speed of the second shooting mode, and performing image parameter adjustment corresponding to the speed difference value on the target image frame to obtain a switched image frame; or,
under the condition that the first shooting mode is switched to the second shooting mode to switch between different lens focal lengths, a focal length difference value between the first shooting focal length of the first shooting mode and the second shooting focal length of the second shooting mode is obtained, and image parameter adjustment corresponding to the focal length difference value is carried out on the target image frame to obtain a switched image frame.
As an alternative embodiment, the editing unit comprises:
a second acquisition subunit for acquiring a predetermined number of video image frames before a start time stamp;
a determining subunit configured to determine a third time period based on a first time period from the start time stamp to the end time stamp and a second time period in which the predetermined number of video image frames are located, where the third time period is a sum of the first time period and the second time period;
The processing subunit is used for extending a second time period where a preset number of video image frames are positioned to a third time period in the target video to obtain a processed video, and editing the processed video to obtain a second video file; or in the process of editing the target video, extending the second time period of the preset number of video image frames to a third time period in the target video to obtain a second video file.
As an alternative embodiment, the editing unit comprises:
a third obtaining subunit, configured to obtain a predetermined video editing template;
and the editing subunit is used for editing the processed video by adopting a preset video editing template to obtain a second video file.
As an alternative embodiment, the shooting mode switching includes at least one of: switching between different lens modes, switching between fields in the same lens mode, switching between different shooting speeds and switching between different lens focal lengths.
Corresponding to the above method embodiments, the present application further provides an electronic device, which is configured to store a memory for storing computer program instructions and a processor for executing the program instructions, where the computer program instructions, when executed by the processor, trigger the electronic device to perform some or all of the steps in the above method embodiments.
In a specific implementation, the application further provides a computer storage medium, where the computer storage medium may store a program, where when the program runs, the device where the computer readable storage medium is controlled to execute some or all of the steps in the foregoing embodiments. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (random access memory, RAM), or the like.
In a specific implementation, the embodiment of the application further provides a computer program product, where the computer program product contains executable instructions, and when the executable instructions are executed on a computer, the computer is caused to perform some or all of the steps in the above method embodiment.
In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "and/or", describes an association relation of association objects, and indicates that there may be three kinds of relations, for example, a and/or B, and may indicate that a alone exists, a and B together, and B alone exists. Wherein A, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of the following" and the like means any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or plural.
Those of ordinary skill in the art will appreciate that the various elements and algorithm steps described in the embodiments disclosed herein can be implemented as a combination of electronic hardware, computer software, and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In several embodiments provided by the present invention, any of the functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method of the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above is only a specific embodiment of the present invention, and any person skilled in the art may easily think of changes or substitutions within the technical scope of the present invention, and should be covered in the scope of the present invention. The protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (24)

1. A video processing method, comprising:
acquiring shooting mode switching operation in the process of shooting video by adopting a first shooting mode;
switching the first shooting mode to a second shooting mode in response to the shooting mode switching operation, and recording tag information of shooting mode switching, wherein the tag information of shooting mode switching is used for marking that the first shooting mode is switched to the second shooting mode in the video shooting process;
acquiring a target video obtained by video shooting in the first shooting mode and the second shooting mode;
generating a first video file based on the tag information and the target video;
editing a switching process of switching the first shooting mode to the second shooting mode in the first video file based on the tag information in the first video file to obtain a second video file; the tag information in the first video file comprises a start time stamp and an end time stamp of the shooting mode switching in the first video file;
Editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the tag information in the first video file to obtain a second video file, wherein the editing comprises the following steps:
inserting a switching image frame in the target video from the starting time stamp to the ending time stamp to obtain the second video file; the switching image frame is obtained by intercepting the video obtained by adopting the first shooting mode to shoot the video, or the switching image frame is obtained by adjusting the image parameters of the image frame obtained by intercepting the video obtained by adopting the first shooting mode to shoot the video.
2. The method according to claim 1, wherein the recording tag information of the photographing mode switching includes:
recording a switching identification of the shooting mode switching, a starting time stamp of the shooting mode switching, and an ending time stamp of the shooting mode switching, wherein the tag information comprises: the switch identification, the start timestamp and the end timestamp.
3. The method of claim 2, wherein the recording of the switch identification of the shooting mode switch, the start time stamp of the shooting mode switch, and the end time stamp of the shooting mode switch comprises:
Determining a switching identification of the shooting mode switching based on the first shooting mode before the shooting mode switching and the second shooting mode after the shooting mode switching;
triggering a switching start callback function when the shooting mode is switched, and determining a time stamp recorded by the switching start callback function as a starting time stamp of the shooting mode switching; and
triggering a switching end callback function when the shooting mode switching is ended, and determining the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching.
4. The method of claim 1, wherein generating a first video file based on the tag information and the target video comprises:
and calling a newly added tag setting interface, writing the tag information into a video information description area of the target video, and calling a stopping interface to finish the generation of the first video file.
5. The method of claim 1, wherein editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the tag information in the first video file, to obtain a second video file comprises:
Extracting the tag information in the first video file;
determining a starting time stamp and an ending time stamp of the shooting mode switching in the first video file according to the tag information;
editing a switching process of switching the first shooting mode to the second shooting mode in the first video file based on a time period from the start time stamp to the end time stamp, and obtaining the second video file.
6. The method of claim 5, wherein editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the period from the start time stamp to the end time stamp, comprises:
acquiring a switching image frame;
inserting the switching image frame in the time period from the starting time stamp to the ending time stamp in the target video to obtain a processed video, and editing the processed video to obtain the second video file; or inserting the switching image frame in the time period from the start time stamp to the end time stamp in the target video in the process of editing the target video, so as to obtain the second video file.
7. The method of claim 6, wherein the acquiring a switch image frame comprises:
intercepting a target image frame from a video obtained by video shooting in the first shooting mode; based on the change parameters of the first shooting mode to the second shooting mode, corresponding image parameter adjustment is carried out on the target image frame, and the switched image frame is obtained; or alternatively
And intercepting the target image frame from a video obtained by video shooting in the first shooting mode, wherein the switching image frame comprises the target image frame.
8. The method of claim 7, wherein the performing corresponding image parameter adjustment on the target image frame based on the change parameter of the first shooting mode to the second shooting mode to obtain the switched image frame includes:
acquiring a speed difference value between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode under the condition that the first shooting mode is switched to the second shooting mode to be switched between different shooting speeds, and performing image parameter adjustment corresponding to the speed difference value on the target image frame to obtain the switched image frame; or,
And under the condition that the first shooting mode is switched to the second shooting mode to switch between different lens focal lengths, acquiring a focal length difference value between a first shooting focal length of the first shooting mode and a second shooting focal length of the second shooting mode, and performing image parameter adjustment corresponding to the focal length difference value on the target image frame to obtain the switched image frame.
9. The method of claim 5, wherein editing the switching process of switching the first shooting mode to the second shooting mode in the first video file based on the period from the start time stamp to the end time stamp, comprises:
acquiring a predetermined number of video image frames preceding the start time stamp;
determining a third time period based on a first time period from the start time stamp to the end time stamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is a sum of the first time period and the second time period;
extending the second time period of the preset number of video image frames to the third time period in the target video to obtain a processed video, and editing the processed video to obtain the second video file; or in the process of editing the target video, extending the second time period where the preset number of video image frames are located to the third time period in the target video to obtain the second video file.
10. The method according to claim 6 or 9, wherein editing the processed video to obtain the second video file comprises:
acquiring a preset video editing template;
and editing the processed video by adopting the preset video editing template to obtain the second video file.
11. The method according to any one of claims 1 to 9, wherein the shooting mode switching comprises at least one of: switching between different lens modes, switching between fields in the same lens mode, switching between different shooting speeds and switching between different lens focal lengths.
12. A video processing apparatus, comprising:
the receiving module is used for acquiring shooting mode switching operation in the process of shooting video by adopting the first shooting mode;
the processing module is used for responding to the shooting mode switching operation, switching the first shooting mode into a second shooting mode and recording tag information of shooting mode switching, wherein the tag information of shooting mode switching is used for marking that the first shooting mode is switched into the second shooting mode in the video shooting process;
The acquisition module is used for acquiring a target video obtained by video shooting in the first shooting mode and the second shooting mode;
the generation module is used for generating a first video file based on the tag information and the target video;
the editing module is used for editing a switching process of switching the first shooting mode into the second shooting mode in the first video file based on the tag information in the first video file to obtain a second video file; the tag information in the first video file comprises a start time stamp and an end time stamp of the shooting mode switching in the first video file;
the editing module is further configured to insert a switching image frame in a switching process of switching the first shooting mode to the second shooting mode in the first video file based on the tag information in the first video file, so as to obtain the second video file; the switching image frame is obtained by intercepting the video obtained by adopting the first shooting mode to shoot the video, or the switching image frame is obtained by adjusting the image parameters of the image frame obtained by intercepting the video obtained by adopting the first shooting mode to shoot the video.
13. The apparatus of claim 12, wherein the processing module comprises:
a recording unit, configured to record a switching identifier of the shooting mode switching, a start time stamp of the shooting mode switching, and an end time stamp of the shooting mode switching, where the tag information includes: the switch identification, the start timestamp and the end timestamp.
14. The apparatus according to claim 13, wherein the recording unit includes:
a recording subunit, configured to determine a switching identifier of the shooting mode switching based on the first shooting mode before the shooting mode switching and the second shooting mode after the shooting mode switching; triggering a switching start callback function when the shooting mode is switched, and determining a time stamp recorded by the switching start callback function as a starting time stamp of the shooting mode switching; and triggering a switching end callback function when the shooting mode switching is ended, and determining the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching.
15. The apparatus of claim 12, wherein the generating module comprises:
And the writing unit is used for calling a newly added tag setting interface, writing the tag information into a video information description area of the target video, and calling a stopping interface to finish the generation of the first video file.
16. The apparatus of claim 12, wherein the editing module comprises:
an extracting unit, configured to extract the tag information in the first video file;
a determining unit configured to determine a start time stamp and an end time stamp of the shooting mode switching in the first video file according to the tag information;
and the editing unit is used for editing a switching process of switching the first shooting mode to the second shooting mode in the first video file based on a time period from the starting time stamp to the ending time stamp, so as to obtain the second video file.
17. The apparatus according to claim 16, wherein the editing unit includes:
a first acquisition subunit configured to acquire a switching image frame;
an inserting subunit, configured to insert the switching image frame in a time period from the start time stamp to the end time stamp in the target video, obtain a processed video, and edit the processed video to obtain the second video file; or inserting the switching image frame in the time period from the start time stamp to the end time stamp in the target video in the process of editing the target video, so as to obtain the second video file.
18. The apparatus of claim 17, wherein the first acquisition subunit comprises:
a first acquisition subunit for capturing a target image frame from a video obtained by video shooting in the first shooting mode; based on the change parameters of the first shooting mode to the second shooting mode, corresponding image parameter adjustment is carried out on the target image frame, and the switched image frame is obtained; or alternatively
A first acquisition sub-unit configured to intercept the target image frame from a video obtained by video capturing in the first capturing mode, wherein the switching image frame includes the target image frame.
19. The apparatus of claim 18, wherein the first acquisition subunit is configured to:
acquiring a speed difference value between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode under the condition that the first shooting mode is switched to the second shooting mode to be switched between different shooting speeds, and performing image parameter adjustment corresponding to the speed difference value on the target image frame to obtain the switched image frame; or,
And under the condition that the first shooting mode is switched to the second shooting mode to switch between different lens focal lengths, acquiring a focal length difference value between a first shooting focal length of the first shooting mode and a second shooting focal length of the second shooting mode, and performing image parameter adjustment corresponding to the focal length difference value on the target image frame to obtain the switched image frame.
20. The apparatus according to claim 16, wherein the editing unit includes:
a second acquisition subunit for acquiring a predetermined number of video image frames preceding the start time stamp;
a determining subunit configured to determine a third time period based on a first time period from the start time stamp to the end time stamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is a sum of the first time period and the second time period;
the processing subunit is used for extending the second time period where the preset number of video image frames are located to the third time period in the target video to obtain a processed video, and editing the processed video to obtain the second video file; or in the process of editing the target video, extending the second time period where the preset number of video image frames are located to the third time period in the target video to obtain the second video file.
21. The apparatus according to claim 16 or 20, wherein the editing unit comprises:
a third obtaining subunit, configured to obtain a predetermined video editing template;
and the editing subunit is used for editing the processed video by adopting the preset video editing template to obtain the second video file.
22. The apparatus according to any one of claims 12 to 20, wherein the shooting mode switching comprises at least one of: switching between different lens modes, switching between fields in the same lens mode, switching between different shooting speeds and switching between different lens focal lengths.
23. An electronic device comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the electronic device to perform the method of any one of claims 1 to 11.
24. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program, when run, controls a device in which the computer readable storage medium is located to perform the method of any one of claims 1 to 11.
CN202111438998.XA 2021-11-26 2021-11-26 Video processing method, apparatus, electronic device, and computer-readable storage medium Active CN115002335B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111438998.XA CN115002335B (en) 2021-11-26 2021-11-26 Video processing method, apparatus, electronic device, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111438998.XA CN115002335B (en) 2021-11-26 2021-11-26 Video processing method, apparatus, electronic device, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN115002335A CN115002335A (en) 2022-09-02
CN115002335B true CN115002335B (en) 2024-04-09

Family

ID=83018157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111438998.XA Active CN115002335B (en) 2021-11-26 2021-11-26 Video processing method, apparatus, electronic device, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN115002335B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106488324A (en) * 2016-10-10 2017-03-08 广东小天才科技有限公司 A kind of video clipping method and system
CN107820006A (en) * 2017-11-07 2018-03-20 北京小米移动软件有限公司 Control the method and device of camera shooting
CN111147779A (en) * 2019-12-31 2020-05-12 维沃移动通信有限公司 Video production method, electronic device, and medium
CN111866404A (en) * 2019-04-25 2020-10-30 华为技术有限公司 Video editing method and electronic equipment
CN111885305A (en) * 2020-07-28 2020-11-03 Oppo广东移动通信有限公司 Preview picture processing method and device, storage medium and electronic equipment
CN112511750A (en) * 2020-11-30 2021-03-16 维沃移动通信有限公司 Video shooting method, device, equipment and medium
CN113115106A (en) * 2021-03-31 2021-07-13 影石创新科技股份有限公司 Automatic clipping method, device, terminal and storage medium of panoramic video
CN113473005A (en) * 2021-06-16 2021-10-01 荣耀终端有限公司 Shooting transition live effect insertion method, device, storage medium and program product
CN114830628A (en) * 2019-11-25 2022-07-29 富士胶片株式会社 Image making method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9554093B2 (en) * 2006-02-27 2017-01-24 Microsoft Technology Licensing, Llc Automatically inserting advertisements into source video content playback streams
CN105493496B (en) * 2014-12-14 2019-01-18 深圳市大疆创新科技有限公司 A kind of method for processing video frequency, device and picture system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106488324A (en) * 2016-10-10 2017-03-08 广东小天才科技有限公司 A kind of video clipping method and system
CN107820006A (en) * 2017-11-07 2018-03-20 北京小米移动软件有限公司 Control the method and device of camera shooting
CN111866404A (en) * 2019-04-25 2020-10-30 华为技术有限公司 Video editing method and electronic equipment
CN114830628A (en) * 2019-11-25 2022-07-29 富士胶片株式会社 Image making method
CN111147779A (en) * 2019-12-31 2020-05-12 维沃移动通信有限公司 Video production method, electronic device, and medium
CN111885305A (en) * 2020-07-28 2020-11-03 Oppo广东移动通信有限公司 Preview picture processing method and device, storage medium and electronic equipment
CN112511750A (en) * 2020-11-30 2021-03-16 维沃移动通信有限公司 Video shooting method, device, equipment and medium
CN113115106A (en) * 2021-03-31 2021-07-13 影石创新科技股份有限公司 Automatic clipping method, device, terminal and storage medium of panoramic video
CN113473005A (en) * 2021-06-16 2021-10-01 荣耀终端有限公司 Shooting transition live effect insertion method, device, storage medium and program product

Also Published As

Publication number Publication date
CN115002335A (en) 2022-09-02

Similar Documents

Publication Publication Date Title
US11049522B2 (en) Digital media editing
CN112291627B (en) Video editing method and device, mobile terminal and storage medium
US10021302B2 (en) Video recording method and device
US11727958B2 (en) Real time video special effects system and method
KR101392676B1 (en) Method for handling multiple video streams
KR101604250B1 (en) Method of Providing Service for Recommending Game Video
US11438510B2 (en) System and method for editing video contents automatically technical field
CN107995482B (en) Video file processing method and device
CN113923391B (en) Method, apparatus and storage medium for video processing
CN113747240B (en) Video processing method, apparatus and storage medium
EP3684048B1 (en) A method for presentation of images
KR20140146592A (en) Color grading preview method and apparatus
CN115002335B (en) Video processing method, apparatus, electronic device, and computer-readable storage medium
WO2018196530A1 (en) Video information processing method, terminal, and computer storage medium
CN113157178B (en) Information processing method and device
CN104853245A (en) Movie preview method and device thereof
CN117768766A (en) Shooting method, video processing method and shooting device
KR20170028593A (en) Method and program for making moving image
CN117676047A (en) Special effect processing method and device, electronic equipment and storage medium

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