[go: up one dir, main page]

CN114979533B - Video recording method, device and terminal - Google Patents

Video recording method, device and terminal Download PDF

Info

Publication number
CN114979533B
CN114979533B CN202210552032.7A CN202210552032A CN114979533B CN 114979533 B CN114979533 B CN 114979533B CN 202210552032 A CN202210552032 A CN 202210552032A CN 114979533 B CN114979533 B CN 114979533B
Authority
CN
China
Prior art keywords
storage path
video
sub
time
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
CN202210552032.7A
Other languages
Chinese (zh)
Other versions
CN114979533A (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.)
Hisense Mobile Communications Technology Co Ltd
Original Assignee
Hisense Mobile Communications Technology 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 Hisense Mobile Communications Technology Co Ltd filed Critical Hisense Mobile Communications Technology Co Ltd
Priority to CN202210552032.7A priority Critical patent/CN114979533B/en
Publication of CN114979533A publication Critical patent/CN114979533A/en
Application granted granted Critical
Publication of CN114979533B publication Critical patent/CN114979533B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • H04N5/91Television signal processing therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

本申请实施例提供了一种视频录制方法、装置及终端,在视频录制过程中,获取当前时间,若该当前时间为整数时间,确定与当前时间对应的关键帧,并将该关键帧对应的录制时间更新为该当前时间,其中,该整数时间为整分整秒的时间,对该关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件,并保存该第一子视频文件。即在本申请实施例中,在视频录制过程中,当当前时间为整数时间时,终端确定该当前时间对应的关键帧,使得后续用户在通过终端从已经录制的视频中截取子视频时,截取的开始时间和结束时间分别对应的视频帧均为关键帧,从而避免截取的子视频出现丢帧的情况,提高了用户的使用感受。

The embodiment of the present application provides a video recording method, device and terminal. During the video recording process, the current time is obtained. If the current time is an integer time, the key frame corresponding to the current time is determined, and the recording time corresponding to the key frame is updated to the current time, wherein the integer time is a whole minute and a whole second. The video frame between the key frame and the previous key frame is encoded to obtain a first sub-video file, and the first sub-video file is saved. That is, during the video recording process, in the embodiment of the present application, when the current time is an integer time, the terminal determines the key frame corresponding to the current time, so that when the subsequent user intercepts a sub-video from the recorded video through the terminal, the video frames corresponding to the start time and the end time of the interception are all key frames, thereby avoiding the situation of frame loss in the intercepted sub-video, and improving the user experience.

Description

一种视频录制方法、装置及终端Video recording method, device and terminal

技术领域Technical Field

本申请涉及视频处理技术领域,尤其涉及一种视频录制方法、装置及终端。The present application relates to the field of video processing technology, and in particular to a video recording method, device and terminal.

背景技术Background Art

随着科技的发展,目前视频录制技术已经广泛应用于社会生活、生产的各种场景。其中,在进行视频录制时,为了确保视频数据的完整性等考量,终端经常会录制一些内存较多、时间较长的视频。用户可以从录制的视频中截取想要的某个时段的子视频。With the development of science and technology, video recording technology has been widely used in various scenes of social life and production. When recording videos, in order to ensure the integrity of video data, terminals often record videos with large memory and long duration. Users can capture a sub-video of a desired period of time from the recorded video.

在现有技术中,终端在进行视频录制时,会对位于相邻两个关键帧之间的视频帧进行编码,并生成对应的视频文件。其中,在现有技术中,终端中保存有预设时间长度,该终端在开始进行视频录制,将录制的首个视频帧确定为关键帧,并将该首个视频帧之后的每个预设时间长度录制的每个视频帧分别确定为关键帧。In the prior art, when a terminal is recording a video, it encodes the video frames between two adjacent key frames and generates a corresponding video file. In the prior art, a preset time length is stored in the terminal. When the terminal starts recording a video, it determines the first recorded video frame as a key frame, and determines each video frame recorded for each preset time length after the first video frame as a key frame.

由于视频开始录制的时间是由用户手动控制的,因此首个视频帧的录制时间可能不是整时整分整秒,例如从八点十分五十秒三十毫秒开始进行录制。但是,在截取子视频时,终端需要根据用户选择的初始时间及结束时间对视频文件截取及解码,其中该初始时间和结束时间都是整时整分整秒,这就导致要查看某分某秒的视频时,该初始时间对应的视频帧不是关键帧,而对于视频文件要想解码,必须从关键帧开始,如果初始时间对应的视频帧不是关键帧,那么会从后面第一个关键帧开始进行解码,该第一个关键帧之前的视频帧将会丢失,导致截取到的子视频丢帧。Since the start time of video recording is manually controlled by the user, the recording time of the first video frame may not be the whole hour, minute, and second, for example, the recording starts at 8:10:50 and 30 milliseconds. However, when intercepting the sub-video, the terminal needs to intercept and decode the video file according to the initial time and end time selected by the user, where the initial time and end time are both the whole hour, minute, and second. This results in that when you want to view the video of a certain minute and second, the video frame corresponding to the initial time is not a key frame. To decode the video file, you must start from the key frame. If the video frame corresponding to the initial time is not a key frame, then the decoding will start from the first key frame behind, and the video frames before the first key frame will be lost, resulting in frame loss of the intercepted sub-video.

发明内容Summary of the invention

本申请提供了一种视频录制方法、装置及终端,用以解决现有技术中在截取子视频时,因为录制的视频的关键帧不是整分整秒,截取的子视频的第一个关键帧之前的视频帧丢失,导致截取到的子视频丢帧的问题。The present application provides a video recording method, device and terminal, which are used to solve the problem in the prior art that when intercepting a sub-video, because the key frames of the recorded video are not full minutes and seconds, the video frames before the first key frame of the intercepted sub-video are lost, resulting in frame loss of the intercepted sub-video.

第一方面,本申请实施例提供了一种视频录制方法,应用于终端,所述方法包括:In a first aspect, an embodiment of the present application provides a video recording method, which is applied to a terminal, and the method includes:

在视频录制过程中,获取当前时间,若所述当前时间为整数时间,则确定与当前时间对应的关键帧,并将所述关键帧对应的录制时间更新为所述当前时间,其中,所述整数时间为整分整秒的时间;During the video recording process, the current time is obtained. If the current time is an integer time, a key frame corresponding to the current time is determined, and the recording time corresponding to the key frame is updated to the current time, wherein the integer time is a time of whole minutes and whole seconds;

对所述关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件,并保存所述第一子视频文件。The video frames between the key frame and the previous key frame are encoded to obtain a first sub-video file, and the first sub-video file is saved.

第二方面,本申请实施例还提供了一种视频录制装置,应用于终端,所述装置包括:In a second aspect, an embodiment of the present application further provides a video recording device, applied to a terminal, the device comprising:

处理模块,用于在视频录制过程中,获取当前时间,若确定所述当前时间为整数时间,则确定与当前时间对应的关键帧,并将所述关键帧对应的录制时间更新为所述当前时间,其中,所述整数时间为整分整秒的时间;A processing module, used for obtaining the current time during video recording, and if it is determined that the current time is an integer time, determining a key frame corresponding to the current time, and updating the recording time corresponding to the key frame to the current time, wherein the integer time is a time of whole minutes and whole seconds;

编码模块,用于对所述关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件;An encoding module, used for encoding the video frame between the key frame and the previous key frame to obtain a first sub-video file;

保存模块,用于保存所述第一子视频文件。A saving module is used to save the first sub-video file.

第三方面,本申请实施例还提供了一种终端,所述终端包括:In a third aspect, an embodiment of the present application further provides a terminal, the terminal comprising:

显示器、处理器和存储器;Display, processor and memory;

所述显示器用于显示屏幕显示区域;The display is used to display the screen display area;

所述存储器,用于存储所述处理器可执行指令;The memory is used to store the processor executable instructions;

所述处理器被配置为执行所述指令以实现如上述中任一项所述的视频录制方法。The processor is configured to execute the instructions to implement the video recording method as described in any one of the above.

在本申请实施例中,在视频录制过程中,获取当前时间,若该当前时间为整数时间,确定与当前时间对应的关键帧,并将该关键帧对应的录制时间更新为该当前时间,其中,该整数时间为整分整秒的时间,对该关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件,并保存该第一子视频文件。即在本申请实施例中,在视频录制过程中,当当前时间为整数时间时,终端确定该当前时间对应的关键帧,使得后续用户在通过终端从已经录制的视频中截取子视频时,截取的开始时间和结束时间分别对应的视频帧均为关键帧,从而避免截取的子视频出现丢帧的情况,提高了用户的使用感受。In an embodiment of the present application, during the video recording process, the current time is obtained. If the current time is an integer time, the key frame corresponding to the current time is determined, and the recording time corresponding to the key frame is updated to the current time, wherein the integer time is a whole minute and a whole second. The video frame between the key frame and the previous key frame is encoded to obtain a first sub-video file, and the first sub-video file is saved. That is, during the video recording process, when the current time is an integer time, the terminal determines the key frame corresponding to the current time, so that when the subsequent user intercepts a sub-video from the recorded video through the terminal, the video frames corresponding to the start time and the end time of the interception are all key frames, thereby avoiding the situation of frame loss in the intercepted sub-video, and improving the user experience.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of 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 any creative work.

图1示出了一种终端100的结构示意图;FIG1 shows a schematic structural diagram of a terminal 100;

图2是本申请实施例的一种终端100的软件结构框图;FIG2 is a software structure block diagram of a terminal 100 according to an embodiment of the present application;

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

图4为现有技术提供的视频帧序列示意图;FIG4 is a schematic diagram of a video frame sequence provided by the prior art;

图5为本申请实施例提供的视频帧序列示意图;FIG5 is a schematic diagram of a video frame sequence provided in an embodiment of the present application;

图6为本申请实施例提供的视频录制的流程示意图;FIG6 is a schematic diagram of a video recording process according to an embodiment of the present application;

图7为本申请实施例提供的视频录制流程示意图;FIG7 is a schematic diagram of a video recording process provided in an embodiment of the present application;

图8为本申请实施例提供的数据库的示意图;FIG8 is a schematic diagram of a database provided in an embodiment of the present application;

图9为本申请实施例提供的将存储路径和开始时间对应保存的流程图;9 is a flowchart of storing the corresponding storage path and start time provided by an embodiment of the present application;

