[go: up one dir, main page]

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, device, 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, device, electronic device and computer-readable storage medium.

背景技术Background technique

在相关技术中,为获得一段质量较好的视频,首先需要用户采用电子设备的相机功能进行视频拍摄,得到拍摄视频;之后,需要用户采用电子设备的视频编辑功能对在拍摄视频进行人为编辑,得到编辑后的视频。因此,用户获得最终需要的视频的操作过程比较烦杂,导致用户体验较差。In the related art, in order to obtain a video with good quality, the user first needs to use the camera function of the electronic device to shoot a video to obtain the shot video; then, the user needs to use the video editing function of the electronic device to manually edit the shot video to obtain the edited video. Therefore, the operation process for the user to obtain the final desired video is relatively complicated, resulting in a poor user experience.

发明内容Summary of the invention

有鉴于此,本申请实施例提供一种视频处理方法、装置、电子设备和计算机可读存储介质,以有利于解决用户为获得最终处理后的视频,操作过程比较烦杂,导致用户体验较差的问题。In view of this, the embodiments of the present application provide a video processing method, device, electronic device and computer-readable storage medium, which are conducive to solving the problem that the operation process for users to obtain the final processed video is complicated, resulting in a poor user experience.

第一方面,本申请实施例提供了一种视频处理方法,包括:In a first aspect, an embodiment of the present application provides a video processing method, including:

在采用第一拍摄模式进行视频拍摄的过程中,获取拍摄模式切换操作;In the process of shooting a video in the first shooting mode, obtaining a shooting mode switching operation;

响应于所述拍摄模式切换操作,将所述第一拍摄模式切换为第二拍摄模式,并记录拍摄模式切换的标签信息,其中,所述拍摄模式切换的标签信息用于标记在所述视频拍摄过程中将所述第一拍摄模式切换为所述第二拍摄模式;In response to the shooting mode switching operation, the first shooting mode is switched to a second shooting mode, and tag information of the shooting mode switching is recorded, wherein the tag information of the shooting mode switching is used to mark that the first shooting mode is switched to the second shooting mode during the video shooting process;

获取采用所述第一拍摄模式和所述第二拍摄模式进行视频拍摄所得到的目标视频;Acquire a target video obtained by shooting a video using the first shooting mode and the second shooting mode;

基于所述标签信息和所述目标视频,生成第一视频文件;Based on the tag information and the target video, generate a first video file;

基于所述第一视频文件中的所述标签信息,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到第二视频文件。Based on the tag information in the first video file, the switching process from the first shooting mode to the second shooting mode in the first video file is edited to obtain a second video file.

可选地,所述记录所述拍摄模式切换的标签信息包括:Optionally, the tag information recording the switching of the shooting mode includes:

记录所述拍摄模式切换的切换标识,所述拍摄模式切换的开始时间戳,以及所述拍摄模式切换的结束时间戳,其中,所述标签信息包括:所述切换标识、所述开始时间戳和所述结束时间戳。Recording the switching identifier of the shooting mode switching, the start timestamp of the shooting mode switching, and the end timestamp of the shooting mode switching, wherein the tag information includes: the switching identifier, the start timestamp, and the end timestamp.

可选地,所述记录所述拍摄模式切换的切换标识,所述拍摄模式切换的开始时间戳,以及所述拍摄模式切换的结束时间戳包括:Optionally, the recording of the switching identifier of the shooting mode switching, the start timestamp of the shooting mode switching, and the end timestamp of the shooting mode switching includes:

基于拍摄模式切换前的所述第一拍摄模式和拍摄模式切换后的所述第二拍摄模式,确定所述拍摄模式切换的切换标识;determining 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 switch start callback function when the shooting mode switch starts, and determining the timestamp recorded by the switch start callback function as the start timestamp of the shooting mode switch; and

在所述拍摄模式切换结束时触发切换结束回调函数,将所述切换结束回调函数所记录的时间戳确定为所述拍摄模式切换的结束时间戳。When the shooting mode switching ends, a switching end callback function is triggered, and a timestamp recorded by the switching end callback function is determined as an end timestamp of the shooting mode switching.

可选地,所述基于所述标签信息和所述目标视频,生成第一视频文件包括:Optionally, generating a first video file based on the tag information and the target video includes:

调用新增的标签设置接口,将所述标签信息写入所述目标视频的视频信息描述区中,调用停止接口完成所述第一视频文件的生成。The newly added tag setting interface is called to write the tag information into the video information description area of the target video, and the stop interface is called to complete the generation of the first video file.

可选地,所述基于所述第一视频文件中的所述标签信息,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到第二视频文件包括:Optionally, the editing, based on the tag information in the first video file, a switching process from the first shooting mode to the second shooting mode in the first video file to obtain the second video file includes:

提取所述第一视频文件中的所述标签信息;Extracting the tag information in the first video file;

根据所述标签信息,确定所述第一视频文件中所述拍摄模式切换的开始时间戳和结束时间戳;Determine, according to the tag information, a start timestamp and an end timestamp of the shooting mode switching in the first video file;

基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件。Based on the time period from the start timestamp to the end timestamp, the switching process from the first shooting mode to the second shooting mode in the first video file is edited to obtain the second video file.

可选地,所述基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件包括:Optionally, the editing, based on the time period from the start timestamp to the end timestamp, of the switching process from the first shooting mode to the second shooting mode in the first video file to obtain the second video file includes:

获取切换图像帧;Get the switching image frame;

在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到所述第二视频文件。Insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain a processed video, and edit the processed video to obtain the second video file; or, in the process of editing the target video, insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain the second video file.

可选地,所述获取切换图像帧包括:Optionally, acquiring the switching image frame includes:

从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取目标图像帧;基于所述第一拍摄模式切换到所述第二拍摄模式的变化参数,对所述目标图像帧进行对应的图像参数调整,得到所述切换图像帧;或者Intercepting a target image frame from a video obtained by shooting the video in the first shooting mode; adjusting the corresponding image parameters of the target image frame based on the change parameters of switching from the first shooting mode to the second shooting mode to obtain the switched image frame; or

从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取所述目标图像帧,其中,所述切换图像帧包括所述目标图像帧。The target image frame is captured from a video obtained by shooting a video in the first shooting mode, wherein the switching image frame includes the target image frame.

可选地,所述基于所述第一拍摄模式切换到所述第二拍摄模式的变化参数,对所述目标图像帧进行对应的图像参数调整,得到所述切换图像帧,包括:Optionally, the adjusting corresponding image parameters of the target image frame based on the change parameters of switching from the first shooting mode to the second shooting mode to obtain the switched image frame includes:

在所述第一拍摄模式切换到所述第二拍摄模式为不同拍摄速度间的切换的情况下,获取所述第一拍摄模式的第一拍摄速度和所述第二拍摄模式的第二拍摄速度之间的速度差值,对所述目标图像帧进行与所述速度差值对应的图像参数调整,得到所述切换图像帧;或者,In the case where the switching from the first shooting mode to the second shooting mode is a switching between different shooting speeds, obtaining a speed difference between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode, and adjusting image parameters of the target image frame corresponding to the speed difference to obtain the switching image frame; or

在所述第一拍摄模式切换到所述第二拍摄模式为不同镜头焦距间的切换的情况下,获取所述第一拍摄模式的第一拍摄焦距和所述第二拍摄模式的第二拍摄焦距之间的焦距差值,对所述目标图像帧进行与所述焦距差值对应的图像参数调整,得到所述切换图像帧。When the switching from the first shooting mode to the second shooting mode is a switch between different lens focal lengths, the focal length difference 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 the image parameters of the target image frame corresponding to the focal length difference are adjusted to obtain the switched image frame.

可选地,所述基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件包括:Optionally, the editing, based on the time period from the start timestamp to the end timestamp, of the switching process from the first shooting mode to the second shooting mode in the first video file to obtain the second video file includes:

获取在所述开始时间戳前的预定数量的视频图像帧;Acquire a predetermined number of video image frames before the start timestamp;

基于从所述开始时间戳至所述结束时间戳的第一时间段,以及所述预定数量的视频图像帧所在的第二时间段,确定第三时间段,其中,所述第三时间段为所述第一时间段和所述第二时间段之和;Determine a third time period based on a first time period from the start timestamp to the end timestamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is the sum of the first time period and the second time period;

在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到所述第二视频文件。In the target video, the second time period where the predetermined number of video image frames are located is extended to the third time period to obtain a processed video, and the processed video is edited to obtain the second video file; or, in the process of editing the target video, the second time period where the predetermined number of video image frames are located is extended 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:

获取预定视频编辑模板;Get pre-defined video editing templates;

采用所述预定视频编辑模板对所述处理后的视频进行编辑,得到所述第二视频文件。The processed video is edited using the predetermined video editing template to obtain the second video file.

可选地,所述拍摄模式切换包括以下至少之一:不同镜头模式间的切换,相同镜头模式内转场间的切换,不同拍摄速度间的切换,不同镜头焦距间的切换。Optionally, the shooting mode switching includes at least one of the following: switching between different lens modes, switching between transitions within 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 device, including:

接收模块,用于在采用第一拍摄模式进行视频拍摄的过程中,获取拍摄模式切换操作;A receiving module, used for obtaining a shooting mode switching operation during video shooting in a first shooting mode;

处理模块,用于响应于所述拍摄模式切换操作,将所述第一拍摄模式切换为第二拍摄模式,并记录拍摄模式切换的标签信息,其中,所述拍摄模式切换的标签信息用于标记在所述视频拍摄过程中将所述第一拍摄模式切换为所述第二拍摄模式;a processing module, configured to switch the first shooting mode to a second shooting mode in response to the shooting mode switching operation, and record tag information of the shooting mode switching, wherein the tag information of the shooting mode switching is used to mark that the first shooting mode is switched to the second shooting mode during the video shooting process;

获取模块,用于获取采用所述第一拍摄模式和所述第二拍摄模式进行视频拍摄所得到的目标视频;An acquisition module, used for acquiring a target video obtained by shooting a video in the first shooting mode and the second shooting mode;

生成模块,用于基于所述标签信息和所述目标视频,生成第一视频文件;A generating module, configured to generate a first video file based on the tag information and the target video;

编辑模块,用于基于所述第一视频文件中的所述标签信息,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到第二视频文件。An editing module is used to edit the switching process from 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 processing module includes:

记录单元,用于记录所述拍摄模式切换的切换标识,所述拍摄模式切换的开始时间戳,以及所述拍摄模式切换的结束时间戳,其中,所述标签信息包括:所述切换标识、所述开始时间戳和所述结束时间戳。A recording unit is used to record a switching identifier of the shooting mode switching, a start timestamp of the shooting mode switching, and an end timestamp of the shooting mode switching, wherein the tag information includes: the switching identifier, the start timestamp, and the end timestamp.

可选地,所述记录单元包括:Optionally, the recording unit includes:

记录子单元,用于基于拍摄模式切换前的所述第一拍摄模式和拍摄模式切换后的所述第二拍摄模式,确定所述拍摄模式切换的切换标识;在所述拍摄模式切换开始时触发切换开始回调函数,将所述切换开始回调函数所记录的时间戳确定为所述拍摄模式切换的开始时间戳;以及在所述拍摄模式切换结束时触发切换结束回调函数,将所述切换结束回调函数所记录的时间戳确定为所述拍摄模式切换的结束时间戳。A recording subunit is used to determine the 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; trigger a switching start callback function when the shooting mode switching starts, and determine the timestamp recorded by the switching start callback function as the starting timestamp of the shooting mode switching; and trigger a switching end callback function when the shooting mode switching ends, and determine the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching.

可选地,所述生成模块包括:Optionally, the generating module includes:

写入单元,用于调用新增的标签设置接口,将所述标签信息写入所述目标视频的视频信息描述区中,调用停止接口完成所述第一视频文件的生成。The writing unit is used to call the newly added tag setting interface to write the tag information into the video information description area of the target video, and call the stop interface to complete the generation of the first video file.

可选地,所述编辑模块包括:Optionally, the editing module includes:

提取单元,用于提取所述第一视频文件中的所述标签信息;An extraction unit, used for extracting the tag information in the first video file;

确定单元,用于根据所述标签信息,确定所述第一视频文件中的所述拍摄模式切换的开始时间戳和结束时间戳;a determining unit, configured to determine a start timestamp and an end timestamp of the shooting mode switching in the first video file according to the tag information;

编辑单元,用于基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件。An editing unit is used to edit the switching process of switching from the first shooting mode to the second shooting mode in the first video file based on a time period from the start timestamp to the end timestamp to obtain the second video file.

可选地,所述编辑单元包括:Optionally, the editing unit includes:

第一获取子单元,用于获取切换图像帧;A first acquisition subunit, used for acquiring a switching image frame;

插入子单元,用于在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到所述第二视频文件。An inserting subunit is used to insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain a processed video, and edit the processed video to obtain the second video file; or, in the process of editing the target video, insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain the second video file.

可选地,所述第一获取子单元包括:Optionally, the first acquiring subunit includes:

第一获取次子单元,用于从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取目标图像帧;基于所述第一拍摄模式切换到所述第二拍摄模式的变化参数,对所述目标图像帧进行对应的图像参数调整,得到所述切换图像帧;或者A first acquisition sub-subunit is configured to capture a target image frame from a video obtained by shooting the video in the first shooting mode; based on a change parameter when the first shooting mode is switched to the second shooting mode, adjust the corresponding image parameters of the target image frame to obtain the switched image frame; or

第一获取次子单元,用于从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取所述目标图像帧,其中,所述切换图像帧包括所述目标图像帧。The first acquisition sub-subunit is used to capture the target image frame from the video obtained by video shooting in the first shooting mode, wherein the switching image frame includes the target image frame.

可选地,所述第一获取次子单元,用于:Optionally, the first acquisition sub-subunit is used to:

在所述第一拍摄模式切换到所述第二拍摄模式为不同拍摄速度间的切换的情况下,获取所述第一拍摄模式的第一拍摄速度和所述第二拍摄模式的第二拍摄速度之间的速度差值,对所述目标图像帧进行与所述速度差值对应的图像参数调整,得到所述切换图像帧;或者,In the case where the switching from the first shooting mode to the second shooting mode is a switching between different shooting speeds, obtaining a speed difference between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode, and adjusting image parameters of the target image frame corresponding to the speed difference to obtain the switching image frame; or

在所述第一拍摄模式切换到所述第二拍摄模式为不同镜头焦距间的切换的情况下,获取所述第一拍摄模式的第一拍摄焦距和所述第二拍摄模式的第二拍摄焦距之间的焦距差值,对所述目标图像帧进行与所述焦距差值对应的图像参数调整,得到所述切换图像帧。When the switching from the first shooting mode to the second shooting mode is a switch between different lens focal lengths, the focal length difference 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 the image parameters of the target image frame corresponding to the focal length difference are adjusted to obtain the switched image frame.

可选地,所述编辑单元包括:Optionally, the editing unit includes:

第二获取子单元,用于获取在所述开始时间戳前的预定数量的视频图像帧;A second acquisition subunit, configured to acquire a predetermined number of video image frames before the start timestamp;

确定子单元,用于基于从所述开始时间戳至所述结束时间戳的第一时间段,以及所述预定数量的视频图像帧所在的第二时间段,确定第三时间段,其中,所述第三时间段为所述第一时间段和所述第二时间段之和;a determination subunit, configured to determine a third time period based on a first time period from the start timestamp to the end timestamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is the sum of the first time period and the second time period;

处理子单元,用于在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到所述第二视频文件。A processing subunit is used to extend the second time period in the target video where the predetermined number of video image frames are located to the third time period to obtain a processed video, and edit the processed video to obtain the second video file; or, during the process of editing the target video, extend the second time period in the target video where the predetermined number of video image frames are located to the third time period to obtain the second video file.

可选地,所述编辑单元包括:Optionally, the editing unit includes:

第三获取子单元,用于获取预定视频编辑模板;A third acquisition subunit is used to acquire a predetermined video editing template;

编辑子单元,用于采用所述预定视频编辑模板对所述处理后的视频进行编辑,得到所述第二视频文件。The editing subunit is used to edit the processed video using the predetermined video editing template to obtain the second video file.

可选地,所述拍摄模式切换包括以下至少之一:不同镜头模式间的切换,相同镜头模式内转场间的切换,不同拍摄速度间的切换,不同镜头焦距间的切换。Optionally, the shooting mode switching includes at least one of the following: switching between different lens modes, switching between transitions within the same lens mode, switching between different shooting speeds, and switching between different lens focal lengths.

第三方面,本申请实施例提供了一种电子设备,包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被所述处理器执行时,触发所述电子设备执行第一方面任一项所述的方法。In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute any one of the methods described in the first aspect.

第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质包括存储的程序,其中,在所述程序运行时控制所述计算机可读存储介质所在设备执行上述第一方面中任意一项所述的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described in the first aspect above.

第五方面,本申请实施例提供了一种计算机程序产品,所述计算机程序产品包含可执行指令,当所述可执行指令在计算机上执行时,使得计算机执行上述第一方面中任意一项所述的方法。In a fifth aspect, an embodiment of the present application provides a computer program product, which includes executable instructions. When the executable instructions are executed on a computer, the computer executes any one of the methods described in the first aspect above.

采用本申请实施例提供的技术方案,在拍摄获得目标视频时,将在拍摄视频过程中获取的拍摄模式切换的标签信息结合获得的该目标视频,生成第一视频文件,这样就可以基于第一视频文件中的标签信息,自动完成对视频的编辑得到第二视频文件。用户仅需要执行拍摄过程,在拍摄完成后即可获得对拍摄模式切换进行处理后的质量较好的第二视频文件,并不需要人为地对视频中的拍摄模式切换进行编辑处理,而在拍摄过程中自动生成质量较好的第二视频文件。因此,通过将在拍摄视频过程中获取的拍摄模式切换的标签信息结合获得的该目标视频,生成第一视频文件,有效地提升了用户获取到质量较好的视频的效率,满足用户一键成片的体验。By adopting the technical solution provided in the embodiment of the present application, when shooting and obtaining a target video, the tag information of the shooting mode switch obtained during the video shooting process is combined with the obtained target video to generate a first video file, so that the video can be automatically edited based on the tag information in the first video file to obtain a second video file. The user only needs to execute the shooting process, and after the shooting is completed, a second video file with good quality after processing the shooting mode switch is obtained. There is no need to manually edit the shooting mode switch in the video, and a second video file with good quality is automatically generated during the shooting process. Therefore, by combining the tag information of the shooting mode switch obtained during the video shooting process with the obtained target video to generate a first video file, the efficiency of the user in obtaining a video with good quality is effectively improved, and the user's one-click filming experience is satisfied.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

图1为本申请实施例提供的一种电子设备示意图;FIG1 is a schematic diagram of an electronic device provided in an embodiment of the present application;

图2A为本申请实施例提供的一种前后双摄模式拍摄场景示意图;FIG2A is a schematic diagram of a front and rear dual-camera mode shooting scene provided in an embodiment of the present application;

图2B为本申请实施例提供的一种前后画中画模式拍摄场景示意图;FIG2B is a schematic diagram of a front and back picture-in-picture mode shooting scene provided by an embodiment of the present application;

图2C为本申请实施例提供的一种后置画中画模式拍摄场景示意图;FIG2C is a schematic diagram of a rear-mounted picture-in-picture mode shooting scene provided in an embodiment of the present application;

图3为本申请实施例提供的一种视频方法的处理过程的示意图;FIG3 is a schematic diagram of a processing process of a video method provided in an embodiment of the present application;

图4为本申请实施例提供的一种拍摄模式切换场景示意图;FIG4 is a schematic diagram of a shooting mode switching scenario provided in an embodiment of the present application;

图5为本申请实施例提供的一种视频处理方法的流程图;FIG5 is a flow chart of a video processing method provided in an embodiment of the present application;

