CN112068771A - Video processing method, video processing device, terminal device and storage medium - Google Patents
Video processing method, video processing device, terminal device and storage medium Download PDFInfo
- Publication number
- CN112068771A CN112068771A CN202010828382.2A CN202010828382A CN112068771A CN 112068771 A CN112068771 A CN 112068771A CN 202010828382 A CN202010828382 A CN 202010828382A CN 112068771 A CN112068771 A CN 112068771A
- Authority
- CN
- China
- Prior art keywords
- video
- written
- sampling
- preset
- memory
- 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.)
- Withdrawn
Links
- 238000012545 processing Methods 0.000 title claims abstract description 55
- 238000003672 processing method Methods 0.000 title claims abstract description 15
- 238000005070 sampling Methods 0.000 claims abstract description 287
- 238000000034 method Methods 0.000 claims abstract description 38
- 230000033001 locomotion Effects 0.000 claims description 26
- 230000008859 change Effects 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 8
- 230000004044 response Effects 0.000 claims description 8
- 230000008569 process Effects 0.000 abstract description 11
- 230000002035 prolonged effect Effects 0.000 abstract description 2
- 230000006870 function Effects 0.000 description 18
- 230000000007 visual effect Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 239000003086 colorant Substances 0.000 description 5
- 230000000694 effects Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000003313 weakening effect Effects 0.000 description 4
- 238000001514 detection method Methods 0.000 description 3
- 239000007787 solid Substances 0.000 description 3
- 230000007774 longterm Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 230000005236 sound signal Effects 0.000 description 2
- 241000699670 Mus sp. Species 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 230000003321 amplification Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 239000000470 constituent Substances 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000003199 nucleic acid amplification method Methods 0.000 description 1
- 230000002688 persistence Effects 0.000 description 1
- 238000010079 rubber tapping Methods 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000012706 support-vector machine Methods 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 238000012549 training Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0614—Improving the reliability of storage systems
- G06F3/0616—Improving the reliability of storage systems in relation to life time, e.g. increasing Mean Time Between Failures [MTBF]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
- G06F3/0611—Improving I/O performance in relation to response time
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
本申请实施例公开了一种视频处理方法、视频处理装置、终端设备及存储介质,应用于数据处理领域,所述方法包括:获取终端设备中待写入视频的写入指令;根据写入指令获取待写入视频的视频采样参数;按照视频采样参数,对待写入视频进行数据处理,得到写入视频的图像帧;写入视频的内存占用量小于待写入视频的内存占用量;对写入视频的图像帧进行写入操作。可见,由于终端设备存在大容量的数据写入时,大容量的数据通常为视频数据,故本申请通过视频采样参数对待写入视频进行数据处理,从而减少数据的写入量,可以避免终端设备的内存占用量较大导致的写入速度较慢的问题,以及在终端设备的硬盘为固态硬盘的情况下,延长了固态硬盘中闪存的使用寿命。
The embodiment of the present application discloses a video processing method, a video processing device, a terminal device and a storage medium, which are applied to the field of data processing. The method includes: acquiring a writing instruction of the video to be written in the terminal equipment; according to the writing instruction Obtain the video sampling parameters of the video to be written; perform data processing on the video to be written according to the video sampling parameters to obtain the image frame of the written video; the memory occupancy of the written video is smaller than the memory occupancy of the video to be written; Input the image frame of the video to perform the write operation. It can be seen that when there is a large-capacity data write in the terminal device, the large-capacity data is usually video data. Therefore, the present application uses the video sampling parameters to process the data to be written in the video, thereby reducing the amount of data written, which can avoid the terminal device. The problem of slow writing speed caused by the large memory occupancy of the terminal device, and in the case where the hard disk of the terminal device is a solid-state hard disk, the service life of the flash memory in the solid-state hard disk is prolonged.
Description
技术领域technical field
本申请涉及数据处理技术领域,尤其涉及一种视频处理方法、视频处理装置、终端设备及存储介质。The present application relates to the technical field of data processing, and in particular, to a video processing method, a video processing apparatus, a terminal device, and a storage medium.
背景技术Background technique
目前,对于小容量(比如16GB,32GB等)的终端设备,若写入大量的数据,则会对终端设备的硬盘(例如机械硬盘或者固态硬盘等)的空间占用较大,从而导致数据的写入速度较慢。At present, for a terminal device with a small capacity (such as 16GB, 32GB, etc.), if a large amount of data is written, it will occupy a large space on the hard disk (such as a mechanical hard disk or a solid-state hard disk, etc.) of the terminal device, resulting in data writing. The entry speed is slower.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种视频处理方法、视频处理装置、终端设备及存储介质,避免终端设备的内存占用量较大导致的写入速度较慢的问题,以及在终端设备的硬盘为固态硬盘的情况下,延长了固态硬盘中闪存的使用寿命。Embodiments of the present application provide a video processing method, a video processing device, a terminal device, and a storage medium, which avoid the problem of slow writing speed caused by the large memory occupancy of the terminal device, and when the hard disk of the terminal device is a solid-state hard disk , extending the life of the flash memory in the SSD.
第一方面,提供一种视频处理方法,包括:In a first aspect, a video processing method is provided, including:
获取终端设备中待写入视频的写入指令;Obtain the writing instruction of the video to be written in the terminal device;
根据所述写入指令获取所述待写入视频的视频采样参数;Obtain the video sampling parameters of the to-be-written video according to the write instruction;
按照所述视频采样参数,对所述待写入视频进行数据处理,得到写入视频的图像帧;所述写入视频的内存占用量小于所述待写入视频的内存占用量;According to the video sampling parameters, data processing is performed on the video to be written to obtain an image frame of the written video; the memory occupancy of the written video is smaller than the memory occupancy of the to-be-written video;
对所述写入视频的图像帧进行写入操作。A write operation is performed on the image frame of the written video.
第二方面,提供一种视频处理装置,包括:In a second aspect, a video processing apparatus is provided, including:
获取模块,用于获取终端设备中待写入视频的写入指令;以及,an acquisition module, used to acquire the writing instruction of the video to be written in the terminal device; and,
根据所述写入指令获取所述待写入视频的视频采样参数;Obtain the video sampling parameters of the to-be-written video according to the write instruction;
处理模块,用于按照所述视频采样参数,对所述待写入视频进行数据处理,得到写入视频的图像帧;所述写入视频的内存占用量小于所述待写入视频的内存占用量;以及,a processing module, configured to perform data processing on the to-be-written video according to the video sampling parameters to obtain image frames of the written video; the memory occupancy of the written video is smaller than the memory occupancy of the to-be-written video amount; and,
对所述写入视频的图像帧进行写入操作。A write operation is performed on the image frame of the written video.
第三方面,提供一种终端设备,包括处理器和存储器,所述处理器和存储器耦合,所述存储器用于存储计算机程序指令,当所述处理器执行所述计算机程序指令时,使得终端设备执行上述第一方面所述的方法。In a third aspect, a terminal device is provided, including a processor and a memory, the processor and the memory are coupled, the memory is used for storing computer program instructions, when the processor executes the computer program instructions, the terminal device is The method described in the first aspect above is performed.
第四方面,提供一种计算机存储介质,所述计算机存储介质中存储有程序指令,当所述程序指令在终端设备上运行时,使得终端设备执行上述第一方面所述的方法。In a fourth aspect, a computer storage medium is provided, where program instructions are stored in the computer storage medium, and when the program instructions are executed on a terminal device, the terminal device is made to execute the method described in the first aspect.
第五方面,提供一种芯片,所述芯片与终端设备中的存储器耦合,使得所述芯片在运行时调用所述存储器中存储的程序指令,使得所述终端设备执行上述第一方面所述的方法。In a fifth aspect, a chip is provided, the chip is coupled to a memory in a terminal device, so that the chip calls program instructions stored in the memory when running, so that the terminal device executes the above-mentioned first aspect. method.
从以上技术方案可以看出,本申请实施例具有以下优点:本申请首先获取终端设备中待写入视频的写入指令;接着根据写入指令获取所述待写入视频的视频采样参数;然后按照视频采样参数,对待写入视频进行数据处理,得到写入视频的图像帧;写入视频的内存占用量小于待写入视频的内存占用量;最后对写入视频的图像帧进行写入操作。可见,由于终端设备存在大容量的数据写入时,大容量的数据通常为视频数据,故本申请通过视频采样参数对待写入视频进行数据处理,从而减少数据的写入量,可以避免终端设备的内存占用量较大导致的写入速度较慢的问题,以及在终端设备的硬盘为固态硬盘的情况下,延长了固态硬盘中闪存的使用寿命。It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: the present application first obtains the writing instruction of the video to be written in the terminal device; then obtains the video sampling parameters of the to-be-written video according to the writing instruction; then According to the video sampling parameters, data processing is performed on the video to be written to obtain the image frame of the written video; the memory occupancy of the written video is smaller than the memory occupancy of the video to be written; finally, the write operation is performed on the image frame written into the video . It can be seen that when there is a large-capacity data write in the terminal device, the large-capacity data is usually video data. Therefore, the present application uses the video sampling parameters to process the data to be written in the video, thereby reducing the amount of data written, which can avoid the terminal device. The problem of slow writing speed caused by the large memory occupancy of the terminal device, and in the case where the hard disk of the terminal device is a solid-state hard disk, the service life of the flash memory in the solid-state hard disk is prolonged.
附图说明Description of drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例和现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,还可以根据这些附图获得其它的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments and the prior art. Obviously, the drawings in the following description are only some implementations of the present application. For example, other drawings may also be obtained from these drawings.
图1为本申请实施例提供的一种视频处理方法的示意图;1 is a schematic diagram of a video processing method provided by an embodiment of the present application;
图2为本申请实施例提供的一种终端设备显示的界面的示意图;FIG. 2 is a schematic diagram of an interface displayed by a terminal device according to an embodiment of the present application;
图3为本申请实施例提供的另一种终端设备显示的界面的示意图;3 is a schematic diagram of an interface displayed by another terminal device according to an embodiment of the present application;
图4为本申请实施例提供的另一种视频处理方法的示意图;4 is a schematic diagram of another video processing method provided by an embodiment of the present application;
图5为本申请实施例提供的一种视频处理装置的结构框图;FIG. 5 is a structural block diagram of a video processing apparatus provided by an embodiment of the present application;
图6为本申请实施例提供的一种终端设备的结构框图。FIG. 6 is a structural block diagram of a terminal device provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,都应当属于本申请保护的范围。In order to make those skilled in the art better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the present application. examples, but not all examples. Based on the embodiments in this application, all should belong to the scope of protection of this application.
在相关技术中,机械硬盘存在机械结构,故机械硬盘的内部部件相对于固态硬盘比较复杂,使得机械硬盘比固态硬盘重。随着用户对终端设备的轻便性的需求日益增长,固态硬盘在终端设备中的利用率越高越高。In the related art, the mechanical hard disk has a mechanical structure, so the internal components of the mechanical hard disk are more complicated than the solid-state hard disk, so that the mechanical hard disk is heavier than the solid-state hard disk. As users' demands for portability of terminal devices increase, the utilization of solid-state drives in terminal devices is higher.
其中,固态硬盘采用闪存作为存储介质,读取速度相对机械硬盘更快。其中,闪存控制器可以通过软件(例如firmware固件)以及闪存转换层(flash translate layer,FTL)对闪存(例如NAND flash memory等)进行管理。闪存控制器可以为内嵌在固态硬盘中的控制器,或者,可以为与固态硬盘连接的外部的控制器。考虑到闪存具有失效机制,故在使用过程中会产生失效位,若失效位超出错误检查和纠正(error checking and correcting,ECC)引擎的挽救范围,则失效位所属的块(即通常所说的block)为坏块(即通常所说的badblock),并无法再被使用。以及,闪存的每个块存在有限的擦写寿命(即通常所说的PEcycle),故需要通过FTL进行坏块管理、ECC引擎管理、垃圾收集(即通常所说的garbagecollection,GC)管理、磨耗均衡(即通常所说的wear leveling)管理等,以避免由于过度使用某些块导致某些块失效。Among them, the solid-state drive uses flash memory as the storage medium, and the reading speed is faster than that of the mechanical hard disk. The flash memory controller can manage the flash memory (eg, NAND flash memory, etc.) through software (eg, firmware) and a flash translate layer (flash translate layer, FTL). The flash memory controller may be a controller embedded in the solid state drive, or may be an external controller connected to the solid state drive. Considering that the flash memory has a failure mechanism, a failure bit will be generated during use. If the failed bit is beyond the rescue range of the error checking and correcting (ECC) engine, the block to which the failed bit belongs (the so-called block) is a bad block (the so-called badblock) and can no longer be used. In addition, each block of flash memory has a limited erasing and writing life (that is, the so-called PEcycle), so it is necessary to perform bad block management, ECC engine management, garbage collection (that is, the so-called garbage collection, GC) management, wear and tear through FTL. Equalization (also known as wear leveling) management, etc., to avoid the failure of certain blocks due to overuse of them.
但是,小容量的闪存仍会存在大量的数据擦写而达到寿命的终点。例如,对于面向低端用户的手机,一般不会提供足够的预留空间(over provision,OP)进行GC,从而导致无法减小写入放大因子(write amplification factor,WAF)。这样,FTL受小容量的物理限制无法避免闪存的使用寿命较短的问题,从而导致终端设备的整机寿命也较短。However, a small-capacity flash memory will still have a large amount of data erasing and writing to reach the end of its life. For example, for a mobile phone for low-end users, generally enough over provision (OP) is not provided for GC, so that the write amplification factor (WAF) cannot be reduced. In this way, due to the physical limitation of small capacity, FTL cannot avoid the problem of short service life of flash memory, which leads to the short service life of the terminal device as a whole.
为了解决该问题,本申请考虑到终端设备存在大容量的数据写入时,大容量的数据通常为视频数据。故本申请可以通过视频采样参数对待写入视频进行数据处理得到写入视频的图像帧,写入视频的内存占用量小于待写入视频的内存占用量,以及对写入视频的图像帧进行写入操作。可见,通过减少数据的写入量,可以避免终端设备的内存占用量较大导致的写入速度较慢的问题,以及在终端设备的硬盘为固态硬盘的情况下,延长固态硬盘中闪存的使用寿命,从而使得终端设备的整机寿命也延长。In order to solve this problem, the present application considers that when a terminal device has large-capacity data writing, the large-capacity data is usually video data. Therefore, the present application can perform data processing on the video to be written through the video sampling parameters to obtain the image frame of the written video, the memory occupancy of the written video is smaller than the memory occupancy of the to-be-written video, and the image frame of the written video can be written. into operation. It can be seen that by reducing the amount of data written, the problem of slow writing speed caused by the large memory footprint of the terminal device can be avoided, and when the hard disk of the terminal device is a solid-state hard disk, the use of flash memory in the solid-state hard disk can be extended. life, so that the life of the terminal equipment is also extended.
下面结合具体实施例对本申请进行详细说明。The present application will be described in detail below with reference to specific embodiments.
图1为本申请实施例提供的一种视频处理方法的流程示意图。所述方法可以应用于终端设备,可选地,所述方法可以由终端设备中的控制器执行。本申请实施例以终端设备的硬盘包括固态硬盘为例进行说明,控制器可以为集成在闪存控制器内的硬件控制模块,也可以为与闪存控制器连接的电路控制模块,也可以为具备视频处理功能的闪存控制器,还可以为终端设备内的中央处理器(central processing unit,CPU)等等,本申请对此不做特殊限制。FIG. 1 is a schematic flowchart of a video processing method provided by an embodiment of the present application. The method can be applied to a terminal device, and optionally, the method can be executed by a controller in the terminal device. The embodiments of this application are described by taking a hard disk of a terminal device including a solid-state hard disk as an example. The controller may be a hardware control module integrated in a flash memory controller, a circuit control module connected to the flash memory controller, or a video The flash memory controller for the processing function may also be a central processing unit (central processing unit, CPU) in the terminal device, etc., which is not particularly limited in this application.
如图1所示,所述方法可以包括:As shown in Figure 1, the method may include:
101、获取终端设备中待写入视频的写入指令。101. Obtain a writing instruction of the video to be written in the terminal device.
在本申请实施例中,可以通过但不限于以下方式获取写入指令:In this embodiment of the present application, the write instruction may be obtained by, but not limited to, the following methods:
方式一、终端设备响应于对终端设备的显示界面上的存储控件的第一存储操作,获取第一存储操作对应的待写入视频的写入指令。Manner 1: In response to a first storage operation on a storage control on a display interface of the terminal device, the terminal device acquires a writing instruction of the video to be written corresponding to the first storage operation.
可以理解的是,存储控件可以为视频应用程序中设置的视频下载控件和/或视频录制控件等。It can be understood that, the storage control may be a video download control and/or a video recording control, etc. set in the video application.
方式二、终端设备响应于对终端设备上的存储按键的第二存储操作,获取第二存储操作对应的待写入视频的写入指令。Manner 2: In response to the second storage operation on the storage button on the terminal device, the terminal device obtains a writing instruction of the video to be written corresponding to the second storage operation.
可以理解的是,存储按键可以为终端设备上设置的用于进行视频下载的视频下载按键,和/或,用于进行视频录制的视频录制按键等。示例性的,视频下载按键可以为调大音量键和电源键的组合键,视频录制按键可以为调小音量键和电源键的组合键,等等。It can be understood that the storage button may be a video download button set on the terminal device for performing video download, and/or a video recording button for performing video recording, and the like. Exemplarily, the video download button may be a combination of volume up and power keys, the video recording button may be a combination of volume down and power, and so on.
需要说明的是,本申请可以对不同视频应用程序设置相同的存储按键;或者,可以对不同视频应用程序设置不同的存储按键,本申请对此不作特殊限制。It should be noted that the application may set the same storage button for different video applications; or, different storage buttons may be set for different video applications, which is not particularly limited in this application.
方式三、在检测到写入数据流为视频数据的情况下,生成写入数据流对应的待写入视频的写入指令。Manner 3: In the case where it is detected that the write data stream is video data, a write command of the to-be-written video corresponding to the write data stream is generated.
可以理解的是,终端设备的视频应用程序向控制器发送写入数据流,写入数据流包括数据类型标识(例如写入数据流的文件头用于指示数据类型)。这样,控制器获取写入数据流中的数据类型标识,并在确定数据类型标识与视频数据标识相同的情况下,确定写入数据流为视频数据;在确定数据类型标识与视频数据标识不同的情况下,确定写入数据流为非视频数据,由于本申请认为非视频数据的数据量通常较小,故为了减少数据处理量,无需对非视频数据进行数据处理。It can be understood that the video application of the terminal device sends the write data stream to the controller, and the write data stream includes a data type identifier (for example, the file header of the write data stream is used to indicate the data type). In this way, the controller obtains the data type identifier written in the data stream, and when determining that the data type identifier is the same as the video data identifier, determines that the write data stream is video data; when determining that the data type identifier is different from the video data identifier In this case, it is determined that the written data stream is non-video data. Since the application considers that the data amount of non-video data is generally small, in order to reduce the data processing amount, data processing is not required for non-video data.
在本申请的一种可选实施例中,考虑到部分用户并不需要通过本申请中视频处理方法对待写入视频进行数据处理,而是直接对待写入视频进行写入操作。这样,为了提高视频写入的灵活性。如图2所示,本申请还可以在终端设备的第一设置页面中设置有节省内存控件,以及用于控制节省内存控件的选择控件。在节省内存控件处于开启状态时,执行本申请中的视频处理方法的步骤;在节省内存控件处于关闭状态时,执行现有技术中的对待写入视频进行写入操作的过程。图2中示出了节省内存控件处于开启状态的示意图。In an optional embodiment of the present application, it is considered that some users do not need to perform data processing on the video to be written by using the video processing method in the present application, but directly perform a writing operation on the video to be written. In this way, in order to improve the flexibility of video writing. As shown in FIG. 2 , the present application may further be provided with a memory saving control and a selection control for controlling the memory saving control on the first setting page of the terminal device. When the memory saving control is in an on state, the steps of the video processing method in the present application are performed; when the memory saving control is in an off state, the process of performing a writing operation on the video to be written in the prior art is performed. FIG. 2 shows a schematic diagram in which the memory saving control is turned on.
102、根据写入指令获取待写入视频的视频采样参数。102. Acquire video sampling parameters of the video to be written according to the write instruction.
其中,视频采样参数包括以下至少一种:采样帧频、采样分辨率、不同颜色分量集合、以及不同颜色分量分别对应的采样色阶;不同颜色分量集合存在对应的采样周期和/或采样顺序,颜色分量集合包括至少一个颜色分量。Wherein, the video sampling parameters include at least one of the following: sampling frame rate, sampling resolution, different color component sets, and sampling levels corresponding to different color components respectively; different color component sets have corresponding sampling periods and/or sampling sequences, The set of color components includes at least one color component.
需要说明的是,待写入视频的当前视频参数可以包括当前帧频、当前分辨率、当前颜色分量集合、不同颜色分量分别对应的当前色阶。其中,视频采样参数可以满足以下至少一个条件:采样帧频小于当前帧频;采样分辨率小于当前分辨率;至少一个颜色分量集合包括的颜色分量的数量对应小于当前颜色分量集合包括的颜色分量的数量;不同颜色分量的采样色阶对应小于不同颜色分量的当前色阶。It should be noted that the current video parameters of the video to be written may include the current frame rate, the current resolution, the current color component set, and the current color levels corresponding to different color components respectively. The video sampling parameter may satisfy at least one of the following conditions: the sampling frame rate is smaller than the current frame rate; the sampling resolution is smaller than the current resolution; the number of color components included in at least one color component set is correspondingly smaller than the number of color components included in the current color component set Quantity; the sampling level of different color components corresponds to the current level that is smaller than the different color components.
应理解,采样帧频可以为单位时间(例如1s)内采集的帧数。示例性的,采样帧频可以为50fs。It should be understood that the sampling frame rate may be the number of frames collected in a unit time (for example, 1 s). Exemplarily, the sampling frame rate may be 50fs.
应理解,采样分辨率可以包括两个方向(即通常所说的横向和纵向)的分辨率或者单个方向(即通常所说的横向或者纵向)的分辨率。It should be understood that the sampling resolution may include resolutions in two directions (ie, generally referred to as horizontal and vertical) or resolution in a single direction (ie, generally referred to as horizontal or vertical).
可以理解的是,采样周期可以为单位时间,或者指定帧数等。示例性的,不同的颜色分量集合包括第一个颜色分量集合(例如第一个颜色分量集合包括R颜色分量)、第二个颜色分量集合(例如第二个颜色分量集合包括G颜色分量)以及第三个颜色分量集合(例如第三个颜色分量集合包括B颜色分量),且不同颜色分量集合对应的采样周期均为单位时间,且单位时间为1s,不同颜色分量集合对应的采样顺序从先到后可以包括:第一个颜色分量集合、第二个颜色分量集合以及第三个颜色分量集合。It can be understood that the sampling period may be a unit time, or a specified number of frames or the like. Illustratively, the different sets of color components include a first set of color components (eg, the first set of color components includes R color components), a second set of color components (eg, the second set of color components includes G color components), and The third color component set (for example, the third color component set includes the B color component), and the sampling periods corresponding to different color component sets are unit time, and the unit time is 1s, and the sampling order corresponding to different color component sets is from the first Afterwards, it can include: a first set of color components, a second set of color components, and a third set of color components.
需要说明的是,不同颜色分量分别对应的采样色阶可以为同一色阶,也可以为不同色阶,本申请对此不作限制。示例性的,不同颜色分量包括R、G、B,且对应的采样色阶均为8。It should be noted that the sampling color levels corresponding to different color components may be the same color level or different color levels, which is not limited in this application. Exemplarily, the different color components include R, G, and B, and the corresponding sampling levels are all 8.
可选地,在终端设备的参数设置页面中设置有视频采样参数的参数类型分别对应的参数控件,以及用于控制参数控件的选择控件,以便用户可以选取目标参数类型进行开启;参数类型包括目标参数类型。此时,本步骤可以包括:终端设备获取开启的目标参数类型所属的视频采样参数。Optionally, parameter controls corresponding to the parameter types of the video sampling parameters, and a selection control for controlling the parameter controls are provided on the parameter setting page of the terminal device, so that the user can select the target parameter type to open; the parameter type includes the target parameter. Parameter Type. At this time, this step may include: the terminal device obtains the video sampling parameter to which the enabled target parameter type belongs.
如图3所示,参数类型可以为采样帧频对应的帧频类型、采样分辨率对应的分辨率类型、不同的颜色分量集合对应的颜色分量类型、不同颜色分量的采样色阶对应的色阶类型。这样,若帧频类型对应的参数控件处于开启状态,则视频采样参数包括采样帧频;若分辨率类型对应的参数控件处于开启状态,则视频采样参数包括采样分辨率;若颜色分量类型对应的参数控件处于开启状态,则视频采样参数包括不同的颜色分量集合;若色阶类型对应的参数控件处于开启状态,则视频采样参数包括不同颜色分量分别对应的采样色阶。上述示例只是开启单个参数控件的示例性说明,本申请还可以同时开启至少两个参数控件。图3是以颜色分量类型对应的参数控件处于开启状态为例进行说明的。As shown in FIG. 3 , the parameter type can be the frame rate type corresponding to the sampling frame rate, the resolution type corresponding to the sampling resolution, the color component type corresponding to different color component sets, and the color scale corresponding to the sampling color scale of different color components. type. In this way, if the parameter control corresponding to the frame rate type is enabled, the video sampling parameters include the sampling frame rate; if the parameter control corresponding to the resolution type is enabled, the video sampling parameters include the sampling resolution; If the parameter control is enabled, the video sampling parameters include different color component sets; if the parameter control corresponding to the color scale type is enabled, the video sampling parameters include the sampling color levels corresponding to different color components. The above example is only an exemplary illustration of enabling a single parameter control, and the present application can also enable at least two parameter controls at the same time. FIG. 3 illustrates by taking an example that the parameter control corresponding to the color component type is in an open state.
进一步地,根据写入指令获取待写入视频的视频采样参数,可以包括但不限于以下方式:Further, obtaining the video sampling parameters of the video to be written according to the write instruction may include but not be limited to the following ways:
方式一、根据写入指令获取待写入视频对应的目标预置采样参数,并将目标预置采样参数作为待写入视频的视频采样参数。Manner 1: Acquire the target preset sampling parameter corresponding to the video to be written according to the writing instruction, and use the target preset sampling parameter as the video sampling parameter of the video to be written.
在本申请实施例中,可以预先存储有预置采样参数,预置采样参数的参数类型包括视频采样参数的参数类型,预置采样参数可以为用户预先设定的参数。其中,不同视频可以对应相同预置采样参数,或者,不同视频可以对应不同的预置采样参数。In this embodiment of the present application, preset sampling parameters may be stored in advance, the parameter types of the preset sampling parameters include the parameter types of the video sampling parameters, and the preset sampling parameters may be parameters preset by the user. Wherein, different videos may correspond to the same preset sampling parameters, or different videos may correspond to different preset sampling parameters.
在一种实施例中,若不同视频对应相同预置采样参数,则目标预置采样参数与预置采样参数相同。In one embodiment, if different videos correspond to the same preset sampling parameter, the target preset sampling parameter is the same as the preset sampling parameter.
示例性的,预置采样参数包括以下至少一种:预置采样帧频、预置采样分辨率、预置颜色分量集合、以及预置颜色分量对应的预置采样色阶。在预置颜色分量集合的数量为至少两个的情况下,至少两个预置颜色分量集合存在对应的预置采样周期和/或预置采样顺序;预置颜色分量集合包括至少一个颜色分量。Exemplarily, the preset sampling parameters include at least one of the following: a preset sampling frame rate, a preset sampling resolution, a preset color component set, and a preset sampling level corresponding to the preset color components. When the number of preset color component sets is at least two, the at least two preset color component sets have corresponding preset sampling periods and/or preset sampling sequences; the preset color component sets include at least one color component.
例如,预置采样帧频可以为50fs;预置采样分辨率可以为M×N;不同的预置颜色分量集合可以包括{R}、{G}、{B},且{R}对应的采样周期可以为1s,{G}对应的采样周期可以为2s,{B}对应的采样周期可以为1s,且{R}、{G}、{B}对应的采样顺序从先到后依次为{G}、{B}、{R};预置颜色分量包括R、G、B三个颜色分量,R对应的预置采样色阶为8,G对应的预置采样色阶为16,B对应的预置采样色阶为16。其中,M以及N为正整数。上述示例只是示例性说明,本申请对此不做特殊限制。For example, the preset sampling frame rate can be 50fs; the preset sampling resolution can be M×N; different preset color component sets can include {R}, {G}, {B}, and the samples corresponding to {R} The period can be 1s, the sampling period corresponding to {G} can be 2s, the sampling period corresponding to {B} can be 1s, and the sampling order corresponding to {R}, {G}, {B} from first to last is { G}, {B}, {R}; the preset color components include three color components: R, G, and B. The preset sampling level corresponding to R is 8, the preset sampling level corresponding to G is 16, and B corresponds to The preset sampling level is 16. Here, M and N are positive integers. The above examples are only illustrative, and the present application does not make any special restrictions on them.
在另一种实施例中,若不同视频对应不同的预置采样参数,则终端设备需要预先构建预置采样参数与视频参数样本之间的参数对应关系。故本申请可以根据写入指令获取待写入视频的当前视频参数,并根据参数对应关系,确定当前视频参数匹配的视频参数样本对应的预置采样参数为目标预置采样参数。In another embodiment, if different videos correspond to different preset sampling parameters, the terminal device needs to construct a parameter correspondence between preset sampling parameters and video parameter samples in advance. Therefore, the present application can obtain the current video parameters of the video to be written according to the writing instruction, and determine the preset sampling parameters corresponding to the video parameter samples matching the current video parameters as the target preset sampling parameters according to the parameter correspondence.
可以理解的是,当前视频参数和视频参数样本二者的参数类型可以与视频采样参数的参数类型相同。It can be understood that the parameter types of both the current video parameter and the video parameter sample may be the same as the parameter type of the video sample parameter.
示例性的,参数对应关系可以包括:帧频样本为60fs,对应的预置采样帧频为50fs;分辨率样本为1396×768,对应的预置采样分辨率为1380×720;颜色分量集合样本为{R,G,B},对应的预置颜色分量集合包括{R}、{G}、{B},且预置颜色分量集合对应的采样顺序为{G}、{B}、{R},{R}对应的采样周期可以为1s,{G}对应的采样周期可以为2s,{B}对应的采样周期可以为1s;以预置颜色分量包括R、G、B三个颜色分量为例说明,在R的色阶样本为8时,对应的预置采样色阶为4,在G的色阶样本为16时,对应的预置采样色阶为8,在B的色阶样本为16时,对应的预置采样色阶为8。这样,假设待写入视频的当前视频参数包括:当前帧频为60fs;当前分辨率为1396×768;当前颜色分量集合为{R,G,B},R对应的当前色阶为8,G对应的当前色阶为16,B对应的当前色阶为16。则可以确定目标预置采样参数包括:预置采样帧频为50fs;预置采样分辨率为1380×720;预置颜色分量集合包括{R}、{G}、{B},且预置颜色分量集合对应的采样顺序为{G}、{B}、{R},{R}对应的采样周期可以为1s,{G}对应的采样周期可以为2s,{B}对应的采样周期可以为1s;R对应的预置采样色阶为4,G对应的预置采样色阶为8,B对应的预置采样色阶为8。上述数值只是示例性说明,本申请对此不作限制。Exemplarily, the parameter correspondence may include: the frame frequency sample is 60fs, and the corresponding preset sampling frame frequency is 50fs; the resolution sample is 1396×768, and the corresponding preset sampling resolution is 1380×720; the color component set sample is {R, G, B}, the corresponding preset color component set includes {R}, {G}, {B}, and the sampling order corresponding to the preset color component set is {G}, {B}, {R }, {R} corresponds to a sampling period of 1s, {G} corresponds to a sampling period of 2s, {B} corresponds to a sampling period of 1s; the preset color components include R, G, B three color components For example, when the color scale sample of R is 8, the corresponding preset sampling color scale is 4; when the color scale sample of G is 16, the corresponding preset sampling color scale is 8, and the color scale sample of B is 8. When it is 16, the corresponding preset sampling level is 8. In this way, it is assumed that the current video parameters of the video to be written include: the current frame rate is 60fs; the current resolution is 1396×768; the current color component set is {R, G, B}, and the current color level corresponding to R is 8, G The corresponding current color level is 16, and the current color level corresponding to B is 16. Then it can be determined that the target preset sampling parameters include: the preset sampling frame frequency is 50fs; the preset sampling resolution is 1380×720; the preset color component set includes {R}, {G}, {B}, and the preset color The sampling order corresponding to the component set is {G}, {B}, {R}, the sampling period corresponding to {R} can be 1s, the sampling period corresponding to {G} can be 2s, and the sampling period corresponding to {B} can be 1s; the preset sampling level corresponding to R is 4, the preset sampling level corresponding to G is 8, and the preset sampling level corresponding to B is 8. The above numerical values are only illustrative, and are not limited in this application.
方式二、根据写入指令获取待写入视频的视频内容,并根据视频内容确定待写入视频的视频采样参数。Manner 2: Acquire the video content of the video to be written according to the writing instruction, and determine the video sampling parameters of the video to be written according to the video content.
在本申请实施例中,考虑到视频内容可能包括运动对象或者风景对象等,针对不同的视频内容,视频采样参数可能不同。In the embodiments of the present application, considering that the video content may include moving objects or scenery objects, the video sampling parameters may be different for different video content.
可选地,若待写入视频包括的第一图像帧序列的视频内容中存在运动对象,则根据运动对象的运动变化量确定第一图像帧序列的采样帧频。Optionally, if there is a moving object in the video content of the first image frame sequence included in the video to be written, the sampling frame rate of the first image frame sequence is determined according to the motion change amount of the moving object.
其中,可以采用光流法识别图像帧序列中是否存在运动对象。当然,本申请也可以通过采集多个图像帧序列样本,并通过图像帧序列样本和图像帧序列样本对应的标记结果(即存在运动对象或者不存在运动对象)对预设模型进行训练,得到训练完成的对象识别模型。这样,本申请可以通过对象识别模型识别到第一图像帧序列的视频内容中存在运动对象。其中,预设模型可以为支持向量机等。Among them, the optical flow method can be used to identify whether there is a moving object in the image frame sequence. Of course, in the present application, the preset model can also be trained by collecting multiple image frame sequence samples and using the image frame sequence samples and the labeling results corresponding to the image frame sequence samples (that is, the presence of moving objects or the absence of moving objects) to obtain the training results. The completed object recognition model. In this way, the present application can recognize that there is a moving object in the video content of the first image frame sequence through the object recognition model. The preset model may be a support vector machine or the like.
可以理解的是,第一图像帧序列可以为单位时间(例如,1s或者2s等)内的图像帧序列。若运动对象的运动变化量较大,采样帧频较小,则会导致视频不流畅,运动对象的动作跨度较大,从而视觉效果较差。故,在一种实施例中,运动对象的运动变化范围与采样帧频预先存在第一正比关系,从而可以通过第一正比关系确定运动变化量所属运动变化范围对应的采样帧频。比如,关于飞机飞行的第一图像帧序列,则需要获取飞行速度所属运动变化范围对应的采样帧频。在另一种实施例中,可以根据运动对象的运动变化量调整预置采样帧频得到采样帧频,例如,可以根据运动变化量确定调整数值,运动变化量越大,调整数值越大;接着将调整数值和预置采样帧频之间的和值作为采样帧频。It can be understood that, the first image frame sequence may be an image frame sequence within a unit time (for example, 1 s or 2 s, etc.). If the motion variation of the moving object is large and the sampling frame rate is small, the video will be unsmooth, and the action span of the moving object will be large, resulting in poor visual effect. Therefore, in an embodiment, a first proportional relationship exists between the motion variation range of the moving object and the sampling frame rate, so that the sampling frame rate corresponding to the motion variation range to which the motion variation amount belongs can be determined through the first proportional relationship. For example, regarding the first image frame sequence of the flight of the aircraft, it is necessary to obtain the sampling frame frequency corresponding to the motion variation range to which the flight speed belongs. In another embodiment, the preset sampling frame rate can be adjusted according to the motion change amount of the moving object to obtain the sampling frame rate. For example, the adjustment value can be determined according to the motion change amount, and the larger the motion change amount, the larger the adjustment value; then The sum of the adjustment value and the preset sampling frame rate is taken as the sampling frame rate.
可选地,若待写入视频包括的第二图像帧序列的视频内容中存在运动对象,则根据运动对象的运动变化量确定第二图像帧序列的采样分辨率。Optionally, if there is a moving object in the video content of the second image frame sequence included in the video to be written, the sampling resolution of the second image frame sequence is determined according to the motion change amount of the moving object.
可以理解的是,第二图像帧序列也可以为单位时间(例如,1s或者2s等)内的图像帧序列。若运动对象的运动变化量较大,采样分辨率较小,则会导致视频模糊,从而视觉效果较差。故,在一种实施例中,运动对象的运动变化范围与采样分辨率预先存在第二正比关系,从而可以通过第二正比关系确定运动变化量所属运动变化范围对应的采样分辨率。比如,关于踢足球的第二图像帧序列,则需要获取踢球速度所属运动变化范围对应的采样分辨率。在另一种实施例中,可以根据运动对象的运动变化量调整预置采样分辨率得到采样分辨率,例如,可以根据运动变化量确定调整比值,运动变化量越大,调整比值越大;接着将调整比值和预置采样分辨率之间的乘积作为采样分辨率。It can be understood that, the second image frame sequence may also be an image frame sequence within a unit time (for example, 1 s or 2 s, etc.). If the motion variation of the moving object is large and the sampling resolution is small, the video will be blurred and the visual effect will be poor. Therefore, in one embodiment, a second proportional relationship exists between the motion variation range of the moving object and the sampling resolution, so that the sampling resolution corresponding to the motion variation range to which the motion variation amount belongs can be determined through the second proportional relationship. For example, regarding the second image frame sequence of kicking football, it is necessary to obtain the sampling resolution corresponding to the motion variation range to which the kicking speed belongs. In another embodiment, the sampling resolution can be obtained by adjusting the preset sampling resolution according to the movement change of the moving object. For example, the adjustment ratio can be determined according to the movement change, and the larger the movement change, the larger the adjustment ratio; then Take the product between the adjustment ratio and the preset sampling resolution as the sampling resolution.
可选地,若待写入视频包括的第三图像帧序列的视频内容中存在风景对象,则确定至少一个第一预置颜色分量集合为第三图像帧序列对应的颜色分量集合;其中,第一预置颜色分量集合包括的颜色分量的数量大于等于预设数量。预设数量可以为待写入视频包括的第三图像帧序列的视频内容中不存在风景对象时,对应的预置颜色分量集合包括的颜色分量的数量。Optionally, if there is a landscape object in the video content of the third image frame sequence included in the video to be written, then at least one first preset color component set is determined as a color component set corresponding to the third image frame sequence; The number of color components included in a preset color component set is greater than or equal to the preset number. The preset number may be the number of color components included in the corresponding preset color component set when there is no landscape object in the video content of the third image frame sequence included in the video to be written.
可以理解的是,第三图像帧序列也可以为单位时间(例如,1s或者2s等)内的图像帧序列。若风景对象使用较少的颜色分量,则会导致色彩的完整性较差,从而视觉效果较差。故,第一预置颜色分量集合包括的颜色分量的数量大于等于预设数量。需要说明的是,在至少一个第一预置颜色分量集合包括至少两个第一预置颜色分量集合的情况下,至少两个第一预置颜色分量集合存在对应的预置采样周期和/或预置采样顺序。示例性的,预设数量为2,至少两个第一预置颜色分量集合可以包括{R,G,B}、{R,B}、{G,B},至少两个第一预置颜色分量集合对应的采样顺序为{R,G,B}、{R,B}、{G,B},{R,G,B}对应的采样周期可以为1s,{R,B}对应的采样周期可以为2s,{G,B}对应的采样周期可以为1s。It can be understood that, the third image frame sequence may also be an image frame sequence within a unit time (eg, 1 s or 2 s, etc.). Landscape objects that use fewer color components can result in poor color integrity and thus poorer visual effects. Therefore, the number of color components included in the first preset color component set is greater than or equal to the preset number. It should be noted that, in the case where the at least one first preset color component set includes at least two first preset color component sets, the at least two first preset color component sets have corresponding preset sampling periods and/or Preset sampling order. Exemplarily, the preset number is 2, the at least two first preset color component sets may include {R, G, B}, {R, B}, {G, B}, the at least two first preset color components The sampling order corresponding to the component set is {R, G, B}, {R, B}, {G, B}, the sampling period corresponding to {R, G, B} can be 1s, and the sampling period corresponding to {R, B} The period can be 2s, and the sampling period corresponding to {G, B} can be 1s.
可选地,若待写入视频包括的第四图像帧序列的视频内容中存在风景对象,则确定不同颜色分量的第一预置色阶对应为所述第四图像帧序列中不同颜色分量的采样色阶;其中,第一预置色阶大于等于预设数值。Optionally, if there is a scenery object in the video content of the fourth image frame sequence included in the video to be written, it is determined that the first preset color levels of different color components correspond to the different color components in the fourth image frame sequence. Sampling level; wherein, the first preset level is greater than or equal to a preset value.
可以理解的是,第四图像帧序列也可以为单位时间(例如,1s或者2s等)内的图像帧序列。若风景对象使用较小的色阶,则会导致相近颜色无法区分,从而视觉效果较差。故,第一预置色阶大于等于预设数值。预设数值可以为待写入视频包括的第四图像帧序列的视频内容中不存在风景对象时,对应的不同颜色分量的预置色阶。It can be understood that, the fourth image frame sequence may also be an image frame sequence within a unit time (for example, 1 s or 2 s, etc.). Using a smaller color scale for landscape objects results in indistinguishable colors that are close to each other, resulting in poorer visual effects. Therefore, the first preset color level is greater than or equal to the preset value. The preset value may be preset color levels corresponding to different color components when there is no landscape object in the video content of the fourth image frame sequence included in the video to be written.
当然,本申请还可以将上述根据视频内容确定待写入视频的视频采样参数的实施例进行结合。示例性的,若待写入视频包括的第五图像帧序列的视频内容中存在风景对象,则确定至少一个预置颜色分量集合为第五图像帧序列对应的颜色分量集合;其中,预置颜色分量集合包括的颜色分量的数量大于等于预设数量,且确定预置颜色分量集合包括的颜色分量的预置色阶对应为第五图像帧序列的颜色分量集合包括的颜色分量的采样色阶;其中,预置色阶大于等于预设数值。Of course, the present application can also combine the above-mentioned embodiments of determining the video sampling parameters of the video to be written according to the video content. Exemplarily, if there is a scenery object in the video content of the fifth image frame sequence included in the video to be written, at least one preset color component set is determined as a color component set corresponding to the fifth image frame sequence; The number of color components included in the component set is greater than or equal to a preset number, and it is determined that the preset color level of the color components included in the preset color component set corresponds to the sampling level of the color components included in the color component set of the fifth image frame sequence; Wherein, the preset color level is greater than or equal to the preset value.
方式三、根据写入指令获取终端设备的内存可用量,并根据内存可用量确定待写入视频的视频采样参数。Mode 3: Acquire the available memory of the terminal device according to the writing instruction, and determine the video sampling parameters of the video to be written according to the available memory.
可以理解的是,内存可用量可以为内存剩余量或者总内存容量等。It can be understood that the available amount of memory may be the remaining amount of memory or the total memory capacity, or the like.
可选地,根据内存可用量确定待写入视频的采样帧频。Optionally, the sampling frame rate of the video to be written is determined according to the available memory.
一种实施例中,本申请可以预先存储有预置帧频,并且根据不同终端设备的内存可用量,对预置帧频进行调整得到采样帧频。即内存可用量大于第一预设阈值,则可以将预置帧频调大得到采样帧频(例如,可以将预置帧频和第一数值的和值作为采样帧频,或者,将预置帧频和第一比值的乘积作为采样帧频,第一比值大于1);内存可用量小于第一预设阈值,则可以将预置帧频调小得到采样帧频(例如,可以将预置帧频和第二数值的差值作为采样帧频,或者,将预置帧频和第二比值的乘积作为采样帧频,第二比值小于1);若内存可用量等于第一预设阈值,则采样帧频等于预置帧频。In one embodiment, the present application may store a preset frame rate in advance, and adjust the preset frame rate according to the available memory of different terminal devices to obtain the sampling frame rate. That is, if the amount of available memory is greater than the first preset threshold, the preset frame rate may be increased to obtain the sampling frame rate (for example, the sum of the preset frame rate and the first value may be used as the sampling frame rate, or the preset frame rate may be The product of the frame rate and the first ratio is used as the sampling frame rate, and the first ratio is greater than 1). The difference between the frame rate and the second value is taken as the sampling frame rate, or the product of the preset frame rate and the second ratio is taken as the sampling frame rate, and the second ratio is less than 1); if the available memory is equal to the first preset threshold, Then the sampling frame rate is equal to the preset frame rate.
需要说明的是,由于内存可用量可以包括内存剩余量或者总内存容量,故内存剩余量和总内存容量分别对应不同的第一预设阈值,后续的第二预设阈值、第三预设阈值、第四预设阈值同理,不再赘述。It should be noted that, since the amount of available memory may include the remaining amount of memory or the total memory capacity, the remaining amount of memory and the total memory capacity correspond to different first preset thresholds, and subsequent second preset thresholds and third preset thresholds. The same is true for the fourth preset threshold, and details are not repeated here.
另一种实施例中,根据第一预置对应关系,获取内存可用量所属内存可用量范围对应的采样帧频,第一预置对应关系包括内存可用量范围与采样帧频之间的对应关系。In another embodiment, the sampling frame rate corresponding to the memory availability range to which the memory availability belongs is obtained according to a first preset correspondence relationship, and the first preset correspondence relationship includes the correspondence relationship between the memory availability range and the sampling frame rate .
可选地,根据内存可用量确定待写入视频的采样分辨率。Optionally, the sampling resolution of the video to be written is determined according to the available memory.
在一种实施例中,本申请可以预先存储有预置分辨率,并且根据不同终端设备的内存可用量,对预置分辨率进行调整得到采样分辨率。即内存可用量大于第二预设阈值,则可以将预置分辨率调大得到采样分辨率(例如,可以将预置分辨率和第三数值的和值作为采样分辨率,或者,将预置分辨率和第三比值的乘积作为采样分辨率,第三比值大于1);内存可用量小于第二预设阈值,则可以将预置分辨率调小得到采样分辨率(例如,可以将预置分辨率和第四数值的差值作为采样分辨率,或者,将预置分辨率和第四比值的乘积作为采样分辨率,第四比值小于1);若内存可用量等于第二预设阈值,则采样分辨率等于预置分辨率。In an embodiment, the present application may store a preset resolution in advance, and adjust the preset resolution according to the available memory of different terminal devices to obtain the sampling resolution. That is, the available amount of memory is greater than the second preset threshold, the preset resolution can be increased to obtain the sampling resolution (for example, the sum of the preset resolution and the third value can be used as the sampling resolution, or the preset The product of the resolution and the third ratio is used as the sampling resolution, and the third ratio is greater than 1); if the available memory is less than the second preset threshold, the preset resolution can be reduced to obtain the sampling resolution (for example, the preset The difference between the resolution and the fourth value is used as the sampling resolution, or the product of the preset resolution and the fourth ratio is used as the sampling resolution, and the fourth ratio is less than 1); if the available memory is equal to the second preset threshold, Then the sampling resolution is equal to the preset resolution.
在另一种实施例中,根据第二预置对应关系,获取内存可用量所属内存可用量范围对应的采样分辨率,第二预置对应关系包括内存可用量范围与采样分辨率之间的对应关系。In another embodiment, the sampling resolution corresponding to the memory availability range to which the memory availability belongs is obtained according to a second preset correspondence relationship, and the second preset correspondence relationship includes the correspondence between the memory availability range and the sampling resolution relation.
可选地,根据内存可用量确定待写入视频的不同颜色分量集合。Optionally, different sets of color components to be written into the video are determined according to the amount of memory available.
在一种实施例中,本申请可以预先存储有第二预置颜色分量集合,并且根据不同终端设备的内存可用量,对第二预置颜色分量集合进行调整得到颜色分量集合。即内存可用量大于第三预设阈值,则可以在第二预置颜色分量集合中添加新颜色分量得到颜色分量集合(即颜色分量集合包括的颜色分量的数量大于等于对应的第二预置颜色分量集合包括的颜色分量的数量,且第二预置颜色分量集合为对应的颜色分量集合的子集);内存可用量小于第三预设阈值,则可以将第二预置颜色分量集合中的部分颜色分量删除得到颜色分量集合(即颜色分量集合包括的颜色分量的数量小于对应的第二预置颜色分量集合包括的颜色分量的数量,且颜色分量集合为对应的第二预置颜色分量集合的子集);若内存可用量等于第三预设阈值,则颜色分量集合与对应的第二预置颜色分量集合相同。In an embodiment, the present application may store a second preset color component set in advance, and adjust the second preset color component set according to the available memory of different terminal devices to obtain a color component set. That is, the amount of available memory is greater than the third preset threshold, then a new color component can be added to the second preset color component set to obtain a color component set (that is, the number of color components included in the color component set is greater than or equal to the corresponding second preset color The number of color components included in the component set, and the second preset color component set is a subset of the corresponding color component set); the available memory is less than the third preset threshold, then the second preset color component set can be Delete some color components to obtain a color component set (that is, the number of color components included in the color component set is less than the number of color components included in the corresponding second preset color component set, and the color component set is the corresponding second preset color component set. If the available memory is equal to the third preset threshold, the color component set is the same as the corresponding second preset color component set.
在另一种实施例中,根据第三预置对应关系,获取内存可用量所属内存可用量范围对应的采样颜色分量集合,第三预置对应关系包括内存可用量范围与采样颜色分量集合之间的对应关系。In another embodiment, a set of sampled color components corresponding to a range of available memory to which the available memory belongs is obtained according to a third preset correspondence, where the third preset correspondence includes a relationship between the range of available memory and the set of sampled color components corresponding relationship.
可选地,根据内存可用量确定待写入视频对应不同颜色分量的采样色阶。Optionally, sampling levels corresponding to different color components of the video to be written are determined according to available memory.
在一种实施例中,本申请可以预先存储有不同颜色分量的第二预置色阶,并且根据不同终端设备的内存可用量,对不同颜色分量的第二预置色阶进行调整得到不同颜色分量对应的采样色阶。即若内存可用量大于第四预设阈值,则可以将不同颜色分量的第二预置色阶中的至少一个预置色阶调大得到不同颜色分量的采样色阶;若内存可用量小于第四预设阈值,则可以将不同颜色分量的第二预置色阶中的至少一个预置色阶调小得到不同颜色分量的采样色阶;若内存可用量等于第四预设阈值,不同颜色分量的第二预置色阶与不同颜色分量的采样色阶对应相同。In an embodiment, the present application may pre-store second preset color levels of different color components, and adjust the second preset color levels of different color components according to the available memory of different terminal devices to obtain different colors The sampling level corresponding to the component. That is, if the amount of available memory is greater than the fourth preset threshold, at least one preset level in the second preset levels of different color components can be increased to obtain sampling levels of different color components; With four preset thresholds, at least one preset level in the second preset levels of different color components can be downsized to obtain sampling levels of different color components; if the amount of available memory is equal to the fourth preset threshold, different colors The second preset color level of the components corresponds to the same sampling level of different color components.
在另一可选实施例中,根据第四预置对应关系,获取内存可用量所属内存可用量范围对应的不同颜色分量的采样色阶,第四预置对应关系包括内存可用量范围、颜色分量以及采样色阶之间的对应关系。In another optional embodiment, the sampling level of different color components corresponding to the memory availability range to which the memory availability belongs is obtained according to a fourth preset correspondence relationship, where the fourth preset correspondence relationship includes the memory availability range, the color component And the correspondence between sampling levels.
方式四、根据写入指令获取待写入视频的视频内容以及终端设备的内存可用量,并根据内存可用量和视频内容确定待写入视频的视频采样参数。Manner 4: Obtain the video content of the video to be written and the available memory of the terminal device according to the writing instruction, and determine the video sampling parameters of the video to be written according to the available memory and the video content.
具体内容可以参考方式二和方式三中的内容,此处不再赘述。For specific content, reference may be made to the content in the second and third modes, which will not be repeated here.
方式五、根据写入指令获取待写入视频的当前参数,当前参数包括当前帧频和当前分辨率中的至少一个,并根据当前参数和预设比例对应确定待写入视频的视频采样参数,视频采样参数包括采样帧频和采样分辨率中的至少一个。需要说明的是,本申请中的当前分辨率同样可以包括两个方向的分辨率或者单个方向的分辨率,本申请对此不作特殊限制。The fifth method is to obtain the current parameters of the video to be written according to the writing instruction, the current parameters include at least one of the current frame rate and the current resolution, and correspondingly determine the video sampling parameters of the video to be written according to the current parameters and the preset ratio, The video sampling parameters include at least one of a sampling frame rate and a sampling resolution. It should be noted that the current resolution in this application may also include the resolution in two directions or the resolution in a single direction, which is not particularly limited in this application.
可以理解的是,预设比例可以小于1。示例性的,当前帧频为60fs,且预设比例为5/6,则采样帧频可以为50fs。上述示例只是示例性说明,本申请对此不做特殊限制。It can be understood that the preset ratio may be less than 1. Exemplarily, if the current frame rate is 60fs and the preset ratio is 5/6, the sampling frame rate may be 50fs. The above examples are only illustrative, and the present application does not make any special restrictions on them.
当然,本申请还可以获取待写入视频的不同颜色分量分别对应的当前色阶,并对当前色阶进行调整得到不同颜色分量分别对应的采样色阶。例如,R颜色分量分别对应的当前色阶为16位数,则可以将当前色阶与固定值(如2)的比值作为R颜色分量对应的采样色阶(即8位数)。Of course, the present application can also obtain the current color levels corresponding to different color components of the video to be written, and adjust the current color levels to obtain the sampling color levels corresponding to the different color components respectively. For example, if the current color level corresponding to the R color component is 16 digits, the ratio of the current color level to a fixed value (such as 2) can be used as the sampling color level (ie, 8 digits) corresponding to the R color component.
103、按照视频采样参数,对待写入视频进行数据处理,得到写入视频的图像帧;写入视频的内存占用量小于待写入视频的内存占用量。103. Perform data processing on the video to be written according to the video sampling parameters to obtain image frames to be written into the video; the memory occupancy of the written video is smaller than the memory occupancy of the to-be-written video.
其中,在视频采样参数包括采样帧频的情况下,终端设备可以按照采样帧频,对待写入视频进行数据处理,得到写入视频的图像帧;在视频采样参数包括采样分辨率的情况下,终端设备可以按照采样分辨率,对待写入视频进行数据处理,得到写入视频的图像帧;在视频采样参数包括不同的颜色分量集合的情况下,终端设备可以按照不同的颜色分量集合,对待写入视频进行数据处理,得到写入视频的图像帧;在视频采样参数包括不同颜色分量分别对应的采样色阶终端设备可以按照不同颜色分量分别对应的采样色阶,对待写入视频进行数据处理,得到写入视频的图像帧。Wherein, in the case where the video sampling parameter includes the sampling frame rate, the terminal device can perform data processing on the video to be written according to the sampling frame rate to obtain the image frame written in the video; in the case where the video sampling parameter includes the sampling resolution, The terminal device can perform data processing on the video to be written according to the sampling resolution to obtain image frames to be written into the video; in the case where the video sampling parameters include different sets of color components, the terminal device can, according to the different sets of color components, Enter the video for data processing to obtain the image frame written into the video; if the video sampling parameters include sampling levels corresponding to different color components, the terminal device can perform data processing on the video to be written according to the sampling levels corresponding to different color components. Get the image frame written to the video.
示例性的,采样帧频可以为50fs,此时,本步骤可以包括:终端设备对待写入视频的单位时间(例如每秒)内的图像帧采样50个图像帧。Exemplarily, the sampling frame rate may be 50fs. In this case, this step may include: the terminal device samples 50 image frames of image frames within a unit time (for example, per second) of the video to be written.
示例性的,当前分辨率可以为B×D,采样分辨率可以为M×N,B、D、M、N均为自然数,且B大于M,D大于N。此时,本步骤可以包括:终端设备将待写入视频的图像帧的当前分辨率缩小至M×N;又如,采样分辨率可以包括采样横向分辨率为M,此时,本步骤可以包括:终端设备将待写入视频的图像帧的当前横向分辨率缩小至M,上述示例只是示例性说明,本申请对此不作特殊限制。Exemplarily, the current resolution may be B×D, the sampling resolution may be M×N, B, D, M, and N are all natural numbers, and B is greater than M and D is greater than N. In this case, this step may include: the terminal device reduces the current resolution of the image frame to be written in the video to M×N; for another example, the sampling resolution may include that the sampling horizontal resolution is M, in this case, this step may include : The terminal device reduces the current horizontal resolution of the image frame to be written in the video to M. The above examples are only illustrative, and this application does not make any special restrictions on this.
示例性的,若不同的颜色分量集合包括第一个颜色分量集合(例如第一个颜色分量集合包括R颜色分量)、第二个颜色分量集合(例如第二个颜色分量集合包括G颜色分量)以及第三个颜色分量集合(例如第三个颜色分量集合包括B颜色分量),且不同颜色分量集合对应的采样周期均为1s,不同颜色分量集合对应的采样顺序从先到后可以包括:第一个颜色分量集合、第二个颜色分量集合以及第三个颜色分量集合。则本步骤可以包括:对待写入视频的第1s内的图像帧按照R颜色分量进行采样,对待写入视频的第2s内的图像帧按照G颜色分量进行采样,对待写入视频的第3s内的图像帧按照B颜色分量进行采样,依次类推。Exemplarily, if the different color component sets include a first color component set (for example, the first color component set includes an R color component), a second color component set (for example, the second color component set includes a G color component) And the third color component set (for example, the third color component set includes the B color component), and the sampling period corresponding to the different color component sets is 1s, and the sampling order corresponding to the different color component sets can include: A set of color components, a second set of color components, and a third set of color components. Then this step may include: the image frame in the 1s to be written in the video is sampled according to the R color component, the image frame to be written in the 2s in the video is sampled according to the G color component, and the image frame to be written in the 3s in the video is sampled according to the G color component. The image frame of is sampled according to the B color component, and so on.
示例性的,不同颜色分量包括R、G、B,且对应的采样色阶均为8,则本步骤可以对待写入视频的不同颜色分量的像素值均按照8位色进行采样。上述示例只是示例性说明,本申请对此不作特殊限制。Exemplarily, the different color components include R, G, and B, and the corresponding sampling levels are all 8. In this step, the pixel values of the different color components to be written in the video can be sampled according to 8-bit colors. The above examples are only illustrative, and this application does not make any special limitations.
需要说明的是,由于视频通常由连续的图像帧组成,相邻帧之间的图像内容差别较小,且人眼具备视觉暂留效应,故待写入视频存在部分失帧,待写入视频的部分帧失去少量颜色分量,待写入视频的部分帧的分辨率变小,或者待写入视频的部分帧的颜色对比度降低,并不会对观看造成较大影响。It should be noted that, since the video is usually composed of consecutive image frames, the difference in image content between adjacent frames is small, and the human eye has a visual persistence effect, so there are some missing frames in the video to be written, and the video to be written is missing. Some frames of the video lose a small amount of color components, the resolution of some frames to be written in the video becomes smaller, or the color contrast of some frames to be written in the video is reduced, which will not have a great impact on viewing.
104、对写入视频的图像帧进行写入操作。104. Perform a writing operation on the image frame written into the video.
在本申请的一种实施例中,可以在获取到写入视频的全部图像帧后,对写入视频的全部图像帧进行写入操作;或者,首先获取写入视频的部分图像帧,接着对写入视频的部分图像帧进行写入操作的同时,可以继续获取写入视频的另一部分图像帧,这样提高了写入效率。本申请对写入方式不作具体限定。In an embodiment of the present application, after acquiring all the image frames of the written video, a write operation may be performed on all the image frames of the written video; While performing the writing operation on part of the image frames written in the video, another part of the image frames in the written video can be continuously acquired, which improves the writing efficiency. The present application does not specifically limit the writing method.
可以理解的是,若通过采样帧频对待写入视频进行数据处理,则可以减少写入的帧数;若通过采样分辨率对待写入视频进行数据处理,则可以减少像素点的数量;若通过不同的颜色分量集合对待写入视频进行数据处理,则可以写入部分颜色分量的像素值,从而减少像素值的数量;若通过采样色阶对待写入视频进行数据处理,则可以减少像素值的位数。当然,本申请可以结合不同类型的采样视频参数对待写入视频进行数据处理,以减少数据写入量。It can be understood that if the data to be written is processed by the sampling frame rate, the number of frames to be written can be reduced; if the data to be written is processed by the sampling resolution, the number of pixels can be reduced; Different color component sets perform data processing on the video to be written, and the pixel values of some color components can be written, thereby reducing the number of pixel values; digits. Of course, the present application can perform data processing on the video to be written in combination with different types of sampled video parameters, so as to reduce the amount of data written.
如表1所示,示出了一种通过不同方案对待写入视频进行数据处理的相关数据,其中,方案1为按照采样帧频对待写入视频进行数据处理的方案;方案2为按照采样帧频和采样分辨率中的单个方向的分辨率(即X分辨率)对待写入视频进行数据处理的方案;方案3为按照采样帧频和采样分辨率中的两个方向的分辨率(即X分辨率和Y分辨率)对待写入视频进行数据处理的方案;方案4为按照采样帧频、采样分辨率中的两个方向的分辨率(即X分辨率和Y分辨率)、不同的颜色分量集合、以及不同颜色分量分别对应的采样色阶对待写入视频进行数据处理的方案。可以理解的是,色度为单个图像中的颜色分量的数量。As shown in Table 1, it shows the relevant data of data processing of the video to be written through different schemes, wherein, scheme 1 is a scheme of performing data processing on the video to be written according to the sampling frame rate; scheme 2 is according to the sampling frame rate. A scheme for data processing of the video to be written in a single direction in the frequency and sampling resolution (i.e. X resolution); scheme 3 is based on the resolution in two directions in the sampling frame rate and sampling resolution (i.e. X resolution). Resolution and Y resolution) The scheme for data processing of the video to be written; Scheme 4 is the resolution in two directions (ie X resolution and Y resolution), different colors according to the sampling frame rate and sampling resolution. A solution for performing data processing on a video to be written to a component set and sampling levels corresponding to different color components respectively. It is understood that chrominance is the number of color components in a single image.
表1Table 1
由表1可见,参考方案为现有技术中写入1s的视频的方案,可见,总内存占用量需要达到368.0859MB;而采用本申请中的方案1,总内存占用量为331.2770MB,减少约10%,相当于闪存的寿命延长10%;采用本申请中的方案2,总内存占用量为298.0547MB,减少约19%,相当于闪存的寿命延长19%;采用本申请中的方案3,总内存占用量为268.1716MB,减少约27%,相当于闪存的寿命延长27%;采用本申请中的方案4,总内存占用量为217.3511MB,减少约40%,相当于闪存的寿命延长40%。由实验数据可知,通过本申请的所述的视频处理方法可以大大降低数据写入量。As can be seen from Table 1, the reference scheme is a scheme for writing a video of 1s in the prior art, and it can be seen that the total memory occupancy needs to reach 368.0859MB; and using the scheme 1 in this application, the total memory occupancy is 331.2770MB, which is reduced by about 368.0859MB. 10%, which is equivalent to 10% longer life of flash memory; using solution 2 in this application, the total memory footprint is 298.0547MB, which is reduced by about 19%, which is equivalent to 19% longer life of flash memory; using solution 3 in this application, The total memory occupancy is 268.1716MB, a reduction of about 27%, which is equivalent to a 27% extension of the life of the flash memory; using scheme 4 in this application, the total memory footprint is 217.3511MB, a reduction of about 40%, which is equivalent to a 40% extension of the life of the flash memory. %. It can be known from the experimental data that the amount of data writing can be greatly reduced by the video processing method described in this application.
在本申请的可选实施例中,还可以在第二设置页面中设置有弱化图像边缘的弱化功能控件。这样,在用户启动弱化功能控件的情况下,本申请还可以对写入视频的图像帧进行边缘弱化,使得写入视频的图像帧的像素值的数量减少。In an optional embodiment of the present application, a weakening function control for weakening the edge of the image may also be set on the second setting page. In this way, when the user activates the weakening function control, the present application can also perform edge weakening on the image frame written in the video, so that the number of pixel values in the image frame written in the video is reduced.
示例性的,若对写入视频的某个图像帧中的像素点(1,1)、(1,3)、(1,5)、(1,9)、(1,12)、(2,1)、(3,1)进行弱化使得对应的像素值均为指定数值(例如像素值为(0,0,0)),则在对该某个图像帧进行写入操作时,可以直接写入像素点(1,1)、(1,3)、(1,5)、(1,9)、(1,12)、(2,1)、(3,1)均为(0,0,0),避免了依次对这几个像素点输入像素值,从而减少了数据量。Exemplarily, if the pixels (1, 1), (1, 3), (1, 5), (1, 9), (1, 12), (2) in a certain image frame of the video are written , 1), (3, 1) are weakened so that the corresponding pixel values are all specified values (for example, the pixel values are (0, 0, 0)), then when writing to an image frame, you can directly Write pixels (1, 1), (1, 3), (1, 5), (1, 9), (1, 12), (2, 1), (3, 1) are all (0, 0, 0), which avoids inputting pixel values to these pixel points in turn, thereby reducing the amount of data.
采用上述所述的方法,考虑到终端设备存在大容量的数据写入时,大容量的数据通常为视频数据。故本申请可以通过视频采样参数对待写入视频进行数据处理得到写入视频的图像帧,写入视频的内存占用量小于待写入视频的内存占用量,以及对写入视频的图像帧进行写入操作。可见,通过减少数据的写入量,可以避免终端设备的内存占用量较大导致的写入速度较慢的问题,以及在终端设备的硬盘为固态硬盘的情况下,延长了固态硬盘中闪存的使用寿命。With the method described above, considering that there is a large-capacity data write in the terminal device, the large-capacity data is usually video data. Therefore, the present application can perform data processing on the video to be written through the video sampling parameters to obtain the image frame of the written video, the memory occupancy of the written video is smaller than the memory occupancy of the to-be-written video, and the image frame of the written video can be written. into operation. It can be seen that by reducing the amount of data written, the problem of slow writing speed caused by the large memory footprint of the terminal device can be avoided, and when the hard disk of the terminal device is a solid-state hard disk, the flash memory in the solid-state hard disk can be extended. service life.
结合图1所示的实施例,如图4所示,在步骤104之后,还可以包括:With reference to the embodiment shown in FIG. 1, as shown in FIG. 4, after
105、在接收到对写入视频的播放指令的情况下,根据写入视频的图像帧,获取待播放视频。105. Obtain the video to be played according to the image frame of the written video in the case of receiving the play instruction for the written video.
其中,待播放视频包括写入视频的图像帧,或者,待播放视频为对写入视频的图像帧进行数据还原得到的视频。The video to be played includes an image frame written in the video, or the video to be played is a video obtained by performing data restoration on the image frame written in the video.
可以理解的是,考虑到本申请中的写入视频与待写入视频二者的视觉偏差不明显,故可以直接将写入视频作为待播放视频(即写入视频的内存占用量等于待播放视频的内存占用量),减少了数据处理量。It can be understood that, considering that the visual deviation between the written video and the to-be-written video in this application is not obvious, the written video can be directly used as the to-be-played video (that is, the memory occupancy of the written video is equal to the to-be-played video). video memory footprint), reducing the amount of data processing.
应理解,考虑到本申请中的写入视频与待写入视频二者的视觉偏差较大,故可以对写入视频进行数据还原得到待播放视频(即写入视频的内存占用量小于待播放视频的内存占用量),从而提高用户的视觉效果。It should be understood that, considering that the visual deviation between the written video and the to-be-written video in the present application is relatively large, it is possible to perform data restoration on the written video to obtain the to-be-played video (that is, the memory occupancy of the written video is smaller than the to-be-played video). the memory footprint of the video), thereby improving the user's visual effect.
可选地,可以按照待写入视频的当前目标视频参数对写入视频进行数据还原得到待播放视频。其中,当前目标视频参数与视频采样参数二者的参数类型相同,且当前目标视频参数为待写入视频未进行数据处理之前的参数。当前目标视频参数包括当前帧频和当前分辨率、当前颜色分量集合,不同颜色分量分别对应的当前色阶中的至少一个。Optionally, the to-be-played video may be obtained by performing data restoration on the written video according to the current target video parameters of the to-be-written video. The parameter types of the current target video parameter and the video sampling parameter are the same, and the current target video parameter is the parameter of the video to be written before data processing is performed. The current target video parameters include at least one of the current frame rate and current resolution, the current color component set, and the current color levels corresponding to different color components respectively.
其中,在当前目标视频参数与视频采样参数中均包括帧频类型的情况下,在写入视频的图像帧中插入目标数量的初始图像帧,目标数量为待写入视频的当前帧频与采样帧频的差值。例如,待写入视频的当前帧频为60fs,采样帧频为50fs,则目标数量为10(即60-50=10),故可以在写入视频的图像帧中插入10个初始图像帧。Wherein, when both the current target video parameter and the video sampling parameter include the frame rate type, insert a target number of initial image frames into the image frame written into the video, where the target number is the current frame rate and sampling rate of the video to be written The difference in frame rate. For example, if the current frame rate of the video to be written is 60fs and the sampling frame rate is 50fs, then the target number is 10 (ie 60-50=10), so 10 initial image frames can be inserted into the image frame of the written video.
进一步地,可以按照采样帧频的采样策略,在写入视频的图像帧中插入目标数量的初始图像帧。示例性的,若按照采样帧频从待写入视频的第1秒的60个图像帧中获取前50个图像帧作为写入视频的第1秒的图像帧,则本步骤可以在写入视频的第1秒的图像帧后面插入10个初始图像帧;若按照采样帧频从待写入视频的第1秒的前20个图像帧中获取第o个图像帧,以及获取待写入视频的第1秒的后40个图像帧,得到写入视频的第1秒的图像帧,o为奇数,则本步骤可以在写入视频的第1秒的前10个图像帧的每帧后面均插入1个初始图像帧,等等。Further, a target number of initial image frames can be inserted into the image frames written into the video according to the sampling strategy of the sampling frame rate. Exemplarily, if the first 50 image frames are obtained from the 60 image frames in the first second of the video to be written according to the sampling frame rate as the image frames in the first second of the video to be written, then this step can be performed when the video is written. Insert 10 initial image frames after the image frame of the first second of the In the last 40 image frames of the first second, the image frames of the first second written into the video are obtained. If o is an odd number, then this step can be inserted after each frame of the first 10 image frames written into the first second of the video. 1 initial image frame, etc.
其中,在当前目标视频参数与视频采样参数中均包括分辨率类型的情况下,若待写入视频包括的各个图像帧对应的当前分辨率相同,则可以将写入视频的图像帧按照当前分辨率进行设置。或者,考虑到待写入视频包括的各个图像帧对应的当前分辨率不同,则可以预先对写入视频的图像帧标记未处理之前的当前分辨率,这样,可以将写入视频的图像帧按照对应的当前分辨率进行设置。Wherein, in the case where both the current target video parameter and the video sampling parameter include the resolution type, if the current resolution corresponding to each image frame included in the video to be written is the same, the image frame written in the video may be written according to the current resolution. rate is set. Or, considering that the current resolutions corresponding to each image frame included in the video to be written are different, the current resolution before the unprocessed image frame can be marked in advance for the image frame written in the video. In this way, the image frame written in the video can be Set the corresponding current resolution.
其中,在当前目标视频参数与视频采样参数中均包括分辨率类型和帧频类型的情况下,若待写入视频包括的各个图像帧对应的当前分辨率相同,则可以将写入视频的图像帧和初始图像帧按照当前分辨率进行设置。或者,考虑到待写入视频包括的各个图像帧对应的当前分辨率不同,则可以预先对写入视频的图像帧标记未处理之前的当前分辨率,这样,可以将写入视频的图像帧按照对应的当前分辨率进行设置,以及根据初始图像帧的相邻帧的分辨率,确定初始图像帧的目标分辨率。其中,相邻帧可以为前V帧和/或后U帧,V和U均为自然数。考虑到视频的相邻若干帧的关联性较好,故为了使得还原效果较好,V和U均小于预置数值。这样,在一种实施例中,可以将前1帧的分辨率作为初始图像帧的目标分辨率;在另一种实施例中,可以将后1帧的分辨率作为初始图像帧的目标分辨率;在又一种实施例中,可以将前1帧的分辨率和后1帧的分辨率的均值作为初始图像帧的目标分辨率;在另一种实施例中,可以前若干帧的分辨率和后若干帧的分辨率的均值作为初始图像帧的目标分辨率,等等。Wherein, when both the current target video parameter and the video sampling parameter include the resolution type and the frame rate type, if the current resolution corresponding to each image frame included in the video to be written is the same, the image written in the video can be The frame and initial image frame are set according to the current resolution. Or, considering that the current resolutions corresponding to each image frame included in the video to be written are different, the current resolution before the unprocessed image frame can be marked in advance for the image frame written in the video. In this way, the image frame written in the video can be The corresponding current resolution is set, and the target resolution of the initial image frame is determined according to the resolutions of adjacent frames of the initial image frame. The adjacent frames may be previous V frames and/or subsequent U frames, and both V and U are natural numbers. Considering that the correlation of several adjacent frames of the video is good, in order to make the restoration effect better, both V and U are smaller than the preset values. In this way, in one embodiment, the resolution of the previous frame may be used as the target resolution of the initial image frame; in another embodiment, the resolution of the next frame may be used as the target resolution of the initial image frame In another embodiment, the average value of the resolution of the previous frame and the resolution of the next frame can be used as the target resolution of the initial image frame; In another embodiment, the resolution of the previous frames can be and the average of the resolutions of the subsequent frames as the target resolution of the initial image frame, and so on.
在另一种实施例中,为了使得待播放视频与终端设备的屏幕分辨率匹配,本申请也可以将屏幕分辨率作为初始图像帧和写入视频的图像帧的目标分辨率。In another embodiment, in order to match the to-be-played video with the screen resolution of the terminal device, the present application may also use the screen resolution as the target resolution of the initial image frame and the image frame written into the video.
其中,在当前目标视频参数与视频采样参数中均包括颜色分量类型的情况下,对写入视频的目标图像帧进行像素值的还原处理可以包括:在目标图像帧的颜色分量集合中未包括全部颜色分量,或者,目标图像帧的颜色分量集合中的颜色分量的数量小于等于预设分量数量的情况下,获取目标图像帧中的缺失颜色分量,以及从目标图像帧的相邻帧中获取目标相邻帧,其中,相邻帧可以为前R帧和/或后T帧,R和T均为自然数,目标相邻帧的颜色分量集合中包括缺失颜色分量。这样,可以根据目标相邻帧的缺失颜色分量对应的参考分量像素值,确定目标图像帧的缺失颜色分量对应的目标分量像素值。若目标相邻帧的数量为一个,则将参考分量像素值作为目标分量像素值;若目标相邻帧的数量为至少两个,则将参考分量像素值的均值作为目标分量像素值。Wherein, when both the current target video parameter and the video sampling parameter include the color component type, performing pixel value restoration processing on the target image frame written in the video may include: not including all the color components in the target image frame color component set color components, or, if the number of color components in the color component set of the target image frame is less than or equal to the preset number of components, obtain the missing color components in the target image frame, and obtain the target image frame from adjacent frames of the target image frame Adjacent frames, where the adjacent frames may be the previous R frame and/or the next T frame, R and T are both natural numbers, and the color component set of the target adjacent frame includes missing color components. In this way, the pixel value of the target component corresponding to the missing color component of the target image frame can be determined according to the pixel value of the reference component corresponding to the missing color component of the target adjacent frame. If the number of target adjacent frames is one, the reference component pixel value is used as the target component pixel value; if the number of target adjacent frames is at least two, the average of the reference component pixel values is used as the target component pixel value.
示例性的,对于目标图像帧,前一帧图像的颜色分量集合为{R},后一帧图像的颜色分量集合为{B},目标图像帧的颜色分量集合为{G},则可以将前一帧图像的R颜色分量的参考分量像素值作为目标R分量像素值,将后一帧图像的B颜色分量的参考分量像素值作为目标R分量像素值。Exemplarily, for the target image frame, the set of color components of the previous frame of image is {R}, the set of color components of the next frame of image is {B}, and the set of color components of the target image frame is {G}, then you can set The reference component pixel value of the R color component of the previous frame image is used as the target R component pixel value, and the reference component pixel value of the B color component of the next frame image is used as the target R component pixel value.
需要说明的是,在目标图像帧的颜色分量集合中包括全部颜色分量的情况下,可以无需对目标图像帧进行像素值还原处理。It should be noted that, in the case where the color component set of the target image frame includes all the color components, it is not necessary to perform pixel value restoration processing on the target image frame.
其中,在当前目标视频参数与视频采样参数中均包括色阶类型的情况下,将写入视频的图像帧中的不同颜色分量,设置为当前色阶;或者,可以根据显示屏幕的对比度参数确定目标色阶,并将写入视频的图像帧中不同颜色分量,设置为目标色阶。其中,对比度越大,目标色阶越大;相反,对比度越小,目标色阶越小。Wherein, when both the current target video parameter and the video sampling parameter include the color scale type, the different color components in the image frame written in the video are set as the current color scale; or, it can be determined according to the contrast parameter of the display screen The target level, and set the different color components in the image frame written to the video as the target level. Among them, the larger the contrast, the larger the target color level; on the contrary, the smaller the contrast, the smaller the target color level.
需要说明的是,若当前目标视频参数包括多种类型参数,则可以结合上述实施例中的内容获取待播放视频,本申请不再赘述。It should be noted that, if the current target video parameters include multiple types of parameters, the to-be-played video may be obtained in combination with the content in the above embodiment, which will not be repeated in this application.
106、播放待播放视频。106. Play the video to be played.
需要说明的是,在待播放视频为对写入视频的图像帧进行数据还原得到的视频的情况下,终端设备可以将待播放视频进行缓存,这样,使得待播放视频无需占用终端设备的内存。此时,本步骤可以包括:将缓存的待播放视频进行播放。另外,终端设备可以周期性地对缓存的待播放视频进行删除,以使得终端设备可以缓存其他信息,以及提高缓存效率。It should be noted that when the video to be played is a video obtained by data restoration of the image frame written in the video, the terminal device can cache the video to be played, so that the video to be played does not need to occupy the memory of the terminal device. At this time, this step may include: playing the buffered video to be played. In addition, the terminal device can periodically delete the cached video to be played, so that the terminal device can cache other information and improve the cache efficiency.
采用上述所述的方法,由于存储的写入视频的图像帧的数据量较少,故终端设备在进行视频播放的过程中,可以读取较少的数据量,从而缩短了读取时间。另外,本申请通过对写入视频的图像帧进行数据还原得到待播放视频,从而保证了视频播放效果,提升了用户的视觉体验。With the above-mentioned method, since the stored data amount of the image frame written in the video is small, the terminal device can read a small amount of data during the video playback process, thereby shortening the reading time. In addition, the present application obtains the video to be played by performing data restoration on the image frame written in the video, thereby ensuring the video playback effect and improving the user's visual experience.
图5为本申请实施例提供的一种视频处理装置的结构框图,如图5所示,包括:FIG. 5 is a structural block diagram of a video processing apparatus provided by an embodiment of the application, as shown in FIG. 5 , including:
获取模块501,用于获取终端设备中待写入视频的写入指令;以及,an acquisition module 501, configured to acquire the writing instruction of the video to be written in the terminal device; and,
根据所述写入指令获取所述待写入视频的视频采样参数;Obtain the video sampling parameters of the to-be-written video according to the write instruction;
处理模块502,用于按照所述视频采样参数,对所述待写入视频进行数据处理,得到写入视频的图像帧;所述写入视频的内存占用量小于所述待写入视频的内存占用量;以及,The processing module 502 is configured to perform data processing on the video to be written according to the video sampling parameters to obtain image frames of the written video; the memory occupancy of the written video is smaller than the memory of the to-be-written video Occupancy; and,
对所述写入视频的图像帧进行写入操作。A write operation is performed on the image frame of the written video.
可选地,所述视频采样参数包括以下至少一种:Optionally, the video sampling parameters include at least one of the following:
采样帧频、采样分辨率、不同颜色分量集合、以及不同颜色分量分别对应的采样色阶;所述不同颜色分量集合存在对应的采样周期和/或采样顺序。Sampling frame rate, sampling resolution, different color component sets, and sampling levels corresponding to different color components respectively; the different color component sets have corresponding sampling periods and/or sampling sequences.
可选地,处理模块502,进一步用于根据所述写入指令获取所述待写入视频对应的目标预置采样参数,并将所述目标预置采样参数作为所述待写入视频的视频采样参数;或者,Optionally, the processing module 502 is further configured to obtain the target preset sampling parameter corresponding to the video to be written according to the write instruction, and use the target preset sampling parameter as the video of the video to be written. sampling parameters; or,
根据所述写入指令获取所述待写入视频的视频内容,并根据所述视频内容确定所述待写入视频的视频采样参数;或者,Obtain the video content of the to-be-written video according to the write instruction, and determine the video sampling parameters of the to-be-written video according to the video content; or,
根据所述写入指令获取所述终端设备的内存可用量,并根据所述内存可用量确定所述待写入视频的视频采样参数;或者,Obtain the available memory of the terminal device according to the write instruction, and determine the video sampling parameter of the video to be written according to the available memory; or,
根据所述写入指令获取所述待写入视频的视频内容以及所述终端设备的内存可用量,并根据所述内存可用量和所述视频内容确定所述待写入视频的视频采样参数;或者,Obtain the video content of the video to be written and the available memory of the terminal device according to the write instruction, and determine the video sampling parameter of the video to be written according to the available memory and the video content; or,
根据所述写入指令获取所述待写入视频的当前参数,所述当前参数包括当前帧频和当前分辨率中的至少一个,并根据所述当前参数和预设比例对应确定所述待写入视频的视频采样参数,所述视频采样参数包括所述采样帧频和所述采样分辨率中的至少一个。The current parameters of the video to be written are acquired according to the write instruction, where the current parameters include at least one of a current frame rate and a current resolution, and the to-be-written video is determined correspondingly according to the current parameters and a preset ratio video sampling parameters of the input video, where the video sampling parameters include at least one of the sampling frame rate and the sampling resolution.
可选地,处理模块502,进一步用于所述根据所述视频内容确定所述待写入视频的视频采样参数,包括:Optionally, the processing module 502 is further configured to determine the video sampling parameter of the to-be-written video according to the video content, including:
若所述待写入视频包括的第一图像帧序列的视频内容中存在运动对象,则根据所述运动对象的运动变化量确定所述第一图像帧序列的采样帧频;或者,If there is a moving object in the video content of the first image frame sequence included in the video to be written, determining the sampling frame rate of the first image frame sequence according to the motion change amount of the moving object; or,
若所述待写入视频包括的第二图像帧序列的视频内容中存在运动对象,则根据所述运动对象的运动变化量确定所述第二图像帧序列的采样分辨率;或者,If there is a moving object in the video content of the second image frame sequence included in the video to be written, the sampling resolution of the second image frame sequence is determined according to the motion change amount of the moving object; or,
若所述待写入视频包括的第三图像帧序列的视频内容中存在风景对象,则确定至少一个第一预置颜色分量集合为所述第三图像帧序列对应的颜色分量集合;其中,所述第一预置颜色分量集合包括的颜色分量的数量大于等于预设数量;或者,If there is a scenery object in the video content of the third image frame sequence included in the to-be-written video, then at least one first preset color component set is determined as a color component set corresponding to the third image frame sequence; The number of color components included in the first preset color component set is greater than or equal to a preset number; or,
若所述待写入视频包括的第四图像帧序列的视频内容中存在风景对象,则确定所述不同颜色分量的第一预置色阶对应为所述第四图像帧序列中不同颜色分量的采样色阶;其中,所述第一预置色阶大于等于预设数值。If there is a scenery object in the video content of the fourth image frame sequence included in the video to be written, it is determined that the first preset color levels of the different color components correspond to the different color components in the fourth image frame sequence Sampling level; wherein, the first preset level is greater than or equal to a preset value.
可选地,处理模块502,进一步用于根据第一预置对应关系,获取所述内存可用量所属内存可用量范围对应的采样帧频,其中,所述第一预置对应关系包括所述内存可用量范围与所述采样帧频之间的对应关系;或者,Optionally, the processing module 502 is further configured to obtain, according to a first preset correspondence, the sampling frame frequency corresponding to the memory availability range to which the available memory belongs, wherein the first preset correspondence includes the memory. the correspondence between the available amount range and the sampling frame rate; or,
根据第二预置对应关系,获取所述内存可用量所属内存可用量范围对应的采样分辨率,所述第二预置对应关系包括所述内存可用量范围与所述采样分辨率之间的对应关系;或者,Obtain the sampling resolution corresponding to the memory availability range to which the memory availability belongs according to a second preset correspondence, where the second preset correspondence includes the correspondence between the memory availability range and the sampling resolution relationship; or,
根据第三预置对应关系,获取所述内存可用量所属内存可用量范围对应的采样颜色分量集合,所述第三预置对应关系包括所述内存可用量范围与所述采样颜色分量集合之间的对应关系;或者,Acquire a sampled color component set corresponding to a memory availability range to which the memory availability belongs according to a third preset correspondence, where the third preset correspondence includes a relationship between the memory availability range and the sampled color component set correspondence; or,
根据第四预置对应关系,获取所述内存可用量所属内存可用量范围对应的不同颜色分量的采样色阶,所述第四预置对应关系包括所述内存可用量范围、所述颜色分量以及所述采样色阶之间的对应关系。Obtain sampling levels of different color components corresponding to the memory availability range to which the memory availability belongs according to a fourth preset correspondence, where the fourth preset correspondence includes the memory availability range, the color components, and The corresponding relationship between the sampling levels.
可选地,获取模块501,进一步用于响应于对所述终端设备的显示界面上的存储控件的第一存储操作,获取所述第一存储操作对应的待写入视频的写入指令;或者,Optionally, the obtaining module 501 is further configured to, in response to a first storage operation on the storage control on the display interface of the terminal device, obtain a write instruction of the video to be written corresponding to the first storage operation; or ,
响应于对所述终端设备上的存储按键的第二存储操作,获取所述第二存储操作对应的待写入视频的写入指令;或者,In response to the second storage operation on the storage button on the terminal device, obtain the writing instruction of the to-be-written video corresponding to the second storage operation; or,
在检测到写入数据流为视频数据的情况下,生成所述写入数据流对应的待写入视频的写入指令。In the case that it is detected that the written data stream is video data, a write instruction of the to-be-written video corresponding to the written data stream is generated.
可选地,视频处理模块还包括:播放模块;Optionally, the video processing module further includes: a playback module;
处理模块502,还用于在接收到对所述写入视频的播放指令的情况下,根据所述写入视频的图像帧,获取待播放视频;所述待播放视频包括所述写入视频的图像帧,或者,所述待播放视频为对所述写入视频的图像帧进行数据还原得到的视频;The processing module 502 is further configured to obtain a video to be played according to the image frame of the written video in the case of receiving a playback instruction for the written video; the to-be-played video includes the written video. An image frame, or the video to be played is a video obtained by performing data restoration on the image frame written in the video;
所述播放模块,用于播放所述待播放视频。The playing module is configured to play the to-be-played video.
视频处理装置的具体内容可以参考上述视频处理方法的实施例所述的内容,此处不再赘述。For the specific content of the video processing apparatus, reference may be made to the content described in the above embodiments of the video processing method, which will not be repeated here.
图6示出了本申请实施例提供的一种终端设备的结构框图。参考图6,终端设备包括:射频(radio frequency,RF)电路610、存储器620、输入单元630、显示单元640、传感器650、音频电路660、无线保真(wireless fidelity,WiFi)模块670、处理器680、以及电源690等部件。本领域技术人员可以理解,图6中示出的终端设备结构并不构成对终端设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 6 shows a structural block diagram of a terminal device provided by an embodiment of the present application. 6 , the terminal device includes: a radio frequency (RF)
下面结合图6对终端设备的各个构成部件进行具体的介绍:Below in conjunction with Fig. 6, each constituent component of the terminal equipment is introduced in detail:
RF电路610可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器680处理;另外,将设计上行的数据发送给基站。通常,RF电路610包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low NoiseAmplifier,LNA)、双工器等。此外,RF电路610还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(globalsystem of mobile communication,GSM)、通用分组无线服务(general packet radioservice,GPRS)、码分多址(code division multiple access,CDMA)、宽带码分多址(wideband code division multiple access,WCDMA)、长期演进(long term evolution,LTE)、电子邮件、短消息服务(short messaging service,SMS)等。The
存储器620可用于存储软件程序以及模块,处理器680通过运行存储在存储器620的软件程序以及模块,从而执行终端设备的各种功能应用以及数据处理。存储器620可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据终端设备的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器620可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The
输入单元630可用于接收输入的数字或字符信息,以及产生与终端设备的用户设置以及功能控制有关的键信号输入。具体地,输入单元630可包括触控面板631以及其他输入设备632。触控面板631,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板631上或在触控面板631附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板631可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器680,并能接收处理器680发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板631。除了触控面板631,输入单元630还可以包括其他输入设备632。具体地,其他输入设备632可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The
显示单元640可用于显示由用户输入的信息或提供给用户的信息以及终端设备的各种菜单。显示单元640可包括显示面板641,可选的,可以采用液晶显示器(liquidcrystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)等形式来配置显示面板641。进一步的,触控面板631可覆盖显示面板641,当触控面板631检测到在其上或附近的触摸操作后,传送给处理器680以确定触摸事件的类型,随后处理器680根据触摸事件的类型在显示面板641上提供相应的视觉输出。虽然在图6中,触控面板631与显示面板641是作为两个独立的部件来实现终端设备的输入和输入功能,但是在某些实施例中,可以将触控面板631与显示面板641集成而实现终端设备的输入和输出功能。The
终端设备还可包括至少一种传感器650,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板641的亮度,接近传感器可在终端设备移动到耳边时,关闭显示面板641和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别终端设备姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于终端设备还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The terminal device may also include at least one
音频电路660、扬声器661,传声器662可提供用户与终端设备之间的音频接口。音频电路660可将接收到的音频数据转换后的电信号,传输到扬声器661,由扬声器661转换为声音信号输出;另一方面,传声器662将收集的声音信号转换为电信号,由音频电路660接收后转换为音频数据,再将音频数据输出处理器680处理后,经RF电路610以发送给比如另一终端设备,或者将音频数据输出至存储器620以便进一步处理。The
WiFi属于短距离无线传输技术,终端设备通过WiFi模块670可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。WiFi is a short-distance wireless transmission technology. The terminal device can help users to send and receive emails, browse web pages, and access streaming media through the
处理器680是终端设备的控制中心,利用各种接口和线路连接整个终端设备的各个部分,通过运行或执行存储在存储器620内的软件程序和/或模块,以及调用存储在存储器620内的数据,执行终端设备的各种功能和处理数据,从而对终端设备进行整体监控。可选的,处理器680可包括一个或多个处理单元;优选的,处理器680可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器680中。The
终端设备还包括给各个部件供电的电源690(比如电池),优选的,电源可以通过电源管理系统与处理器680逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The terminal device also includes a power supply 690 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the
尽管未示出,终端设备还可以包括摄像头、蓝牙模块等,在此不再赘述。Although not shown, the terminal device may also include a camera, a Bluetooth module, and the like, which will not be repeated here.
在本发明实施例中,该终端设备所包括的处理器680还具有以下功能:In this embodiment of the present invention, the
获取终端设备中待写入视频的写入指令;Obtain the writing instruction of the video to be written in the terminal device;
根据所述写入指令获取所述待写入视频的视频采样参数;Obtain the video sampling parameters of the to-be-written video according to the write instruction;
按照所述视频采样参数,对所述待写入视频进行数据处理,得到写入视频的图像帧;所述写入视频的内存占用量小于所述待写入视频的内存占用量;According to the video sampling parameters, data processing is performed on the video to be written to obtain an image frame of the written video; the memory occupancy of the written video is smaller than the memory occupancy of the to-be-written video;
对所述写入视频的图像帧进行写入操作。A write operation is performed on the image frame of the written video.
可选地,所述视频采样参数包括以下至少一种:Optionally, the video sampling parameters include at least one of the following:
采样帧频、采样分辨率、不同颜色分量集合、以及不同颜色分量分别对应的采样色阶;所述不同颜色分量集合存在对应的采样周期和/或采样顺序。Sampling frame rate, sampling resolution, different color component sets, and sampling levels corresponding to different color components respectively; the different color component sets have corresponding sampling periods and/or sampling sequences.
可选地,该终端设备所包括的处理器680还具有以下功能:Optionally, the
根据所述写入指令获取所述待写入视频对应的目标预置采样参数,并将所述目标预置采样参数作为所述待写入视频的视频采样参数;或者,Acquire the target preset sampling parameter corresponding to the video to be written according to the write instruction, and use the target preset sampling parameter as the video sampling parameter of the video to be written; or,
根据所述写入指令获取所述待写入视频的视频内容,并根据所述视频内容确定所述待写入视频的视频采样参数;或者,Obtain the video content of the to-be-written video according to the write instruction, and determine the video sampling parameters of the to-be-written video according to the video content; or,
根据所述写入指令获取所述终端设备的内存可用量,并根据所述内存可用量确定所述待写入视频的视频采样参数;或者,Obtain the available memory of the terminal device according to the write instruction, and determine the video sampling parameter of the video to be written according to the available memory; or,
根据所述写入指令获取所述待写入视频的视频内容以及所述终端设备的内存可用量,并根据所述内存可用量和所述视频内容确定所述待写入视频的视频采样参数;或者,Obtain the video content of the video to be written and the available memory of the terminal device according to the write instruction, and determine the video sampling parameter of the video to be written according to the available memory and the video content; or,
根据所述写入指令获取所述待写入视频的当前参数,所述当前参数包括当前帧频和当前分辨率中的至少一个,并根据所述当前参数和预设比例对应确定所述待写入视频的视频采样参数,所述视频采样参数包括所述采样帧频和所述采样分辨率中的至少一个。The current parameters of the video to be written are acquired according to the write instruction, where the current parameters include at least one of a current frame rate and a current resolution, and the to-be-written video is determined correspondingly according to the current parameters and a preset ratio video sampling parameters of the input video, where the video sampling parameters include at least one of the sampling frame rate and the sampling resolution.
可选地,该终端设备所包括的处理器680还具有以下功能:若所述待写入视频包括的第一图像帧序列的视频内容中存在运动对象,则根据所述运动对象的运动变化量确定所述第一图像帧序列的采样帧频;或者,Optionally, the
若所述待写入视频包括的第二图像帧序列的视频内容中存在运动对象,则根据所述运动对象的运动变化量确定所述第二图像帧序列的采样分辨率;或者,If there is a moving object in the video content of the second image frame sequence included in the video to be written, the sampling resolution of the second image frame sequence is determined according to the motion change amount of the moving object; or,
若所述待写入视频包括的第三图像帧序列的视频内容中存在风景对象,则确定至少一个第一预置颜色分量集合为所述第三图像帧序列对应的颜色分量集合;其中,所述第一预置颜色分量集合包括的颜色分量的数量大于等于预设数量;或者,If there is a scenery object in the video content of the third image frame sequence included in the to-be-written video, then at least one first preset color component set is determined as a color component set corresponding to the third image frame sequence; The number of color components included in the first preset color component set is greater than or equal to a preset number; or,
若所述待写入视频包括的第四图像帧序列的视频内容中存在风景对象,则确定所述不同颜色分量的第一预置色阶对应为所述第四图像帧序列中不同颜色分量的采样色阶;其中,所述第一预置色阶大于等于预设数值。If there is a scenery object in the video content of the fourth image frame sequence included in the video to be written, it is determined that the first preset color levels of the different color components correspond to the different color components in the fourth image frame sequence Sampling level; wherein, the first preset level is greater than or equal to a preset value.
可选地,该终端设备所包括的处理器680还具有以下功能:根据第一预置对应关系,获取所述内存可用量所属内存可用量范围对应的采样帧频,其中,所述第一预置对应关系包括所述内存可用量范围与所述采样帧频之间的对应关系;或者,Optionally, the
根据第二预置对应关系,获取所述内存可用量所属内存可用量范围对应的采样分辨率,所述第二预置对应关系包括所述内存可用量范围与所述采样分辨率之间的对应关系;或者,Obtain the sampling resolution corresponding to the memory availability range to which the memory availability belongs according to a second preset correspondence, where the second preset correspondence includes the correspondence between the memory availability range and the sampling resolution relationship; or,
根据第三预置对应关系,获取所述内存可用量所属内存可用量范围对应的采样颜色分量集合,所述第三预置对应关系包括所述内存可用量范围与所述采样颜色分量集合之间的对应关系;或者,Acquire a sampled color component set corresponding to a memory availability range to which the memory availability belongs according to a third preset correspondence, where the third preset correspondence includes a relationship between the memory availability range and the sampled color component set correspondence; or,
根据第四预置对应关系,获取所述内存可用量所属内存可用量范围对应的不同颜色分量的采样色阶,所述第四预置对应关系包括所述内存可用量范围、所述颜色分量以及所述采样色阶之间的对应关系。Obtain sampling levels of different color components corresponding to the memory availability range to which the memory availability belongs according to a fourth preset correspondence, where the fourth preset correspondence includes the memory availability range, the color components, and The corresponding relationship between the sampling levels.
可选地,该终端设备所包括的处理器680还具有以下功能:响应于对所述终端设备的显示界面上的存储控件的第一存储操作,获取所述第一存储操作对应的待写入视频的写入指令;或者,Optionally, the
响应于对所述终端设备上的存储按键的第二存储操作,获取所述第二存储操作对应的待写入视频的写入指令;或者,In response to the second storage operation on the storage button on the terminal device, obtain the writing instruction of the to-be-written video corresponding to the second storage operation; or,
在检测到写入数据流为视频数据的情况下,生成所述写入数据流对应的待写入视频的写入指令。In the case that it is detected that the written data stream is video data, a write instruction of the to-be-written video corresponding to the written data stream is generated.
可选地,该终端设备所包括的处理器680还具有以下功能:在接收到对所述写入视频的播放指令的情况下,根据所述写入视频的图像帧,获取待播放视频;所述待播放视频包括所述写入视频的图像帧,或者,所述待播放视频为对所述写入视频的图像帧进行数据还原得到的视频;以及,Optionally, the
播放所述待播放视频。Play the to-be-played video.
本发明实施例还提供一种终端设备,该终端设备可以包括处理器,存储器以及存储在存储器上并可在处理器上运行的计算机程序,该计算机程序被处理器执行时可以实现上述方法实施例中终端设备执行的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。An embodiment of the present invention further provides a terminal device, the terminal device may include a processor, a memory, and a computer program stored in the memory and running on the processor, the computer program being executed by the processor may implement the above method embodiments Each process performed by the terminal device can achieve the same technical effect. In order to avoid repetition, details are not repeated here.
本申请实施例提供一种计算机可读存储介质,其特征在于,该计算机可读存储介质上存储计算机程序,该计算机程序被处理器执行时实现上述方法实施例中终端设备执行的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。An embodiment of the present application provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, each process performed by the terminal device in the foregoing method embodiments is implemented, and The same technical effect can be achieved, and in order to avoid repetition, details are not repeated here.
其中,该计算机可读存储介质可以为只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。Wherein, the computer-readable storage medium may be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, an optical disk, or the like.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course hardware can also be used, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods of the various embodiments of the present application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific embodiments, which are merely illustrative rather than restrictive. Under the inspiration of this application, without departing from the scope of protection of the purpose of this application and the claims, many forms can be made, which all fall within the protection of this application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010828382.2A CN112068771A (en) | 2020-08-17 | 2020-08-17 | Video processing method, video processing device, terminal device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010828382.2A CN112068771A (en) | 2020-08-17 | 2020-08-17 | Video processing method, video processing device, terminal device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112068771A true CN112068771A (en) | 2020-12-11 |
Family
ID=73661355
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010828382.2A Withdrawn CN112068771A (en) | 2020-08-17 | 2020-08-17 | Video processing method, video processing device, terminal device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112068771A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112883782A (en) * | 2021-01-12 | 2021-06-01 | 上海肯汀通讯科技有限公司 | Method, device, equipment and storage medium for identifying putting behaviors |
CN116089320A (en) * | 2022-08-31 | 2023-05-09 | 荣耀终端有限公司 | Garbage collection method and related apparatus |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104853193A (en) * | 2014-02-19 | 2015-08-19 | 腾讯科技(北京)有限公司 | Video compression method, device and electronic equipment |
WO2017185609A1 (en) * | 2016-04-28 | 2017-11-02 | 乐视控股(北京)有限公司 | Video processing method and device |
CN107803029A (en) * | 2017-10-26 | 2018-03-16 | 广东欧珀移动通信有限公司 | Display processing method and related product |
CN108347580A (en) * | 2018-03-27 | 2018-07-31 | 聚好看科技股份有限公司 | A kind of method and electronic equipment of processing video requency frame data |
CN108769682A (en) * | 2018-06-20 | 2018-11-06 | 腾讯科技(深圳)有限公司 | Video coding, coding/decoding method, device, computer equipment and storage medium |
CN110312156A (en) * | 2018-03-27 | 2019-10-08 | 腾讯科技(深圳)有限公司 | A kind of video cache method, apparatus and readable storage medium storing program for executing |
CN110502954A (en) * | 2018-05-17 | 2019-11-26 | 杭州海康威视数字技术股份有限公司 | The method and apparatus of video analysis |
CN110622517A (en) * | 2018-01-19 | 2019-12-27 | 深圳市大疆创新科技有限公司 | Video processing method and device |
CN110675342A (en) * | 2019-09-18 | 2020-01-10 | 努比亚技术有限公司 | Video frame optimization method, mobile terminal and computer readable storage medium |
-
2020
- 2020-08-17 CN CN202010828382.2A patent/CN112068771A/en not_active Withdrawn
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104853193A (en) * | 2014-02-19 | 2015-08-19 | 腾讯科技(北京)有限公司 | Video compression method, device and electronic equipment |
WO2017185609A1 (en) * | 2016-04-28 | 2017-11-02 | 乐视控股(北京)有限公司 | Video processing method and device |
CN107803029A (en) * | 2017-10-26 | 2018-03-16 | 广东欧珀移动通信有限公司 | Display processing method and related product |
CN110622517A (en) * | 2018-01-19 | 2019-12-27 | 深圳市大疆创新科技有限公司 | Video processing method and device |
CN108347580A (en) * | 2018-03-27 | 2018-07-31 | 聚好看科技股份有限公司 | A kind of method and electronic equipment of processing video requency frame data |
CN110312156A (en) * | 2018-03-27 | 2019-10-08 | 腾讯科技(深圳)有限公司 | A kind of video cache method, apparatus and readable storage medium storing program for executing |
CN110502954A (en) * | 2018-05-17 | 2019-11-26 | 杭州海康威视数字技术股份有限公司 | The method and apparatus of video analysis |
CN108769682A (en) * | 2018-06-20 | 2018-11-06 | 腾讯科技(深圳)有限公司 | Video coding, coding/decoding method, device, computer equipment and storage medium |
CN110675342A (en) * | 2019-09-18 | 2020-01-10 | 努比亚技术有限公司 | Video frame optimization method, mobile terminal and computer readable storage medium |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112883782A (en) * | 2021-01-12 | 2021-06-01 | 上海肯汀通讯科技有限公司 | Method, device, equipment and storage medium for identifying putting behaviors |
CN112883782B (en) * | 2021-01-12 | 2023-03-24 | 上海肯汀通讯科技有限公司 | Method, device, equipment and storage medium for identifying putting behaviors |
CN116089320A (en) * | 2022-08-31 | 2023-05-09 | 荣耀终端有限公司 | Garbage collection method and related apparatus |
CN116089320B (en) * | 2022-08-31 | 2023-10-20 | 荣耀终端有限公司 | Garbage recycling method and related device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109597556B (en) | Screen capture method and terminal | |
CN107911812B (en) | Method for adjusting preferred public land mobile network PPLMN list and mobile terminal | |
CN110874128B (en) | Visualized data processing method and electronic equipment | |
CN109999494B (en) | Game control method, device and computer readable storage medium | |
CN112672201B (en) | Screen recording frame rate control method, equipment and computer readable storage medium | |
CN107835452A (en) | Data processing method and related product | |
CN108600520B (en) | Reception state control method, mobile terminal, and computer-readable storage medium | |
CN103581762A (en) | Method, device and terminal equipment for playing network videos | |
CN107608606A (en) | A kind of image display method, mobile terminal and computer-readable recording medium | |
CN108228034A (en) | Control method, mobile terminal and the computer readable storage medium of mobile terminal | |
CN109976611A (en) | The control method and terminal device of terminal device | |
CN109309953B (en) | Power consumption detection method, device, terminal and readable storage medium | |
CN115083330A (en) | Screen parameter adjustment method, mobile terminal and computer-readable storage medium | |
CN109284110A (en) | Terminal applies replacement method, terminal and computer readable storage medium | |
CN110064191A (en) | Game interaction method, apparatus, system and storage medium based on gyroscope | |
CN108984063B (en) | Desktop interaction regulation and control method and device and computer readable storage medium | |
CN112068771A (en) | Video processing method, video processing device, terminal device and storage medium | |
CN110069333A (en) | Backstage management-control method, mobile terminal and the computer readable storage medium of application | |
CN108228357A (en) | A memory cleaning method and mobile terminal | |
CN108228876A (en) | A kind of method and mobile terminal for reading file data | |
CN108322595A (en) | A kind of control method, terminal and computer readable storage medium | |
CN108415549B (en) | Method for improving battery life of mobile terminal, mobile terminal and readable storage medium | |
CN107623788B (en) | Method, device and computer-readable storage medium for improving application startup speed | |
CN109890072A (en) | Saving power for terminal control method, device, mobile terminal and readable storage medium storing program for executing | |
CN110209434A (en) | A kind of EMS memory management process, device and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20201211 |