图10为本申请实施例提供的视频播放过程示意图;FIG10 is a schematic diagram of a video playback process provided in an embodiment of the present application;

图11为本申请实施例提供的视频截取过程示意图;FIG11 is a schematic diagram of a video capture process provided in an embodiment of the present application;

图12为本申请实施例提供的视频截取过程示意图;FIG12 is a schematic diagram of a video capture process provided in an embodiment of the present application;

图13为本申请实施例提供的视频录制装置的结构示意图;FIG13 is a schematic diagram of the structure of a video recording device provided in an embodiment of the present application;

图14为本申请实施例提供的终端的另一种结构示意图。FIG. 14 is another schematic diagram of the structure of a terminal provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, 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.

图1示出了一种终端100的结构示意图。应该理解的是,图1所示终端100仅是一个范例,并且终端100可以具有比图1中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。FIG1 shows a schematic diagram of the structure of a terminal 100. It should be understood that the terminal 100 shown in FIG1 is only an example, and the terminal 100 may have more or fewer components than those shown in FIG1, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.

图1中示例性示出了根据示例性实施例中终端100的硬件配置框图。如图1所示,终端100包括:射频(radio frequency,RF)电路110、存储器120、显示单元130、摄像头140、传感器150、音频电路160、无线保真(Wireless Fidelity,Wi-Fi)模块170、处理器180、蓝牙模块181、以及电源190等部件。Fig. 1 exemplarily shows a hardware configuration block diagram of a terminal 100 according to an exemplary embodiment. As shown in Fig. 1 , the terminal 100 includes: a radio frequency (RF) circuit 110, a memory 120, a display unit 130, a camera 140, a sensor 150, an audio circuit 160, a wireless fidelity (Wi-Fi) module 170, a processor 180, a Bluetooth module 181, and a power supply 190 and other components.

RF电路110可用于在收发信息或通话过程中信号的接收和发送,可以接收基站的下行数据后交给处理器180处理;可以将上行数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器、双工器等器件。The RF circuit 110 can be used to receive and send signals during the process of sending and receiving information or making calls. It can receive downlink data from the base station and hand it over to the processor 180 for processing; it can send uplink data to the base station. Generally, the RF circuit includes but is not limited to antennas, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer and other devices.

存储器120可用于存储软件程序及数据。处理器180通过运行存储在存储器120的软件程序或数据,从而执行终端100的各种功能以及数据处理。存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。存储器120存储有使得终端100能运行的操作系统。本申请中存储器120可以存储操作系统及各种应用程序,还可以存储执行本申请实施例终端的省电方法的程序代码。The memory 120 can be used to store software programs and data. The processor 180 executes various functions and data processing of the terminal 100 by running the software programs or data stored in the memory 120. The memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The memory 120 stores an operating system that enables the terminal 100 to run. In the present application, the memory 120 can store an operating system and various application programs, and can also store program codes for executing the power saving method of the terminal in the embodiment of the present application.

显示单元130可用于接收输入的数字或字符信息,产生与终端100的用户设置以及功能控制有关的信号输入,具体地,显示单元130可以包括设置在终端100正面的触摸屏131,可收集用户在其上或附近的触摸操作,例如点击按钮。The display unit 130 may be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal 100. Specifically, the display unit 130 may include a touch screen 131 disposed on the front of the terminal 100, which may collect user touch operations thereon or near the touch screen, such as clicking a button.

显示单元130还可用于显示由用户输入的信息或提供给用户的信息以及终端100的各种菜单的图形用户界面(graphical user interface,GUI)。具体地,显示单元130可以包括设置在终端100正面的显示屏132。其中,显示屏132可以采用液晶显示器、发光二极管等形式来配置。显示单元130可以用于显示本申请中终端的屏幕显示区域。The display unit 130 can also be used to display information input by the user or information provided to the user and a graphical user interface (GUI) of various menus of the terminal 100. Specifically, the display unit 130 may include a display screen 132 disposed on the front of the terminal 100. The display screen 132 may be configured in the form of a liquid crystal display, a light emitting diode, etc. The display unit 130 may be used to display the screen display area of the terminal in the present application.

其中,触摸屏131可以覆盖在显示屏132之上,也可以将触摸屏131与显示屏132集成而实现终端100的输入和输出功能,集成后可以简称触摸显示屏。本申请中显示单元130可以显示应用程序以及对应的操作步骤。The touch screen 131 may be covered on the display screen 132, or the touch screen 131 and the display screen 132 may be integrated to realize the input and output functions of the terminal 100, and the integrated touch screen may be referred to as a touch display screen. In the present application, the display unit 130 may display the application and the corresponding operation steps.

摄像头140可用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给处理器180转换成数字图像信号。The camera 140 can be used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to the processor 180 for conversion into a digital image signal.

终端100还可以包括至少一种传感器150,比如加速度传感器151、距离传感器152、指纹传感器153、温度传感器154。终端100还可配置有陀螺仪、气压计、湿度计、温度计、红外线传感器、光传感器、运动传感器等其他传感器。The terminal 100 may further include at least one sensor 150, such as an acceleration sensor 151, a distance sensor 152, a fingerprint sensor 153, and a temperature sensor 154. The terminal 100 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.

音频电路160、扬声器161、麦克风162可提供用户与终端100之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出。终端100还可配置音量按钮,用于调节声音信号的音量,还可以用于组合其他按钮,调整封闭区域。另一方面,麦克风162将收集的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出至RF电路110以发送给比如另一终端,或者将音频数据输出至存储器120以便进一步处理。The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal 100. The audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, which is converted into a sound signal for output. The terminal 100 can also be configured with a volume button for adjusting the volume of the sound signal, and can also be used to combine other buttons to adjust the closed area. On the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, and then the audio data is output to the RF circuit 110 to be sent to, for example, another terminal, or the audio data is output to the memory 120 for further processing.

Wi-Fi属于短距离无线传输技术,终端100可以通过Wi-Fi模块170帮助用户收发电子邮件、浏览网页和访问流媒体等,它为用户提供了无线的宽带互联网访问。Wi-Fi is a short-range wireless transmission technology. The terminal 100 can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 170, which provides users with wireless broadband Internet access.

处理器180是终端100的控制中心,利用各种接口和线路连接整个终端的各个部分,通过运行或执行存储在存储器120内的软件程序,以及调用存储在存储器120内的数据,执行终端100的各种功能和处理数据。在一些实施例中,处理器180可包括一个或多个处理单元;处理器180还可以集成应用处理器和基带处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,基带处理器主要处理无线通信。可以理解的是,上述基带处理器也可以不集成到处理器180中。本申请中处理器180可以运行操作系统、应用程序、用户界面显示及触控响应,以及本申请实施例的终端的省电方法。另外,处理器180与显示单元130耦接。The processor 180 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal. It executes various functions of the terminal 100 and processes data by running or executing software programs stored in the memory 120 and calling data stored in the memory 120. In some embodiments, the processor 180 may include one or more processing units; the processor 180 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 180. In the present application, the processor 180 can run the operating system, application programs, user interface display and touch response, as well as the power saving method of the terminal in the embodiment of the present application. In addition, the processor 180 is coupled to the display unit 130.

蓝牙模块181,用于通过蓝牙协议来与其他具有蓝牙模块的蓝牙设备进行信息交互。例如,终端100可以通过蓝牙模块181与同样具备蓝牙模块的可穿戴电子设备(例如智能手表)建立蓝牙连接,从而进行数据交互。The Bluetooth module 181 is used to exchange information with other Bluetooth devices having Bluetooth modules through the Bluetooth protocol. For example, the terminal 100 can establish a Bluetooth connection with a wearable electronic device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 181 to exchange data.

终端100还包括给各个部件供电的电源190(比如电池)。电源可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理充电、放电以及功耗等功能。终端100还可配置有电源按钮,用于终端的开机和关机,以及锁屏等功能。The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 180 through a power management system, so that the power management system can manage functions such as charging, discharging, and power consumption. The terminal 100 can also be configured with a power button for turning on and off the terminal, as well as locking the screen and other functions.

图2是本申请实施例的一种终端100的软件结构框图。FIG. 2 is a software structure block diagram of a terminal 100 according to an embodiment of the present application.

分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,可将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.

如图2所示,应用程序包可以包括电话、彩信,WiFi,微信,信息,闹钟,图库,日历,WLAN等应用程序。As shown in FIG. 2 , the application package may include applications such as phone, MMS, WiFi, WeChat, information, alarm clock, gallery, calendar, WLAN, etc.