图6为本申请实施例提供的在视频拍摄过程中记录的拍摄模式切换的标签信息的示意图;FIG6 is a schematic diagram of tag information of shooting mode switching recorded during video shooting according to an embodiment of the present application;

图7为本申请实施例提供的一种拍摄模式切换的标签信息生成方法的流程图;FIG7 is a flow chart of a method for generating tag information for switching shooting modes provided in an embodiment of the present application;

图8为本申请实施例提供的基于标签信息和目标视频生成第一视频文件的流程图;8 is a flow chart of generating a first video file based on tag information and a target video according to an embodiment of the present application;

图9为本申请实施例提供的一种视频处理方法中视频编辑方法的流程图;FIG9 is a flow chart of a video editing method in a video processing method provided in an embodiment of the present application;

图10为本申请实施例提供的一种对第一视频文件中的目标视频进行编辑的流程示意图;FIG10 is a schematic diagram of a flow chart of editing a target video in a first video file provided by an embodiment of the present application;

图11为本申请实施例提供的一种基于标签信息对目标视频中的拍摄模式切换进行编辑的示意图;FIG11 is a schematic diagram of editing a shooting mode switch in a target video based on tag information provided by an embodiment of the present application;

图12为本申请实施例提供的一种基于标签信息对目标视频中的拍摄模式切换进行编辑的示意图;FIG12 is a schematic diagram of editing a shooting mode switch in a target video based on tag information provided by an embodiment of the present application;

图13为本申请实施例提供的一种视频处理方法的示意图;FIG13 is a schematic diagram of a video processing method provided in an embodiment of the present application;

图14为本申请实施例提供的一种电子设备的软件结构框图;FIG14 is a software structure block diagram of an electronic device provided in an embodiment of the present application;

图15为本申请实施例提供的一种视频处理装置的结构框图。FIG15 is a structural block diagram of a video processing device provided in an embodiment of the present application.

具体实施方式Detailed ways

为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.

应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

在本申请实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,甲和/或乙,可以表示:单独存在甲,同时存在甲和乙,单独存在乙这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。It should be understood that the term "and/or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and/or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character "/" in this article generally indicates that the associated objects before and after are in an "or" relationship.

图1为本申请实施例提供的一种电子设备示意图,如图1所示,在图1中以手机100为例对电子设备进行示例性说明,图1中示出了手机100的前视图和后视图,在手机100的前侧配置有两个前置摄像头111、112,在手机100的后侧面配置有四个后置摄像头121、122、123、124。通过配置的多个摄像头,可以为用户提供多种拍摄模式,例如,前摄模式、后摄模式、前后双摄模式等。用户可以根据拍摄场景,选择相应的拍摄模式进行拍摄,以提高用户体验。FIG1 is a schematic diagram of an electronic device provided by an embodiment of the present application. As shown in FIG1 , a mobile phone 100 is used as an example to exemplarily illustrate the electronic device in FIG1 . FIG1 shows a front view and a rear view of the mobile phone 100. Two front cameras 111 and 112 are configured on the front side of the mobile phone 100, and four rear cameras 121, 122, 123, and 124 are configured on the rear side of the mobile phone 100. Through the multiple cameras configured, a variety of shooting modes can be provided for the user, for example, a front shooting mode, a rear shooting mode, a front and rear dual shooting mode, etc. The user can select a corresponding shooting mode to shoot according to the shooting scene to improve the user experience.