应用程序框架层为应用程序层的应用程序提供应用编程接口(applicationprogramming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。As shown in FIG. 2 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.

窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿、短信息等。Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, short messages, etc.

视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信息通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a short message notification icon can include a view for displaying text and a view for displaying images.

电话管理器用于提供终端100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide communication functions of the terminal 100, such as management of call status (including connection, disconnection, etc.).

资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等。The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, etc.

通知管理器使应用程序可以在状态栏中显示通知信息(例如短信息的消息内容),可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,终端振动,指示灯闪烁等。The notification manager enables applications to display notification information (such as the content of short messages) in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal vibrates, the indicator light flashes, etc.

Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

2D(一种动画方式)图形引擎是2D绘图的绘图引擎。A 2D (animation mode) graphics engine is a drawing engine for 2D drawing.

内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

本申请实施例中的终端100可以为包括但不限于智能手机、平板电脑、可穿戴电子设备(例如智能手表)、笔记本电脑等电子设备。The terminal 100 in the embodiment of the present application may be an electronic device including but not limited to a smart phone, a tablet computer, a wearable electronic device (such as a smart watch), a laptop computer, etc.

在本申请实施例中,在视频录制过程中,获取当前时间,若该当前时间为整数时间,确定与当前时间对应的关键帧,并将该关键帧对应的录制时间更新为该当前时间,对该关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件,并保存该第一子视频文件。In an embodiment of the present application, during the video recording process, the current time is obtained. If the current time is an integer time, the key frame corresponding to the current time is determined, and the recording time corresponding to the key frame is updated to the current time. The video frame between the key frame and the previous key frame is encoded to obtain a first sub-video file, and the first sub-video file is saved.

为了在截取子视频时,避免由于录制的视频的关键帧不是整分整秒,导致截取的子视频的第一个关键帧之前的视频帧丢失,避免截取到的子视频丢帧,本申请实施例提供了一种视频录制方法、装置及终端。In order to avoid the loss of video frames before the first key frame of the captured sub-video due to the key frames of the recorded video not being full minutes and seconds when capturing a sub-video, and to avoid frame loss of the captured sub-video, the embodiments of the present application provide a video recording method, device and terminal.

图3为本申请实施例提供的一种视频录制过程示意图,该过程包括:FIG3 is a schematic diagram of a video recording process provided in an embodiment of the present application, the process comprising:

S301:在视频录制过程中,获取当前时间,若确定所述当前时间为整数时间,则确定与当前时间对应的关键帧,并将所述关键帧对应的录制时间更新为所述当前时间,其中,所述整数时间为整分整秒的时间。S301: During video recording, the current time is obtained. If the current time is determined to be an integer time, a key frame corresponding to the current time is determined, and the recording time corresponding to the key frame is updated to the current time, wherein the integer time is a whole minute and a whole second.

本申请实施例提供的一种视频录制方法应用于终端,其中该终端可以为手机、平板电脑、图像采集设备等设备。A video recording method provided in an embodiment of the present application is applied to a terminal, wherein the terminal may be a mobile phone, a tablet computer, an image acquisition device, or the like.

在本申请实施例中,终端在进行视频录制时,将每个整数时间对应的每个视频帧确定为关键帧,使得后续用户在通过终端从已经录制的视频中截取子视频时,由于截取的开始时间和结束时间均为整数时间,则该开始时间和结束时间分别对应的视频帧均为关键帧,从而避免截取子视频的过程中出现丢帧的情况,提高了用户的使用感受。其中,在本申请实施例中,该整数时间指整分整秒的时间,即当前时间为整数时间时,该当前时间中毫秒及毫秒以下的时间单位对应的数值为0。In the embodiment of the present application, when the terminal is recording a video, each video frame corresponding to each integer time is determined as a key frame, so that when the user subsequently intercepts a sub-video from the recorded video through the terminal, since the start time and end time of the interception are both integer times, the video frames corresponding to the start time and end time are all key frames, thereby avoiding frame loss in the process of intercepting the sub-video, improving the user experience. Among them, in the embodiment of the present application, the integer time refers to the time of whole minutes and whole seconds, that is, when the current time is an integer time, the value corresponding to the time unit of milliseconds and below in the current time is 0.

具体的,在本申请实施例中,终端在录制视频的过程中,获取当前时间,若该当前时间为整数时间,则确定与当前时间对应的关键帧,并将该关键帧对应的录制时间更新为该当前时间。其中,在本申请实施例中,该当前时间可以为终端从网络中获取到的当前网络时间,该整数时间为整分整秒的时间。Specifically, in the embodiment of the present application, the terminal obtains the current time during the video recording process, and if the current time is an integer time, determines the key frame corresponding to the current time, and updates the recording time corresponding to the key frame to the current time. In the embodiment of the present application, the current time can be the current network time obtained by the terminal from the network, and the integer time is the time of whole minutes and whole seconds.

其中,在本申请实施例中,终端在确定与当前时间对应的关键帧时,该终端通过终端内部的编码器,将与当前时间对应的视频帧确定并标记为关键帧。在本申请实施例中,通过编码器将该视频帧确定并标记为关键帧的过程与现有技术相同,在此不再进行赘述。Among them, in the embodiment of the present application, when the terminal determines the key frame corresponding to the current time, the terminal determines and marks the video frame corresponding to the current time as the key frame through the encoder inside the terminal. In the embodiment of the present application, the process of determining and marking the video frame as the key frame by the encoder is the same as the prior art, and will not be repeated here.

例如,在本申请实施例中,若当前终端正在视频录制过程中,且该终端获取到当前时间为五点五十分三十秒,该终端确定该当前时间为整数时间,则确定当前时间对应的关键帧,并将该关键帧对应的录制时间更新为五点五十分三十秒。For example, in an embodiment of the present application, if the current terminal is in the process of video recording, and the terminal obtains the current time as five fifty and thirty seconds, the terminal determines that the current time is an integer time, then determines the key frame corresponding to the current time, and updates the recording time corresponding to the key frame to five fifty and thirty seconds.

图4为现有技术提供的视频帧序列示意图,如该图4所示,视频开始录制的时间为19:01:00:500,下一个关键帧时间为19:01:01:500,如果此时要从19:01:01播放或截取子视频,由于19:01:01对应的视频帧不是关键帧,那么播放或截取到的子视频只能是从19:01:01:500开始的,这就导致了19:01:01到19:01:01:500之间录制的视频帧丢失。Figure 4 is a schematic diagram of a video frame sequence provided by the prior art. As shown in Figure 4, the time when the video starts recording is 19:01:00:500, and the time of the next key frame is 19:01:01:500. If you want to play or intercept a sub-video from 19:01:01, since the video frame corresponding to 19:01:01 is not a key frame, the sub-video played or intercepted can only start from 19:01:01:500, which results in the loss of video frames recorded between 19:01:01 and 19:01:01:500.

图5为本申请实施例提供的视频帧序列示意图,如该图5所示,视频开始录制的时间为19:01:00:500,下一个关键帧时间为19:01:01,如果此时要从19:01:01播放或截取子视频,则播放或截取到的子视频是从19:01:01开始的,避免了视频帧的丢失。Figure 5 is a schematic diagram of the video frame sequence provided in an embodiment of the present application. As shown in Figure 5, the time when the video starts recording is 19:01:00:500, and the time of the next key frame is 19:01:01. If a sub-video is to be played or intercepted from 19:01:01 at this time, the sub-video played or intercepted starts from 19:01:01, thereby avoiding the loss of video frames.

S302:对所述关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件,并保存所述第一子视频文件。S302: Encode the video frames between the key frame and the previous key frame to obtain a first sub-video file, and save the first sub-video file.

在本申请实施例中,终端在确定了当前时间对应的关键帧之后,为了实现视频的录制和保存,该终端对该关键帧和上一个关键帧之间的视频帧进行编码,得到第一子视频文件,并保存该第一子视频文件。In an embodiment of the present application, after the terminal determines the key frame corresponding to the current time, in order to realize video recording and saving, the terminal encodes the video frames between the key frame and the previous key frame, obtains the first sub-video file, and saves the first sub-video file.

其中,在本申请实施例中,终端在保存该第一子视频文件时,将该第一子视频文件保存在预先配置的存储路径下。In this embodiment of the present application, when the terminal saves the first sub-video file, it saves the first sub-video file in a pre-configured storage path.

即在本申请实施例中,在视频录制过程中,当当前时间为整数时间时,终端确定该当前时间对应的关键帧,使得后续用户在通过终端从已经录制的视频中截取子视频时,由于截取的开始时间和结束时间均为整数时间,则该开始时间和结束时间分别对应的视频帧均为关键帧,从而避免截取的子视频出现丢帧的情况,提高了用户的使用感受。That is, in an embodiment of the present application, during the video recording process, when the current time is an integer time, the terminal determines the key frame corresponding to the current time, so that when the subsequent user captures a sub-video from the recorded video through the terminal, since the start time and end time of the capture are both integer times, the video frames corresponding to the start time and end time are all key frames, thereby avoiding frame loss in the captured sub-video and improving the user experience.

为了确定整数时间对应的关键帧,从而避免截取子视频的过程中出现丢帧的情况,在上述实施例的基础上,在本申请实施例中,所述确定与当前时间对应的关键帧包括:In order to determine the key frame corresponding to the integer time, thereby avoiding frame loss in the process of intercepting the sub-video, based on the above embodiment, in the embodiment of the present application, the key frame corresponding to the current time is determined, which includes:

若当前时间采集到了视频帧,则将当前时间采集的视频帧确定为关键帧;If a video frame is captured at the current time, the video frame captured at the current time is determined as a key frame;

若当前时间未采集到视频帧,则获取在所述当前时间之前采集到的最后一个视频帧,将该最后一个视频帧确定为关键帧。If no video frame is captured at the current time, the last video frame captured before the current time is obtained, and the last video frame is determined as a key frame.

在本申请实施例中,终端在视频录制的过程中,至少存在以下两种情况:一是终端在进行视频录制,由于延迟或卡帧等情况,终端在当前时间可能没有采集到视频帧;二是终端在当前时间采集到了视频帧。In an embodiment of the present application, during the video recording process of the terminal, there are at least the following two situations: one is that the terminal is recording the video, and due to delays or frame jams, the terminal may not have captured the video frame at the current time; the other is that the terminal has captured the video frame at the current time.

其中,若终端在当前时间采集到了视频帧,且该当前时间为整数时间,则该终端将该当前时间采集的视频帧确定为关键帧;若该终端在该当前时间未采集到视频帧,则该终端获取在该当前时间之前采集到的最后一个视频帧,并将该最后一个视频帧确定为关键帧。Among them, if the terminal captures a video frame at the current time, and the current time is an integer time, the terminal determines the video frame captured at the current time as a key frame; if the terminal does not capture a video frame at the current time, the terminal obtains the last video frame captured before the current time, and determines the last video frame as a key frame.

具体的,在本申请实施例中,若该终端在当前时间采集到了视频帧,且该当前时间为整数时间,则该终端通过内部的编码器,将该当前时间采集到的视频帧确定并标记为当前时间对应的关键帧。例如,当前时间为十点十分十秒,且终端在当前时间采集到了视频帧,则终端将该当前时间采集到的视频帧确定为该当前时间对应的关键帧。Specifically, in the embodiment of the present application, if the terminal has captured a video frame at the current time, and the current time is an integer time, the terminal determines and marks the video frame captured at the current time as a key frame corresponding to the current time through an internal encoder. For example, if the current time is 10:10 and the terminal has captured a video frame at the current time, the terminal determines the video frame captured at the current time as a key frame corresponding to the current time.

若该终端在当前时间未采集到视频帧,且该当前时间为整数时间,则该终端获取在该当前时间之前采集到的最后一个视频帧,并通过该终端内部的编码器,将该最后一个视频帧确定并标记为当前时间对应的关键帧。例如,当前时间为十点十分十秒,且终端在当前时间未采集到视频帧,则终端获取在当前时间之前采集到的最后一个视频帧,其中该最后一个视频帧为十点十分九秒九百毫秒采集到的,该终端将该最后一个视频帧确定为关键帧。If the terminal has not collected any video frame at the current time, and the current time is an integer time, the terminal obtains the last video frame collected before the current time, and determines and marks the last video frame as the key frame corresponding to the current time through the encoder inside the terminal. For example, if the current time is 10:10:10, and the terminal has not collected any video frame at the current time, the terminal obtains the last video frame collected before the current time, wherein the last video frame is collected at 10:10:9:900 milliseconds, and the terminal determines the last video frame as the key frame.

图6为本申请实施例提供的视频录制的流程示意图,如该图6所示,该过程包括:FIG6 is a schematic diagram of a video recording process provided by an embodiment of the present application. As shown in FIG6 , the process includes:

S601:接收视频录制指令,生成待录制的视频文件对应的第一存储路径。S601: Receive a video recording instruction, and generate a first storage path corresponding to the video file to be recorded.

S602:判断当前时间是否为整数时间,若是,执行S603,若否,则继续进行录制,并返回S602。S602: Determine whether the current time is an integer time, if so, execute S603, if not, continue recording and return to S602.

S603:确定与当前时间对应的关键帧,并将所述关键帧对应的录制时间更新为所述当前时间。S603: Determine a key frame corresponding to the current time, and update the recording time corresponding to the key frame to the current time.

S604:对所述关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件,并保存所述第一子视频文件。S604: Encode the video frames between the key frame and the previous key frame to obtain a first sub-video file, and save the first sub-video file.

S605:判断是否接收到录制结束指令,若否,则继续进行录制,执行上述S602,若是,则执行S606。S605: Determine whether a recording end instruction is received. If not, continue recording and execute the above S602. If yes, execute S606.

S606:结束当前视频录制。S606: End the current video recording.

为了更好地对录制得到的视频进行存储,在上述各实施例的基础上,在本申请实施例中,所述获取当前时间之前,所述方法还包括:In order to better store the recorded video, based on the above embodiments, in the embodiment of the present application, before obtaining the current time, the method further includes:

接收视频录制指令,生成待录制的视频文件对应的第一存储路径;Receiving a video recording instruction, and generating a first storage path corresponding to the video file to be recorded;

所述保存所述第一子视频文件包括:The saving of the first sub-video file comprises:

判断所述第一子视频文件对应的第一存储路径下已存储的每个第二子视频文件及所述第一子视频文件的大小是否达到预设阈值;Determine whether the size of each second sub video file and the first sub video file stored in the first storage path corresponding to the first sub video file reaches a preset threshold;

若否,则将所述第一子视频文件保存到所述第一存储路径下。If not, the first sub-video file is saved in the first storage path.

在本申请实施例中,当用户有录制视频的需求时,用户可以通过终端的显示屏或外部按键等,向终端发送视频录制指令。该终端接收到该视频录制指令后,开始进行视频录制。并且,在本申请实施例中,当终端接收到视频录制指令后,该终端还会生成待录制的视频文件对应的第一存储路径,以便于后续录制的视频文件可以存储在该第一存储路径下。其中,在本申请实施例中,终端在开始进行视频录制之前,还会获取当前的网络时间,并用当前的网络时间对终端中的当前时间进行校正。In an embodiment of the present application, when a user has a need to record a video, the user can send a video recording instruction to the terminal through the display screen or external buttons of the terminal. After the terminal receives the video recording instruction, it starts video recording. In addition, in an embodiment of the present application, after the terminal receives the video recording instruction, the terminal will also generate a first storage path corresponding to the video file to be recorded, so that the subsequently recorded video file can be stored in the first storage path. Among them, in an embodiment of the present application, before starting video recording, the terminal will also obtain the current network time and use the current network time to correct the current time in the terminal.

此外,为了在后续截取子视频时,可以快速定位待截取子视频的位置,在本申请实施例中,终端中保存有预先配置的每个存储路径下保存的视频文件大小的预设阈值,其中每个存储路径中保存的视频文件的大小不超过该预设阈值。In addition, in order to quickly locate the position of the sub-video to be intercepted when the sub-video is subsequently intercepted, in an embodiment of the present application, the terminal stores a preset threshold value for the size of video files saved in each storage path, wherein the size of the video files saved in each storage path does not exceed the preset threshold value.

基于此,在本申请实施例中,终端在保存第一子视频文件时,该终端先获取第一存储路径下已存储的每个第二子视频文件的大小,并确定该第一子视频文件的大小及该每个第二子视频文件的大小的和值,判断该和值是否超过预设阈值,若否,则将该第一子视频文件存储到该第一存储路径下。Based on this, in an embodiment of the present application, when the terminal saves the first sub-video file, the terminal first obtains the size of each second sub-video file stored in the first storage path, and determines the sum of the size of the first sub-video file and the size of each second sub-video file, and determines whether the sum exceeds a preset threshold. If not, the first sub-video file is stored in the first storage path.

需要说明的是,在本申请实施例中,在保存第一子视频文件时,若该终端中有至少两个存储路径,则该终端确定最后一个生成的存储路径中保存的每个第二子视频文件及该第一子视频文件的大小是否超过预设阈值,若否,则将该第一子视频文件保存到该最后一个生成的存储路径下。It should be noted that in an embodiment of the present application, when saving the first sub-video file, if there are at least two storage paths in the terminal, the terminal determines whether the size of each second sub-video file and the first sub-video file saved in the last generated storage path exceeds a preset threshold. If not, the first sub-video file is saved to the last generated storage path.

为了更好地对录制得到的视频进行存储,在上述各实施例的基础上,在本申请实施例中,若所述第一存储路径下已存储的每个第二子视频文件及所述第一子视频文件的大小达到预设阈值,所述方法还包括:In order to better store the recorded video, based on the above embodiments, in the embodiment of the present application, if the size of each second sub video file and the first sub video file stored in the first storage path reaches a preset threshold, the method further includes:

生成第二存储路径;generating a second storage path;

将所述第一子视频文件保存到所述第二存储路径下。The first sub-video file is saved in the second storage path.

在本申请实施例中,若终端的第一存储路径下已存储的每个第二子视频文件及第一子视频文件的大小超过预设阈值,则终端会生成第二存储路径,并将该第一子视频文件保存到该第二存储路径下。In an embodiment of the present application, if the size of each second sub video file and the first sub video file stored in the first storage path of the terminal exceeds a preset threshold, the terminal will generate a second storage path and save the first sub video file to the second storage path.

图7为本申请实施例提供的视频录制流程示意图,如该图7所示,该过程包括:FIG. 7 is a schematic diagram of a video recording process provided in an embodiment of the present application. As shown in FIG. 7 , the process includes:

S701:接收视频录制指令。S701: Receive a video recording instruction.

S702:生成待录制的视频文件对应的第一存储路径,生成第一子视频文件。S702: Generate a first storage path corresponding to the video file to be recorded, and generate a first sub-video file.

S703:判断该第一子视频文件对应的第一存储路径下已存储的每个第二子视频文件及该第一子视频文件的大小是否达到预设阈值,若否,则执行S704,若是,则执行S705。S703: Determine whether the size of each second sub video file and the first sub video file stored in the first storage path corresponding to the first sub video file reaches a preset threshold, if not, execute S704, if yes, execute S705.

S704:将该第一子视频文件保存到该第一存储路径下。S704: Save the first sub-video file to the first storage path.

S705:生成第二存储路径。S705: Generate a second storage path.

S706:将该第一子视频文件保存到该第二存储路径下。S706: Save the first sub-video file to the second storage path.

为了提高在终端中查找每个时间对应的视频帧的效率,在上述各实施例的基础上,在本申请实施例中,所述方法还包括:In order to improve the efficiency of searching for the video frame corresponding to each time in the terminal, based on the above embodiments, in the embodiment of the present application, the method further includes:

将开始进行视频录制的时间作为第一开始时间,并将所述第一开始时间和所述第一存储路径对应保存到预先设置的数据库中;The time when the video recording starts is taken as a first start time, and the first start time and the first storage path are correspondingly saved in a preset database;

将所述上一帧关键对应的录制时间确定为第二开始时间,将所述第二开始时间和所述第二存储路径对应保存到所述数据库中。The recording time corresponding to the previous frame key is determined as a second start time, and the second start time and the second storage path are correspondingly saved in the database.

在本申请实施例中,针对每个存储路径,终端获取该存储路径下首个被保存的子视频文件中首个关键帧对应的录制时间,并将该录制时间确定为该存储路径中保存的子视频文件对应的开始时间,终端将该存储路径与该开始时间的对应关系保存到数据库中。其中,该数据库可以是终端在投入使用后,首次接收到视频录制指令后,在预先保存的存储位置创建的,还是可以预先在终端中配置好的,在此不做限制。In the embodiment of the present application, for each storage path, the terminal obtains the recording time corresponding to the first key frame in the first sub-video file saved in the storage path, and determines the recording time as the start time corresponding to the sub-video file saved in the storage path, and the terminal saves the corresponding relationship between the storage path and the start time in the database. The database can be created in a pre-saved storage location after the terminal is put into use and receives the video recording instruction for the first time, or it can be pre-configured in the terminal, which is not limited here.

具体的,在本申请实施例中,第一存储路径为终端接收到视频录制指令后生成的,该第一存储路径对应的第一开始时间为该终端接收到视频录制指令,并开始进行视频录制的时间。终端在确定了第一开始时间之后,将该第一开始时间与该第一存储路径对应保存到数据库中。其中,为了将该第一存储路径对应的开始时间与第二存储路径对应的开始时间进行区分,在本申请实施例中,将该第一存储路径对应的开始时间称为第一开始时间,将第二存储路径对应的开始时间称为第二开始时间。Specifically, in an embodiment of the present application, the first storage path is generated after the terminal receives a video recording instruction, and the first start time corresponding to the first storage path is the time when the terminal receives the video recording instruction and starts video recording. After determining the first start time, the terminal saves the first start time and the first storage path in a database. In order to distinguish the start time corresponding to the first storage path from the start time corresponding to the second storage path, in an embodiment of the present application, the start time corresponding to the first storage path is referred to as the first start time, and the start time corresponding to the second storage path is referred to as the second start time.

此外,在本申请实施例中,终端在存储第一子视频文件时,由于第一存储路径下已存储的每个第二子视频文件及该第一子视频文件的大小达到预设阈值,此存储路径下不能再存储其他文件了,所以该终端生成了第二存储路径,并将该第一子视频文件存储到了该第二存储路径下,该第一子视频文件中的首个关键对应的录制时间即为该第二存储路径的第二开始时间。也就是说,该第一子视频文件中的首个关键帧对应的录制时间为该第二存储路径对应的第二开始时间,则终端将该第二开始时间和该第二存储路径对应保存到数据库中。In addition, in the embodiment of the present application, when the terminal stores the first sub-video file, since the size of each second sub-video file and the first sub-video file stored in the first storage path reaches a preset threshold, no other files can be stored in this storage path, so the terminal generates a second storage path and stores the first sub-video file in the second storage path, and the recording time corresponding to the first key in the first sub-video file is the second start time of the second storage path. In other words, the recording time corresponding to the first key frame in the first sub-video file is the second start time corresponding to the second storage path, and the terminal saves the second start time and the second storage path in the database.

图8为本申请实施例提供的数据库的示意图,如该图8所示,在该数据库中第一存储路径与第一开始时间对应保存,第二存储路径与第二开始时间对应保存,第三存储路径与第三开始时间对应保存等等。Figure 8 is a schematic diagram of the database provided in an embodiment of the present application. As shown in Figure 8, in the database, the first storage path is saved corresponding to the first start time, the second storage path is saved corresponding to the second start time, the third storage path is saved corresponding to the third start time, and so on.

图9为本申请实施例提供的将存储路径和开始时间对应保存的流程图,如该图9所示,该过程包括:FIG9 is a flowchart of storing the storage path and the start time in correspondence with each other provided by an embodiment of the present application. As shown in FIG9 , the process includes:

S901:接收视频录制指令。S901: receiving a video recording instruction.

S902:生成待录制的视频文件对应的第一存储路径。S902: Generate a first storage path corresponding to the video file to be recorded.

S903:判断当前是否为首次接收到视频录制指令,若是,则执行S904,若否,则执行S905。S903: Determine whether it is the first time to receive the video recording instruction. If so, execute S904; if not, execute S905.

S904:在预先配置的存储位置创建数据库,并执行S906。S904: Create a database in a pre-configured storage location, and execute S906.

S905:确定已经创建好的数据库,并执行S906。S905: Determine the database that has been created, and execute S906.

S906:将开始进行视频录制的时间作为第一开始时间,并将该第一开始时间和第一存储路径对应保存到数据库中。S906: The time when the video recording starts is taken as a first start time, and the first start time and the first storage path are correspondingly saved in a database.

为了能够从终端录制的视频中播放部分视频,且播放的视频不丢帧,在上述各实施例的基础上,在本申请实施例中,所述方法还包括:In order to be able to play part of the video recorded by the terminal without losing frames in the played video, based on the above embodiments, in the embodiment of the present application, the method further includes:

接收输入的播放指令,其中所述播放指令中携带有播放开始时间;Receiving an inputted play instruction, wherein the play instruction carries a play start time;

根据数据库中保存的每个存储路径对应的开始时间及所述播放开始时间,确定所述播放开始时间对应的第一目标存储路径;Determine a first target storage path corresponding to the playback start time according to the start time corresponding to each storage path and the playback start time stored in the database;

根据所述第一目标存储路径以及在所述第一目标存储路径之后生成的每个第二目标存储路径,确定待播放的第三子视频文件;Determine a third sub video file to be played according to the first target storage path and each second target storage path generated after the first target storage path;

对所述第三子视频文件进行解析,得到第一目标子视频,并播放所述第一目标子视频。The third sub-video file is parsed to obtain a first target sub-video, and the first target sub-video is played.

在本申请实施例中,当用户有播放视频的需求时,该用户通过终端的显示界面或外部按键输入播放指令,其中该播放指令中携带有播放开始时间,终端接收到该播放指令后,获取该播放指令中携带的播放开始时间,并从该播放开始时间开始播放视频。In an embodiment of the present application, when a user needs to play a video, the user inputs a play instruction through the display interface of the terminal or an external button, wherein the play instruction carries a play start time. After receiving the play instruction, the terminal obtains the play start time carried in the play instruction and starts playing the video from the play start time.

具体的,在本申请实施例中,终端根据该播放开始时间及数据库中保存的每个存储路径对应的开始时间,确定保存有在该播放开始时间录制的视频帧的第一目标存储路径。终端根据该第一目标存储路径以及在该第一目标存储路径之后生成的每个第二目标存储路径,确定该播放开始时间对应的第三子视频文件。终端对该第三子视频文件进行解析,得到第一目标子视频,并播放该第一目标子视频。Specifically, in an embodiment of the present application, the terminal determines the first target storage path storing the video frame recorded at the start time of the playback according to the start time of the playback and the start time corresponding to each storage path stored in the database. The terminal determines the third sub-video file corresponding to the start time of the playback according to the first target storage path and each second target storage path generated after the first target storage path. The terminal parses the third sub-video file to obtain the first target sub-video, and plays the first target sub-video.

其中,在本申请实施例中,终端在确定播放开始时间对应的第三子视频文件时,该终端从第一目标存储路径和每个生成时间在该第一目标存储路径的生成时间之后的第二目标存储路径下,获取录制时间在该播放时间之后的每个子视频文件,将该每个子视频文件按照录制时间进行排序,将排序结果确定为待播放的第三子视频文件。Among them, in an embodiment of the present application, when the terminal determines the third sub-video file corresponding to the playback start time, the terminal obtains each sub-video file whose recording time is after the playback time from the first target storage path and each second target storage path whose generation time is after the generation time of the first target storage path, sorts each sub-video file according to the recording time, and determines the sorting result as the third sub-video file to be played.

图10为本申请实施例提供的视频播放过程示意图,如该图10所示,该过程包括:FIG10 is a schematic diagram of a video playback process provided by an embodiment of the present application. As shown in FIG10 , the process includes:

S1001:接收输入的播放指令,其中该播放指令中携带有播放开始时间。S1001: receiving an input play instruction, wherein the play instruction carries a play start time.

S1002:根据数据库中保存的每个存储路径对应的开始时间及该播放开始时间,确定该播放开始时间对应的第一目标存储路径。S1002: Determine a first target storage path corresponding to the playback start time according to the start time corresponding to each storage path stored in the database and the playback start time.

S1003:根据该第一目标存储路径以及在该第一目标存储路径之后生成的每个第二目标存储路径,确定待播放的第三子视频文件。S1003: Determine a third sub-video file to be played according to the first target storage path and each second target storage path generated after the first target storage path.

S1004:对该第三子视频文件进行解析,得到第一目标子视频,并播放该第一目标子视频。S1004: Parse the third sub-video file to obtain the first target sub-video, and play the first target sub-video.

为了能够从终端录制的视频中截取子视频,且截取到的子视频不丢帧,在上述各实施例的基础上,在本申请实施例中,所述方法还包括:In order to be able to capture a sub-video from a video recorded by a terminal without losing frames in the captured sub-video, based on the above embodiments, in an embodiment of the present application, the method further includes:

接收输入的截取指令,其中所述截取指令中携带有截取开始时间和截取结束时间;Receive an input interception instruction, wherein the interception instruction carries an interception start time and an interception end time;

根据数据库中保存的每个存储路径对应的开始时间及所述截取开始时间,确定所述截取开始时间对应的第三目标存储路径和所述截取结束时间对应的第四目标存储路径;According to the start time corresponding to each storage path and the interception start time stored in the database, determining a third target storage path corresponding to the interception start time and a fourth target storage path corresponding to the interception end time;

根据所述第三目标存储路径以及所述第四目标存储路径,确定待截取的第四子视频文件;Determining a fourth sub video file to be intercepted according to the third target storage path and the fourth target storage path;

对所述第四子视频文件进行解析,得到第二目标子视频。The fourth sub-video file is parsed to obtain a second target sub-video.

在本申请实施例中,当用户有截取子视频的需求时,该用户通过终端的显示界面或外部按键输入截取指令,其中该截取指令中携带有截取开始时间和截取结束时间,终端接收到该截取指令后,获取该截取指令中携带的截取开始时间和截取结束时间,并根据该截取开始时间和截取结束时间截取对应的子视频。In an embodiment of the present application, when a user needs to capture a sub-video, the user inputs an interception instruction through the display interface of the terminal or an external button, wherein the interception instruction carries an interception start time and an interception end time. After receiving the interception instruction, the terminal obtains the interception start time and the interception end time carried in the interception instruction, and captures the corresponding sub-video according to the interception start time and the interception end time.

具体的,在本申请实施例中,终端根据数据库中保存的每个存储路径对应的开始时间及该截取开始时间,确定保存有该截取开始时间录制的视频帧的第三目标存储路径和保存有该截取结束时间录制的视频帧的第四目标存储路径。终端根据该第三目标存储路径以及在该第四目标存储路径,确定待截取的第四子视频文件。终端对该第四子视频文件进行解析,得到第二目标子视频。Specifically, in an embodiment of the present application, the terminal determines a third target storage path storing a video frame recorded at the interception start time and a fourth target storage path storing a video frame recorded at the interception end time according to the start time corresponding to each storage path stored in the database and the interception start time. The terminal determines a fourth sub-video file to be intercepted according to the third target storage path and the fourth target storage path. The terminal parses the fourth sub-video file to obtain the second target sub-video.

具体的,在本申请实施例中,终端根据数据库中保存的每个存储路径与开始时间的对应关系,确定保存有该截取开始时间录制的视频帧的第三目标存储路径和该截取结束时间录制的视频帧的第四目标存储路径。并根据该第三目标存储路径和第四目标存储路径,确定第二目标子视频。Specifically, in the embodiment of the present application, the terminal determines the third target storage path storing the video frame recorded at the interception start time and the fourth target storage path storing the video frame recorded at the interception end time according to the correspondence between each storage path and the start time stored in the database. And according to the third target storage path and the fourth target storage path, the second target sub-video is determined.

为了能够从终端录制的视频中截取子视频,且截取到的子视频不丢帧,在上述各实施例的基础上,在本申请实施例中,所述根据所述第三目标存储路径以及所述第四目标存储路径,确定所述截取开始时间和所述截取结束时间对应的第四子视频文件包括:In order to be able to capture a sub-video from a video recorded by a terminal without losing frames in the captured sub-video, based on the above embodiments, in an embodiment of the present application, determining the fourth sub-video file corresponding to the capture start time and the capture end time according to the third target storage path and the fourth target storage path includes:

若所述第三目标存储路径和所述第四目标存储路径为同一存储路径,则从所述第三目标存储路径下获取所述第四子视频文件;If the third target storage path and the fourth target storage path are the same storage path, obtaining the fourth sub video file from the third target storage path;

若所述第三目标存储路径和所述第四目标存储路径不是同一存储路径,则根据所述数据库中保存的每个存储路径对应的开始时间,判断是否存在至少一个第五目标存储路径对应的开始时间位于所述第三目标存储路径对应的开始时间和所述第四目标存储路径对应的开始时间之间;若存在,则从所述第三目标存储路径、第四目标存储路径和所述至少一个第五目标存储路径下获取所述第四子视频文件;若不存在,则从所述第三目标存储路径和第四目标存储路径下获取所述第四子视频文件。If the third target storage path and the fourth target storage path are not the same storage path, then, based on the start time corresponding to each storage path saved in the database, determine whether there is at least one fifth target storage path whose start time is between the start time corresponding to the third target storage path and the start time corresponding to the fourth target storage path; if so, obtain the fourth sub-video file from the third target storage path, the fourth target storage path and the at least one fifth target storage path; if not, obtain the fourth sub-video file from the third target storage path and the fourth target storage path.

在本申请实施例中,终端在根据第三目标存储路径和第四目标存储路径,确定待截取的第四子视频文件时,该终端先判断该第三目标存储路径和该第四目标存储路径是否为同一存储路径。若该第三目标存储路径和所述第四目标存储路径为同一存储路径,则从该存储路径下获取录制时间位于该截取开始时间和该截取结束时间之间的每个子视频文件。将该每个子视频文件按照录制时间进行排序,将排序结果确定待截取的第四子视频文件。In an embodiment of the present application, when the terminal determines the fourth sub-video file to be intercepted according to the third target storage path and the fourth target storage path, the terminal first determines whether the third target storage path and the fourth target storage path are the same storage path. If the third target storage path and the fourth target storage path are the same storage path, each sub-video file whose recording time is between the interception start time and the interception end time is obtained from the storage path. Each sub-video file is sorted according to the recording time, and the sorting result is used to determine the fourth sub-video file to be intercepted.

此外,在本申请实施例中,若该第三目标存储路径和该第四目标存储路径不是同一存储路径,则该终端根据数据库中保存的每个存储路径对应的开始时间,判断是否存在至少一个第五目标存储路径对应的开始时间位于该第三目标存储路径对应的开始时间和该第四目标存储路径对应的开始时间之间;若存在,则该第三目标存储路径、第四目标存储路径和该至少一个第五目标存储路径下获取录制时间位于该截取开始时间和该截取结束时间之间的每个子视频文件。将该每个子视频文件按照录制时间进行排序,将排序结果确定为待截取的第四子视频文件。In addition, in an embodiment of the present application, if the third target storage path and the fourth target storage path are not the same storage path, the terminal determines whether there is at least one fifth target storage path corresponding to a start time between the start time corresponding to the third target storage path and the start time corresponding to the fourth target storage path based on the start time corresponding to each storage path stored in the database; if so, each sub-video file whose recording time is between the interception start time and the interception end time is obtained under the third target storage path, the fourth target storage path and the at least one fifth target storage path. Each sub-video file is sorted according to the recording time, and the sorting result is determined as the fourth sub-video file to be intercepted.

在本申请实施例中,若终端确定不存在第五目标存储路径,则终端从该第三目标存储路径和第四目标存储路径下获取录制时间位于该截取开始时间和该截取结束时间之间的每个子视频文件。将该每个子视频文件按照录制时间进行排序,将排序结果确定为待截取的第四子视频文件。In the embodiment of the present application, if the terminal determines that the fifth target storage path does not exist, the terminal obtains each sub-video file whose recording time is between the interception start time and the interception end time from the third target storage path and the fourth target storage path, sorts each sub-video file according to the recording time, and determines the sorting result as the fourth sub-video file to be intercepted.

图11为本申请实施例提供的视频截取过程示意图,如该图11所示,该过程包括:FIG11 is a schematic diagram of a video capture process provided in an embodiment of the present application. As shown in FIG11 , the process includes:

S1101:接收输入的截取指令,其中该截取指令中携带有截取开始时间和截取结束时间。S1101: receiving an input interception instruction, wherein the interception instruction carries an interception start time and an interception end time.

S1102:根据数据库中保存的每个存储路径对应的开始时间及该截取开始时间,确定该截取开始时间对应的第三目标存储路径和该截取结束时间对应的第四目标存储路径。S1102: According to the start time corresponding to each storage path and the interception start time stored in the database, determine a third target storage path corresponding to the interception start time and a fourth target storage path corresponding to the interception end time.

S1103:根据该第三目标存储路径以及该第四目标存储路径,确定该截取开始时间和该截取结束时间对应的第四子视频文件。S1103: Determine, according to the third target storage path and the fourth target storage path, a fourth sub-video file corresponding to the capture start time and the capture end time.

S1104:对该第四子视频文件进行解析,得到第二目标子视频。S1104: Parse the fourth sub-video file to obtain a second target sub-video.

图12为本申请实施例提供的视频截取过程示意图,如该图12所示,该过程包括:FIG. 12 is a schematic diagram of a video capture process provided in an embodiment of the present application. As shown in FIG. 12 , the process includes:

S1201:接收输入的截取指令,其中该截取指令中携带有截取开始时间和截取结束时间。S1201: Receive an input interception instruction, wherein the interception instruction carries an interception start time and an interception end time.

S1202:根据数据库中保存的每个存储路径对应的开始时间及该截取开始时间,确定该截取开始时间对应的第三目标存储路径和该截取结束时间对应的第四目标存储路径。S1202: According to the start time corresponding to each storage path and the interception start time stored in the database, determine a third target storage path corresponding to the interception start time and a fourth target storage path corresponding to the interception end time.

S1203:判断该第三目标存储路径和该第四目标存储路径是否为同一存储路径,若是,则执行S1204,若否,则执行S1205。S1203: Determine whether the third target storage path and the fourth target storage path are the same storage path, if so, execute S1204, if not, execute S1205.

S1204:从该第三目标存储路径下获取该第四子视频文件,并执行S1208。S1204: Obtain the fourth sub-video file from the third target storage path, and execute S1208.

S1205:判断是否存在至少一个第五目标存储路径,其中该至少一个第五目标存储路径对应的开始时间位于该第三目标存储路径对应的开始时间和该第四目标存储路径对应的开始时间之间,若存在,则执行S1206,若不存在,则执行S1207。S1205: Determine whether there is at least one fifth target storage path, wherein the start time corresponding to the at least one fifth target storage path is between the start time corresponding to the third target storage path and the start time corresponding to the fourth target storage path; if so, execute S1206; if not, execute S1207.

S1206:从该第三目标存储路径、第四目标存储路径和该至少一个第五目标存储路径下获取该第四子视频文件,并执行S1208。S1206: Acquire the fourth sub video file from the third target storage path, the fourth target storage path, and the at least one fifth target storage path, and execute S1208.

S1207:从该第三目标存储路径和第四目标存储路径下获取该第四子视频文件,并执行S1208。S1207: Obtain the fourth sub video file from the third target storage path and the fourth target storage path, and execute S1208.

S1208:对该第四子视频文件进行解析,得到第二目标子视频。S1208: Parse the fourth sub-video file to obtain a second target sub-video.

图13为本申请实施例提供的视频录制装置的结构示意图,如该图13所示,该装置包括:FIG13 is a schematic diagram of the structure of a video recording device provided in an embodiment of the present application. As shown in FIG13 , the device includes:

处理模块1301,用于在视频录制过程中,获取当前时间,若确定所述当前时间为整数时间,则确定与当前时间对应的关键帧,并将所述关键帧对应的录制时间更新为所述当前时间,其中,所述整数时间为整分整秒的时间;The processing module 1301 is used to obtain the current time during the video recording process, and if it is determined that the current time is an integer time, determine the key frame corresponding to the current time, and update the recording time corresponding to the key frame to the current time, wherein the integer time is the time of whole minutes and whole seconds;

编码模块1302,用于对所述关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件;The encoding module 1302 is used to encode the video frame between the key frame and the previous key frame to obtain a first sub-video file;

保存模块1303,用于保存所述第一子视频文件。The saving module 1303 is used to save the first sub video file.

在一种可能的实施方式中,所述处理模块1301,具体用于若当前时间采集到了视频帧,则将当前时间采集的视频帧确定为关键帧;若当前时间未采集到视频帧,则获取在所述当前时间之前采集到的最后一个视频帧,将该最后一个视频帧确定为关键帧。In a possible implementation, the processing module 1301 is specifically used to, if a video frame is captured at the current time, determine the video frame captured at the current time as a key frame; if no video frame is captured at the current time, obtain the last video frame captured before the current time, and determine the last video frame as a key frame.

在一种可能的实施方式中,所述处理模块1301,还用于接收视频录制指令,生成待录制的视频文件对应的第一存储路径;In a possible implementation manner, the processing module 1301 is further configured to receive a video recording instruction and generate a first storage path corresponding to the video file to be recorded;

所述保存模块1303,具体用于判断所述第一子视频文件对应的第一存储路径下已存储的每个第二子视频文件及所述第一子视频文件的大小是否达到预设阈值;若否,则将所述第一子视频文件保存到所述第一存储路径下。The saving module 1303 is specifically used to determine whether the size of each second sub video file and the first sub video file stored in the first storage path corresponding to the first sub video file reaches a preset threshold; if not, the first sub video file is saved in the first storage path.

在一种可能的实施方式中,保存模块1303,还用于生成第二存储路径;将所述第一子视频文件保存到所述第二存储路径下。In a possible implementation, the saving module 1303 is further configured to generate a second storage path; and save the first sub video file to the second storage path.

在一种可能的实施方式中,保存模块1303,还用于将开始进行视频录制的时间作为第一开始时间,并将所述第一开始时间和所述第一存储路径对应保存到预先设置的数据库中;将所述上一帧关键帧对应的录制时间确定为第二开始时间,将所述第二开始时间和所述第二存储路径对应保存到所述数据库中。In a possible implementation, the saving module 1303 is also used to use the time when video recording starts as the first start time, and save the first start time and the first storage path correspondingly in a pre-set database; determine the recording time corresponding to the previous key frame as the second start time, and save the second start time and the second storage path correspondingly in the database.

在一种可能的实施方式中,所述处理模块1301,还用于接收输入的播放指令,其中所述播放指令中携带有播放开始时间;根据数据库中保存的每个存储路径对应的开始时间及所述播放开始时间,确定所述播放开始时间对应的第一目标存储路径;根据所述第一目标存储路径以及在所述第一目标存储路径之后生成的每个第二目标存储路径,确定待播放的第三子视频文件;对所述第三子视频文件进行解析,得到第一目标子视频,并播放所述第一目标子视频。In a possible implementation, the processing module 1301 is also used to receive an input playback instruction, wherein the playback instruction carries a playback start time; determine a first target storage path corresponding to the playback start time based on the start time corresponding to each storage path saved in a database and the playback start time; determine a third sub-video file to be played based on the first target storage path and each second target storage path generated after the first target storage path; parse the third sub-video file to obtain a first target sub-video, and play the first target sub-video.

在一种可能的实施方式中,所述处理模块1301,还用于接收输入的截取指令,其中所述截取指令中携带有截取开始时间和截取结束时间;根据数据库中保存的每个存储路径对应的开始时间及所述截取开始时间,确定所述截取开始时间对应的第三目标存储路径和所述截取结束时间对应的第四目标存储路径;根据所述第三目标存储路径以及所述第四目标存储路径,确定所述截取开始时间和所述截取结束时间对应的第四子视频文件;对所述第四子视频文件进行解析,得到待截取的第二目标子视频。In a possible implementation, the processing module 1301 is also used to receive an input interception instruction, wherein the interception instruction carries an interception start time and an interception end time; determine a third target storage path corresponding to the interception start time and a fourth target storage path corresponding to the interception end time according to the start time corresponding to each storage path saved in the database and the interception start time; determine a fourth sub-video file corresponding to the interception start time and the interception end time according to the third target storage path and the fourth target storage path; and parse the fourth sub-video file to obtain a second target sub-video to be intercepted.

在一种可能的实施方式中,所述处理模块1301,具体用于若所述第三目标存储路径和所述第四目标存储路径为同一存储路径,则从所述第三目标存储路径下获取所述第四子视频文件;若所述第三目标存储路径和所述第四目标存储路径不是同一存储路径,则根据所述数据库中保存的每个存储路径对应的开始时间,判断是否存在第五目标存储路径对应的开始时间位于所述第三目标存储路径对应的开始时间和所述第四目标存储路径对应的开始时间之间;若存在,则从所述第三目标存储路径、第四目标存储路径和所述第五目标存储路径下获取所述第四子视频文件;若不存在,则从所述第三目标存储路径和第四目标存储路径下获取所述第四子视频文件。In a possible implementation, the processing module 1301 is specifically used to obtain the fourth sub-video file from the third target storage path if the third target storage path and the fourth target storage path are the same storage path; if the third target storage path and the fourth target storage path are not the same storage path, judging whether there is a fifth target storage path whose start time is between the start time corresponding to the third target storage path and the start time corresponding to the fourth target storage path according to the start time corresponding to each storage path saved in the database; if so, obtaining the fourth sub-video file from the third target storage path, the fourth target storage path and the fifth target storage path; if not, obtaining the fourth sub-video file from the third target storage path and the fourth target storage path.

基于相同的发明构思,图14为本申请实施例提供的终端的另一种结构示意图,如图14所示,包括:一个或两个以上(包括两个)处理器1401和通信接口1402。Based on the same inventive concept, FIG. 14 is another structural diagram of a terminal provided in an embodiment of the present application. As shown in FIG. 14 , it includes: one or more (including two) processors 1401 and a communication interface 1402 .

可选的,该终端还包括存储器1403,存储器1403可以包括只读存储器和随机存取存储器,并向处理器提供操作指令和数据。存储器的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。Optionally, the terminal further includes a memory 1403, which may include a read-only memory and a random access memory, and provides operation instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory (NVRAM).

在一些实施方式中,如图14所示,存储器1403存储了如下的元素,执行模块或者数据结构,或者他们的子集,或者他们的扩展集。In some embodiments, as shown in FIG. 14 , the memory 1403 stores the following elements, execution modules or data structures, or a subset thereof, or an extended set thereof.

如图14所示,在本申请一些实施例中,通过调用存储器1403存储的操作指令(该操作指令可存储在操作系统中),执行相应的操作。As shown in FIG. 14 , in some embodiments of the present application, corresponding operations are performed by calling operation instructions stored in the memory 1403 (the operation instructions may be stored in the operating system).

如图14所示,处理器1401控制头端设备的处理操作,处理器还可以称为中央处理单元(central processing unit,CPU)。As shown in FIG. 14 , a processor 1401 controls the processing operations of the head-end device. The processor may also be referred to as a central processing unit (CPU).

如图14所示,存储器1403可以包括只读存储器和随机存取存储器,并向处理器提供指令和数据。存储器1403的一部分还可以包括NVRAM。例如应用中通信接口以及存储器通过总线系统1404耦合在一起,其中总线系统1404除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图14中将各种总线都标为总线系统1404。As shown in FIG. 14 , the memory 1403 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory 1403 may also include an NVRAM. For example, in an application, the communication interface and the memory are coupled together through a bus system 1404, wherein the bus system 1404 may include a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, various buses are labeled as bus system 1404 in FIG. 14 .

上述本申请一些实施例揭示的方法可以应用于处理器中,或者由处理器实现。处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、数字信号处理器(digital signal processing,DSP)、ASIC、现成可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请一些实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请一些实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。The methods disclosed in some embodiments of the present application described above can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in the form of software. The above processor may be a general-purpose processor, a digital signal processor (digital signal processing, DSP), an ASIC, a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in some embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the methods disclosed in some embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

在上述各实施例的基础上,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有可由电子设备执行的计算机程序,当所述程序在所述电子设备上运行时,使得所述电子设备执行时实现上述本申请一些实施例中揭示的方法。Based on the above embodiments, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program executable by an electronic device is stored. When the program runs on the electronic device, the electronic device implements the methods disclosed in some embodiments of the present application.

由于上述计算机可读存储介质解决问题的原理与视频录制方法相似,因此上述计算机可读存储介质的实施可以参见方法的实施例,重复之处不再赘述。Since the principle of solving the problem by the above-mentioned computer-readable storage medium is similar to that of the video recording method, the implementation of the above-mentioned computer-readable storage medium can refer to the embodiment of the method, and the repeated parts will not be repeated.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

本申请是参照根据本申请的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to the flowchart and/or block diagram of the method, device (system), and computer program product according to the present application. It should be understood that each process and/or box in the flowchart and/or block diagram, as well as the combination of the process and/or box in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes in the flowchart and/or one box or multiple boxes in the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and/or one or more boxes in the block diagram.

显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims (9)

1.一种视频录制方法,应用于终端,其特征在于,所述方法包括:1. A video recording method, applied to a terminal, characterized in that the method comprises: 在视频录制过程中,获取当前时间,若所述当前时间为整数时间,则确定与当前时间对应的关键帧,并将所述关键帧对应的录制时间更新为所述当前时间,其中,所述整数时间为整分整秒的时间;During the video recording process, the current time is obtained. If the current time is an integer time, a key frame corresponding to the current time is determined, and the recording time corresponding to the key frame is updated to the current time, wherein the integer time is a time of whole minutes and whole seconds; 对所述关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件,并保存所述第一子视频文件;Encoding the video frames between the key frame and the previous key frame to obtain a first sub-video file, and saving the first sub-video file; 其中,所述确定与当前时间对应的关键帧包括:Wherein, determining the key frame corresponding to the current time includes: 若当前时间采集到了视频帧,则将当前时间采集的视频帧确定为关键帧;If a video frame is captured at the current time, the video frame captured at the current time is determined as a key frame; 若当前时间未采集到视频帧,则获取在所述当前时间之前采集到的最后一个视频帧,将该最后一个视频帧确定为关键帧。If no video frame is captured at the current time, the last video frame captured before the current time is obtained, and the last video frame is determined as a key frame. 2.根据权利要求1所述的方法,其特征在于,所述获取当前时间之前,所述方法还包括:2. The method according to claim 1, characterized in that before obtaining the current time, the method further comprises: 接收视频录制指令,生成待录制的视频文件对应的第一存储路径;Receiving a video recording instruction, and generating a first storage path corresponding to the video file to be recorded; 所述保存所述第一子视频文件包括:The saving of the first sub-video file comprises: 判断所述第一子视频文件对应的第一存储路径下已存储的每个第二子视频文件及所述第一子视频文件的大小是否达到预设阈值;Determine whether the size of each second sub video file and the first sub video file stored in the first storage path corresponding to the first sub video file reaches a preset threshold; 若否,则将所述第一子视频文件保存到所述第一存储路径下。If not, the first sub-video file is saved in the first storage path. 3.根据权利要求2所述的方法,其特征在于,若所述第一存储路径下已存储的每个第二子视频文件及所述第一子视频文件的大小达到预设阈值,所述方法还包括:3. The method according to claim 2, characterized in that if the size of each second sub video file and the first sub video file stored in the first storage path reaches a preset threshold, the method further comprises: 生成第二存储路径;generating a second storage path; 将所述第一子视频文件保存到所述第二存储路径下。The first sub-video file is saved in the second storage path. 4.根据权利要求3所述的方法,其特征在于,所述方法还包括:4. The method according to claim 3, characterized in that the method further comprises: 将开始进行视频录制的时间作为第一开始时间,并将所述第一开始时间和所述第一存储路径对应保存到预先设置的数据库中;The time when the video recording starts is taken as a first start time, and the first start time and the first storage path are correspondingly saved in a preset database; 将所述上一个关键帧对应的录制时间确定为第二开始时间,将所述第二开始时间和所述第二存储路径对应保存到所述数据库中。The recording time corresponding to the previous key frame is determined as a second start time, and the second start time and the second storage path are correspondingly saved in the database. 5.根据权利要求4所述的方法,其特征在于,所述方法还包括:5. The method according to claim 4, characterized in that the method further comprises: 接收输入的播放指令,其中所述播放指令中携带有播放开始时间;Receiving an inputted play instruction, wherein the play instruction carries a play start time; 根据数据库中保存的每个存储路径对应的开始时间及所述播放开始时间,确定所述播放开始时间对应的第一目标存储路径;Determine a first target storage path corresponding to the playback start time according to the start time corresponding to each storage path and the playback start time stored in the database; 根据所述第一目标存储路径以及在所述第一目标存储路径之后生成的每个第二目标存储路径,确定待播放的第三子视频文件;Determine a third sub video file to be played according to the first target storage path and each second target storage path generated after the first target storage path; 对所述第三子视频文件进行解析,得到第一目标子视频,并播放所述第一目标子视频。The third sub-video file is parsed to obtain a first target sub-video, and the first target sub-video is played. 6.根据权利要求4所述的方法,其特征在于,所述方法还包括:6. The method according to claim 4, characterized in that the method further comprises: 接收输入的截取指令,其中所述截取指令中携带有截取开始时间和截取结束时间;Receive an input interception instruction, wherein the interception instruction carries an interception start time and an interception end time; 根据数据库中保存的每个存储路径对应的开始时间及所述截取开始时间,确定所述截取开始时间对应的第三目标存储路径和所述截取结束时间对应的第四目标存储路径;According to the start time corresponding to each storage path and the interception start time stored in the database, determining a third target storage path corresponding to the interception start time and a fourth target storage path corresponding to the interception end time; 根据所述第三目标存储路径以及所述第四目标存储路径,确定所述截取开始时间和所述截取结束时间对应的第四子视频文件;Determine, according to the third target storage path and the fourth target storage path, a fourth sub video file corresponding to the interception start time and the interception end time; 对所述第四子视频文件进行解析,得到待截取的第二目标子视频。The fourth sub-video file is parsed to obtain a second target sub-video to be intercepted. 7.根据权利要求6所述的方法,其特征在于,所述根据所述第三目标存储路径以及所述第四目标存储路径,确定所述截取开始时间和所述截取结束时间对应的第四子视频文件包括:7. The method according to claim 6, characterized in that the determining, according to the third target storage path and the fourth target storage path, the fourth sub video file corresponding to the interception start time and the interception end time comprises: 若所述第三目标存储路径和所述第四目标存储路径为同一存储路径,则从所述第三目标存储路径下获取所述第四子视频文件;If the third target storage path and the fourth target storage path are the same storage path, obtaining the fourth sub video file from the third target storage path; 若所述第三目标存储路径和所述第四目标存储路径不是同一存储路径,则根据所述数据库中保存的每个存储路径对应的开始时间,判断是否存在第五目标存储路径对应的开始时间位于所述第三目标存储路径对应的开始时间和所述第四目标存储路径对应的开始时间之间;若存在,则从所述第三目标存储路径、第四目标存储路径和所述第五目标存储路径下获取所述第四子视频文件;若不存在,则从所述第三目标存储路径和第四目标存储路径下获取所述第四子视频文件。If the third target storage path and the fourth target storage path are not the same storage path, then, based on the start time corresponding to each storage path saved in the database, determine whether there is a fifth target storage path whose start time is between the start time corresponding to the third target storage path and the start time corresponding to the fourth target storage path; if so, obtain the fourth sub-video file from the third target storage path, the fourth target storage path and the fifth target storage path; if not, obtain the fourth sub-video file from the third target storage path and the fourth target storage path. 8.一种视频录制装置,应用于终端,其特征在于,所述装置包括:8. A video recording device, applied to a terminal, characterized in that the device comprises: 处理模块,用于在视频录制过程中,获取当前时间,若确定所述当前时间为整数时间,则确定与当前时间对应的关键帧,并将所述关键帧对应的录制时间更新为所述当前时间,其中,所述整数时间为整分整秒的时间;A processing module, used for obtaining the current time during video recording, and if it is determined that the current time is an integer time, determining a key frame corresponding to the current time, and updating the recording time corresponding to the key frame to the current time, wherein the integer time is a time of whole minutes and whole seconds; 编码模块,用于对所述关键帧和上一个关键帧之间的视频帧进行编码得到第一子视频文件;An encoding module, used for encoding the video frame between the key frame and the previous key frame to obtain a first sub-video file; 保存模块,用于保存所述第一子视频文件;A saving module, used for saving the first sub video file; 其中,所述处理模块,具体用于若当前时间采集到了视频帧,则将当前时间采集的视频帧确定为关键帧;若当前时间未采集到视频帧,则获取在所述当前时间之前采集到的最后一个视频帧,将该最后一个视频帧确定为关键帧。Among them, the processing module is specifically used to determine the video frame captured at the current time as a key frame if a video frame is captured at the current time; if no video frame is captured at the current time, obtain the last video frame captured before the current time and determine the last video frame as a key frame. 9.一种终端,其特征在于,所述终端包括:9. A terminal, characterized in that the terminal comprises: 显示器、处理器和存储器;Display, processor and memory; 所述显示器用于显示屏幕显示区域;The display is used to display the screen display area; 所述存储器,用于存储所述处理器可执行指令;The memory is used to store the processor executable instructions; 所述处理器被配置为执行所述指令以实现如权利要求1-7中任一项所述的视频录制方法。The processor is configured to execute the instructions to implement the video recording method according to any one of claims 1 to 7.
CN202210552032.7A 2022-05-18 2022-05-18 Video recording method, device and terminal Active CN114979533B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210552032.7A CN114979533B (en) 2022-05-18 2022-05-18 Video recording method, device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210552032.7A CN114979533B (en) 2022-05-18 2022-05-18 Video recording method, device and terminal

Publications (2)

Publication Number Publication Date
CN114979533A CN114979533A (en) 2022-08-30
CN114979533B true CN114979533B (en) 2024-11-08

Family

ID=82985298

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210552032.7A Active CN114979533B (en) 2022-05-18 2022-05-18 Video recording method, device and terminal

Country Status (1)

Country Link
CN (1) CN114979533B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115589450B (en) * 2022-09-01 2024-04-05 荣耀终端有限公司 Video recording method and device
CN115941573B (en) * 2022-12-07 2024-09-24 四川天邑康和通信股份有限公司 Method for analyzing and monitoring video frame loss to judge switch performance

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102325244A (en) * 2011-08-26 2012-01-18 杭州海康威视数字技术股份有限公司 Method for rapidly positioning videos by time, video storage control device and positioning device
CN110012251A (en) * 2018-01-04 2019-07-12 腾讯科技(深圳)有限公司 Video recording method, device and readable storage medium storing program for executing

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4209379B2 (en) * 2004-11-05 2009-01-14 株式会社デジタル RECORDING DEVICE, ITS BROWSER DEVICE, ITS PROGRAM, AND RECORDING MEDIUM
CN103308330B (en) * 2012-03-14 2017-08-01 富泰华工业(深圳)有限公司 Test device and test method for electronic product performance
CN105072439B (en) * 2015-07-31 2017-10-03 珠海市杰理科技股份有限公司 The insertion method and device of key frame in Video coding
CN107846574A (en) * 2016-12-30 2018-03-27 河北长铄科技有限公司 A kind of method that surveillance video is retrieved using financial account
CN107580242A (en) * 2017-09-20 2018-01-12 深圳前海茂佳软件科技有限公司 Video method for real-time transmitting, television equipment and storage medium based on television equipment
CN108366294A (en) * 2018-03-06 2018-08-03 广州市千钧网络科技有限公司 A kind of video method of cutting out and device
CN111436005B (en) * 2019-01-15 2022-03-08 北京字节跳动网络技术有限公司 Method and apparatus for displaying image
CN110022489B (en) * 2019-05-30 2021-12-24 腾讯音乐娱乐科技(深圳)有限公司 Video playing method, device and storage medium
CN113645481B (en) * 2021-08-23 2023-01-24 歌尔科技有限公司 Video recording method, camera equipment, control terminal and video recording system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102325244A (en) * 2011-08-26 2012-01-18 杭州海康威视数字技术股份有限公司 Method for rapidly positioning videos by time, video storage control device and positioning device
CN110012251A (en) * 2018-01-04 2019-07-12 腾讯科技(深圳)有限公司 Video recording method, device and readable storage medium storing program for executing

Also Published As

Publication number Publication date
CN114979533A (en) 2022-08-30

Similar Documents

Publication Publication Date Title
CN114979533B (en) Video recording method, device and terminal
CN110865837B (en) Method and terminal for system upgrade
CN112114733B (en) Screen capturing and recording method, mobile terminal and computer storage medium
CN113709026B (en) Method, device, storage medium and program product for processing instant communication message
CN113835569A (en) Terminal device, quick start method for internal function of application and storage medium
CN111857531A (en) Mobile terminal and file display method thereof
CN113253905B (en) Touch method based on multi-finger operation and intelligent terminal
CN112000408B (en) Mobile terminal and display method thereof
CN113055585B (en) Thumbnail display method of shooting interface and mobile terminal
CN116700601B (en) Memory optimization methods, equipment and storage media
CN114595203B (en) File synchronization method, terminal device and storage medium based on dual systems
CN113079332B (en) Mobile terminal and screen recording method thereof
CN113642010B (en) Method for acquiring data of extended storage device and mobile terminal
CN111182361B (en) Communication terminal and video previewing method
CN112000411B (en) Mobile terminal and display method of recording channel occupation information thereof
CN113760164B (en) Display device and response method of its control operation
CN118796326A (en) Method and terminal device for enhancing display of two-dimensional code
CN115175002B (en) Video playing method and device
CN113672249B (en) Mobile terminal and download interface updating method thereof
CN114968013B (en) Terminal device, function setting method and storage medium
CN116701327B (en) File processing method and electronic device
CN114356477B (en) Terminal equipment and application program calling method
CN113031903B (en) Electronic equipment and audio stream synthesis method thereof
CN117097793B (en) A message push method, terminal and server
CN111142648B (en) Data processing method and intelligent terminal

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
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: Shandong City, Qingdao Province, Jiangxi City Road No. 11

Applicant after: Qingdao Hisense Mobile Communication Technology Co.,Ltd.

Address before: Shandong City, Qingdao Province, Jiangxi City Road No. 11

Applicant before: HISENSE MOBILE COMMUNICATIONS TECHNOLOGY Co.,Ltd.

Country or region before: China

GR01 Patent grant
GR01 Patent grant