可理解,图1所示仅为一种示例性说明,并不应当将其作为本申请保护范围的限制。例如,不同的手机,其摄像头的配置数量和配置位置可能不同。另外,本申请实施例涉及的电子设备除了手机以外,还可以为平板电脑、个人计算机(personal computer,PC)、个人数字助理(personal digital assistant,PDA)、智能手表、上网本、可穿戴电子设备、增强现实技术(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、车载设备、智能汽车、智能音响、机器人、智能眼镜、智能电视等。It is understandable that what is shown in FIG. 1 is only an exemplary illustration and should not be used as a limitation on the scope of protection of this application. For example, different mobile phones may have different numbers and locations of cameras. In addition, in addition to mobile phones, the electronic devices involved in the embodiments of the present application may also be tablet computers, personal computers (PCs), personal digital assistants (PDAs), smart watches, netbooks, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, vehicle-mounted devices, smart cars, smart speakers, robots, smart glasses, smart TVs, etc.

需要指出的是,在一些可能的实现方式中,电子设备也可能称为终端设备、用户设备(User Equipment,UE)等,本申请实施例对此不作限制。It should be noted that in some possible implementations, the electronic device may also be called a terminal device, a user equipment (UE), etc., which is not limited in the embodiments of the present application.

在一些可能的实现方式中,电子设备涉及的拍摄模式可能包括单摄模式和多摄模式。其中,单摄模式可能包括前置单摄模式、后置单摄模式等;多摄模式可能包括前置双摄模式、后置双摄模式、前后双摄模式、前置画中画模式、后置画中画模式、前后画中画模式等。In some possible implementations, the shooting modes involved in the electronic device may include a single-camera mode and a multi-camera mode. The single-camera mode may include a front single-camera mode and a rear single-camera mode, etc. The multi-camera mode may include a front dual-camera mode, a rear dual-camera mode, a front and rear dual-camera mode, a front picture-in-picture mode, a rear picture-in-picture mode, and a front and rear picture-in-picture mode.

其中,在单摄模式下,采用一个摄像头进行视频拍摄;在多摄模式下采用两个或两个以上摄像头进行视频拍摄。In single-camera mode, one camera is used for video shooting; in multi-camera mode, two or more cameras are used for video shooting.

具体地,在前置单摄模式下,采用一个前置摄像头进行视频拍摄;在后置单摄模式下,采用一个后置摄像头进行视频拍摄;在前置双摄模式下,采用两个前置摄像头进行视频拍摄;在后置双摄模式下,采用两个后置摄像头进行视频拍摄;在前后双摄模式下,采用一个前置摄像头和一个后置摄像头进行视频拍摄;在前置画中画模式下,采用采用两个前置摄像头进行视频拍摄,且将一个前置摄像头拍摄的画面置于另一个前置摄像头拍摄的画面之中;在后置画中画模式下,采用两个后置摄像头进行视频拍摄,且将一个后置摄像头拍摄的画面置于另一个后置摄像头拍摄的画面之中;在前后画中画模式下,采用一个前置摄像头和一个后置摄像头进行视频拍摄,且将前置摄像头或后置摄像头拍摄的画面置于后置摄像头或前置摄像头拍摄的画面之中。Specifically, in the front single-camera mode, one front camera is used for video shooting; in the rear single-camera mode, one rear camera is used for video shooting; in the front dual-camera mode, two front cameras are used for video shooting; in the rear dual-camera mode, two rear cameras are used for video shooting; in the front and rear dual-camera mode, one front camera and one rear camera are used for video shooting; in the front picture-in-picture mode, two front cameras are used for video shooting, and the picture shot by one front camera is placed in the picture shot by the other front camera; in the rear picture-in-picture mode, two rear cameras are used for video shooting, and the picture shot by one rear camera is placed in the picture shot by the other rear camera; in the front and rear picture-in-picture modes, one front camera and one rear camera are used for video shooting, and the picture shot by the front camera or the rear camera is placed in the picture shot by the rear camera or the front camera.

图2A为本申请实施例提供的一种前后双摄模式拍摄场景示意图,如图2A所示,在前后双摄模式下,采用一个前置摄像头采集前景画面,采用一个后置摄像头采集后景画面,前景画面和后景画面在显示界面内同时显示。Figure 2A is a schematic diagram of a front and rear dual camera mode shooting scene provided in an embodiment of the present application. As shown in Figure 2A, in the front and rear dual camera mode, a front camera is used to capture the foreground image, and a rear camera is used to capture the background image. The foreground image and the background image are displayed simultaneously in the display interface.

图2B为本申请实施例提供的一种前后画中画模式拍摄场景示意图,如图2B所示,在前后画中画模式下,采用一个前置摄像头采集前景画面,采用一个后置摄像头采集后景画面,将前景画面置于后景画面之中。Figure 2B is a schematic diagram of a front and back picture-in-picture mode shooting scene provided in an embodiment of the present application. As shown in Figure 2B, in the front and back picture-in-picture mode, a front camera is used to capture the foreground image, and a rear camera is used to capture the background image, and the foreground image is placed in the background image.

图2C为本申请实施例提供的一种后置画中画模式拍摄场景示意图,如图2C所示,在后置画中画模式下,采用一个后置摄像头采集远景画面,采用另一个后置摄像头采集近景画面,将近景画面置于远景画面之中。Figure 2C is a schematic diagram of a rear-mounted picture-in-picture mode shooting scene provided in an embodiment of the present application. As shown in Figure 2C, in the rear-mounted picture-in-picture mode, one rear camera is used to capture a distant image, and another rear camera is used to capture a close-up image, and the close-up image is placed in the distant image.

需要指出的是,上述拍摄模式仅是本申请实施例列举的一些可能的实现方式,本领域技术人员可以根据实际需要配置其它拍摄模式,本申请实施例对此不作具体限制。It should be pointed out that the above-mentioned shooting modes are only some possible implementation methods listed in the embodiments of the present application. Those skilled in the art can configure other shooting modes according to actual needs, and the embodiments of the present application do not impose specific limitations on this.

在一些可能的实现方式中,拍摄模式还可能描述为单路模式、双路模式或多路模式。可理解,单路模式采用一个摄像头进行拍摄,双路模式采用两个摄像头进行拍摄,多路模式采用两个以上摄像头进行拍摄。In some possible implementations, the shooting mode may also be described as a single-channel mode, a dual-channel mode, or a multi-channel mode. It is understood that the single-channel mode uses one camera for shooting, the dual-channel mode uses two cameras for shooting, and the multi-channel mode uses more than two cameras for shooting.

在一些可能的实现方式中,拍摄模式还可能描述为单景模式、双景模式和画中画模式。其中,单景模式可以包括前置单摄模式和后置单摄模式;双景模式可以包括前置双摄模式、后置双摄模式、前后双摄模式;画中画模式可以包括前置画中画模式、后置画中画模式、前后画中画模式。In some possible implementations, the shooting mode may also be described as a single-view mode, a dual-view mode, and a picture-in-picture mode. The single-view mode may include a front single-camera mode and a rear single-camera mode; the dual-view mode may include a front dual-camera mode, a rear dual-camera mode, and a front and rear dual-camera mode; the picture-in-picture mode may include a front picture-in-picture mode, a rear picture-in-picture mode, and a front and rear picture-in-picture mode.

在视频拍摄的过程中,用户可能需要对拍摄模式进行切换。参见表一,为本申请实施例列举的一些可能的拍摄模式切换场景。During the video shooting process, the user may need to switch the shooting mode. See Table 1 for some possible shooting mode switching scenarios listed in the embodiments of the present application.

表一:Table I:

在一些可能的实现方式中,电子设备涉及的拍摄模式可能包括不同的拍摄状态。不同的拍摄状态对应不同的拍摄模式。例如,采用不同的拍摄参数进行拍摄。该不同的拍摄参数可以是不同的拍摄速度,或者不同的拍摄焦距,或者不同的拍摄速度和不同的拍摄焦距等。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, different shooting parameters are used for shooting. The different shooting parameters may be different shooting speeds, or different shooting focal lengths, or different shooting speeds and different shooting focal lengths, etc.

比如,在单摄模式进行拍摄时,可以采用快速拍摄,慢速拍摄和正常拍摄。在多摄模式进行拍摄时,可以指定某一镜头采用快速拍摄,慢速拍摄和正常拍摄等。需要说明的是,本申请实施例中所涉及的快速拍摄也可以分成多个层级,例如,2倍速拍摄,1.5倍速拍摄,等。慢速拍摄也可以分成多个层级,比如,0.5倍数拍摄,0.25倍数拍摄,等。因此,电子设备采用不同的速度参数进行拍摄时,为采用不同的拍摄模式进行拍摄。For example, when shooting in single-shot mode, you can use fast shooting, slow shooting and normal shooting. When shooting in multi-shot mode, you can specify a certain lens to use fast shooting, slow shooting and normal shooting, etc. It should be noted that the fast shooting involved in the embodiments of the present application can also be divided into multiple levels, for example, 2x speed shooting, 1.5x speed shooting, etc. Slow shooting can also be divided into multiple levels, for example, 0.5x shooting, 0.25x shooting, etc. Therefore, when an electronic device uses different speed parameters for shooting, it uses different shooting modes for shooting.

又比如,在单摄模式进行拍摄时,可以采用远焦拍摄,近焦拍摄和正常拍摄。在多摄模式进行拍摄时,可以指定某一镜头采用远焦拍摄,近焦拍摄和正常拍摄等。因此,电子设备采用不同的焦距参数进行拍摄时,为采用不同的拍摄模式进行拍摄。For another example, when shooting in single-camera mode, you can use telephoto shooting, close-up shooting, and normal shooting. When shooting in multi-camera mode, you can specify a lens to use telephoto shooting, close-up shooting, and normal shooting. Therefore, when the electronic device uses different focal length parameters for shooting, it uses different shooting modes for shooting.

在视频拍摄的过程中,用户可能需要对上述拍摄模式进行切换。参见表二,为本申请实施例列举的一些可能的拍摄模式切换场景。During the video shooting process, the user may need to switch the above shooting modes. See Table 2 for some possible shooting mode switching scenarios listed in the embodiment of the present application.

表二:Table II:

在进行视频拍摄的过程中,在用户采用上述拍摄模式切换拍摄后,得到拍摄视频。然而,对于拍摄模式切换这一过程,由于需要电子设备的相机的反应,因此,在得到的拍摄视频中在拍摄模式切换这一区间可能出现画面模糊,导致画面的不连续。反应时间长的时候,可能还会出现暗屏的情况。因此,为获取质量较高的视频,需要后期对视频进行编辑时,人为地对该拍摄模式切换区间进行处理,而人为地对视频的拍摄模式切换敬意进行处理时,处理效率较低,影响用户快速得到视频的体验。During the video shooting process, after the user uses the above-mentioned shooting mode switching to shoot, the shot video is obtained. However, for the shooting mode switching process, since the reaction of the camera of the electronic device is required, the obtained shot video may appear blurred in the shooting mode switching interval, resulting in discontinuity of the picture. When the reaction time is long, a dark screen may also appear. Therefore, in order to obtain a higher quality video, it is necessary to manually process the shooting mode switching interval when editing the video later. When the shooting mode switching interval of the video is manually processed, the processing efficiency is low, which affects the user's experience of quickly obtaining the video.

针对该问题,本申请实施例提供了一种视频处理方法,图3为本申请实施例提供的一种视频方法的处理过程的示意图,如图3所示,本申请实施例中,在视频拍摄过程中,在接收到用户的拍摄模式切换操作时,记录该拍摄模式切换的标签信息(如图3中的切换标识,切换开始时间和切换结束时间)。在得到对整个拍摄过程的音视频流进行混合后的目标视频后,将在拍摄视频过程中获取的拍摄模式切换的标签信息结合获得的该目标视频,生成第一视频文件,用户仅需要执行拍摄过程,在拍摄完成后即可获得对拍摄模式切换进行处理后的质量较好的第二视频文件(如图中对拍摄模式切换进行了填充的第二视频文件),并不需要人为地对视频中的拍摄模式切换进行编辑处理,有效地提升了用户获取到质量较好的视频的效率,满足用户一键成片的体验。In view of this problem, an embodiment of the present application provides a video processing method. FIG3 is a schematic diagram of a processing process of a video method provided by an embodiment of the present application. As shown in FIG3, in an embodiment of the present application, during the video shooting process, when receiving the shooting mode switching operation of the user, the tag information of the shooting mode switching is recorded (such as the switching mark, the switching start time and the switching end time in FIG3). After obtaining the target video after mixing the audio and video streams of the entire shooting process, the tag information of the shooting mode switching obtained during the video shooting process is combined with the obtained target video to generate a first video file. The user only needs to execute the shooting process, and after the shooting is completed, a second video file with better quality after processing the shooting mode switching can be obtained (such as the second video file with the shooting mode switching filled in as shown in the figure). There is no need to manually edit the shooting mode switching in the video, which effectively improves the efficiency of the user in obtaining a video with better quality and satisfies the user's one-click filming experience.

图4为本申请实施例提供的一种拍摄模式切换场景示意图,如图4所示,用户在通过电子设备进行视频拍摄的过程中,显示界面内可以实时显示拍摄过程中的视频画面。另外,在显示界面内还包括拍摄模式选择窗口,用户可以在拍摄模式选择窗口内选择相应的拍摄模式进行视频拍摄。例如,前置单摄模式、后置单摄模式、前后双摄模式、前后画中画模式等。FIG4 is a schematic diagram of a shooting mode switching scenario provided by an embodiment of the present application. As shown in FIG4, when a user is shooting a video through an electronic device, the display interface can display the video screen of the shooting process in real time. In addition, the display interface also includes a shooting mode selection window, and the user can select the corresponding shooting mode in the shooting mode selection window to shoot the video. For example, the front single camera mode, the rear single camera mode, the front and rear dual camera mode, the front and rear picture-in-picture mode, etc.

在图4所示的应用场景中,用户首先选择前置单摄模式进行视频拍摄,在显示界面401内实时显示前景画面。当用户触发拍摄模式选择窗口402内的“前后双摄”控件后,电子设备接收到拍摄模式切换操作,将前置单摄模式切换为前后双摄模式。在模式切换过程中,电子设备响应于该模式切换过程,在显示界面401内显示模糊画面,即切换前的前景画面显示结束,但切换后的前景画面和后景画面还未显示,在显示界面401内出现断流现象。在切换完成后,显示界面401内实时显示在前后双摄模式下拍摄的视频画面,例如,图4所示的前景画面和后景画面。也就是说,在前后双摄模式下,分别通过前置摄像头和后置摄像头进行前景画面的采集和后景画面的采集,并在显示界面401内分别显示前景画面和后景画面。In the application scenario shown in FIG4 , the user first selects the front single-camera mode for video shooting, and the foreground image is displayed in real time in the display interface 401. When the user triggers the "front and rear dual-camera" control in the shooting mode selection window 402, the electronic device receives the shooting mode switching operation and switches the front single-camera mode to the front and rear dual-camera mode. During the mode switching process, the electronic device responds to the mode switching process and displays a blurred image in the display interface 401, that is, the display of the foreground image before the switch ends, but the foreground image and the background image after the switch are not yet displayed, and a flow interruption phenomenon occurs in the display interface 401. After the switch is completed, the video image shot in the front and rear dual-camera mode is displayed in real time in the display interface 401, for example, the foreground image and the background image shown in FIG4. That is, in the front and rear dual-camera mode, the foreground image and the background image are collected by the front camera and the rear camera, respectively, and the foreground image and the background image are displayed in the display interface 401, respectively.

可理解,在视频拍摄过程中,除了可以在显示界面401内对拍摄的视频画面进行显示以外,还可以将拍摄的视频画面编码为视频文件(例如,MP4格式的视频文件),即目标视频,并存储在电子设备中。如果在编辑时不对上述模式切换过程进行处理,后期在对得到的视频文件进行播放时,也即会出现上述画面模糊的情况。而如果人为对上述目标视频中的拍摄模式切换的过程进行处理得到质量较好的视频时,又会导致得到视频的效率较低,影响用户快速获得视频的体验。在本申请实施例中,在拍摄视频的过程中记录拍摄模式切换的标签信息,并将记录的标签信息结合获得的该目标视频,生成第一视频文件,之后就可以直接依据第一视频文件中携带的该标签信息对第一视频文件中的视频进行自动视频编辑,实现对拍摄模式切换的自动化处理,得到质量较好的视频,实现用户一键成片的体验。It is understandable that in the process of video shooting, in addition to displaying the captured video screen in the display interface 401, the captured video screen can also be encoded into a video file (for example, a video file in MP4 format), that is, a target video, and stored in an electronic device. If the above-mentioned mode switching process is not processed during editing, when the obtained video file is played later, the above-mentioned picture blur will appear. If the process of switching the shooting mode in the above-mentioned target video is processed manually to obtain a video with better quality, it will result in a low efficiency of obtaining the video, affecting the user's experience of quickly obtaining the video. In an embodiment of the present application, the tag information of the shooting mode switching is recorded during the process of shooting the video, and the recorded tag information is combined with the obtained target video to generate a first video file, and then the video in the first video file can be automatically edited according to the tag information carried in the first video file, so as to realize the automatic processing of the shooting mode switching, obtain a video with better quality, and realize the user's one-click film experience.

图5为本申请实施例提供的一种视频处理方法的流程图。该方法可应用于图1所示的电子设备,如图5所示,该流程主要包括以下步骤。Fig. 5 is a flow chart of a video processing method provided in an embodiment of the present application. The method can be applied to the electronic device shown in Fig. 1 , as shown in Fig. 5 , the process mainly includes the following steps.

步骤S501:在采用第一拍摄模式进行视频拍摄的过程中,获取拍摄模式切换操作。Step S501: in the process of taking a video in a first shooting mode, obtaining a shooting mode switching operation.

本申请实施例涉及的第一拍摄模式可以为前置单摄模式、后置单摄模式、前置双摄模式、后置双摄模式、前后双摄模式、前置画中画模式、后置画中画模式、前后画中画模式中的任意一种;本申请实施例涉及的第一拍摄模式还可以为不同拍摄状态对应的拍摄模式,例如,可以是快速拍摄模式,慢速拍摄模式和正常拍摄模式中的任意一种,还可以为远焦拍摄模式,近焦拍摄模式和正常拍摄模式中的任意一种。本申请实施例对此不作具体限制。The first shooting mode involved in the embodiment of the present application can be any one of the front single-camera mode, the rear single-camera mode, the front dual-camera mode, the rear dual-camera mode, the front and rear dual-camera mode, the front picture-in-picture mode, the rear picture-in-picture mode, and the front and rear picture-in-picture mode; the first shooting mode involved in the embodiment of the present application can also be a shooting mode corresponding to different shooting states, for example, it can be any one of the fast shooting mode, the slow shooting mode and the normal shooting mode, and can also be any one of the far-focus shooting mode, the near-focus shooting mode and the normal shooting mode. The embodiment of the present application does not impose specific restrictions on this.

具体实现中,可以监听第一拍摄模式拍摄的视频画面,将监听到的第一拍摄模式拍摄的视频画面发送至电子设备的显示界面进行显示。In a specific implementation, the video images shot in the first shooting mode may be monitored, and the monitored video images shot in the first shooting mode may be sent to a display interface of the electronic device for display.

在实际应用中,用户可能在视频拍摄过程中需要切换拍摄模式时,在电子设备中输入拍摄模式切换操作,以将第一拍摄模式切换为第二拍摄模式。其中,用户可以通过触摸屏、物理按键、手势控制、语音控制等方式输入拍摄模式切换操作。In actual applications, when a user needs to switch shooting modes during video shooting, he/she may input a shooting mode switching operation in the electronic device to switch the first shooting mode to the second shooting mode. The user may input the shooting mode switching operation through a touch screen, physical buttons, gesture control, voice control, etc.

本申请实施例涉及的拍摄模式切换可以为上述表一,二种任意一种拍摄模式切换场景,本申请实施例对此不作具体限制。The shooting mode switching involved in the embodiments of the present application can be any one of the shooting mode switching scenarios in Tables 1 and 2 above, and the embodiments of the present application do not impose specific limitations on this.

步骤S502:响应于拍摄模式切换操作,将第一拍摄模式切换为第二拍摄模式,并记录拍摄模式切换的标签信息,其中,拍摄模式切换的标签信息用于标记在视频拍摄过程中将第一拍摄模式切换为第二拍摄模式。Step S502: In response to the shooting mode switching operation, the first shooting mode is switched to the second shooting mode, and tag information of the shooting mode switching is recorded, wherein the tag information of the shooting mode switching is used to mark the switching of the first shooting mode to the second shooting mode during the video shooting process.

在本申请实施例中,响应于拍摄模式切换操作,将第一拍摄模式切换为第二拍摄模式,采用第二拍摄模式进行视频拍摄,并在对第二拍摄模式拍摄的视频画面进行监听,将监听到的采用第二拍摄模式拍摄的视频画面发送至电子设备的显示界面进行显示。In an embodiment of the present application, in response to a shooting mode switching operation, the first shooting mode is switched to the second shooting mode, video shooting is performed using the second shooting mode, and the video screen shot in the second shooting mode is monitored, and the monitored video screen shot in the second shooting mode is sent to the display interface of the electronic device for display.

在本申请实施例中,在拍摄模式切换过程中,记录视频拍摄过程中由第一拍摄模式切换为第二拍摄模式这一拍摄模式切换的标签信息。即记录拍摄模式切换在视频拍摄过程所在的位置。该拍摄模式切换的标签信息主要用于标识该拍摄模式切换过程,可以包括多种信息,例如,可以包括:用于标识拍摄模式切换的切换标识,拍摄模式切换的开始时间点和拍摄模式切换的结束时间点。In the embodiment of the present application, during the shooting mode switching process, the tag information of the shooting mode switching from the first shooting mode to the second shooting mode during the video shooting process is recorded. That is, the position of the shooting mode switching during the video shooting process is recorded. The tag information of the shooting mode switching is mainly used to identify the shooting mode switching process, and may include a variety of information, for example, it may include: a switching identifier for identifying the shooting mode switching, the starting time point of the shooting mode switching, and the ending time point of the shooting mode switching.

需要说明的是,上述拍摄模式切换的标签信息属于视频标签信息中的一种信息,例如,视频标签信息还可以包括其它信息,参见表三,为本申请实施例的视频标签所包括的一些信息。It should be noted that the tag information of the above-mentioned shooting mode switching belongs to a type of information in the video tag information. For example, the video tag information may also include other information. See Table 3 for some information included in the video tag of the embodiment of the present application.

表三:Table 3:

上述的拍摄模式切换的标签信息可以是上述表三所示的视频标签信息中的转场信息,快慢速信息和Zoom信息(通过镜头缩放的变焦信息)。The tag information of the shooting mode switching may be the transition information, the fast and slow speed information and the Zoom information (zoom information through lens zooming) in the video tag information shown in Table 3.

其中,记录视频拍摄过程中由第一拍摄模式切换为第二拍摄模式这一拍摄模式切换的标签信息可以采用多种方式。例如,为记录拍摄模式切换的切换标识,可以先获取拍摄模式切换前所采用的模式(如上述第一拍摄模式),以及拍摄模式切换后所采用的模式(如上述第二拍摄模式),之后,基于拍摄模式切换前的第一拍摄模式和拍摄模式切换后的第二拍摄模式,确定该切换标识。又例如,为记录拍摄模式切换这一时间段,可以通过记录时间戳的方式来实现。比如,可以记录拍摄模式切换的开始时间戳,以及拍摄模式切换的结束时间戳,其中,标签信息包括:上述切换标识,上述开始时间戳和上述结束时间戳。Among them, the label information of the shooting mode switch from the first shooting mode to the second shooting mode during the video shooting process can be recorded in a variety of ways. For example, to record the switching mark of the shooting mode switch, you can first obtain the mode adopted before the shooting mode switch (such as the first shooting mode mentioned above), and the mode adopted after the shooting mode switch (such as the second shooting mode mentioned above), and then determine the switching mark based on the first shooting mode before the shooting mode switch and the second shooting mode after the shooting mode switch. For another example, to record the time period of the shooting mode switch, it can be achieved by recording a timestamp. For example, the start timestamp of the shooting mode switch and the end timestamp of the shooting mode switch can be recorded, wherein the label information includes: the above-mentioned switching mark, the above-mentioned start timestamp and the above-mentioned end timestamp.

其中,本申请实施例中所涉及的切换标识是用于标识拍摄模式切换的。在一个视频的拍摄过程中,可能不止涉及到一个拍摄模式切换。例如,在一个完整的视频拍摄过程中,可能涉及单路拍摄模式切换为双路拍摄模式这一拍摄模式切换,还涉及前后拍摄模式切换为画中画拍摄模式等等。为对上述两个拍摄模式切换过程进行区分,可以采用不同的切换标识来实现。用不同的切换标识来代表不同的拍摄模式切换。便于后续读取标签信息,基于标签信息编辑视频时,针对不同的拍摄模式切换填充对应不同的动效等。Among them, the switching mark involved in the embodiment of the present application is used to identify the shooting mode switch. In the process of shooting a video, more than one shooting mode switch may be involved. For example, in a complete video shooting process, it may involve the shooting mode switch from the single-channel shooting mode to the dual-channel shooting mode, and also involve the switching of the front and back shooting modes to the picture-in-picture shooting mode, and so on. In order to distinguish the above two shooting mode switching processes, different switching marks can be used to implement it. Different switching marks are used to represent different shooting mode switches. It is convenient to read the tag information later. When editing the video based on the tag information, different corresponding animation effects are filled in for different shooting mode switches.

需要说明的是,该切换标识可以采用多种表现形式,比如,采用数字表示时,1表示前置单摄模式切换为前后双摄模式,2表示前后双摄模式切换为前置单摄模式,等等;采用字母表示时,A表示前置单摄模式切换为前置双摄模式,B表示后置单摄模式切换为前置双摄模式,等等;采用符号来表示,@表示快速拍摄模式切换为正常拍摄模式,#表示慢速拍摄模式切换为快速拍摄模式,等等。It should be noted that the switching mark can be expressed in various forms. For example, when expressed in numbers, 1 indicates that the front single-camera mode is switched to the front and rear dual-camera mode, 2 indicates that the front and rear dual-camera mode is switched to the front single-camera mode, and so on; when expressed in letters, A indicates that the front single-camera mode is switched to the front dual-camera mode, B indicates that the rear single-camera mode is switched to the front dual-camera mode, and so on; when expressed in symbols, @ 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.

其中,在通过记录时间戳的方式来记录拍摄模式切换的开始时间点和结束时间点时,可以先设置记录时间点的基线,例如,以电子设备开始拍摄时在显示界面上显示的预览流进行编码的第一帧图像所对应的时间点为时间基线,开始拍摄的该第一帧图像的时间为T0;拍摄模式切换的开始时间点使用的是拍摄模式切换前的最后一帧图像对应的时间戳,结束时间点使用的是拍摄模式切换后的第一帧图像对应的时间戳。图6为本申请实施例提供的在视频拍摄过程中记录的拍摄模式切换的标签信息的示意图。如图6所示,1,为拍摄模式切换的切换标识,表示当前执行的拍摄模式切换为:前置单摄模式切换为前后双摄模式。T1为拍摄模式切换的开始时间点使用的是拍摄模式切换前的最后一帧图像对应的时间戳,T2为拍摄模式切换后的第一帧图像对应的时间戳。Among them, when recording the start time point and end time point of the shooting mode switch by recording the timestamp, the baseline of the recording time point can be set first, for example, the time point corresponding to the first frame image encoded by the preview stream displayed on the display interface when the electronic device starts shooting is used as the time baseline, and the time of the first frame image started to be shot is T0; the start time point of the shooting mode switch uses the timestamp corresponding to the last frame image before the shooting mode switch, and the end time point uses the timestamp corresponding to the first frame image after the shooting mode switch. Figure 6 is a schematic diagram of the label information of the shooting mode switch recorded during the video shooting process provided by an embodiment of the present application. As shown in Figure 6, 1 is the switching mark of the shooting mode switch, indicating that the shooting mode switch currently executed is: the front single camera mode is switched to the front and rear dual camera mode. T1 is the start time point of the shooting mode switch, which uses the timestamp corresponding to the last frame image before the shooting mode switch, and T2 is the timestamp corresponding to the first frame image after the shooting mode switch.

作为一种可选的实施例,在记录拍摄模式切换的开始时间戳,以及拍摄模式切换的结束时间戳时,可以采用多种方式,例如,可以针对拍摄切换开始设置回调函数,从而得到拍摄模式切换开始的开始时间戳;针对拍摄切换结束设置回调函数,从而得到拍摄模式切换结束的结束时间戳。上述针对拍摄切换开始和拍摄切换结束设置的回调函数主要用于针对拍摄切换开始触发相应的记录,以及在拍摄切换结束触发相应的记录。例如,在拍摄模式切换开始时触发切换开始回调函数,将切换开始回调函数所记录的时间戳确定为拍摄模式切换的开始时间戳;以及在拍摄模式切换结束时触发切换结束回调函数,将切换结束回调函数所记录的时间戳确定为拍摄模式切换的结束时间戳。通过上述回调函数记录的方式来记录拍摄模式切换的开始时间戳和拍摄模式切换的结束时间戳,能够对拍摄模式切换的开始时间戳,以及拍摄模式切换的结束时间戳进行准确记录,使得在视频拍摄过程中记录的拍摄模式切换的标签信息更为准确。As an optional embodiment, when recording the start timestamp of the shooting mode switch and the end timestamp of the shooting mode switch, multiple methods can be used. For example, a callback function can be set for the start of the shooting switch to obtain the start timestamp of the shooting mode switch; a callback function can be set for the end of the shooting switch to obtain the end timestamp of the shooting mode switch. The callback functions set for the start of the shooting switch and the end of the shooting switch are mainly used to trigger the corresponding record for the start of the shooting switch and the corresponding record at the end of the shooting switch. For example, the switch start callback function is triggered at the start of the shooting mode switch, and the timestamp recorded by the switch start callback function is determined as the start timestamp of the shooting mode switch; and the switch end callback function is triggered at the end of the shooting mode switch, and the timestamp recorded by the switch end callback function is determined as the end timestamp of the shooting mode switch. By recording the start timestamp of the shooting mode switch and the end timestamp of the shooting mode switch in the above callback function recording manner, the start timestamp of the shooting mode switch and the end timestamp of the shooting mode switch can be accurately recorded, so that the tag information of the shooting mode switch recorded during the video shooting process is more accurate.

对于上述拍摄模式切换的标签信息的生成过程,以及将生成的标签信息写入拍摄得到的视频中。下面举例说明。The process of generating the tag information of the above-mentioned shooting mode switching and writing the generated tag information into the shot video is described below with an example.

图7为本申请实施例提供的一种拍摄模式切换的标签信息生成方法的流程图。如图7所示,在本申请实施例中,在拍摄视频的过程中,视频拍摄模式切换的标签信息涉及两种标签信息的生成。一种是镜头场景切换对应的拍摄模式切换的标签信息,例如,可以是由单路拍摄模式切换为双路拍摄模式的拍摄模式切换的标签信息。另一种是,镜头切换转场的拍摄模式切换的标签信息,例如,可以是在双路拍摄模式下,实现的由前后画中画拍摄模式(即前置摄像头采集的前景画面置于后置摄像头采集的后景画面之中的拍摄模式)切换为后前画中画拍摄模式(即后置摄像头采集的后景画面置于前置摄像头采集的前景画画之中的拍摄模式)。FIG7 is a flow chart of a method for generating label information for shooting mode switching provided in an embodiment of the present application. As shown in FIG7 , in an embodiment of the present application, in the process of shooting a video, the label information for switching the video shooting mode involves the generation of two types of label information. One is the label information for the shooting mode switching corresponding to the lens scene switching, for example, it can be the label information for the shooting mode switching from a single-channel shooting mode to a dual-channel shooting mode. The other is the label information for the shooting mode switching of the lens switching transition, for example, it can be the switching from the front-to-back picture-in-picture shooting mode (i.e., the shooting mode in which the foreground picture captured by the front camera is placed in the background picture captured by the rear camera) to the rear-to-front picture-in-picture shooting mode (i.e., the shooting mode in which the background picture captured by the rear camera is placed in the foreground picture captured by the front camera) in the dual-channel shooting mode.

步骤S701:电子设备启动相机应用,相机应用加载多镜模式;Step S701: the electronic device starts a camera application, and the camera application loads a multi-lens mode;

步骤S702:在多镜模式下,加载相机应用的视频标签功能;Step S702: In the multi-lens mode, loading the video tag function of the camera application;

步骤S703:相机应用的视频标签功能注册回调函数,例如,为拍摄模式切换配置监听函数,例如,配置对应于记录拍摄模式切换开始和拍摄模式切换结束的回调函数的触发条件。比如,通过配置切换开始回调函数的触发条件,在满足触发条件时,该切换开始回调函数记录拍摄模式切换的开始时间戳;通过配置切换结束回调函数的触发条件,在满足触发条件时,该切换结束回调函数记录拍摄模式切换的结束时间戳。Step S703: The video tag function of the camera application registers a callback function, for example, configures a monitoring function for the shooting mode switch, for example, configures the trigger conditions of the callback function corresponding to recording the start of the shooting mode switch and the end of the shooting mode switch. For example, by configuring the trigger conditions of the switch start callback function, when the trigger conditions are met, the switch start callback function records the start timestamp of the shooting mode switch; by configuring the trigger conditions of the switch end callback function, when the trigger conditions are met, the switch end callback function records the end timestamp of the shooting mode switch.

步骤S704:电子设备接收用户输入的模式切换操作,该模式切换操作用于确定电子设备开始拍摄时的拍摄模式(即上述的第一拍摄模式,也即镜头场景切换前的拍摄模式,在本实施例中以第一拍摄模式为单路拍摄模式为例),电子设备的模式切换器响应于该模式切换操作切换多镜模式,确定采用该第一拍摄模式进行拍摄;Step S704: the electronic device receives a mode switching operation input by the user, the mode switching operation is used to determine the shooting mode of the electronic device when starting shooting (i.e., the first shooting mode mentioned above, i.e., the shooting mode before the lens scene is switched, and in this embodiment, the first shooting mode is taken as the single-channel shooting mode as an example), and the mode switcher of the electronic device switches the multi-lens mode in response to the mode switching operation, and determines to adopt the first shooting mode for shooting;

步骤S705:模式切换器通过设备工厂打开相机;Step S705: The mode switcher turns on the camera through the device factory;

步骤S706:设备工厂与相机捕获会话器创建会话起流;Step S706: the device factory and the camera capture session controller create a session flow;

步骤S707:相机捕获会话器向模式切换器回调预览流。即在本实施例中,启动单路拍摄模式,采用单路拍摄模式进行视频拍摄,拍摄获得的视频画面显示在电子设备的显示界面上;Step S707: the camera capture session controller calls back the preview stream to the mode switcher. That is, in this embodiment, the single-channel shooting mode is started, and the video is shot in the single-channel shooting mode, and the video screen obtained by shooting is displayed on the display interface of the electronic device;

步骤S708:电子设备的模式切换器接收用户输入的开始拍摄指令,即相机开始采用单路拍摄模式进行拍摄;Step S708: the mode switch of the electronic device receives a start shooting instruction input by the user, that is, the camera starts shooting in a single-channel shooting mode;

步骤S709:响应于该开始拍摄指令,作为记录标签(TAG)的时间基线,即开始记录时间戳的开始时间点。例如,可以获取预览流编码第一帧图像的时间戳,将该时间戳记为标记标签记录的时间基线T0。Step S709: In response to the start shooting instruction, the time base of the tag (TAG) is recorded, that is, the start time point of the timestamp. For example, the timestamp of the first frame of the preview stream encoding can be obtained and recorded as the time base T0 of the tag recording.

步骤S710:视频标签功能模块记录镜头场景TAG,开始时间戳T0;Step S710: the video tag function module records the shot scene TAG, starting with timestamp T0;

步骤S711:模式切换器接收用户输入的(拍摄)模式切换指令,响应于该模式切换指令,将当前的单路拍摄模式切换为双路拍摄模式。Step S711: the mode switch receives a (shooting) mode switching instruction input by the user, and in response to the mode switching instruction, switches the current single-channel shooting mode to a dual-channel shooting mode.

步骤S712:视频标签功能模块记录镜头场景TAG,结束时间戳为模式切换前的最后一帧图像的时间戳T1;Step S712: the video tag function module records the shot scene TAG, and the end timestamp is the timestamp T1 of the last frame image before the mode switching;

步骤S713:视频标签功能模块监听到上述拍摄模式切换操作(即上述单路拍摄模式切换为双路拍摄模式的切换操作),记录当前的拍摄模式切换的开始时间戳,以及拍摄模式切换的结束时间戳。Step S713: the video tag function module monitors the shooting mode switching operation (ie, the switching operation from the single-channel shooting mode to the dual-channel shooting mode), and records the start timestamp of the current shooting mode switching and the end timestamp of the shooting mode switching.

具体实现时,假设上述配置切换开始回调函数的触发条件是监听到切换前拍摄模式的最后一帧图像,则视频标签功能模块在监听到单路拍摄模式的最后一帧图像时,触发切换开始回调函数记录该最后一帧图像的时间戳为拍摄模式切换的开始时间戳T1。In specific implementation, assuming that the trigger condition of the above-mentioned configuration switching start callback function is to monitor the last frame image of the shooting mode before switching, when the video tag function module monitors the last frame image of the single-channel shooting mode, it triggers the switching start callback function to record the timestamp of the last frame image as the start timestamp T1 of the shooting mode switching.

步骤S714:视频标签功能模块监听到上述拍摄模式切换操作(即上述单路拍摄模式切换为双路拍摄模式的切换操作),记录当前的拍摄模式切换的结束时间戳。Step S714: the video tag function module monitors the shooting mode switching operation (ie, the switching operation from the single-channel shooting mode to the dual-channel shooting mode), and records the end timestamp of the current shooting mode switching.

假设上述配置切换结束回调函数的触发条件是监听到切换后拍摄模式的第一帧图像时,则视频标签功能模块在监听到双路拍摄模式的第一帧图像时,触发切换结束回调函数记录该第一帧图像的时间戳为拍摄模式切换的结束时间戳T2。Assuming that the trigger condition of the above-configured switching end callback function is when the first frame image of the shooting mode after switching is monitored, the video tag function module triggers the switching end callback function when monitoring the first frame image of the dual-channel shooting mode to record the timestamp of the first frame image as the end timestamp T2 of the shooting mode switching.

步骤S715:在电子设备切换到双路拍摄模式后,采用切换后的双路拍摄模式进行拍摄,在电子设备的显示界面上显示采用双路拍摄模式进行拍摄后,获得的视频流。例如,在双路拍摄模式为前后画中画拍摄模式时,在电子设置的显示界面上显示的是,前置摄像头采集的前景画面置于后置摄像头采集的后景画面之中。Step S715: After the electronic device switches to the two-way shooting mode, the switched two-way shooting mode is used for shooting, and the video stream obtained after shooting in the two-way shooting mode is displayed on the display interface of the electronic device. For example, when the two-way shooting mode is a front and back picture-in-picture shooting mode, what is displayed on the display interface of the electronic device is that the foreground picture captured by the front camera is placed in the background picture captured by the rear camera.

步骤S716:电子设备的模式切换器接收到镜头转场指令,响应于该镜头转场指令,将当前的前后画中画拍摄模式切换为后前画中画拍摄模式(即后置摄像头采集的后景画面置于前置摄像头采集的前景画画之中的拍摄模式)。在切换为后前画中画拍摄模式后,在电子设备的显示界面上显示的是,后置摄像头采集的后景画面置于前置摄像头采集的前景画画之中。Step S716: The mode switcher of the electronic device receives the lens transition instruction, and in response to the lens transition instruction, switches the current front-back picture-in-picture shooting mode to the rear-front picture-in-picture shooting mode (i.e., the shooting mode in which the rear scene captured by the rear camera is placed in the foreground scene captured by the front camera). After switching to the rear-front picture-in-picture shooting mode, what is displayed on the display interface of the electronic device is that the rear scene captured by the rear camera is placed in the foreground scene captured by the front camera.

步骤S717:视频标签功能模块监听到上述拍摄模式切换操作(即上述前后画中画拍摄模式切换为后前画中画拍摄模式的切换操作),记录当前的拍摄模式切换的开始时间戳。Step S717: the video tag function module monitors the shooting mode switching operation (ie, the switching operation of switching the front and back picture-in-picture shooting mode to the back and front picture-in-picture shooting mode), and records the start timestamp of the current shooting mode switching.

具体实现时,假设上述配置切换开始回调函数的触发条件是监听到切换前拍摄模式的最后一帧图像,则视频标签功能模块在监听到前后画中画拍摄模式的最后一帧图像时,触发切换开始回调函数记录该最后一帧图像的时间戳为拍摄模式切换的开始时间戳T3。In specific implementation, assuming that the trigger condition of the above-mentioned configuration switching start callback function is to monitor the last frame image of the shooting mode before switching, the video tag function module will trigger the switching start callback function when monitoring the last frame image of the front and back picture-in-picture shooting mode, and record the timestamp of the last frame image as the start timestamp T3 of the shooting mode switching.

步骤S718:视频标签功能模块监听到上述拍摄模式切换操作(即上述前后画中画拍摄模式切换为后前画中画拍摄模式的切换操作),记录当前的拍摄模式切换的结束时间戳。Step S718: the video tag function module monitors the shooting mode switching operation (ie, the switching operation of switching the front and back picture-in-picture shooting mode to the back and front picture-in-picture shooting mode), and records the end timestamp of the current shooting mode switching.

假设上述配置切换结束回调函数的触发条件是监听到切换后拍摄模式的第一帧图像时,则视频标签功能模块在监听到后前画中画拍摄模式的第一帧图像时,触发切换结束回调函数记录该第一帧图像的时间戳为拍摄模式切换的结束时间戳T4。Assuming that the trigger condition of the above-configured switching end callback function is when the first frame image of the shooting mode after switching is monitored, the video tag function module will trigger the switching end callback function when monitoring the first frame image of the back-to-front picture-in-picture shooting mode, and record the timestamp of the first frame image as the end timestamp T4 of the shooting mode switching.

步骤S719:电子设备接收到用户输入的结束拍摄指令,响应于该结束拍摄指令,相机应用的多镜模式基于拍摄到的视频流,生成拍摄视频(即上述的目标视频,可以是一个MP4视频)。视频标签功能模块监听到上述结束拍摄指令后,会将上述记录的两个拍摄模式切换对应的标签信息结合上述目标视频,生成第一视频文件。Step S719: The electronic device receives the end shooting instruction input by the user, and in response to the end shooting instruction, the multi-lens mode of the camera application generates a shot video (i.e., the above-mentioned target video, which can be an MP4 video) based on the captured video stream. After the video tag function module monitors the above-mentioned end shooting instruction, it combines the tag information corresponding to the above-mentioned two shooting mode switches with the above-mentioned target video to generate a first video file.

通过上述处理,将在视频拍摄过程中,在实现拍摄模式的切换时,会针对该拍摄模式切换生成对应的标签信息,为后续将该标签信息写入拍摄得到的视频文件中提供了基础。Through the above processing, during the video shooting process, when the shooting mode is switched, corresponding tag information will be generated for the shooting mode switch, which provides a basis for subsequently writing the tag information into the video file obtained by shooting.

需要说明的是上述镜头场景切换对应的拍摄模式切换,以及镜头切换转场的拍摄模式仅是一个实施,也可以应用于其他模式切换。It should be noted that the shooting mode switching corresponding to the above-mentioned lens scene switching and the shooting mode of the lens switching transition are only an implementation and can also be applied to other mode switching.

另外,上述实施例中也仅仅列举了两种拍摄模式切换,一段视频拍摄的过程中,拍摄模式切换的数量可以不限定,例如,还可以一个,三个,或更多个。In addition, the above embodiment only lists two shooting mode switches. During the process of shooting a video, the number of shooting mode switches may not be limited, for example, it may be one, three, or more.

步骤S503:获取采用第一拍摄模式和第二拍摄模式进行视频拍摄后得到的目标视频。Step S503: Acquire a target video obtained by shooting videos in the first shooting mode and the second shooting mode.

在本申请实施例中,对采用第一拍摄模式进行拍摄,以及采用第二拍摄模式进行拍摄时,可以采用一边拍摄一边音视频混合的方式,得到目标视频。即对从开始采用第一拍摄模式进行拍摄到采用第二拍摄模式拍摄结束这一拍摄过程中的视频画面和音频进行混合,得到目标视频。In the embodiment of the present application, when shooting in the first shooting mode and shooting in the second shooting mode, the target video can be obtained by mixing the audio and video while shooting. That is, the video image and the audio in the shooting process from the beginning of shooting in the first shooting mode to the end of shooting in the second shooting mode are mixed to obtain the target video.

步骤S504:基于标签信息和目标视频,生成第一视频文件。Step S504: Generate a first video file based on the tag information and the target video.

在本申请实施例中,在得到拍摄模式切换的标签信息后,将得到的该标签信息结合拍摄得到的目标视频,进而得到第一视频文件。因此,得到的该第一视频文件是携带有标识拍摄模式切换的标签信息的,因而可以依据该标签信息识别出在视频拍摄过程中的拍摄模式切换过程。In the embodiment of the present application, after obtaining the tag information of the shooting mode switching, the tag information is combined with the target video obtained by shooting, and then the first video file is obtained. Therefore, the first video file obtained carries the tag information identifying the shooting mode switching, and thus the shooting mode switching process during the video shooting process can be identified according to the tag information.

在一种实现方式中,目标视频为将视频拍摄得到的音视频进行混合后得到的音视频混合的视频。在步骤S504中,将标签信息结合目标视频,生成第一视频文件包括,调用新增的标签设置接口,将标签信息写入目标视频的视频信息描述区中,调用停止接口完成第一视频文件的生成。In one implementation, the target video is a mixed video of audio and video obtained by mixing audio and video obtained by video shooting. In step S504, combining the tag information with the target video to generate the first video file includes calling a newly added tag setting interface, writing the tag information into the video information description area of the target video, and calling a stop interface to complete the generation of the first video file.

图8为本申请实施例提供的基于标签信息和目标视频生成第一视频文件的流程图。如图8所示,在相关技术中,电子设备(电子设备中的相机)拍摄视频的过程中,会产生两条数据轨道,分别是音频轨和视频轨,在视频拍摄结束后,需要对这两条轨道进行混合封装,生成最终的视频文件(例如,MP4视频文件)。在本申请实施例中,通过电子设备拍摄视频生成视频文件的过程大致如下:FIG8 is a flowchart of generating a first video file based on tag information and a target video provided by an embodiment of the present application. As shown in FIG8, in the related art, during the process of video shooting by an electronic device (a camera in an electronic device), two data tracks are generated, namely an audio track and a video track. After the video shooting is completed, these two tracks need to be mixed and packaged to generate a final video file (for example, an MP4 video file). In an embodiment of the present application, the process of generating a video file by shooting a video by an electronic device is roughly as follows:

S801,相机拍摄视频后,可以通过第一媒体混合器(HwMediaMuxerEx)和第二媒体混合器(HwMediaMuxer)的透传,调用MediaMuxer类((第三)媒体混合器)中的addTrack(轨道加入)接口,将音频轨和视频轨加入到MPEG4Writer类(写入器)中。S801, after the camera shoots the video, it can call the addTrack (track addition) interface in the MediaMuxer class ((third) media mixer) through the transparent transmission of the first media mixer (HwMediaMuxerEx) and the second media mixer (HwMediaMuxer) to add the audio track and the video track to the MPEG4Writer class (writer).

S802,相机调用MediaMuxer类中的start(开始)接口和WriteSampleData(数据写入)接口,开始混合音视频,得到目标视频(例如,可以是MP4视频)。S802, the camera calls the start interface and the WriteSampleData interface in the MediaMuxer class to start mixing audio and video to obtain a target video (for example, an MP4 video).

S803,相机调用MediaMuxer类中的setUserTag(标签设置)接口,将目标视频对应的TAG信息写入到目标视频的视频信息描述区(该视频信息描述区为该TAG信息所属字段存储的区域)。例如,在该记录的TAG信息为场景信息时,将场景信息对应的场景标识(例如,单模拍摄模式对应的标识),场景的开始时间戳,场景的结束时间戳,写入该场景信息对应的场景字段中。又例如,在该记录的TAG信息为转场信息时,将该转场信息对应的转场标识(例如,由单模拍摄模式切换为双模拍摄模式的切换标识,转场的开始时间戳,转场的结束时间戳,写入该转场信息对应的转场字段中)。S803, the camera calls the setUserTag (tag setting) interface in the MediaMuxer class, and writes the TAG information corresponding to the target video into the video information description area of the target video (the video information description area is the area where the field to which the TAG information belongs is stored). For example, when the recorded TAG information is scene information, the scene identifier corresponding to the scene information (for example, the identifier corresponding to the single-mode shooting mode), the start timestamp of the scene, and the end timestamp of the scene are written into the scene field corresponding to the scene information. For another example, when the recorded TAG information is transition information, the transition identifier corresponding to the transition information (for example, the switching identifier for switching from the single-mode shooting mode to the dual-mode shooting mode, the start timestamp of the transition, and the end timestamp of the transition are written into the transition field corresponding to the transition information).

例如,可以采用以下代码实现调用setUserTag接口将标签信息写入目标视频对应的信息字段中,即通过以下代码把相机应用传过来的标签信息拷贝到内存中,后续跟其它视频信息一起,写到MP4文件中:For example, the following code can be used to call the setUserTag interface to write the tag information into the information field corresponding to the target video. That is, the tag information passed by the camera application is copied to the memory through the following code, and then written to the MP4 file together with other video information:

S804,相机调用stop接口生成最终的MP4视频文件,得到的MP4视频文件即为第一视频文件。完成将标签信息结合目标视频,生成第一视频文件的目的。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, thereby completing the purpose of combining the tag information with the target video to generate the first video file.

在相关技术中,一般在采用步骤S702进行音视频混合,得到目标视频后,即可调用stop接口(即上述所指的停止接口)生成MP4视频文件。然而,为了达到将在视频拍摄过程中记录的TAG信息(即上述的拍摄模式切换对应的标签信息)写入到MP4视频(即上述的目标视频)中,在本申请实施例中,在MPEG4Writer类和MediaMuxer类中新增了setUserTag接口(即上述所指的标签设置接口),并新增了HwMediaMuxer类供相机调用,相机在调用stop接口前,首先通过HwMediaMuxer类调用MediaMuxer类中的setUserTag接口,将目标视频对应的TAG信息写入到目标视频对应的视频信息描述区中,得到第一视频文件。In the related art, generally, after audio and video are mixed in step S702 and the target video is obtained, the stop interface (i.e., the stop interface mentioned above) can be called to generate an MP4 video file. However, in order to achieve the goal of writing the TAG information recorded during the video shooting process (i.e., the tag information corresponding to the shooting mode switch mentioned above) into the MP4 video (i.e., the target video mentioned above), in the embodiment of the present application, the setUserTag interface (i.e., the tag setting interface mentioned above) is added to the MPEG4Writer class and the MediaMuxer class, and the HwMediaMuxer class is added for the camera to call. Before calling the stop interface, the camera first calls the setUserTag interface in the MediaMuxer class through the HwMediaMuxer class to write the TAG information corresponding to the target video into the video information description area corresponding to the target video to obtain the first video file.

需要说明的是,本申请实施例所涉及的第一视频文件可以包括多个区域,多个不同的区域用于存储不同的内容。例如,多个区域可以包括信息区和视频区,其中,信息区用于存储描述信息,上述所指的视频信息描述区即属于该信息区;视频区用于存储视频流本身(例如,目标视频)的。It should be noted that the first video file involved in the embodiment of the present application may include multiple areas, and the multiple different areas are used to store different contents. For example, the multiple areas may include an information area and a video area, wherein the information area is used to store description information, and the video information description area referred to above belongs to the information area; the video area is used to store the video stream itself (for example, the target video).

在将标签信息结合目标视频,生成第一视频文件时,具体可以采用以下方式:When the tag information is combined with the target video to generate the first video file, the following method may be used:

在相机调用MediaMuxer类中的start(开始)接口和WriteSampleData(数据写入)接口,进行音视频混合,得到音视频混合流时,即可以开始对该音视频混合流开启编码线程,将该音视频混合流发送到预定编码器中,采用该预定编码器编码成预定格式的视频文件(例如,MP4格式的视频文件)。在音视频混合结束后,调用MediaMuxer类中的setUserTag(标签设置)接口,将目标视频对应的TAG信息写入到目标视频的视频信息描述区(即上述标签信息对应的字段中)。在对目标视频对应的音视频混合流编码结束后,编码操作继续采用该预定编码器对写入到视频信息描述区中的TAG信息字段进行编码,将编码后的TAG信息刷新到该预定格式的视频文件中,在TAG信息编码结束后,调用stop接口生成最终的MP4视频文件,即第一视频文件。When the camera calls the start (start) interface and WriteSampleData (data writing) interface in the MediaMuxer class to mix audio and video and obtain an audio and video mixed stream, it can start the encoding thread for the audio and video mixed stream, send the audio and video mixed stream to the predetermined encoder, and use the predetermined encoder to encode it into a video file in a predetermined format (for example, a video file in MP4 format). After the audio and video mixing is completed, call the setUserTag (tag setting) interface in the MediaMuxer class to write the TAG information corresponding to the target video into the video information description area of the target video (that is, the field corresponding to the above tag information). After the encoding of the audio and video mixed stream corresponding to the target video is completed, the encoding operation continues to use the predetermined encoder to encode the TAG information field written in the video information description area, and refresh the encoded TAG information into the video file in the predetermined format. After the TAG information encoding is completed, call the stop interface to generate the final MP4 video file, that is, the first video file.

基于上述可选实施例,在得到上述拍摄模式切换对应的标签信息后,就可以将该标签信息结合拍摄得到的目标视频,生成第一视频文件。这样得到的第一视频文件中就携带有整个拍摄过程中所包括的全部拍摄模式切换的标签信息。在通过相机应用得到上述第一视频文件后,可以直接将得到的该第一视频文件发送给视频编辑应用,也可以将得到的该第一视频文件存储于本地,或者媒体库中,待视频编辑应用基于用户的操作需要时,基于该文件的路径,对该第一视频文件进行调用。Based on the above optional embodiment, after obtaining the tag information corresponding to the above shooting mode switching, the tag information can be combined with the target video obtained by shooting to generate a first video file. The first video file obtained in this way carries the tag information of all shooting mode switches included in the entire shooting process. After obtaining the above first video file 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 the media library. When the video editing application needs to operate based on the user, the first video file is called based on the path of the file.

步骤S505:基于第一视频文件中的标签信息,对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。Step S505: based on the tag information in the first video file, the switching process from the first shooting mode to the second shooting mode in the first video file is edited to obtain a second video file.

具体实现中,在获得携带有标签信息的第一视频文件时,可以基于第一视频文件中的标签信息,对该第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑处理,得到编辑好的第二视频文件。例如,可以由相机应用将拍摄得到的第一视频文件发送给视频编辑应用,视频编辑应用在得到该第一标签文件时,可以先对该第一标签文件采用与相机应用中的编码器对应的解码器进行解码,得到该第一视频文件中的目标视频以及标识模式切换对应的标签信息,之后基于第一视频文件中的标签信息,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。In a specific implementation, when a first video file carrying tag information is obtained, the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file can be edited based on the tag information in the first video file to obtain an edited second video file. For example, the camera application can send the first video file obtained by shooting to a video editing application. When the video editing application obtains the first tag file, it can first decode the first tag file using a decoder corresponding to the encoder in the camera application to obtain the target video in the first video file and the tag information corresponding to the identification mode switching. Then, based on the tag information in the first video file, the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file is edited to obtain a second video file.

另外,基于第一视频文件中的标签信息,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件时,可以采用不同的视频编辑策略。不同的视频编辑策略对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑的方式也不同,因而得到的第二视频文件也可以不同。In addition, based on the tag information in the first video file, different video editing strategies may be used to edit the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file to obtain the second video file. Different video editing strategies may edit the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file in different ways, and thus the obtained second video files may also be different.

作为一种可选的实施方式,视频编辑策略可以是按照预定视频编辑模板进行视频编辑,也可以是采用随机调用视频生成过程所需资源的方式来对对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑。As an optional implementation, the video editing strategy may be to perform video editing according to a predetermined video editing template, or to edit the switching process from the first shooting mode to the second shooting mode in the first video file by randomly calling resources required for the video generation process.

图9为本申请实施例提供的一种视频处理方法中视频编辑方法的流程图。如图9所示,该视频编辑方法包括以下流程:FIG9 is a flow chart of a video editing method in a video processing method provided in an embodiment of the present application. As shown in FIG9 , the video editing method includes the following process:

步骤S901:启动视频编辑应用,在电子设备的显示界面显示视频编辑应用的界面,在该界面上显示有标识视频编辑策略的选择控件,包括:随机生成视频控件和模板生成视频控制。Step S901: Start a video editing application, and display the interface of the video editing application on the display interface of the electronic device. The interface displays selection controls identifying video editing strategies, including: randomly generated video controls and template generated video controls.

步骤S902:接收用户输入的视频编辑策略选择指令,响应于该视频编辑策略选择指令,生成视频。Step S902: receiving a video editing strategy selection instruction input by a user, and generating a video in response to the video editing strategy selection instruction.

步骤S903:在电子设备接收到的视频编辑策略选择指令为采用随机生成视频的情况下,采用随机生成视频的方法生成视频。例如,为该第一视频文件中的视频随机选择片头片尾的素材,随机选择滤镜的滤镜参数,随机选择贴纸的素材,随机选择视频的边框等,在基于第一视频文件中的标签信息对拍摄模式切换这一过程进行处理时,采用随机的特效处理方法进行处理。基于上述随机的处理方法,得到编辑后的视频,进而生成上述所指的第二视频文件。Step S903: When the video editing strategy selection instruction received by the electronic device is to randomly generate a video, a random video generation method is used to generate a video. For example, the opening and ending materials are randomly selected for the video in the first video file, the filter parameters of the filter are randomly selected, the sticker materials are randomly selected, the video border is randomly selected, etc. When the process of switching the shooting mode is processed based on the tag information in the first video file, a random special effects processing method is used for processing. Based on the above random processing method, the edited video is obtained, and then the second video file referred to above is generated.

步骤S904:在电子设备接收到的视频编辑策略选择指令为视频编辑模板生成视频的情况下,采用预定的视频编辑模板生成视频。例如,基于该预定的视频编辑模板配置的素材对该第一视频文件中的视频进行编辑,得到编辑后的视频,进而生成上述所指的第二视频文件。比如,采用视频编辑模板中配置的片头片尾的素材编辑片头片尾,采用视频编辑模板中配置的滤镜参数调整滤镜对视频进行滤镜处理,采用视频编辑模板中配置的贴纸素材为视频添加贴纸,采用视频编辑模板中配置的边框素材为视频添加边框等,在基于第一视频文件中的标签信息对拍摄模式切换这一过程进行处理时,采用视频编辑模板中配置的处理方法(例如,下面将详细描述的插入切换图像帧的方法,延长播放切换前的图像帧的方法等)对该拍摄模式切换进行处理。基于上述随机的处理方法,得到编辑后的视频,进而生成上述所指的第二视频文件。Step S904: When the video editing strategy selection instruction received by the electronic device is to generate a video for a video editing template, a predetermined video editing template is used to generate a video. For example, the video in the first video file is edited based on the material configured by the predetermined video editing template to obtain an edited video, and then the second video file referred to above is generated. For example, the opening and ending materials configured in the video editing template are used to edit the opening and ending, the filter parameters configured in the video editing template are used to adjust the filter to process the video, the sticker material configured in the video editing template is used to add stickers to the video, and the border material configured in the video editing template is used to add a border to the video, etc. When processing the process of switching the shooting mode based on the tag information in the first video file, the processing method configured in the video editing template (for example, the method of inserting the switching image frame described in detail below, the method of extending the playback of the image frame before switching, etc.) is used to process the switching of the shooting mode. Based on the above random processing method, the edited video is obtained, and then the second video file referred to above is generated.

通过上述处理,由于用于编辑的第一视频文件包括有拍摄模式切换的标签信息,因此,在对第一视频文件中的视频进行编辑时,可以基于该标签信息有选择地自动对拍摄模式切换进行处理,在保证制作的视频质量的前提下,视频的制作效率也高。Through the above processing, since the first video file used for editing includes tag information for shooting mode switching, when editing the video in the first video file, the shooting mode switching can be selectively and automatically processed based on the tag information. While ensuring the quality of the produced video, the video production efficiency is also high.

需要说明的是,上述视频编辑策略仅仅列举了随机生成视频的策略和视频编辑模板生成视频的策略,但也可以采用两者结合的策略或者其它的生成视频的策略,在此也不进行限定。It should be noted that the above video editing strategies only list strategies for randomly generating videos and strategies for generating videos using video editing templates, but a combination of the two strategies or other strategies for generating videos may also be adopted, which are not limited here.

作为一种可选的实施例,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件可以包括:在视频编辑策略包括采用视频编辑模板进行编辑的情况下,获取视频编辑模板,采用获取到的该视频编辑模板对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。在采用视频编辑模板对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑时,视频编辑模板中的调用资源也可以在一定的资源库中灵活随机选择。例如,对于需要在拍摄模式切换的切换过程中插入某一动效时,该视频编辑模板可以仅设定插入的该动效是属于某一风格的,而不需要从该某一风格的众多动效中确定出具体的一款动效。采用上述处理,即使采用视频编辑模板来对对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑时,也能够得出多样性的视频,避免得到的视频过于单一,观赏体验差的情况。As an optional embodiment, editing the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file to obtain the second video file may include: when the video editing strategy includes editing using a video editing template, obtaining a video editing template, and using the obtained video editing template to edit the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file to obtain the second video file. When the video editing template is used to edit the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file, the calling resources in the video editing template can also be flexibly and randomly selected in a certain resource library. For example, when it is necessary to insert a certain motion effect in the switching process of switching the shooting mode, the video editing template can only set the inserted motion effect to belong to a certain style, without determining a specific motion effect from the many motion effects of the certain style. With the above processing, even if the video editing template is used to edit the switching process of switching from the first shooting mode in the first video file to the second shooting mode, a diverse video can be obtained to avoid the situation where the obtained video is too single and the viewing experience is poor.

作为一种可选的实施方式,在采用视频编辑模板对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件时,该视频编辑模板可以是从众多的视频编辑模板中选出来的。对于一个视频编辑模板,对应有为模板配置的素材和/或参数。例如,有对应于目标视频的片头片尾的素材,有对应于为目标视频执行滤镜功能的滤镜参数,有对应于为目标视频配置的贴纸,为目标视频配置的特效素材,以及为目标视频所配置的边框素材等。具体举例来说,预定的视频编辑模板可以包括:片头片尾是播放预定的背景音乐,在目标视频的中间第2-3分钟的时间内采用黑白灰对应的滤镜参数,达到复古的效果,在目标视频的第4-5分钟内的视频帧图像上加上贴纸,在目标视频的第6-7分钟内的视频帧图像上播放特效资源库中的某一特效,以及为目标视频设置纯黑的边框等。因此,采用该视频编辑模板进行编辑后,得到的即是一个在原视频内容加上纯黑边框的基础上,在片头片尾播放上述预定的背景音乐,在第2-3分钟引入滤镜呈现复古效果,在第4-5分钟内的视频帧图像上贴有贴纸,以及在第6-7分钟内播放特效的视频。As an optional implementation, when a video editing template is used to edit the switching process of switching the first shooting mode in the first video file to the second shooting mode in the first video file to obtain the second video file, the video editing template can be selected from a large number of video editing templates. For a video editing template, there are corresponding materials and/or parameters configured for the template. For example, there are materials corresponding to the opening and ending of the target video, filter parameters corresponding to the filter function performed for the target video, stickers corresponding to the configuration of the target video, special effects materials configured for the target video, and border materials configured for the target video. For example, the predetermined video editing template may include: the opening and ending are to play predetermined background music, the filter parameters corresponding to black, white and gray are used in the middle of the target video in the 2nd to 3rd minute to achieve a retro effect, stickers are added to the video frame image in the 4th to 5th minute of the target video, a special effect in the special effects resource library is played on the video frame image in the 6th to 7th minute of the target video, and a pure black border is set for the target video. Therefore, after editing using this video editing template, what is obtained is a video that adds a pure black border to the original video content, plays the above-mentioned predetermined background music at the beginning and end of the video, introduces a filter to present a retro effect in the 2nd to 3rd minutes, has stickers on the video frame image in the 4th to 5th minutes, and plays special effects in the 6th to 7th minutes.

基于上述可选实施例,在得到携带有拍摄模式切换的标签信息的第一视频文件时,可以基于第一视频文件中的标签信息,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。例如,在具体依据上述标签信息,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑时,可以采用多种方式,例如,可以采用以下流程对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑。Based on the above optional embodiment, when a first video file carrying tag information of shooting mode switching is obtained, the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file can be edited based on the tag information in the first video file to obtain a second video file. For example, when editing the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file based on the above tag information, multiple methods can be used. For example, the following process can be used to edit the switching process of switching from the first shooting mode in the first video file to the second shooting mode in the first video file.

图10为本申请实施例提供的一种对第一视频文件中的视频进行编辑的流程示意图。如图10所示,该流程包括如下步骤:FIG10 is a schematic diagram of a process for editing a video in a first video file provided by an embodiment of the present application. As shown in FIG10 , the process includes the following steps:

步骤S1001:提取第一视频文件中的标签信息。Step S1001: extracting tag information from a first video file.

作为一种可选的实施方式,在对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑前,可以先从第一视频文件中的视频信息描述区域中读取与该目标视频相关的信息,例如,从该视频信息描述区域读取在视频拍摄阶段写入的该标签信息。其中,该视频信息描述区域可以是上述目标视频的信息描述区,也可以是为存储该标签信息重新设置的视频标签的信息区。在本申请实施例中,并不具体限定。需要说明的是,在对对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑前,也可能从该视频信息描述区域读取视频的其它信息,例如,视频的大小,视频的编码方式,视频的格式等,但读取这些信息的过程与相关技术的做法类似,在此不进行展开说明。As an optional implementation, before editing the switching process from the first shooting mode to the second shooting mode in the first video file, the information related to the target video can be read from the video information description area in the first video file, for example, the tag information written in the video shooting stage is read from the video information description area. Among them, the video information description area can be the information description area of the above-mentioned target video, or it can be the information area of the video tag reset to store the tag information. In the embodiment of the present application, it is not specifically limited. It should be noted that before editing the switching process from the first shooting mode to the second shooting mode in the first video file, other information of the video may also be read from the video information description area, for example, the size of the video, the encoding method of the video, the format of the video, etc., but the process of reading this information is similar to the practice of the related art, and will not be described in detail here.

步骤S1002:根据标签信息,确定第一视频文件中的拍摄模式切换的开始时间戳和结束时间戳。Step S1002: Determine the start timestamp and the end timestamp of the shooting mode switch in the first video file according to the tag information.

作为一种可选的实施方式,基于第一视频文件中提取的该标签信息,从而确定拍摄模式切换的相关信息,例如,用于标识拍摄模式切换的标识信息,拍摄模式切换的开始时间戳,拍摄模式切换的结束时间戳,从而用于后续对该拍摄模式切换这一切换过程在视频中的位置进行定位。As an optional implementation, based on the tag information extracted from the first video file, relevant information of the shooting mode switching is determined, for example, identification information for identifying the shooting mode switching, the start timestamp of the shooting mode switching, and the end timestamp of the shooting mode switching, so as to subsequently locate the position of the shooting mode switching process in the video.

步骤S1003:基于从开始时间戳至结束时间戳的时间段,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。Step S1003: based on the time period from the start timestamp to the end timestamp, 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 to obtain a second video file.

作为一种可选的实施方式,基于从开始时间戳至结束时间戳的时间段,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。通过定位出拍摄模式切换在目标视频中所对应的这一时间段,并对目标视频所在的时间段基于预定的视频编辑策略进行处理编辑,从而自动得到质量较好的第二视频文件。As an optional implementation, based on the time period from the start timestamp to the end timestamp, the switching process of switching from the first shooting mode to the second shooting mode in the first video file is edited to obtain the second video file. By 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 predetermined video editing strategy, a second video file with better quality is automatically obtained.

具体地,在基于从开始时间戳至结束时间戳这一时间段,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件时,可以在上述所描述的基于预定的视频编辑模板,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑的基础上,在预定的视频编辑模板的配置中添加对拍摄模式切换这一项的处理方式。因此,在基于预定的视频编辑模板对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑时,针对拍摄模式切换时,则采用视频编辑模板中所配置的处理方式对拍摄模式切换进行处理,从而完成视频的自动化制作,真正实现一键成片。Specifically, when the switching process from 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 timestamp to the end timestamp to obtain the second video file, a processing method for the shooting mode switching item can be added to the configuration of the predetermined video editing template on the basis of editing the switching process from the first shooting mode in the first video file to the second shooting mode in the first video file based on the predetermined video editing template as described above. Therefore, when editing the switching process from the first shooting mode in the first video file to the second shooting mode in the first video file based on the predetermined video editing template, the shooting mode switching is processed using the processing method configured in the video editing template for shooting mode switching, thereby completing the automated production of the video and truly achieving one-click filming.

作为一种可选的实施方式,在基于从开始时间戳至结束时间戳这一时间段,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件时,在采用视频编辑模板进行编辑时,在该视频编辑模板中针对拍摄模式切换可以配置多种处理方式,不同的处理方式,用于编辑视频以自动完成视频制作的过程也不同,下面分别举例说明。As an optional implementation, based on the time period from the start timestamp to the end timestamp, the switching process from the first shooting mode to the second shooting mode in the first video file is edited to obtain the second video file. When editing using a video editing template, a variety of processing methods can be configured in the video editing template for shooting mode switching. Different processing methods are used to edit videos to automatically complete video production. The process is also different, and examples are given below to illustrate each of them.

作为一种可选的实施方式,基于从开始时间戳至结束时间戳这一时间段,对第一视频文件中的视频进行编辑,得到第二视频文件可以包括:获取切换图像帧;在目标视频中从开始时间戳至结束时间戳的时间段内插入切换图像帧,得到处理后的视频,对处理后的视频进行编辑,得到第二视频文件;或者,在对目标视频进行编辑的过程中,在目标视频中从开始时间戳至结束时间戳的时间段内插入切换图像帧,得到第二视频文件。通过上述处理,即通过在拍摄模式切换对应的时间段插入图像帧的方式对该拍摄模式切换这一过程进行填充,有效避免在展示切换过程时,图像模糊的情况,使用户后续在观看视频时感知不到切换。As an optional implementation, based on the time period from the start timestamp to the end timestamp, editing the video in the first video file to obtain the second video file may include: obtaining a switching image frame; inserting the switching image frame in the time period from the start timestamp to the end timestamp 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 the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain the second video file. Through the above processing, that is, by inserting the image frame in the time period corresponding to the shooting mode switch to fill the process of the shooting mode switch, it is effectively avoided that the image is blurred when displaying the switching process, so that the user cannot perceive the switch when watching the video later.

因此,作为一种可选的实施方式,在基于从开始时间戳至结束时间戳的时间段,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件时,可以是先基于从开始时间戳至结束时间戳的时间段,对第一视频文件中的目标视频进行处理得到处理后的视频,而后基于视频编辑模板对得到的处理后的视频进行编辑,得到第二视频文件。也可以是,在采用视频编辑模板对目标视频进行编辑的过程中,在编辑到目标视频中开始时间戳至结束时间戳的时间段时,对该时间段进行处理,从而得到第二视频文件。因此,在采用视频编辑模板编辑视频时,可以采用视频编辑模板对原始拍摄的目标视频进行编辑,也可以采用视频编辑模板对处理后的视频进行编辑。Therefore, as an optional implementation, when editing the switching process from the first shooting mode to the second shooting mode in the first video file based on the time period from the start timestamp to the end timestamp to obtain the second video file, it can be that the target video in the first video file is first processed based on the time period from the start timestamp to the end timestamp to obtain the processed video, and then the processed video is edited based on the video editing template to obtain the second video file. It can also be that in the process of editing the target video using the video editing template, when editing the time period from the start timestamp to the end timestamp in the target video, the time period is processed to obtain the second video file. Therefore, when editing a video using the video editing template, the video editing template can be used to edit the original target video, and the video editing template can also be used to edit the processed video.

需要说明的是,不管是采用上述先处理视频再对处理后的视频进行编辑得到第二视频文件,还是采用边编辑边处理视频(即编辑视频的过程中处理视频)的方式得到第二视频文件,均可以采用预定编码器对编辑后的视频流进行编码得到预定编码格式的第二视频文件。It should be noted that regardless of whether the above-mentioned method of first processing the video and then editing the processed video to obtain the second video file is adopted, or the method of processing the video while editing (i.e. processing the video during the editing process) is adopted to obtain the second video file, a predetermined encoder can be used to encode the edited video stream to obtain a second video file in a predetermined encoding format.

图11为本申请实施例提供的一种基于标签信息对视频中的拍摄模式切换进行编辑的示意图,如图11所示,从开始时间戳T1至结束时间戳T2这一时间段插入图像帧,采用这样的处理方式时,原来在第一拍摄模式拍摄的图像帧以及在第二拍摄模式拍摄的图像帧均在对应的时间段内,不会影响原有视频的本来信息,在编辑得到视频中能够最为真实地体现原始拍摄的视频内容。Figure 11 is a schematic diagram of editing the shooting mode switching in a video based on tag information provided in an embodiment of the present application. As shown in Figure 11, image frames are inserted in the time period from the start timestamp T1 to the end timestamp T2. When such a processing method is adopted, the image frames originally shot in the first shooting mode and the image frames shot in the second shooting mode are all within the corresponding time period, which will not affect the original information of the original video, and the originally shot video content can be most realistically reflected in the edited video.

作为一种可选的实施方式,上述插入拍摄模式切换这一过程中的图像帧可以采用多种方式获取,例如,获取切换图像帧可以包括:从采用第一拍摄模式进行视频拍摄所获得的目标视频中截取目标图像帧;基于第一拍摄模式切换到第二拍摄模式的变化参数,对目标图像帧进行对应的图像参数调整,得到切换图像帧。需要说明的是,截取的目标图像帧可以是一帧图像,也可以是多帧图像。例如,目标图像帧为一帧图像时,可以是采用第一拍摄模式进行视频拍摄时所获得的最后一帧图像,也可以是最后一帧图像之前的其他帧图像,具体可以依据需求灵活选择。又例如,目标图像帧为多帧图像时,可以是从第一拍摄模式进行视频拍摄所获得的视频图像帧中截取的连续的多帧图像,可以是从最后一帧图像开始往前的多帧图像,也可以是从最后一帧之前的中间帧开始往前的多帧图像。As an optional implementation, the image frames in the process of inserting the shooting mode switching can be obtained in a variety of ways. For example, obtaining the switching image frame may include: intercepting the target image frame from the target video obtained by shooting the video in the first shooting mode; adjusting the corresponding image parameters of the target image frame based on the change parameters of the first shooting mode switching to the second shooting mode to obtain the switching image frame. It should be noted that the intercepted target image frame can be a frame of image or multiple frames of image. For example, when the target image frame is a frame of image, it can be the last frame of image obtained when shooting the video in the first shooting mode, or it can be other frames of image before the last frame of image, which can be flexibly selected according to the needs. For another example, when the target image frame is a multi-frame image, it can be a continuous multi-frame image intercepted from the video image frame obtained by shooting the video in the first shooting mode, it can be a multi-frame image starting from the last frame of image, or it can be a multi-frame image starting from the middle frame before the last frame.

在基于第一拍摄模式切换到第二拍摄模式的变化参数,对目标图像帧进行对应的图像参数调整,得到切换图像帧时,可以采用多种方式,例如,在目标图像帧为一帧图像时,根据拍摄模式切换策略(切换时长,切换帧率,切换效果等)计算切换过程中每一切换图像帧对应的图像调整参数,根据对应的图像调整参数对目标图像帧进行调整,得到对应的切换图像帧。又例如,在目标图像帧为多帧图像时,根据拍摄模式切换策略(切换时长,切换帧率,切换效果等)计算该多帧图像分别需要获得的切换图像帧的数量,针对该多帧图像中的每一帧图像,分别计算对应数量的切换图像帧的图像调整参数,并基于对应的图像调整参数对该帧图像进行调整,得到与该帧图像对应的切换图像帧。之后,基于该多帧图像中的每一帧图像所在位置,将对应得到的切换图像帧排在该帧图像之后,得到拍摄模式切换这一切换过程所包括的所有切换帧图像。When adjusting the corresponding image parameters of the target image frame based on the change parameters of switching from the first shooting mode to the second shooting mode to obtain the switching image frame, a variety of methods can be used. For example, when the target image frame is a single-frame 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, etc.), and the target image frame is adjusted according to the corresponding image adjustment parameters to obtain the corresponding switching image frame. For another example, when the target image frame is a multi-frame image, the number of switching image frames required to be obtained for the multi-frame image is calculated according to the shooting mode switching strategy (switching duration, switching frame rate, switching effect, etc.), and the image adjustment parameters of the corresponding number of switching image frames are calculated for each frame image in the multi-frame image, and the frame image is adjusted based on the corresponding image adjustment parameters to obtain the switching image frame corresponding to the frame image. Afterwards, based on the position of each frame image in the multi-frame image, the corresponding switching image frame is arranged after the frame image to obtain all the switching frame images included in the switching process of the shooting mode switching.

需要指出的是,在采用切换图像帧插入开始时间戳至结束时间戳这一时间段的方式时,只要能够对该画面模糊的时间段进行填充即可实现流畅性。例如,可以直接从采用第一拍摄模式进行视频拍摄所获得的视频图像帧时选择目标图像帧来进行填充,采用直接填充的方式操作简单,但在对生成的视频进行播放时,由于该目标图像帧在之前的时间内已经播放过,如果再次播放可能会导致画面重复,使得观看者观看到的画面出现停滞的情况。而采用对从视频图像帧中截取的目标图像帧进行图像参数调整,得到切换图像帧时,一方面不会引起上述画面停滞的情况,由于是对原画面的图像帧的图像参数进行调整后得到的,因此,与原画面存在一定的相似性,不会出现画面差别过大导致突兀的情况,实现流畅过度切换的好处。It should be pointed out that when the switching image frame is inserted into the time period from the start timestamp to the end timestamp, smoothness can be achieved as long as the blurred time period of the picture can be filled. For example, the target image frame can be directly selected from the video image frame obtained by shooting the video in the first shooting mode for filling. The direct filling method is simple to operate, but when the generated video is played, since the target image frame has been played in the previous time, if it is played again, it may cause the picture to be repeated, causing the viewer to see the picture stagnant. When the image parameters of the target image frame captured from the video image frame are adjusted to obtain the switching image frame, on the one hand, it will not cause the above-mentioned picture stagnation. Since it is obtained by adjusting the image parameters of the image frame of the original picture, it has a certain similarity with the original picture, and there will be no abrupt situation caused by excessive picture difference, thus achieving the benefit of smooth transition switching.

作为一种可选的实施方式,在基于第一拍摄模式切换到第二拍摄模式的变化参数,对目标图像帧进行对应的图像参数调整,得到切换图像帧时,可以采用以下方式:在第一拍摄模式切换到第二拍摄模式为不同拍摄速度间的切换的情况下,获取第一拍摄模式的第一拍摄速度和第二拍摄模式的第二拍摄速度之间的速度差值,对目标图像帧进行与速度差值对应的图像参数调整,得到切换图像帧;或者,在第一拍摄模式切换到第二拍摄模式为不同镜头焦距间的切换的情况下,获取第一拍摄模式的第一拍摄焦距和第二拍摄模式的第二拍摄焦距之间的焦距差值,对目标图像帧进行与焦距差值对应的图像参数调整,得到切换图像帧。As an optional implementation, when adjusting the corresponding image parameters of the target image frame based on the change parameters when the first shooting mode is switched to the second shooting mode to obtain the switched image frame, the following method can be adopted: when the switching from the first shooting mode to the second shooting mode is a switch between different shooting speeds, the speed difference between the first shooting speed of the first shooting mode and the second shooting speed of the second shooting mode is obtained, and the image parameters of the target image frame are adjusted corresponding to the speed difference to obtain the switched image frame; or, when the switching from the first shooting mode to the second shooting mode is a switch between different lens focal lengths, the focal length difference 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 the image parameters of the target image frame are adjusted corresponding to the focal length difference to obtain the switched image frame.

例如,在第一拍摄模式切换到第二拍摄模式为不同拍摄速度间的切换的情况下,例如,第一拍摄模式的拍摄速度为2倍拍摄速度,第二拍摄模式的拍摄速度为0.5倍的拍摄速度,那么,基于第一拍摄模式的拍摄速度与第二拍摄模式的拍摄速度之间的速度差值,就可以将目标图像帧的拍摄速度由2倍调整正常1倍的拍摄速度,从而得到切换图像帧。又例如,在第一拍摄模式切换到第二拍摄模式为不同镜头焦距间的切换的情况下,第一拍摄模式的拍摄焦距为1,第二拍摄模式的拍摄焦距为0.8时,基于第一拍摄模式的拍摄焦距与第二拍摄模式的拍摄焦距之间的焦距差值,就可以将目标图像帧的拍摄焦距由1调整为0.9,从而得到切换图像帧。For example, when the switching from the first shooting mode to the second shooting mode is a switching between different shooting speeds, for example, the shooting speed of the first shooting mode is 2 times the shooting speed, and the shooting speed of the second shooting mode is 0.5 times the shooting speed, then based on the speed difference between the shooting speeds of the first shooting mode and the shooting speeds of the second shooting mode, the shooting speed of the target image frame can be adjusted from 2 times to the normal shooting speed of 1 times, thereby obtaining a switching image frame. For another example, when the switching from the first shooting mode to the second shooting mode is a switching between different lens focal lengths, the shooting focal length of the first shooting mode is 1, and the shooting focal length of the second shooting mode is 0.8, based on the focal length difference between the shooting focal length of the first shooting mode and the shooting focal length of the second shooting mode, the shooting focal length of the target image frame can be adjusted from 1 to 0.9, thereby obtaining a switching image frame.

需要说明的是,获取切换图像帧对应的图像调整参数时,可以采用多种方式,例如,可以采用OpenGL渲染器中的计算模块计算得到图像调整参数。另外,图像调整参数也可以包括多种,例如,可以包括旋转角度、缩放比例、透明度、模糊度、位移量等。It should be noted that when obtaining the image adjustment parameters corresponding to the switching image frame, multiple methods can be used, for example, the image adjustment parameters can be calculated by a calculation module in the OpenGL renderer. In addition, the image adjustment parameters can also include multiple types, for example, they can include rotation angle, scaling, transparency, blur, displacement, etc.

针对上述采用插入切换图像帧的方式对目标视频中的拍摄模式切换进行处理时,对应上述两种编码方式,可以有对应的两处处理形式:一种是,将切换图像帧插入至目标视频中与拍摄模式切换这一过程对应的位置,得到完整视频流,之后对该完整视频流采用预定编码器进行编码,得到预定文件格式的第二视频文件;另一种是,对采用预定编码器对目标视频中拍摄模式切换前的视频流进行编码,得到预定文件格式的视频文件,在编码到拍摄模式切换的开始时间戳时,继续对插入的切换图像帧进行编码操作,将切换图像帧对应的编码流更新到该预定文件格式的文件中,在编码到拍摄模式切换的结束时间位置时,继续对目标视频中的拍摄模式切换后的视频流进行编码操作,继续将拍摄模式切换后的视频流的编码流更新到该预定格式的视频文件是,得到该第二视频文件。When processing the shooting mode switch in the target video by inserting the switching image frame, there can be two corresponding processing forms corresponding to the above two encoding methods: one is to insert the switching image frame into the position corresponding to the shooting mode switching process in the target video to obtain a complete video stream, and then encode the complete video stream using a predetermined encoder to obtain a second video file in a predetermined file format; the other is to encode the video stream before the shooting mode switch in the target video using a predetermined encoder to obtain a video file in a predetermined file format, and when encoding to the start timestamp of the shooting mode switch, continue to encode the inserted switching image frame, and update the encoded stream corresponding to the switching image frame to the file in the predetermined file format, and when encoding to the end time position of the shooting mode switch, continue to encode the video stream after the shooting mode switch in the target video, and continue to update the encoded stream of the video stream after the shooting mode switch to the video file in the predetermined format to obtain the second video file.

作为一种可选的实施方式,基于从开始时间戳至结束时间戳的时间段,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件还可以采用以下方式:获取在开始时间戳前的预定数量的视频图像帧;基于从开始时间戳至结束时间戳的第一时间段,以及预定数量的视频图像帧的第二时间段,确定第三时间段,其中,第三时间段为第一时间段和第二时间段之和;在目标视频中将预定数量的视频图像帧所在的第二时间段延长至第二时间段,得到处理后的视频,对处理后的视频进行编辑,得到第二视频文件;或者,在对目标视频进行编辑的过程中,在目标视频中将预定数量的视频图像帧所在的第二时间段延长至第三时间段,得到第二视频文件。通过上述处理,即通过对在拍摄模式切换前的预定数量的视频图像帧的播放参数的调整,达到将预定数量的视频图像帧进行延长播放,从而实现对该拍摄模式切换这一过程进行填充,有效避免在展示切换过程时,图像模糊的情况,也能够使用户后续在观看视频时感知不到切换。As an optional implementation, based on the time period from the start timestamp to the end timestamp, the switching process of switching from the first shooting mode to the second shooting mode in the first video file is edited to obtain the second video file. The following method can also be used: obtain a predetermined number of video image frames before the start timestamp; determine a third time period based on the first time period from the start timestamp to the end timestamp and the second time period of the predetermined number of video image frames, wherein the third time period is the sum of the first time period and the second time period; extend the second time period where the predetermined number of video image frames are located in the target video to the second time period to obtain a processed video, and edit the processed video to obtain a second video file; or, in the process of editing the target video, extend the second time period where the predetermined number of video image frames are located in the target video to the third time period to obtain the second video file. Through the above processing, that is, by adjusting the playback parameters of the predetermined number of video image frames before the shooting mode switching, the predetermined number of video image frames are extended to play, thereby filling the process of the shooting mode switching, effectively avoiding the situation of image blur when displaying the switching process, and also enabling the user to not perceive the switch when watching the video later.

作为一种可选的实施例,对处理后的视频进行编辑,得到第二视频文件包括:获取预定视频编辑模板;采用预定视频编辑模板对处理后的视频进行编辑,得到第二视频文件。上述的处理后的视频即是在目标视频中从开始时间戳至结束时间戳的时间段内插入切换图像帧,得到的视频;或者,在目标视频中将预定数量的视频图像帧所在的第二时间段延长至第二时间段,得到的视频。如上,采用预定视频编辑模板也可以对对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。As an optional embodiment, editing the processed video to obtain a second video file includes: obtaining a predetermined video editing template; using the predetermined video editing template to edit the processed video to obtain a second video file. The above-mentioned processed video is a video obtained by inserting a switching image frame in the time period from the start timestamp to the end timestamp in the target video; or, a video obtained by extending the second time period where a predetermined number of video image frames are located to the second time period in the target video. As above, the predetermined video editing template can also be used to edit the switching process from the first shooting mode to the second shooting mode in the first video file to obtain a second video file.

图12为本申请实施例提供的一种基于标签信息对目标视频中的拍摄模式切换进行编辑的示意图,如图12所示,从开始时间戳T1往前预定数量的视频图像帧所对应的时间戳为T3,将该预定数量的图像帧的由原来在从时间戳T5到开始时间戳T1这一时间段内(T5-T1)播放,调整为从时间戳T5到结束时间戳T2(T5-T2)这一时间段内播放,即通过将预定数量的图像帧由在时间段(T5-T1)内播放调整为在时间段(T5-T2)内播放,由于时间段(T5-T2)大于时间段(T5-T1),因此,实现了对该预定数量的视频图像帧的延长播放。采用这样的处理方式时,在拍摄模式切换的切换过程(T1-T2)也有了播放图像,并不会出现图像模糊,或者暗屏的情况。而且,在该拍摄模式切换的过程中也仅仅是将原来正常播放的图像帧放缓播放,视觉上不会出现太大的差别,并且不需要额外获取切换图像帧,操作简单,处理效率较高。FIG12 is a schematic diagram of editing the shooting mode switching in the target video based on tag information provided by an embodiment of the present application. As shown in FIG12, the timestamp corresponding to the predetermined number of video image frames from the start timestamp T1 to the start timestamp T1 is T3, and the predetermined number of image frames are adjusted from the original playback in the time period (T5-T1) from the timestamp T5 to the start timestamp T1 to the time period (T5-T2) from the timestamp T5 to the end timestamp T2, that is, by adjusting the predetermined number of image frames from the playback in the time period (T5-T1) to the playback in the time period (T5-T2), since the time period (T5-T2) is greater than the time period (T5-T1), the extended playback of the predetermined number of video image frames is achieved. When such a processing method is adopted, there is also a playback image in the switching process (T1-T2) of the shooting mode switching, and there will be no image blur or dark screen. Moreover, in the process of switching the shooting mode, only the original normal playback image frames are slowed down, and there will not be much difference visually, and there is no need to obtain additional switching image frames, the operation is simple, and the processing efficiency is high.

针对上述采用对预定数量的视频图像帧的延长播放的方式对目标视频中的拍摄模式切换进行处理时,对应上述两种编码方式,也有对应的两处处理形式:一种是,先对该预定数量的视频图像帧进行延长播放处理后,得到完整视频流,之后对该完整视频流采用预定编码器进行编码,得到预定文件格式的第二视频文件;另一种是,对采用预定编码器对目标视频中延长播放前的时间段的视频流进行编码,得到预定文件格式的视频文件,在编码到延长播放的时间段对应的开始时间戳时,继续对该时间段内的视频图像帧进行编码操作,将该时间段内的视频图像帧对应的编码流更新到该预定文件格式的文件中,在编码到拍摄模式切换的结束时间位置时,继续对目标视频中的拍摄模式切换后的视频流进行编码操作,继续将拍摄模式切换后的视频流的编码流更新到该预定格式的视频文件是,得到该第二视频文件。When processing the shooting mode switch in the target video by extending the playback of a predetermined number of video image frames, there are two corresponding processing forms corresponding to the above two encoding methods: one is to first extend the playback of the predetermined number of video image frames to obtain a complete video stream, and then encode the complete video stream using a predetermined encoder to obtain a second video file in a predetermined file format; the other is to encode the video stream of the time period before the extended playback in the target video using a predetermined encoder to obtain a video file in a predetermined file format, and when encoding to the start timestamp corresponding to the time period of extended playback, continue to encode the video image frames in the time period, and update the encoded streams corresponding to the video image frames in the time period to the file in the predetermined file format, and when encoding to the end time position of the shooting mode switch, continue to encode the video stream after the shooting mode switch in the target video, and continue to update the encoded stream of the video stream after the shooting mode switch to the video file in the predetermined format to obtain the second video file.

图13为本申请实施例提供的一种视频处理方法的示意图。该方法可应用于图1的电子设备,如图13所示,该视频处理方法包括两方面的处理:第一方面主要是,相机应用启动相应的摄像镜头进行视频拍摄,以及实时记录拍摄过程中执行的拍摄模式切换的标签信息,并将记录的标签信息结合拍摄得到的视频生成视频文件(即上述第一视频文件)中(如上述的图7,图8所示的处理过程,在此不再详述);第二方面主要是,视频编辑应用获取相机应用得到的视频文件,并基于视频文件中携带的标签信息来生成视频。下面结合图13进行说明,如图13所示,该视频处理方法包括如下流程。FIG13 is a schematic diagram of a video processing method provided by an embodiment of the present application. The method can be applied to the electronic device of FIG1 . As shown in FIG13 , the video processing method includes two aspects of processing: the first aspect is mainly that the camera application starts the corresponding camera lens to shoot a video, and records the tag information of the shooting mode switch executed during the shooting process in real time, and combines the recorded tag information with the video obtained by shooting to generate a video file (i.e., the above-mentioned first video file) (such as the processing process shown in FIG7 and FIG8 above, which will not be described in detail here); the second aspect is mainly that the video editing application obtains the video file obtained by the camera application, and generates a video based on the tag information carried in the video file. The following is explained in conjunction with FIG13 . As shown in FIG13 , the video processing method includes the following process.

步骤S1301:采用相机应用进行视频拍摄,在视频拍摄的过程中,记录拍摄模式切换的标签信息。Step S1301: Use a camera application to shoot a video, and during the video shooting process, record tag information of the shooting mode switching.

其中,在视频拍摄结束后,得到相机应用拍摄得到的原始视频(例如,存储于上述目标视频)。在得到原始视频后,可以执行以下操作:基于该原始视频结合视频的相关描述信息生成视频文件。视频的相关描述信息包括:上述记录的标签信息,标识视频类型的0号特殊类型标签(例如,双摄视频),视频的大小信息,视频的编码方式信息等。After the video shooting is completed, the original video shot by the camera application is obtained (for example, stored in the above-mentioned target video). After obtaining the original video, the following operations can be performed: a video file is generated based on the original video and the relevant description information of the video. The relevant description information of the video includes: the tag information of the above-mentioned record, the special type tag No. 0 that identifies the video type (for example, dual-camera video), the size information of the video, the encoding method information of the video, etc.

步骤S1302:在执行完上述操作后,将得到的携带有标签信息的第一视频文件存储到相机目录中,即存储到相机应用的预定存储空间。Step S1302: After performing the above operations, the obtained first video file carrying the tag information is stored in the camera directory, that is, stored in the predetermined storage space of the camera application.

步骤S1303:由于该第一视频文件中的视频是新拍摄的,相机会将该新拍摄的视频的相关描述信息存储到媒体提供者(MediaProvider)中,便于后续为需要该第一视频文件的需求者提供该第一视频文件的相关描述信息。Step S1303: Since the video in the first video file is newly shot, the camera will store the relevant description information of the newly shot video in the media provider (MediaProvider), so as to provide the relevant description information of the first video file to the demander who needs the first video file later.

步骤S1304:在媒体提供者接收到第一视频文件的相关描述信息时,会触发相应的通知消息,该通知消息用于通知媒体数据库同步该新的第一视频文件的相关描述信息。Step S1304: When the media provider receives the relevant description information of the first video file, a corresponding notification message is triggered, and the notification message is used to notify the media database to synchronize the relevant description information of the new first video file.

步骤S1305:媒体数据库接收到通知后,扫描并解析该0号特殊类型标签等扩展元信息,对该第一视频文件中视频的相关描述信息进行存储。Step S1305: After receiving the notification, the media database scans and parses the extended meta information such as the special type tag No. 0, and stores the relevant description information of the video in the first video file.

步骤S1306:在对携带有拍摄模式切换对应的标签信息的视频文件进行存储以及本地同步后,可以对电子设备的显示界面进行跳转,例如,可以由相机的拍摄显示界面跳转为视频编辑界面。其中,在跳转为视频编辑界面时,可以携带该第一视频文件的路径。Step S1306: After the video file carrying the tag information corresponding to the shooting mode switching is stored and locally synchronized, the display interface of the electronic device can be jumped, for example, the shooting display interface of the camera can be jumped to the video editing interface. When jumping to the video editing interface, the path of the first video file can be carried.

步骤S1307:基于上述第一视频文件的路径,从文件存储器中读取第一视频文件。Step S1307: Based on the path of the first video file, read the first video file from the file storage.

步骤S1308:从该第一视频文件中读取出携带的标签信息,之后基于该标签信息以及预定视频编辑策略对其中的该第一视频文件中的模式切换过程进行编辑,得到第二视频文件。例如,可以是基于预定的视频编辑模板(包括音乐模板或者背景图像模板)生成的15-30s的微视(Vlog)短片。Step S1308: Read the tag information carried in the first video file, and then edit the mode switching process in the first video file based on the tag information and a predetermined video editing strategy to obtain a second video file. For example, it can be a 15-30s Vlog short film generated based on a predetermined video editing template (including a music template or a background image template).

步骤S1309:将得到的第二视频文件存储到文件存储器中。Step S1309: Store the obtained second video file in the file storage.

图14为本申请实施例提供的一种电子设备的软件结构框图。本实施例的软件架构仅作为实例,还可以应用于其他操作系统。本实施例中分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将安卓(Android)系统分为四层,从上至下分别为应用层、框架层、硬件抽象层和硬件层。FIG14 is a software structure block diagram of an electronic device provided in an embodiment of the present application. The software architecture of this embodiment is only used as an example and can also be applied to other operating systems. In this embodiment, the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, namely, the application layer, the framework layer, the hardware abstraction layer, and the hardware layer from top to bottom.

应用层(Application,App)可以包括一系列应用程序包。例如,该应用程序包可以包括相机应用。应用层又可以分为显示界面和应用逻辑。The application layer (Application, App) can include a series of application packages. For example, the application package can include a camera application. The application layer can be divided into display interface and application logic.

相机应用的显示界面包括单景模式、双景模式、画中画模式等。其中,在单景模式下仅显示一个拍摄画面;在双景模式下并列显示两个拍摄画面;在画中画模式下显示两个拍摄画面,其中一个拍摄画面位于另一个拍摄画面之中。The display interface of the camera application includes single view mode, dual view mode, picture-in-picture mode, etc. Among them, in the single view mode, only one shooting screen is displayed; in the dual view mode, two shooting screens are displayed side by side; in the picture-in-picture mode, two shooting screens are displayed, and one shooting screen is located in the other shooting screen.

相机应用的应用逻辑包括切换控制模块、视频标签功能模块、多摄编码模块等。切换控制模块用于控制拍摄模式的切换;视频标签功能用于在拍摄模式切换过程中记录拍摄模式切换的标签信息;多摄编码用于在拍摄模式切换过程中保持编码,生成视频文件。The application logic of the camera application includes a switching control module, a video tag function module, a multi-camera encoding module, etc. The switching control module is used to control the switching of shooting modes; the video tag function is used to record the tag information of the shooting mode switching during the shooting mode switching process; the multi-camera encoding is used to maintain the encoding during the shooting mode switching process and generate a video file.

框架层(Framework,FWK)为应用层的应用程序提供应用编程接口(applicationprogramming interface,API)和编程框架,包括一些预先定义的函数。在图14中,框架层包括相机访问接口(Camera2 API),Camera2 API是Android推出的一套访问摄像头设备的接口,其采用管道式的设计,使数据流从摄像头流向Surface。Camera2 API包括相机管理(CameraManager)和相机设备(CameraDevice)。CameraManager为Camera设备的管理类,通过该类对象可以查询设备的Camera设备信息,得到CameraDevice对象。CameraDevice提供了Camera设备相关的一系列固定参数,例如基础的设置和输出格式等。The framework layer (Framework, FWK) provides application programming interface (application programming interface, API) and programming framework for the application layer, including some predefined functions. In Figure 14, the framework layer includes the camera access interface (Camera2 API). Camera2 API is a set of interfaces for accessing camera devices launched by Android. It adopts a pipeline design to make the data flow from the camera to the Surface. Camera2 API includes camera management (CameraManager) and camera device (CameraDevice). CameraManager is the management class of the Camera device. Through this class object, the Camera device information of the device can be queried to obtain the CameraDevice object. CameraDevice provides a series of fixed parameters related to the Camera device, such as basic settings and output format.

硬件抽象层(HAL)是位于操作系统内核与硬件电路之间的接口层,其目的在于将硬件抽象化。它隐藏了特定平台的硬件接口细节,为操作系统提供虚拟硬件平台,使其具有硬件无关性,可在多种平台上进行移植。在图14中,HAL包括相机硬件抽象层(Camera HAL),Camera HAL包括设备(Device)1、设备(Device)2、设备(Device)3等。可理解,该Device1、Device2和Device3为抽象的设备。The hardware abstraction layer (HAL) is an interface layer between the operating system kernel and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on multiple platforms. In Figure 14, HAL includes the camera hardware abstraction layer (Camera HAL), and the Camera HAL includes Device 1, Device 2, Device 3, etc. It can be understood that Device 1, Device 2, and Device 3 are abstract devices.

硬件层(HardWare,HW)是位于操作系统最底层的硬件。在图14中,HW包括相机设备(CameraDevice)1、相机设备(CameraDevice)2、相机设备(CameraDevice)3等。其中,CameraDevice1、CameraDevice2和CameraDevice3可对应于电子设备上的多个摄像头。The hardware layer (HardWare, HW) is the hardware at the bottom layer of the operating system. In FIG14 , HW includes CameraDevice 1, CameraDevice 2, CameraDevice 3, etc. Among them, CameraDevice 1, CameraDevice 2, and CameraDevice 3 may correspond to multiple cameras on an electronic device.

图15为本申请实施例提供的一种视频处理装置的结构框图。该视频处理可以应用于上述电子装置中,如图15所示,该视频处理装置,包括:接收模块1501,处理模块1502,获取模块1503,生成模块1504和编辑模块1505,下面对该装置进行说明。Figure 15 is a structural block diagram of a video processing device provided in an embodiment of the present application. The video processing can be applied to the above-mentioned electronic device. As shown in Figure 15, the video processing device includes: a receiving module 1501, a processing module 1502, an acquisition module 1503, a generation module 1504 and an editing module 1505. The device is described below.

接收模块1501,用于在采用第一拍摄模式进行视频拍摄的过程中,获取拍摄模式切换操作;The receiving module 1501 is used to obtain a shooting mode switching operation during video shooting in the first shooting mode;

处理模块1502,连接至上述接收模块1501,用于响应于拍摄模式切换操作,将第一拍摄模式切换为第二拍摄模式,并记录拍摄模式切换的标签信息,其中,拍摄模式切换的标签信息用于标记在视频拍摄过程中将第一拍摄模式切换为第二拍摄模式;a processing module 1502, connected to the receiving module 1501, for 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 to mark that the first shooting mode is switched to the second shooting mode during the video shooting process;

获取模块1503,连接至上述处理模块1502,用于获取采用第一拍摄模式和第二拍摄模式进行视频拍摄所得到的目标视频;An acquisition module 1503, connected to the processing module 1502, is used to acquire a target video obtained by shooting a video in the first shooting mode and the second shooting mode;

生成模块1504,连接至上述获取模块1503,用于基于标签信息和目标视频,生成第一视频文件;A generating module 1504, connected to the acquiring module 1503, for generating a first video file based on the tag information and the target video;

编辑模块1505,连接至上述生成模块1504,用于基于第一视频文件中的标签信息,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。The editing module 1505 is connected to the generating module 1504 and is used to edit 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 tag information in the first video file to obtain the second video file.

作为一种可选的实施例,处理模块1502包括:As an optional embodiment, the processing module 1502 includes:

记录单元,用于记录拍摄模式切换的切换标识,拍摄模式切换的开始时间戳,以及拍摄模式切换的结束时间戳,其中,标签信息包括:切换标识、开始时间戳和结束时间戳。The recording unit is used to record a switching identifier of the shooting mode switching, a start timestamp of the shooting mode switching, and an end timestamp of the shooting mode switching, wherein the tag information includes: the switching identifier, the start timestamp, and the end timestamp.

作为一种可选的实施例,记录单元包括:As an optional embodiment, the recording unit includes:

记录子单元,用于基于拍摄模式切换前的第一拍摄模式和拍摄模式切换后的第二拍摄模式,确定拍摄模式切换的切换标识;在拍摄模式切换开始时触发切换开始回调函数,将切换开始回调函数所记录的时间戳确定为拍摄模式切换的开始时间戳;以及在拍摄模式切换结束时触发切换结束回调函数,将切换结束回调函数所记录的时间戳确定为拍摄模式切换的结束时间戳。A recording subunit is used to determine a switching identifier for a shooting mode switch based on a first shooting mode before the shooting mode switch and a second shooting mode after the shooting mode switch; trigger a switching start callback function at the start of the shooting mode switch, and determine the timestamp recorded by the switching start callback function as the start timestamp of the shooting mode switch; and trigger a switching end callback function at the end of the shooting mode switch, and determine the timestamp recorded by the switching end callback function as the end timestamp of the shooting mode switch.

作为一种可选的实施例,生成模块1504包括:As an optional embodiment, the generating module 1504 includes:

写入单元,用于调用新增的标签设置接口,将标签信息写入目标视频的视频信息描述区中,调用停止接口完成第一视频文件的生成。The writing unit is used to call the newly added tag setting interface to write the tag information into the video information description area of the target video, and call the stop interface to complete the generation of the first video file.

作为一种可选的实施例,编辑模块1505包括:As an optional embodiment, the editing module 1505 includes:

提取单元,用于提取第一视频文件中的标签信息;An extraction unit, used to extract tag information from the first video file;

确定单元,用于根据标签信息,确定第一视频文件中的拍摄模式切换的开始时间戳和结束时间戳;A determination unit, configured to determine a start timestamp and an end timestamp of a shooting mode switch in a first video file according to the tag information;

编辑单元,用于基于从开始时间戳至结束时间戳的时间段,对第一视频文件中的对第一视频文件中的第一拍摄模式切换为第二拍摄模式的切换过程进行编辑,得到第二视频文件。The editing unit is used to edit 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 timestamp to the end timestamp to obtain the second video file.

作为一种可选的实施例,编辑单元包括:As an optional embodiment, the editing unit includes:

第一获取子单元,用于获取切换图像帧;A first acquisition subunit, used for acquiring a switching image frame;

插入子单元,用于在目标视频中从开始时间戳至结束时间戳的时间段内插入切换图像帧,得到处理后的视频,对处理后的视频进行编辑,得到第二视频文件;或者,在对目标视频进行编辑的过程中,在目标视频中从开始时间戳至结束时间戳的时间段内插入切换图像帧,得到第二视频文件。The inserting subunit is used to insert a switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain a processed video, and edit the processed video to obtain a second video file; or, in the process of editing the target video, insert a switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain a second video file.

作为一种可选的实施例,第一获取子单元包括:As an optional embodiment, the first acquisition subunit includes:

第一获取次子单元,用于从采用第一拍摄模式进行视频拍摄所获得的视频中截取目标图像帧;基于第一拍摄模式切换到第二拍摄模式的变化参数,对目标图像帧进行对应的图像参数调整,得到切换图像帧;或者A first acquisition sub-subunit is used to capture a target image frame from a video obtained by shooting a video in a first shooting mode; based on a change parameter when the first shooting mode is switched to a second shooting mode, adjust the corresponding image parameters of the target image frame to obtain a switched image frame; or

第一获取次子单元,用于从采用第一拍摄模式进行视频拍摄所获得的视频中截取目标图像帧,其中,切换图像帧包括目标图像帧。The first acquisition sub-subunit is used to capture a target image frame from a video obtained by shooting a video in a first shooting mode, wherein the switching image frame includes the target image frame.

作为一种可选的实施例,第一获取次子单元,用于:As an optional embodiment, the first acquisition sub-subunit is used to:

在第一拍摄模式切换到第二拍摄模式为不同拍摄速度间的切换的情况下,获取第一拍摄模式的第一拍摄速度和第二拍摄模式的第二拍摄速度之间的速度差值,对目标图像帧进行与速度差值对应的图像参数调整,得到切换图像帧;或者,In the case where the switching from the first shooting mode to the second shooting mode is a switching between different shooting speeds, a speed difference between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode is obtained, and an image parameter of a target image frame is adjusted corresponding to the speed difference to obtain a switching image frame; or

在第一拍摄模式切换到第二拍摄模式为不同镜头焦距间的切换的情况下,获取第一拍摄模式的第一拍摄焦距和第二拍摄模式的第二拍摄焦距之间的焦距差值,对目标图像帧进行与焦距差值对应的图像参数调整,得到切换图像帧。When the switch from the first shooting mode to the second shooting mode is a switch between different lens focal lengths, the focal length difference 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 the image parameters of the target image frame are adjusted corresponding to the focal length difference to obtain a switched image frame.

作为一种可选的实施例,编辑单元包括:As an optional embodiment, the editing unit includes:

第二获取子单元,用于获取在开始时间戳前的预定数量的视频图像帧;A second acquisition subunit, used to acquire a predetermined number of video image frames before the start timestamp;

确定子单元,用于基于从开始时间戳至结束时间戳的第一时间段,以及预定数量的视频图像帧所在的第二时间段,确定第三时间段,其中,第三时间段为第一时间段和第二时间段之和;A determination subunit, configured to determine a third time period based on a first time period from a start timestamp to an end timestamp and a second time period in which a predetermined number of video image frames are located, wherein the third time period is the sum of the first time period and the second time period;

处理子单元,用于在目标视频中将预定数量的视频图像帧所在的第二时间段延长至第三时间段,得到处理后的视频,对处理后的视频进行编辑,得到第二视频文件;或者,在对目标视频进行编辑的过程中,在目标视频中将预定数量的视频图像帧所在的第二时间段延长至第三时间段,得到第二视频文件。The processing subunit is used to extend the second time period in the target video where a predetermined number of video image frames are located to a third time period to obtain a processed video, and edit the processed video to obtain a second video file; or, in the process of editing the target video, extend the second time period in the target video where a predetermined number of video image frames are located to a third time period to obtain a second video file.

作为一种可选的实施例,编辑单元包括:As an optional embodiment, the editing unit includes:

第三获取子单元,用于获取预定视频编辑模板;A third acquisition subunit is used to acquire a predetermined video editing template;

编辑子单元,用于采用预定视频编辑模板对处理后的视频进行编辑,得到第二视频文件。The editing subunit is used to edit the processed video using a predetermined video editing template to obtain a second video file.

作为一种可选的实施例,拍摄模式切换包括以下至少之一:不同镜头模式间的切换,相同镜头模式内转场间的切换,不同拍摄速度间的切换,不同镜头焦距间的切换。As an optional embodiment, the shooting mode switching includes at least one of the following: switching between different lens modes, switching between transitions within the same lens mode, switching between different shooting speeds, and switching between different lens focal lengths.

与上述方法实施例相对应,本申请还提供了一种电子设备,该电子设备用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被处理器执行时,触发电子设备执行上述方法实施例中的部分或全部步骤。Corresponding to the above-mentioned method embodiment, the present application also provides an electronic device, which includes a memory for storing computer program instructions and a processor for executing program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute some or all of the steps in the above-mentioned method embodiment.

具体实现中,本申请还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,其中,在程序运行时控制计算机可读存储介质所在设备执行上述实施例中的部分或全部步骤。的存储介质可为磁碟、光盘、只读存储记忆体(英文:read-only memory,简称:ROM)或随机存储记忆体(英文:random access memory,简称:RAM)等。In a specific implementation, the present application also provides a computer storage medium, wherein the computer storage medium may store a program, wherein when the program is running, the device where the computer readable storage medium is located is controlled to perform some or all of the steps in the above embodiment. The storage medium may be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

具体实现中,本申请实施例还提供了一种计算机程序产品,计算机程序产品包含可执行指令,当可执行指令在计算机上执行时,使得计算机执行上述方法实施例中的部分或全部步骤。In a specific implementation, an embodiment of the present application further provides a computer program product, which includes executable instructions. When the executable instructions are executed on a computer, the computer executes some or all of the steps in the above method embodiment.

本申请实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示单独存在A、同时存在A和B、单独存在B的情况。其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项”及其类似表达,是指的这些项中的任意组合,包括单项或复数项的任意组合。例如,a,b和c中的至少一项可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And/or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and/or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character "/" generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple.

本领域普通技术人员可以意识到,本文中公开的实施例中描述的各单元及算法步骤,能够以电子硬件、计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

在本发明所提供的几个实施例中,任一功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,简称ROM)、随机存取存储器(random access memory,简称RAM)、磁碟或者光盘等各种可以存储程序代码的介质。In several embodiments provided by the present invention, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

以上,仅为本发明的具体实施方式,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. The protection scope of the present invention should be based on the protection scope of the claims.

Claims (24)

1.一种视频处理方法,其特征在于,包括:1. A video processing method, comprising: 在采用第一拍摄模式进行视频拍摄的过程中,获取拍摄模式切换操作;In the process of shooting a video in the first shooting mode, obtaining a shooting mode switching operation; 响应于所述拍摄模式切换操作,将所述第一拍摄模式切换为第二拍摄模式,并记录拍摄模式切换的标签信息,其中,所述拍摄模式切换的标签信息用于标记在所述视频拍摄过程中将所述第一拍摄模式切换为所述第二拍摄模式;In response to the shooting mode switching operation, the first shooting mode is switched to a second shooting mode, and tag information of the shooting mode switching is recorded, wherein the tag information of the shooting mode switching is used to mark that the first shooting mode is switched to the second shooting mode during the video shooting process; 获取采用所述第一拍摄模式和所述第二拍摄模式进行视频拍摄所得到的目标视频;Acquire a target video obtained by shooting a video using the first shooting mode and the second shooting mode; 基于所述标签信息和所述目标视频,生成第一视频文件;Based on the tag information and the target video, generate a first video file; 基于所述第一视频文件中的所述标签信息,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到第二视频文件;所述第一视频文件中的所述标签信息包括所述第一视频文件中所述拍摄模式切换的开始时间戳和结束时间戳;Based on the tag information in the first video file, the switching process from the first shooting mode to the second shooting mode in the first video file is edited to obtain a second video file; the tag information in the first video file includes a start timestamp and an end timestamp of the shooting mode switching in the first video file; 所述基于所述第一视频文件中的所述标签信息,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到第二视频文件,包括:The step of editing the switching process from 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 includes: 在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入切换图像帧,得到所述第二视频文件;所述切换图像帧为从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取得到的,或者,所述切换图像帧为对采用所述第一拍摄模式进行视频拍摄所获得的视频中截取得到的图像帧进行图像参数调整得到的。A switching image frame is inserted in the target video within the time period from the start timestamp to the end timestamp to obtain the second video file; the switching image frame is captured from the video obtained by shooting the video in the first shooting mode, or the switching image frame is obtained by adjusting image parameters of an image frame captured from the video obtained by shooting the video in the first shooting mode. 2.根据权利要求1所述的方法,其特征在于,所述记录所述拍摄模式切换的标签信息包括:2. The method according to claim 1, wherein the tag information recording the switching of the shooting mode comprises: 记录所述拍摄模式切换的切换标识,所述拍摄模式切换的开始时间戳,以及所述拍摄模式切换的结束时间戳,其中,所述标签信息包括:所述切换标识、所述开始时间戳和所述结束时间戳。Recording the switching identifier of the shooting mode switching, the start timestamp of the shooting mode switching, and the end timestamp of the shooting mode switching, wherein the tag information includes: the switching identifier, the start timestamp, and the end timestamp. 3.根据权利要求2所述的方法,其特征在于,所述记录所述拍摄模式切换的切换标识,所述拍摄模式切换的开始时间戳,以及所述拍摄模式切换的结束时间戳包括:3. The method according to claim 2, characterized in that the recording of the switching identifier of the shooting mode switching, the start timestamp of the shooting mode switching, and the end timestamp of the shooting mode switching comprises: 基于拍摄模式切换前的所述第一拍摄模式和拍摄模式切换后的所述第二拍摄模式,确定所述拍摄模式切换的切换标识;determining 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 switch start callback function when the shooting mode switch starts, and determining the timestamp recorded by the switch start callback function as the start timestamp of the shooting mode switch; and 在所述拍摄模式切换结束时触发切换结束回调函数,将所述切换结束回调函数所记录的时间戳确定为所述拍摄模式切换的结束时间戳。When the shooting mode switching ends, a switching end callback function is triggered, and a timestamp recorded by the switching end callback function is determined as an end timestamp of the shooting mode switching. 4.根据权利要求1所述的方法,其特征在于,所述基于所述标签信息和所述目标视频,生成第一视频文件包括:4. The method according to claim 1, wherein generating the first video file based on the tag information and the target video comprises: 调用新增的标签设置接口,将所述标签信息写入所述目标视频的视频信息描述区中,调用停止接口完成所述第一视频文件的生成。The newly added tag setting interface is called to write the tag information into the video information description area of the target video, and the stop interface is called to complete the generation of the first video file. 5.根据权利要求1所述的方法,其特征在于,所述基于所述第一视频文件中的所述标签信息,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到第二视频文件包括:5. The method according to claim 1, characterized in that the step of editing the switching process from 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 the second video file comprises: 提取所述第一视频文件中的所述标签信息;Extracting the tag information in the first video file; 根据所述标签信息,确定所述第一视频文件中所述拍摄模式切换的开始时间戳和结束时间戳;Determine, according to the tag information, a start timestamp and an end timestamp of the shooting mode switching in the first video file; 基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件。Based on the time period from the start timestamp to the end timestamp, the switching process from the first shooting mode to the second shooting mode in the first video file is edited to obtain the second video file. 6.根据权利要求5所述的方法,其特征在于,所述基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件包括:6. The method according to claim 5, characterized in that the step of editing the switching process from the first shooting mode to the second shooting mode in the first video file based on the time period from the start timestamp to the end timestamp to obtain the second video file comprises: 获取切换图像帧;Get the switching image frame; 在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到所述第二视频文件。Insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain a processed video, and edit the processed video to obtain the second video file; or, in the process of editing the target video, insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain the second video file. 7.根据权利要求6所述的方法,其特征在于,所述获取切换图像帧包括:7. The method according to claim 6, wherein acquiring the switching image frame comprises: 从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取目标图像帧;基于所述第一拍摄模式切换到所述第二拍摄模式的变化参数,对所述目标图像帧进行对应的图像参数调整,得到所述切换图像帧;或者Intercepting a target image frame from a video obtained by shooting the video in the first shooting mode; adjusting the corresponding image parameters of the target image frame based on the change parameters of switching from the first shooting mode to the second shooting mode to obtain the switched image frame; or 从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取所述目标图像帧,其中,所述切换图像帧包括所述目标图像帧。The target image frame is captured from a video obtained by shooting a video in the first shooting mode, wherein the switching image frame includes the target image frame. 8.根据权利要求7所述的方法,其特征在于,所述基于所述第一拍摄模式切换到所述第二拍摄模式的变化参数,对所述目标图像帧进行对应的图像参数调整,得到所述切换图像帧,包括:8. The method according to claim 7, characterized in that the step of adjusting the corresponding image parameters of the target image frame based on the change parameters of switching from the first shooting mode to the second shooting mode to obtain the switched image frame comprises: 在所述第一拍摄模式切换到所述第二拍摄模式为不同拍摄速度间的切换的情况下,获取所述第一拍摄模式的第一拍摄速度和所述第二拍摄模式的第二拍摄速度之间的速度差值,对所述目标图像帧进行与所述速度差值对应的图像参数调整,得到所述切换图像帧;或者,In the case where the switching from the first shooting mode to the second shooting mode is a switching between different shooting speeds, obtaining a speed difference between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode, and adjusting image parameters of the target image frame corresponding to the speed difference to obtain the switching image frame; or 在所述第一拍摄模式切换到所述第二拍摄模式为不同镜头焦距间的切换的情况下,获取所述第一拍摄模式的第一拍摄焦距和所述第二拍摄模式的第二拍摄焦距之间的焦距差值,对所述目标图像帧进行与所述焦距差值对应的图像参数调整,得到所述切换图像帧。When the switching from the first shooting mode to the second shooting mode is a switch between different lens focal lengths, the focal length difference 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 the image parameters of the target image frame corresponding to the focal length difference are adjusted to obtain the switched image frame. 9.根据权利要求5所述的方法,其特征在于,所述基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件包括:9. The method according to claim 5, characterized in that the step of editing the switching process from the first shooting mode to the second shooting mode in the first video file based on the time period from the start timestamp to the end timestamp to obtain the second video file comprises: 获取在所述开始时间戳前的预定数量的视频图像帧;Acquire a predetermined number of video image frames before the start timestamp; 基于从所述开始时间戳至所述结束时间戳的第一时间段,以及所述预定数量的视频图像帧所在的第二时间段,确定第三时间段,其中,所述第三时间段为所述第一时间段和所述第二时间段之和;Determine a third time period based on a first time period from the start timestamp to the end timestamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is the sum of the first time period and the second time period; 在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到所述第二视频文件。In the target video, the second time period where the predetermined number of video image frames are located is extended to the third time period to obtain a processed video, and the processed video is edited to obtain the second video file; or, in the process of editing the target video, the second time period where the predetermined number of video image frames are located is extended to the third time period in the target video to obtain the second video file. 10.根据权利要求6或9所述的方法,其特征在于,所述对所述处理后的视频进行编辑,得到所述第二视频文件包括:10. The method according to claim 6 or 9, characterized in that the step of editing the processed video to obtain the second video file comprises: 获取预定视频编辑模板;Get pre-defined video editing templates; 采用所述预定视频编辑模板对所述处理后的视频进行编辑,得到所述第二视频文件。The processed video is edited using the predetermined video editing template to obtain the second video file. 11.根据权利要求1至9中任一项所述的方法,其特征在于,所述拍摄模式切换包括以下至少之一:不同镜头模式间的切换,相同镜头模式内转场间的切换,不同拍摄速度间的切换,不同镜头焦距间的切换。11. The method according to any one of claims 1 to 9, characterized in that the shooting mode switching includes at least one of the following: switching between different lens modes, switching between transitions within the same lens mode, switching between different shooting speeds, and switching between different lens focal lengths. 12.一种视频处理装置,其特征在于,包括:12. A video processing device, comprising: 接收模块,用于在采用第一拍摄模式进行视频拍摄的过程中,获取拍摄模式切换操作;A receiving module, used for obtaining a shooting mode switching operation during video shooting in a first shooting mode; 处理模块,用于响应于所述拍摄模式切换操作,将所述第一拍摄模式切换为第二拍摄模式,并记录拍摄模式切换的标签信息,其中,所述拍摄模式切换的标签信息用于标记在所述视频拍摄过程中将所述第一拍摄模式切换为所述第二拍摄模式;a processing module, configured to switch the first shooting mode to a second shooting mode in response to the shooting mode switching operation, and record tag information of the shooting mode switching, wherein the tag information of the shooting mode switching is used to mark that the first shooting mode is switched to the second shooting mode during the video shooting process; 获取模块,用于获取采用所述第一拍摄模式和所述第二拍摄模式进行视频拍摄所得到的目标视频;An acquisition module, used for acquiring a target video obtained by shooting a video in the first shooting mode and the second shooting mode; 生成模块,用于基于所述标签信息和所述目标视频,生成第一视频文件;A generating module, configured to generate a first video file based on the tag information and the target video; 编辑模块,用于基于所述第一视频文件中的所述标签信息,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到第二视频文件;所述第一视频文件中的所述标签信息包括所述第一视频文件中所述拍摄模式切换的开始时间戳和结束时间戳;an editing module, configured to edit the switching process of switching from 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 a second video file; the tag information in the first video file includes a start timestamp and an end timestamp of the shooting mode switching in the first video file; 所述编辑模块,还用于基于所述第一视频文件中的所述标签信息,在所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程中插入切换图像帧,得到所述第二视频文件;所述切换图像帧为从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取得到的,或者,所述切换图像帧为对采用所述第一拍摄模式进行视频拍摄所获得的视频中截取得到的图像帧进行图像参数调整得到的。The editing module is also used to insert a switching image frame in the switching process from 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 the second video file; the switching image frame is captured from the video obtained by adopting the first shooting mode for video shooting, or the switching image frame is obtained by adjusting image parameters of an image frame captured from the video obtained by adopting the first shooting mode for video shooting. 13.根据权利要求12所述的装置,其特征在于,所述处理模块包括:13. The device according to claim 12, wherein the processing module comprises: 记录单元,用于记录所述拍摄模式切换的切换标识,所述拍摄模式切换的开始时间戳,以及所述拍摄模式切换的结束时间戳,其中,所述标签信息包括:所述切换标识、所述开始时间戳和所述结束时间戳。A recording unit is used to record a switching identifier of the shooting mode switching, a start timestamp of the shooting mode switching, and an end timestamp of the shooting mode switching, wherein the tag information includes: the switching identifier, the start timestamp, and the end timestamp. 14.根据权利要求13所述的装置,其特征在于,所述记录单元包括:14. The device according to claim 13, wherein the recording unit comprises: 记录子单元,用于基于拍摄模式切换前的所述第一拍摄模式和拍摄模式切换后的所述第二拍摄模式,确定所述拍摄模式切换的切换标识;在所述拍摄模式切换开始时触发切换开始回调函数,将所述切换开始回调函数所记录的时间戳确定为所述拍摄模式切换的开始时间戳;以及在所述拍摄模式切换结束时触发切换结束回调函数,将所述切换结束回调函数所记录的时间戳确定为所述拍摄模式切换的结束时间戳。A recording subunit is used to determine the 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; trigger a switching start callback function when the shooting mode switching starts, and determine the timestamp recorded by the switching start callback function as the starting timestamp of the shooting mode switching; and trigger a switching end callback function when the shooting mode switching ends, and determine the timestamp recorded by the switching end callback function as the ending timestamp of the shooting mode switching. 15.根据权利要求12所述的装置,其特征在于,所述生成模块包括:15. The device according to claim 12, wherein the generating module comprises: 写入单元,用于调用新增的标签设置接口,将所述标签信息写入所述目标视频的视频信息描述区中,调用停止接口完成所述第一视频文件的生成。The writing unit is used to call the newly added tag setting interface to write the tag information into the video information description area of the target video, and call the stop interface to complete the generation of the first video file. 16.根据权利要求12所述的装置,其特征在于,所述编辑模块包括:16. The device according to claim 12, wherein the editing module comprises: 提取单元,用于提取所述第一视频文件中的所述标签信息;An extraction unit, used for extracting the tag information in the first video file; 确定单元,用于根据所述标签信息,确定所述第一视频文件中的所述拍摄模式切换的开始时间戳和结束时间戳;a determining unit, configured to determine a start timestamp and an end timestamp of the shooting mode switching in the first video file according to the tag information; 编辑单元,用于基于从所述开始时间戳至所述结束时间戳的时间段,对所述第一视频文件中的所述第一拍摄模式切换为所述第二拍摄模式的切换过程进行编辑,得到所述第二视频文件。An editing unit is used to edit the switching process of switching from the first shooting mode to the second shooting mode in the first video file based on a time period from the start timestamp to the end timestamp to obtain the second video file. 17.根据权利要求16所述的装置,其特征在于,所述编辑单元包括:17. The device according to claim 16, wherein the editing unit comprises: 第一获取子单元,用于获取切换图像帧;A first acquisition subunit, used for acquiring a switching image frame; 插入子单元,用于在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中从所述开始时间戳至所述结束时间戳的时间段内插入所述切换图像帧,得到所述第二视频文件。An inserting subunit is used to insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain a processed video, and edit the processed video to obtain the second video file; or, in the process of editing the target video, insert the switching image frame in the time period from the start timestamp to the end timestamp in the target video to obtain the second video file. 18.根据权利要求17所述的装置,其特征在于,所述第一获取子单元包括:18. The device according to claim 17, wherein the first acquisition subunit comprises: 第一获取次子单元,用于从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取目标图像帧;基于所述第一拍摄模式切换到所述第二拍摄模式的变化参数,对所述目标图像帧进行对应的图像参数调整,得到所述切换图像帧;或者A first acquisition sub-subunit is configured to capture a target image frame from a video obtained by shooting the video in the first shooting mode; based on a change parameter when the first shooting mode is switched to the second shooting mode, adjust the corresponding image parameters of the target image frame to obtain the switched image frame; or 第一获取次子单元,用于从采用所述第一拍摄模式进行视频拍摄所获得的视频中截取所述目标图像帧,其中,所述切换图像帧包括所述目标图像帧。The first acquisition sub-subunit is used to capture the target image frame from the video obtained by video shooting in the first shooting mode, wherein the switching image frame includes the target image frame. 19.根据权利要求18所述的装置,其特征在于,所述第一获取次子单元,用于:19. The device according to claim 18, wherein the first acquisition sub-subunit is used to: 在所述第一拍摄模式切换到所述第二拍摄模式为不同拍摄速度间的切换的情况下,获取所述第一拍摄模式的第一拍摄速度和所述第二拍摄模式的第二拍摄速度之间的速度差值,对所述目标图像帧进行与所述速度差值对应的图像参数调整,得到所述切换图像帧;或者,In the case where the switching from the first shooting mode to the second shooting mode is a switching between different shooting speeds, obtaining a speed difference between a first shooting speed of the first shooting mode and a second shooting speed of the second shooting mode, and adjusting image parameters of the target image frame corresponding to the speed difference to obtain the switching image frame; or 在所述第一拍摄模式切换到所述第二拍摄模式为不同镜头焦距间的切换的情况下,获取所述第一拍摄模式的第一拍摄焦距和所述第二拍摄模式的第二拍摄焦距之间的焦距差值,对所述目标图像帧进行与所述焦距差值对应的图像参数调整,得到所述切换图像帧。When the switching from the first shooting mode to the second shooting mode is a switch between different lens focal lengths, the focal length difference 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 the image parameters of the target image frame corresponding to the focal length difference are adjusted to obtain the switched image frame. 20.根据权利要求16所述的装置,其特征在于,所述编辑单元包括:20. The device according to claim 16, wherein the editing unit comprises: 第二获取子单元,用于获取在所述开始时间戳前的预定数量的视频图像帧;A second acquisition subunit, configured to acquire a predetermined number of video image frames before the start timestamp; 确定子单元,用于基于从所述开始时间戳至所述结束时间戳的第一时间段,以及所述预定数量的视频图像帧所在的第二时间段,确定第三时间段,其中,所述第三时间段为所述第一时间段和所述第二时间段之和;a determination subunit, configured to determine a third time period based on a first time period from the start timestamp to the end timestamp and a second time period in which the predetermined number of video image frames are located, wherein the third time period is the sum of the first time period and the second time period; 处理子单元,用于在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到处理后的视频,对所述处理后的视频进行编辑,得到所述第二视频文件;或者,在对所述目标视频进行编辑的过程中,在所述目标视频中将所述预定数量的视频图像帧所在的所述第二时间段延长至所述第三时间段,得到所述第二视频文件。A processing subunit is used to extend the second time period in the target video where the predetermined number of video image frames are located to the third time period to obtain a processed video, and edit the processed video to obtain the second video file; or, during the process of editing the target video, extend the second time period in the target video where the predetermined number of video image frames are located to the third time period to obtain the second video file. 21.根据权利要求16或20所述的装置,其特征在于,所述编辑单元包括:21. The device according to claim 16 or 20, characterized in that the editing unit comprises: 第三获取子单元,用于获取预定视频编辑模板;A third acquisition subunit is used to acquire a predetermined video editing template; 编辑子单元,用于采用所述预定视频编辑模板对所述处理后的视频进行编辑,得到所述第二视频文件。The editing subunit is used to edit the processed video using the predetermined video editing template to obtain the second video file. 22.根据权利要求12至20中任一项所述的装置,其特征在于,所述拍摄模式切换包括以下至少之一:不同镜头模式间的切换,相同镜头模式内转场间的切换,不同拍摄速度间的切换,不同镜头焦距间的切换。22. The device according to any one of claims 12 to 20, characterized in that the shooting mode switching includes at least one of the following: switching between different lens modes, switching between transitions within the same lens mode, switching between different shooting speeds, and switching between different lens focal lengths. 23.一种电子设备,其特征在于,包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被所述处理器执行时,触发所述电子设备执行权利要求1至11中任一项所述的方法。23. An electronic device, characterized in that it comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method according to any one of claims 1 to 11. 24.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括存储的程序,其中,在所述程序运行时控制所述计算机可读存储介质所在设备执行权利要求1至11中任意一项所述的方法。24. A computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117793245B (en) * 2022-09-20 2025-08-08 荣耀终端股份有限公司 Shooting mode switching method, electronic device and readable storage medium
CN117729426B (en) * 2023-07-05 2024-11-15 荣耀终端有限公司 Mode switching method, electronic device and storage medium

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 广东小天才科技有限公司 Video editing 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 华为技术有限公司 A video editing method and electronic device
CN111885305A (en) * 2020-07-28 2020-11-03 Oppo广东移动通信有限公司 Preview image processing method and device, storage medium and electronic device
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 广东小天才科技有限公司 Video editing 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 华为技术有限公司 A video editing method and electronic device
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 image processing method and device, storage medium and electronic device
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
CN113767618B (en) Real-time video special effect system and method
CN112291627B (en) Video editing method and device, mobile terminal and storage medium
EP3526964B1 (en) Masking in video stream
US11563915B2 (en) Media content presentation
US20200296317A1 (en) Media content presentation
KR101604250B1 (en) Method of Providing Service for Recommending Game Video
CN114296949A (en) A virtual reality device and high-definition screen capture method
US20170024110A1 (en) Video editing on mobile platform
KR101919475B1 (en) Device and methodfor providing user interface
CN113747240B (en) Video processing method, device and storage medium
CN102752639A (en) Method and Device for Handling Multiple Video Streams Using Metadata
CN107995482B (en) Video file processing method and device
CN112839190B (en) Method for synchronously recording or live broadcasting virtual image and real scene
CN115002335B (en) Video processing method, apparatus, electronic device, and computer-readable storage medium
RU2694802C2 (en) Creating electronic images, editing images and simplified audio/video editing device, film production method starting from still images and audio tracks
US20230120437A1 (en) Systems for generating dynamic panoramic video content
CN110740261A (en) Video recording method, device, terminal and storage medium
JP5393237B2 (en) Image display apparatus, control method therefor, program, and storage medium
JP6143678B2 (en) Information processing apparatus, information processing method, and program
WO2018085982A1 (en) Video recording method and apparatus, and photographing device
EP3684048B1 (en) A method for presentation of images
WO2023030270A1 (en) Audio/video processing method and apparatus and electronic device
CN107231537B (en) A kind of picture-in-picture switching method and apparatus
CN116708696B (en) Video processing method and electronic device
CN108156512B (en) Video playing control method and device

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
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China