HK40028958B - Method and apparatus for processing video special effect and electronic device - Google Patents
Method and apparatus for processing video special effect and electronic device Download PDFInfo
- Publication number
- HK40028958B HK40028958B HK42020018831.6A HK42020018831A HK40028958B HK 40028958 B HK40028958 B HK 40028958B HK 42020018831 A HK42020018831 A HK 42020018831A HK 40028958 B HK40028958 B HK 40028958B
- Authority
- HK
- Hong Kong
- Prior art keywords
- duration
- timestamp
- target
- video
- scaling
- Prior art date
Links
Description
技术领域Technical Field
本发明涉及数字多媒体技术,尤其涉及一种视频特效的处理方法、装置、电子设备及计算机可读存储介质。This invention relates to digital multimedia technology, and more particularly to a method, apparatus, electronic device, and computer-readable storage medium for processing video special effects.
背景技术Background Technology
互联网特别是移动互联网的发展,使得视频作为信息的传播媒介得到前所未有的运用。为了增强视频所承载信息的表现力,并提升关注度,相关技术通常会为视频增加视频特效。The development of the internet, especially the mobile internet, has led to an unprecedented use of video as a medium for information dissemination. To enhance the expressiveness of the information conveyed by videos and increase viewership, related technologies often add video effects.
例如,相关技术中,可以基于专业的视频编辑设计软件例如AE(Adobe AfterEffect)来设计特效动画,AE中可以使用Airbnb开源的火热动画库方案以及便携式动画图形(PAG,Portable Animated Graphics)方案。For example, in related technologies, special effects animations can be designed based on professional video editing and design software such as AE (Adobe After Effects). AE can use Airbnb's popular open-source animation library and Portable Animated Graphics (PAG) solutions.
但是,通过视频编辑设计软件设计出的视频特效的时长均是固定的,难以适用于需求多样化的应用场景;如果针对各种可能的场景来生成各种不同播放时长的视频特效,则不仅会造成计算资源的浪费,而且影响视频呈现的实时性。However, the duration of video effects designed by video editing software is fixed, making it difficult to adapt to diverse application scenarios. If various video effects with different playback durations are generated for various possible scenarios, it will not only waste computing resources but also affect the real-time performance of the video presentation.
发明内容Summary of the Invention
本发明实施例提供一种视频特效的处理方法、装置、电子设备及计算机可读存储介质,能够实现视频特效时长的自由伸缩。This invention provides a method, apparatus, electronic device, and computer-readable storage medium for processing video special effects, which can achieve free scaling of video special effects duration.
本发明实施例的技术方案是这样实现的:The technical solution of this invention is implemented as follows:
本发明实施例提供一种视频特效的处理方法,所述方法包括:This invention provides a method for processing video special effects, the method comprising:
获取视频特效文件,并从所述视频特效文件中提取时长伸缩逻辑;Obtain video effects files and extract duration scaling logic from the video effects files;
获取需要所述视频特效文件所实现的目标播放时长,其中,所述目标播放时长区别于所述视频特效文件的原始播放时长;Obtain the target playback duration required to be achieved by the video effects file, wherein the target playback duration is different from the original playback duration of the video effects file;
根据所述时长伸缩逻辑,确定所述视频特效文件中与目标时间轴对应的特效帧;Based on the duration scaling logic, determine the special effects frames in the video special effects file that correspond to the target timeline;
其中,所述目标时间轴的长度与所述目标播放时长一致;The length of the target timeline is the same as the target playback duration;
根据与所述目标时间轴对应的特效帧进行渲染,以形成符合所述目标播放时长的视频特效播放过程。Rendering is performed based on the effect frames corresponding to the target timeline to form a video effect playback process that conforms to the target playback duration.
本发明实施例提供一种视频特效的处理装置,所述装置包括:This invention provides a video effects processing apparatus, the apparatus comprising:
文件获取模块,用于获取视频特效文件,并从所述视频特效文件中提取时长伸缩逻辑;The file acquisition module is used to acquire video effects files and extract duration scaling logic from the video effects files.
时长获取模块,用于获取需要所述视频特效文件所实现的目标播放时长,其中,所述目标播放时长区别于所述视频特效文件的原始播放时长;The duration acquisition module is used to acquire the target playback duration required by the video effects file, wherein the target playback duration is different from the original playback duration of the video effects file;
特效帧确定模块,用于根据所述时长伸缩逻辑,确定所述视频特效文件中与目标时间轴对应的特效帧;The special effects frame determination module is used to determine the special effects frame in the video special effects file corresponding to the target timeline according to the duration scaling logic;
其中,所述目标时间轴的长度与所述目标播放时长一致;The length of the target timeline is the same as the target playback duration;
渲染模块,用于根据与所述目标时间轴对应的特效帧进行渲染,以形成符合所述目标播放时长的视频特效播放过程。The rendering module is used to render special effects frames corresponding to the target timeline to form a video special effects playback process that conforms to the target playback duration.
在上述方案中,所述文件获取模块,还用于:In the above scheme, the file acquisition module is further configured to:
执行以下处理之一以得到对应所述特效对象的编码导出文件:Perform one of the following processes to obtain the encoded export file corresponding to the special effects object:
对所述特效对象的多个图层结构进行编码处理,得到对应所述特效对象的编码导出文件;The multiple layer structures of the special effects object are encoded to obtain the corresponding encoded export file of the special effects object;
对所述特效对象的多个特效帧进行编码处理,得到对应所述特效对象的编码导出文件;Encode multiple effect frames of the effect object to obtain the corresponding encoded export file of the effect object;
对所述特效对象的多个特效帧进行视频格式压缩处理,并对得到的视频格式压缩处理结果进行编码处理,得到对应所述特效对象的编码导出文件;Multiple effect frames of the effect object are subjected to video format compression processing, and the resulting video format compression processing result is encoded to obtain the encoded export file corresponding to the effect object;
将时长伸缩类型以及时长伸缩区间封装在所述编码导出文件中,得到对应所述特效对象的视频特效文件。The duration scaling type and duration scaling range are encapsulated in the encoding export file to obtain the video effects file corresponding to the effects object.
在上述方案中,所述时长伸缩逻辑包括时长伸缩区间以及对应的时长伸缩类型;所述文件获取模块,还用于:In the above scheme, the duration scaling logic includes duration scaling intervals and corresponding duration scaling types; the file acquisition module is further used for:
对所述视频特效文件进行解码处理,得到对应所述视频特效文件的至少一个时长伸缩区间以及对应的时长伸缩类型;The video effects file is decoded to obtain at least one duration scaling interval and the corresponding duration scaling type for the video effects file.
其中,所述时长伸缩类型包括以下类型中的任意一种:时间线性伸缩类型;时间重复类型;时间倒序重复类型。The duration scaling type includes any one of the following types: linear time scaling type; time repetition type; and time reverse repetition type.
在上述方案中,所述时长获取模块,还用于:In the above solution, the duration acquisition module is further used for:
当所述时长伸缩区间的数目为多个时,将所述视频特效文件拆分为与所述数目一致的多个视频特效子文件,并分别获取针对每个所述视频特效子文件的目标播放时长间;When there are multiple duration extension intervals, the video effect file is split into multiple video effect sub-files, which is the same number as the duration extension interval, and the target playback duration for each video effect sub-file is obtained.
当所述时长伸缩区间的数目为一个时,获取针对所述视频特效文件的整体的目标播放时长。When the number of duration scaling intervals is one, the overall target playback duration for the video effects file is obtained.
在上述方案中,所述时长获取模块,还用于:在获取需要所述视频特效文件所实现的目标播放时长之后,In the above solution, the duration acquisition module is further configured to: after acquiring the target playback duration required by the video effects file,
当所述时长伸缩区间的数目为多个时,针对每个所述视频特效子文件执行以下处理:When there are multiple duration scaling intervals, the following processing is performed for each video effects sub-file:
从所述视频特效子文件中获取对应特效对象的原始时间轴;Obtain the original timeline of the corresponding effect object from the video effects sub-file;
保持所述原始时间轴的帧率不变,对所述原始时间轴进行时长伸缩处理,得到对应所述目标播放时长的目标时间轴;Keeping the frame rate of the original timeline unchanged, the original timeline is subjected to duration scaling to obtain a target timeline corresponding to the target playback duration;
当所述时长伸缩区间的数目为一个时,针对所述视频特效文件执行以下处理:When the number of duration scaling intervals is one, the following processing is performed on the video effects file:
从所述视频特效文件中获取对应特效对象的原始时间轴;Obtain the original timeline of the corresponding effect object from the video effects file;
保持所述原始时间轴的帧率不变,对所述原始时间轴进行时长伸缩处理,得到对应所述目标播放时长的目标时间轴。Keeping the frame rate of the original timeline unchanged, the original timeline is subjected to duration scaling to obtain a target timeline corresponding to the target playback duration.
在上述方案中,当所述时长伸缩区间的数目为多个时,所述特效帧确定模块,还用于:In the above scheme, when the number of duration expansion intervals is multiple, the special effects frame determination module is further configured to:
针对每个时长伸缩区间执行以下处理:Perform the following processing for each duration scaling interval:
从所述视频特效子文件中获取包括所述特效对象的多个特效帧、以及每个所述特效帧在所述原始时间轴上对应的时间戳,以作为每个所述特效帧的原始特效帧时间戳;Obtain multiple effect frames including the effect object from the video effect sub-file, and the timestamp corresponding to each effect frame on the original timeline, as the original effect frame timestamp for each effect frame;
基于时长伸缩区间、以及每个所述特效帧对应的原始特效帧时间戳,在所述多个特效帧中确定与所述目标时间轴上每个时间戳对应的特效帧。Based on the duration scaling interval and the original effect frame timestamp corresponding to each of the effect frames, the effect frame corresponding to each timestamp on the target timeline is determined from the plurality of effect frames.
在上述方案中,当所述时长伸缩区间的数目为一个时,所述特效帧确定模块,还用于:In the above scheme, when the number of duration expansion intervals is one, the special effects frame determination module is further configured to:
从所述视频特效文件中获取包括所述特效对象的多个特效帧、以及每个所述特效帧在所述原始时间轴上对应的时间戳,以作为每个所述特效帧的原始特效帧时间戳;Obtain multiple effect frames including the effect object from the video effect file, and the timestamp corresponding to each effect frame on the original timeline, as the original effect frame timestamp for each effect frame;
基于时长伸缩区间、以及每个所述特效帧对应的原始特效帧时间戳,在所述多个特效帧中确定与所述目标时间轴上每个时间戳对应的特效帧。Based on the duration scaling interval and the original effect frame timestamp corresponding to each of the effect frames, the effect frame corresponding to each timestamp on the target timeline is determined from the plurality of effect frames.
在上述方案中,所述特效帧确定模块,还用于:In the above scheme, the special effects frame determination module is further used for:
依次将所述目标时间轴上每个时间戳作为目标时间戳,以执行以下处理:Each timestamp on the target timeline is sequentially used as the target timestamp to perform the following processing:
基于时长伸缩区间,确定所述目标时间戳在所述原始时间轴上对应的时间戳;Based on the duration scaling interval, determine the timestamp corresponding to the target timestamp on the original timeline;
当所述目标时间戳在所述原始时间轴上对应的时间戳与任一所述原始特效帧时间戳重叠时,将重叠的所述原始特效帧时间戳对应的特效帧确定为所述目标时间戳对应的特效帧;When the timestamp corresponding to the target timestamp on the original timeline overlaps with any of the original special effects frame timestamps, the special effects frame corresponding to the overlapping original special effects frame timestamp is determined as the special effects frame corresponding to the target timestamp.
当所述目标时间戳在所述原始时间轴上对应的时间戳未与任一所述原始特效帧时间戳重叠时,确定与所述目标时间戳在所述原始时间轴上对应的时间戳距离最小的所述原始时间戳,并将确定所述原始特效帧时间戳对应的特效帧确定为所述目标时间戳对应的特效帧。When the timestamp corresponding to the target timestamp on the original timeline does not overlap with any of the original effect frame timestamps, the original timestamp with the smallest distance from the timestamp corresponding to the target timestamp on the original timeline is determined, and the effect frame corresponding to the determined original effect frame timestamp is determined as the effect frame corresponding to the target timestamp.
在上述方案中,所述特效帧确定模块,还用于:In the above scheme, the special effects frame determination module is further used for:
针对每个所述时长伸缩区间执行以下处理:For each of the aforementioned duration scaling intervals, the following processing is performed:
当所述目标时间戳不大于所述时长伸缩区间的起始时间戳时,将所述目标时间戳确定为在所述原始时间轴上对应的原始时间戳;When the target timestamp is not greater than the starting timestamp of the duration expansion interval, the target timestamp is determined as the original timestamp corresponding to the original timeline;
当所述目标时间戳大于所述时长伸缩区间的起始时间戳,且小于所述时长伸缩区间的终止时间戳时,对所述目标时间戳进行基于所述时长伸缩类型的映射,得到对应的原始时间戳;When the target timestamp is greater than the start timestamp of the duration expansion interval and less than the end timestamp of the duration expansion interval, the target timestamp is mapped based on the duration expansion type to obtain the corresponding original timestamp.
当所述目标时间戳大于或者等于所述终止时间戳,且小于所述目标播放时长时,确定所述原始播放时长与所述目标播放时长之间的第一差值,将所述第一差值与所述目标时间戳进行求和处理,并将求和处理结果确定所述目标时间戳在所述原始时间轴上对应的时间戳。When the target timestamp is greater than or equal to the termination timestamp and less than the target playback duration, a first difference between the original playback duration and the target playback duration is determined. The first difference is summed with the target timestamp, and the summation result is used to determine the timestamp corresponding to the target timestamp on the original timeline.
在上述方案中,所述特效帧确定模块,还用于:In the above scheme, the special effects frame determination module is further used for:
当所述时长伸缩类型为所述时间线性缩减类型、或者所述时间线性拉伸类型时,将所述目标播放时长与所述原始播放时长的第二差值确定为伸缩长度,并将所述伸缩长度与所述时长伸缩区间的长度进行求和处理;When the duration scaling type is the time linear reduction type or the time linear stretch type, the second difference between the target playback duration and the original playback duration is determined as the scaling length, and the scaling length is summed with the length of the duration scaling interval;
对所述时长伸缩区间的长度与求和处理结果进行求比值处理,得到伸缩系数;The length of the time-scaling interval is compared with the summation result to obtain the scaling factor;
确定所述目标时间戳与所述起始时间戳之间的第三差值,将所述第三差值与所述伸缩系数进行相乘处理;Determine a third difference between the target timestamp and the starting timestamp, and multiply the third difference by the scaling factor;
对相乘处理结果与所述起始时间戳进行求和处理,得到对应的原始时间戳。The result of the multiplication process is summed with the starting timestamp to obtain the corresponding original timestamp.
在上述方案中,所述特效帧确定模块,还用于:In the above scheme, the special effects frame determination module is further used for:
当所述时长伸缩类型为所述时间重复类型时,确定所述目标时间戳与所述起始时间戳之间的第四差值,对所述第四差值与所述时长伸缩区间的长度进行求余数处理;When the duration stretching type is the time repetition type, determine the fourth difference between the target timestamp and the starting timestamp, and perform a remainder operation on the fourth difference and the length of the duration stretching interval.
将求余数处理结果与所述起始时间戳进行求和处理,得到对应的原始时间戳。The remainder result is summed with the starting timestamp to obtain the corresponding original timestamp.
在上述方案中,所述特效帧确定模块,还用于:In the above scheme, the special effects frame determination module is further used for:
当所述时长伸缩类型为所述时间倒序重复类型时,确定所述目标时间戳与所述起始时间戳之间的第五差值,对所述第五差值与所述时长伸缩区间的长度进行求余数处理;When the duration stretching type is the time reverse repeating type, determine the fifth difference between the target timestamp and the starting timestamp, and perform a remainder operation on the fifth difference and the length of the duration stretching interval.
针对对应求余数处理结果的比值结果进行取整处理,得到取整结果;The ratio result of the corresponding remainder processing is rounded to obtain the rounded result;
当所述取整结果为偶数时,将求余数处理结果与所述起始时间戳进行求和处理,得到对应的原始时间戳;When the rounding result is even, the remainder result is summed with the starting timestamp to obtain the corresponding original timestamp;
当所述取整结果为奇数时,确定所述时长伸缩区间的长度与所述求余数处理结果之间的第六差值,对所述第六差值与所述起始时间戳进行求和处理,得到对应的原始时间戳。When the rounding result is odd, the sixth difference between the length of the duration expansion interval and the result of the remainder processing is determined, and the sixth difference is summed with the starting timestamp to obtain the corresponding original timestamp.
本发明实施例提供一种电子设备,包括:This invention provides an electronic device, comprising:
存储器,用于存储可执行指令;Memory, used to store executable instructions;
处理器,用于执行所述存储器中存储的可执行指令时,实现本发明实施例提供的视频特效的处理方法。The processor, when executing executable instructions stored in the memory, implements the video effects processing method provided in the embodiments of the present invention.
本发明实施例提供一种计算机可读存储介质,存储有可执行指令,用于被处理器执行时,实现本发明实施例提供的视频特效的处理方法。This invention provides a computer-readable storage medium storing executable instructions that, when executed by a processor, implement the video effects processing method provided in this invention.
本发明实施例具有以下有益效果:The embodiments of the present invention have the following beneficial effects:
通过视频特效文件中封装时长伸缩逻辑,使得一个视频特效文件自由伸缩为不同应用场景所需求的播放时长,具有普遍的适用性,再次基础上进行渲染形成视频特效播放过程,节约了制作大量不同播放时长的视频特效文件所带来的计算资源和时间资源的巨大消耗。By encapsulating duration scaling logic in video effects files, a single video effects file can be freely scaled to the playback duration required by different application scenarios, making it universally applicable. Rendering is then performed on this basis to form the video effects playback process, saving the huge consumption of computing and time resources that would otherwise be required to create a large number of video effects files with different playback durations.
附图说明Attached Figure Description
图1是本发明实施例提供的视频特效的处理系统的一个可选的结构示意图;Figure 1 is a schematic diagram of an optional structure of the video effects processing system provided in an embodiment of the present invention;
图2是本发明实施例提供的视频特效的处理装置的一个可选的结构示意图;Figure 2 is a schematic diagram of an optional structure of the video effects processing device provided in an embodiment of the present invention;
图3A-3E是本发明实施例提供的视频特效的处理方法的一个可选的流程示意图;Figures 3A-3E are schematic diagrams of an optional process for processing video special effects provided in an embodiment of the present invention;
图4是本发明实施例提供的视频特效的处理方法的应用效果示意图;Figure 4 is a schematic diagram illustrating the application effect of the video effects processing method provided in the embodiment of the present invention;
图5是本发明实施例提供的视频特效的处理系统的流程图;Figure 5 is a flowchart of the video effects processing system provided in an embodiment of the present invention;
图6A-6C是本发明实施例提供的视频特效的处理处理方法的标注示意图;Figures 6A-6C are schematic diagrams illustrating the video effects processing method provided in the embodiments of the present invention;
图7是本发明实施例提供的视频特效的处理方法的时间轴示意图。Figure 7 is a timeline diagram of the video effects processing method provided in the embodiments of the present invention.
具体实施方式Detailed Implementation
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,所描述的实施例不应视为对本发明的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on the present invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
在以下的描述中,所涉及的术语“第一\第二\第三”仅仅是是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本发明实施例能够以除了在这里图示或描述的以外的顺序实施。In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本发明实施例的目的,不是旨在限制本发明。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.
对本发明实施例进行进一步详细说明之前,对本发明实施例中涉及的名词和术语进行说明,本发明实施例中涉及的名词和术语适用于如下的解释。Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be interpreted as follows.
1)AE:是Adobe After Effect的简称,是Adobe公司推出的一款图形视频处理软件,适用于从事设计和视频特技的机构,包括电视台、动画制作公司、个人后期制作工作室以及多媒体工作室,属于层类型后期软件。1) AE: Short for Adobe After Effects, it is a graphics and video processing software launched by Adobe. It is suitable for organizations engaged in design and video special effects, including TV stations, animation production companies, personal post-production studios and multimedia studios. It belongs to the layer-type post-production software.
2)视频特效文件,承载特效内容的二进制文件,例如PAG文件,是一种以二进制文件格式进行储存的贴纸动画。2) Video effects files, which are binary files that carry effects content, such as PAG files, are sticker animations stored in binary file format.
3)原始时间轴:视频特效文件整体所对应的时间轴,或者视频特效子文件所对应的特效部分进行播放时所对应的时间轴。3) Original timeline: The timeline corresponding to the entire video effects file, or the timeline corresponding to the effects portion of a video effects sub-file when played.
4)目标时间轴:视频特效文件中完整的特效对象进行伸缩处理后进行播放时所对应的时间轴,或者视频特效子文件所对应的部分特效对象进行伸缩处理后进行播放时所对应的时间轴。4) Target timeline: The timeline corresponding to the playback of a complete special effects object in a video effects file after scaling, or the timeline corresponding to the playback of a partial special effects object in a video effects sub-file after scaling.
相关技术中移动互联网客户端基于AE(Adobe After Effect)实现动画的方案有Airbnb开源的Lottie方案和PAG方案,它们都打通了AE动画设计到移动端呈现的工作流,设计师在AE上设计的动画通过导出插件导出动画文件,进而在移动端通过SDK进行加载渲染,从而大大降低了开发的成本,但是,两个方案通过AE设计出的动画文件中动画的时长都是固定的,申请人在实施本发明实施例的过程中发现,在部分用户界面动画及视频编辑的场景下,需要外部能够控制动画文件的时长,如对部分区间动画文件固定,对部分区间动画进行线性拉伸或循环处理,如贴纸动画长度为2秒,而是实际需要动画长度为4秒,外部需要将贴纸动画拉伸为4秒,或者对贴纸动画进行重复绘制,即将贴纸动画播放2遍。Among related technologies, mobile internet clients using Adobe After Effects (AE) to implement animations include Airbnb's open-source Lottie solution and the PAG solution. Both solutions streamline the workflow from AE animation design to mobile presentation. Designers create animations in AE and export them as animation files via an export plugin, which are then loaded and rendered on the mobile device using an SDK, significantly reducing development costs. However, the animation duration in the AE-designed animation files is fixed in both solutions. During the implementation of this invention, the applicant discovered that in some user interface animations and video editing scenarios, it is necessary to externally control the duration of the animation files. For example, some intervals of the animation file can be fixed, while others can be linearly stretched or looped. For instance, if the sticker animation is 2 seconds long but the actual required animation length is 4 seconds, the external system needs to stretch the sticker animation to 4 seconds or redraw the sticker animation, i.e., play the sticker animation twice.
针对相关技术的固定的视频特效文件与任意目标播放时长需求之间存在矛盾的技术问题,本发明实施例提供一种视频特效的处理方法,可以支持固定动画文件的时间伸缩,并且外部应用平台只需要设置动画文件的目标播放时间,动画文件就可以按照用户配置的伸缩逻辑进行时间伸缩。视频特效文件的播放时长伸缩处理是由视频特效文件中的时长伸缩逻辑控制,对视频特效文件解码后,根据时长伸缩逻辑处理并渲染即可实现目标播放时长的视频特效播放过程;能够直接应用于各种应用和各种平台,且不受平台的操作系统的限制,实现流程极其简洁。To address the technical problem of the contradiction between fixed video effects files and arbitrary target playback duration requirements in related technologies, this invention provides a video effects processing method that supports time scaling of fixed animation files. External application platforms only need to set the target playback time of the animation file, and the animation file can then scale according to the user-configured scaling logic. The playback duration scaling of the video effects file is controlled by the duration scaling logic within the video effects file. After decoding the video effects file, processing and rendering according to the duration scaling logic achieves the desired video effects playback duration. This method can be directly applied to various applications and platforms, is not limited by the platform's operating system, and has an extremely simple implementation process.
下面说明本发明实施例提供的电子设备的示例性应用,本发明实施例提供的电子设备可以实施为笔记本电脑,平板电脑,台式计算机,机顶盒,移动设备(例如,移动电话,便携式音乐播放器,个人数字助理,专用消息设备,便携式游戏设备)等各种类型的终端设备,也可以实施为服务器。下面,将结合图1说明电子设备实施为终端时的示例性应用。The following describes exemplary applications of the electronic device provided in the embodiments of the present invention. The electronic device provided in the embodiments of the present invention can be implemented as various types of terminal devices such as laptops, tablets, desktop computers, set-top boxes, and mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), or as a server. The following will describe exemplary applications when the electronic device is implemented as a terminal, with reference to FIG1.
参见图1,图1是本发明实施例提供的视频特效的处理系统的一个可选的结构示意图,终端400通过网络300连接服务器200,网络300可以是广域网或者局域网,又或者是二者的组合。Referring to Figure 1, which is an optional structural diagram of the video effects processing system provided in an embodiment of the present invention, the terminal 400 is connected to the server 200 through the network 300, which can be a wide area network or a local area network, or a combination of both.
服务器200可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云计算服务的云服务器。终端可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表等,但并不局限于此。终端以及服务器可以通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。Server 200 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. Terminals can be smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, etc., but are not limited to these. Terminals and servers can be connected directly or indirectly via wired or wireless communication, and this application does not impose any restrictions on this connection.
云计算(cloud computing)是一种计算模式,它将计算任务分布在大量计算机构成的资源池上,使各种应用系统能够根据需要获取计算力、存储空间和信息服务。提供资源的网络被称为“云”,“云”中的资源在使用者看来是可以无限扩展的,并且可以随时获取,按需使用,随时扩展,按使用付费。Cloud computing is a computing model that distributes computing tasks across a resource pool consisting of a large number of computers, enabling various application systems to access computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." From the user's perspective, the resources in the "cloud" are infinitely scalable, readily available, on-demand, expandable, and pay-as-you-go.
下面结合不同的应用场景说明本发明实施例提供的视频特效处理方法的应用。The following describes the application of the video effects processing method provided in the embodiments of the present invention in different application scenarios.
在一个应用场景中,设计者利用终端500或者通过调用服务器的云服务设计视频特效文件,发送视频特效文件到客户端的服务器200(即后台服务器),由服务器200存储接收到的视频特效文件,或由服务器200将视频特效文件存储到数据库600或文件系统;用户使用终端400中运行的客户端,客户端可以是游戏应用、社交网络应用、短视频应用、网上购物应用等的各种类型的应用,用户使用的过程中,触发服务器200的下发视频的业务逻辑,例如,服务器200定期下发业务使用报告,例如,游戏中的每周战报视频以及每月消费视频报告的业务逻辑,业务使用报告的具体内容与客户端的业务有关,并触发服务器200下发增强视频表现力的视频特效文件,视频特效文件可以是客户端预先存储的。In one application scenario, the designer uses terminal 500 or calls the server's cloud service to design video effects files, and sends the video effects files to the client's server 200 (i.e., the backend server). Server 200 stores the received video effects files, or stores them in database 600 or a file system. The user uses a client running on terminal 400. The client can be various types of applications, such as games, social networking, short video, or online shopping. During the user's use, the business logic of server 200 to send videos is triggered. For example, server 200 periodically sends business usage reports, such as weekly battle reports and monthly consumption video reports in games. The specific content of the business usage reports is related to the client's business, and triggers server 200 to send video effects files that enhance the video's expressiveness. These video effects files can be pre-stored by the client.
在一些应用场景中,终端400中运行的客户端基于视频特效文件中的时长伸缩逻辑,以服务器200下发的视频的播放时长为目标播放时长,在渲染视频的同时,还渲染视频特效文件中所承载的视频特效,以形成符合目标播放时长的视频特效播放过程,从而实现视频特效与视频同步显示的效果,具体过程如下:终端400响应接收到从服务器200返回的原生视频(每周战报视频)以及视频特效文件,获取原生视频的原生视频时长(每周战报视频的时长),将原生视频时长作为目标播放时长,对视频特效文件进行解码以执行相应的时长伸缩处理,使得经过时长伸缩处理的特效适配于原生视频的播放时长,最后将该特效进行渲染并与原生视频进行同时显示,以显示出带有特效的每周战报视频。In some application scenarios, the client running on terminal 400 uses the duration scaling logic in the video effects file as the target playback duration, taking the playback duration of the video sent by server 200 as the target playback duration. While rendering the video, it also renders the video effects contained in the video effects file to form a video effects playback process that conforms to the target playback duration, thereby achieving the effect of synchronous display of video effects and video. The specific process is as follows: Terminal 400 receives the original video (weekly battle report video) and video effects file returned from server 200, obtains the original video duration (duration of weekly battle report video), uses the original video duration as the target playback duration, decodes the video effects file to perform the corresponding duration scaling processing, so that the duration-scaling processed effects are adapted to the playback duration of the original video, and finally renders the effects and displays them simultaneously with the original video to display the weekly battle report video with effects.
在一些应用场景中,服务器下发多个视频,视频特效作为多个视频之间的转场动画,以将多个视频进行串联播放;转场动画的时长可以是服务器下发视频时指定的,例如可以是根据用户账号等级(等级越高,则转场时间越短);当终端400中运行的客户端播放完一个视频时,渲染视频特效文件中所承载的视频特效,以形成符合目标播放时长的视频特效播放过程,视频特效播放过程实际上是实现了转场动画的作用,以使多个视频之间的衔接更加自然,具体过程如下:终端400从服务器200中获取对应某一特效的视频特效文件进行解码,且基于指定的目标播放时长(转场动画的时长)执行相应的时长伸缩处理,并将经过时长伸缩处理之后的特效在若干个原生视频之间进行渲染。In some application scenarios, the server distributes multiple videos, and video effects serve as transition animations between these videos to allow for sequential playback. The duration of the transition animation can be specified when the server distributes the videos, for example, based on the user's account level (the higher the level, the shorter the transition time). When the client running on terminal 400 finishes playing a video, it renders the video effects contained in the video effects file to form a video effects playback process that conforms to the target playback duration. The video effects playback process actually realizes the function of transition animations, making the connection between multiple videos more natural. The specific process is as follows: Terminal 400 obtains the video effects file corresponding to a certain effect from server 200, decodes it, and performs corresponding duration scaling processing based on the specified target playback duration (the duration of the transition animation), and then renders the duration-scaled effects between several original videos.
服务器针对不同用户下发的视频,或者针对同一用户下发的不同视频的播放时长是变化的,利用同一个视频特效文件可以同时复用于众多视频的播放过程中,减少服务器重复生成视频的计算资源消耗,减少了用户侧的等待延迟。The playback duration of videos sent to different users or to the same user varies. The same video effects file can be reused in the playback of many videos at the same time, reducing the computational resource consumption of the server in repeatedly generating videos and reducing the waiting latency on the user side.
在另一个应用场景中,终端400中的运行的客户端是社交网络客户端,或者视频分享客户端,具有视频采集、编辑和分享的功能。客户端采集了视频,利用从服务器下载的特效文件进行合成,例如图像拼接(二者同时显示)或时间轴拼接(即以视频特效文件用于衔接采集的多个视频),对于前者,以视频的播放时长为目标播放时长,具体过程如下:终端400响应接收到用户拍摄的原生视频,获取原生视频的原生视频时长,终端400从服务器200中获取对应某一特效的视频特效文件进行解码以将原生视频时长作为目标播放时长,针对视频特效执行相应的时长伸缩处理,使得该视频特效适配于原生视频,将该特效与原生视频进行图像拼接处理后,进行实时渲染以预览最终编辑效果,进行预览后还可以对图像拼接处理结果进行编码处理,形成一个新视频文件分享给其他用户,对于后者,以用户设定的时长或客户端默认的转场动画的时长为目标播放时长,在播放完一个视频后,渲染视频特效文件中所承载的视频特效,以形成符合目标播放时长的视频特效播放过程,视频特效播放过程实际上是实现了转场动画的作用,以使多个视频之间的衔接更加自然,具体过程如下:终端400从服务器200中获取对应某一特效的视频特效文件进行解码,且基于指定的目标播放时长(转场动画的时长)执行相应的时长伸缩处理,并将经过时长伸缩处理之后的特效在若干个原生视频之间进行渲染,并将经过时长伸缩处理之后的特效与若干个原生视频进行时间轴拼接处理,再进行编码处理,得到一个新的视频文件,以向其他用户进行分享。In another application scenario, the client running on terminal 400 is a social networking client or a video sharing client, with video capture, editing, and sharing functions. The client captures video and uses effects files downloaded from the server for compositing, such as image stitching (both displayed simultaneously) or timeline stitching (i.e., using video effects files to connect multiple captured videos). For the former, the target playback duration is the video's length. The specific process is as follows: Terminal 400 receives the user-captured native video, obtains the native video's length, retrieves the corresponding video effects file from server 200, decodes it to use the native video's length as the target playback duration, performs corresponding duration scaling for the video effects to adapt them to the native video, performs image stitching between the effects and the native video, renders in real-time to preview the final editing effect, and after previewing, can encode the image stitching result to create a new video file to share with other users. For the latter, the target playback duration is set by the user or the client's default transition animation duration. After playing a video, the video effects contained in the video effects file are rendered to form a video effects playback process that conforms to the target playback duration. The video effects playback process actually realizes the function of transition animation to make the connection between multiple videos more natural. The specific process is as follows: Terminal 400 obtains the video effects file corresponding to a certain effect from server 200, decodes it, and performs corresponding duration scaling processing based on the specified target playback duration (transition animation duration). The duration-scaling processed effects are then rendered between several native videos. The duration-scaling processed effects are then time-stitched together with several native videos, and then encoded to obtain a new video file for sharing with other users.
在上述视频编辑场景中,用户可以继续调整目标播放时长并对原声视频以及视频特效进行重新渲染,直至确定得到的最终预览结果符合要求后,客户端(视频编辑客户端)结合原生视频和视频特效文件编码形成完整的视频文件,并可以进行分享。In the video editing scenario described above, users can continue to adjust the target playback duration and re-render the original audio video and video effects until the final preview result meets the requirements. Then, the client (video editing client) combines the original video and video effects files to encode a complete video file, which can then be shared.
需要指出的,上文所述的客户端中用以实现特效处理的功能可以是客户端中原生的,也可以是客户端通过植入相应的插件例如SDK来实现的,对于客户端中实现视频特效处理的具体形式不做限定。It should be noted that the functions used to implement special effects processing in the client mentioned above can be native to the client or implemented by the client through the implantation of corresponding plugins such as SDKs. There is no limitation on the specific form of video special effects processing implemented in the client.
此外,作为客户端渲染的替代方案,当渲染耗费的计算资源(处理器和运存)超出终端的承受能力(例如)时,客户端可以请求服务器进行渲染,并根据服务器返回的渲染数据呈现视频特效播放过程。In addition, as an alternative to client-side rendering, when the computing resources (processor and RAM) consumed by rendering exceed the terminal's capacity (for example), the client can request the server to render and present the video effects playback process based on the rendering data returned by the server.
下面继续以本发明实施例提供的电子设备为上文所述的终端为例说明,参见图2,图2是本发明实施例提供的终端400一个可选的结构示意图,图2所示的终端400包括:至少一个处理器410、存储器450、至少一个网络接口420和用户接口430。终端400中的各个组件通过总线系统440耦合在一起。可理解,总线系统440用于实现这些组件之间的连接通信。总线系统440除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图2中将各种总线都标为总线系统440。The following description continues using the terminal described above as an example of the electronic device provided in this embodiment of the invention. Referring to Figure 2, Figure 2 is an optional structural schematic diagram of the terminal 400 provided in this embodiment of the invention. The terminal 400 shown in Figure 2 includes: at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the terminal 400 are coupled together through a bus system 440. It can be understood that the bus system 440 is used to realize the connection and communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled as bus system 440 in Figure 2.
处理器410可以是一种集成电路芯片,具有信号的处理能力,例如通用处理器、数字信号处理器(DSP,Digital Signal Processor),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等,其中,通用处理器可以是微处理器或者任何常规的处理器等。The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
用户接口430包括使得能够呈现媒体内容的一个或多个输出装置431,包括一个或多个扬声器和/或一个或多个视觉显示屏。用户接口430还包括一个或多个输入装置432,包括有助于用户输入的用户接口部件,比如键盘、鼠标、麦克风、触屏显示屏、摄像头、其他输入按钮和控件。User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and/or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
存储器450可以是可移除的,不可移除的或其组合。示例性的硬件设备包括固态存储器,硬盘驱动器,光盘驱动器等。存储器450可选地包括在物理位置上远离处理器410的一个或多个存储设备。The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
存储器450包括易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。非易失性存储器可以是只读存储器(ROM,Read Only Memory),易失性存储器可以是随机存取存储器(RAM,Random Access Memory)。本发明实施例描述的存储器450旨在包括任意适合类型的存储器。The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this embodiment is intended to include any suitable type of memory.
在一些实施例中,存储器450能够存储数据以支持各种操作,这些数据的示例包括程序、模块和数据结构或者其子集或超集,下面示例性说明。In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
操作系统451,包括用于处理各种基本系统服务和执行硬件相关任务的系统程序,例如框架层、核心库层、驱动层等,用于实现各种基础业务以及处理基于硬件的任务;Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
网络通信模块452,用于经由一个或多个(有线或无线)网络接口420到达其他计算设备,示例性的网络接口420包括:蓝牙、无线相容性认证(WiFi)、和通用串行总线(USB,Universal Serial Bus)等;The network communication module 452 is used to reach other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
呈现模块453,用于经由一个或多个与用户接口430相关联的输出装置431(例如,显示屏、扬声器等)使得能够呈现信息(例如,用于操作外围设备和显示内容和信息的用户接口);Presentation module 453 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with user interface 430;
输入处理模块454,用于对一个或多个来自一个或多个输入装置432之一的一个或多个用户输入或互动进行检测以及翻译所检测的输入或互动。The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
在一些实施例中,本发明实施例提供的视频特效的处理装置可以采用软件方式实现,图2示出了存储在存储器450中的视频特效的处理装置455,其可以是程序和插件等形式的软件,包括以下软件模块:文件获取模块4551、时长获取模块4552、特效帧确定模块4553和渲染模块4554,这些模块是逻辑上的,因此根据所实现的功能可以进行任意的组合或进一步拆分。In some embodiments, the video effects processing apparatus provided in this invention can be implemented in software. Figure 2 shows a video effects processing apparatus 455 stored in a memory 450, which can be software in the form of programs and plugins, including the following software modules: file acquisition module 4551, duration acquisition module 4552, effects frame determination module 4553, and rendering module 4554. These modules are logically related, and therefore can be arbitrarily combined or further split according to the functions implemented.
将说明本发明实施例提供的视频特效的处理方法在上文所述的终端的示例性应用和实施。需要指出,下文是以终端的角度进行说明,但是可以理解的,根据上文的具体应用场景的介绍,下文中视频特效的相关处理可以是由终端中运行的客户端来完成的,因此下文中对终端具体可以是终端中运行的客户端,关于客户端的示例上文已有说明,不再重复。The following will illustrate the exemplary application and implementation of the video effects processing method provided in the embodiments of the present invention on the terminal described above. It should be noted that the following description is from the perspective of the terminal. However, it is understood that, based on the specific application scenarios described above, the video effects processing described below can be performed by a client running on the terminal. Therefore, the terminal mentioned below can specifically refer to a client running on the terminal. Examples of clients have already been described above and will not be repeated.
参见图3A,图3A是本发明实施例提供的视频特效的处理方法的一个可选的流程示意图,将结合图3A示出的步骤进行说明。Referring to Figure 3A, which is an optional flowchart of the video effects processing method provided in the embodiment of the present invention, the steps shown in Figure 3A will be described in conjunction with the steps shown in Figure 3A.
在步骤101中,终端获取视频特效文件,并从视频特效文件中提取时长伸缩逻辑。In step 101, the terminal obtains the video effects file and extracts the duration scaling logic from the video effects file.
作为示例,获取视频特效文件的方式主要是通过插件来导出视频特效文件,视频特效文件可以是PAG格式的贴纸动画文件,为了读取工程文件中的动画特性数据,可以根据具体需求选择矢量导出方式、位图序列帧导出方式或者视频序列帧导出方式中的一种导出PAG二进制文件,客户端或者服务器端对导出的PAG二进制文件进行解码,这里以终端为例进行说明,即终端对导出的PAG二进制文件进行解码,进而通过渲染模块进行渲染后呈现,终端进行解码以及呈现的过程可以通过调用渲染SDK实现,解码的作用是将PAG二进制文件反序列化为客户端可以操作的数据对象,解码出的数据结构可以参照PAG数据结构。As an example, the main way to obtain video effects files is through plugins to export them. The video effects files can be PAG format sticker animation files. In order to read the animation characteristic data in the project file, you can choose one of the following methods to export PAG binary files: vector export, bitmap sequence frame export, or video sequence frame export, depending on the specific needs. The client or server decodes the exported PAG binary files. Here, we take the terminal as an example. That is, the terminal decodes the exported PAG binary files and then renders them through the rendering module. The decoding and rendering process on the terminal can be achieved by calling the rendering SDK. The purpose of decoding is to deserialize the PAG binary files into data objects that the client can operate on. The decoded data structure can refer to the PAG data structure.
在一些实施例中,步骤101中获取视频特效文件,可以通过以下技术方案实现:执行以下处理之一以得到对应特效对象的编码导出文件:对特效对象的多个图层结构进行编码处理,得到对应特效对象的编码导出文件;对特效对象的多个特效帧进行编码处理,得到对应特效对象的编码导出文件;对特效对象的多个特效帧进行视频格式压缩处理,并对得到的视频格式压缩处理结果进行编码处理,得到对应特效对象的编码导出文件;将时长伸缩类型以及时长伸缩区间封装在编码导出文件中,得到对应特效对象的视频特效文件。In some embodiments, obtaining the video effects file in step 101 can be achieved through the following technical solutions: performing one of the following processes to obtain the encoded export file of the corresponding effects object: encoding multiple layer structures of the effects object to obtain the encoded export file of the corresponding effects object; encoding multiple effects frames of the effects object to obtain the encoded export file of the corresponding effects object; performing video format compression processing on multiple effects frames of the effects object, and encoding the obtained video format compression processing result to obtain the encoded export file of the corresponding effects object; encapsulating the duration extension type and duration extension interval in the encoded export file to obtain the video effects file of the corresponding effects object.
作为示例,首先通过以下三种方式之一得到特效对象的编码导出文件:矢量导出、位图序列帧导出和视频序列帧导出,矢量导出方式可以支持大部分的AE特性,导出文件极小,通常应用于用户界面上或内容可编辑的场景,矢量导出是对AE动画图层结构的还原,矢量导出方式是通过AE提供的SDK,对AE动画图层结构进行了还原,并在导出的过程中采用了动态比特位存储技术,大幅降低了文件大小;位图序列帧导出和视频序列帧导出方式能够支持所有的AE特性,但是导出文件较大,通常应用在视频合成中或对动画特效有特别要求的场景,位图序列帧导出的是位图数据,位图序列帧导出是将设计师设计的复杂动效中的每一帧转换为图片格式进行存储,更具体的,针对AE大部分动画具有连贯性、帧间差异小的特点,选取某一帧作为关键帧,后面的每帧数据与之进行对比,获取到差异位图的位置信息、宽高数据,并截取差异位图信息进行存储,从而降低文件大小。同时位图序列帧支持导出多个版本(缩放系数、帧率、尺寸不同),来满足不同场景下的需求,这种处理方式的优点是可以支持所有AE特性,缺点是导出的文件会偏大,且无法实现对AE动画中图片替换、文本编辑操作,适用于处理遮罩、阴影等复杂特效,主要应用于网页端;视频序列帧导出方式采用的是视频领域的H.264压缩格式,相对于位图序列帧,解码速度会更快,侧重应用于移动端,视频序列帧导出方式将截取的图片进行视频格式压缩,视频序列帧导出方式是针对位图序列帧导出图片格式体积大和解码效率低的问题所进行一种优化,从性能方面看,矢量导出方式可以做到文件大小和性能都到非常优化的极限状态,但是需要设计师花费额外的工作量不断进行调优,针对于序列帧导出方式产生的PAG视频特效文件,渲染性能上增加了额外的图片解码耗时,但整体耗时只跟序列帧图片的尺寸有关系。As an example, the encoded export file of the special effects object is first obtained through one of the following three methods: vector export, bitmap sequence frame export, and video sequence frame export. Vector export supports most After Effects features and produces a very small export file. It is typically used in user interfaces or scenes where content is editable. Vector export restores the layer structure of After Effects animation. The vector export method restores the layer structure of After Effects animation through the SDK provided by After Effects and uses dynamic bit storage technology during the export process, which greatly reduces the file size. Bitmap sequence frame export and video sequence frame export can support all After Effects features, but the export file is larger. They are typically used in video compositing or scenes with special requirements for animation effects. Bitmap sequence frame export produces bitmap data. Bitmap sequence frame export converts each frame of the complex animation effect designed by the designer into an image format for storage. More specifically, considering that most After Effects animations are continuous and have small differences between frames, a certain frame is selected as a keyframe. The data of each subsequent frame is compared with it to obtain the position information, width and height data of the difference bitmap, and the difference bitmap information is extracted and stored, thereby reducing the file size. Meanwhile, bitmap sequence frames support exporting multiple versions (with different scaling factors, frame rates, and sizes) to meet the needs of different scenarios. The advantage of this processing method is that it can support all After Effects features, but the disadvantage is that the exported file will be larger and it cannot perform image replacement or text editing operations in After Effects animations. It is suitable for handling complex effects such as masks and shadows and is mainly used in web applications. The video sequence frame export method uses the H.264 compression format in the video field. Compared with bitmap sequence frames, the decoding speed is faster and it is mainly used in mobile applications. The video sequence frame export method compresses the captured images into video format. The video sequence frame export method is an optimization to address the problems of large file size and low decoding efficiency of bitmap sequence frame exported images. From a performance perspective, the vector export method can achieve a very optimized limit in terms of file size and performance, but designers need to spend extra effort to continuously optimize it. For PAG video effect files generated by the sequence frame export method, the rendering performance is increased by additional image decoding time, but the overall time is only related to the size of the sequence frame image.
作为示例,将用户输入的时长伸缩类型以及时长伸缩区间封装在编码导出文件中,实际上是修改PAG贴纸动画文件的数据结构,可以在文件根路径的层级增加时长伸缩类型和时长伸缩区间,最终得到对应特效对象的视频特效文件,在具体实施的过程中,可以不限定封装步骤与进行编码步骤的执行顺序,即可以先在根路径的层级增加时长伸缩类型和时长伸缩区间,再进行上述三种方式之一的编码导出处理,也可以先进行编码导出处理,再在根路径的层级增加时长伸缩类型和时长伸缩区间。As an example, encapsulating the user-input duration scaling type and duration scaling range in the encoded export file actually modifies the data structure of the PAG sticker animation file. The duration scaling type and duration scaling range can be added at the root path level of the file, ultimately resulting in the video effect file of the corresponding effect object. In the specific implementation process, the execution order of the encapsulation steps and the encoding steps is not limited. That is, the duration scaling type and duration scaling range can be added at the root path level first, and then the encoding export process of the above three methods can be performed, or the encoding export process can be performed first, and then the duration scaling type and duration scaling range can be added at the root path level.
通过上述实施例,将设计师通过AE设计动画、再提供动画数据特性到终端开发工程师以实现动画功能的开发流程,缩减为设计师通过AE设计动画的导出PAG贴纸动画文件,终端对PAG贴纸动画文件直接加载显示,即大幅减少了终端开发的工作量,也兼容了各个平台的开发需求。Through the above embodiments, the development process of designers designing animations through After Effects and then providing animation data characteristics to terminal development engineers to realize the animation function is reduced to designers designing animations through After Effects and exporting PAG sticker animation files, and the terminal directly loading and displaying the PAG sticker animation files. This greatly reduces the workload of terminal development and is also compatible with the development needs of various platforms.
在一些实施例中,所述时长伸缩逻辑包括时长伸缩区间以及对应的时长伸缩类型;步骤101中从视频特效文件中提取时长伸缩逻辑,可以通过以下技术方案实现:对视频特效文件进行解码处理,得到对应视频特效文件的至少一个时长伸缩区间以及对应的时长伸缩类型;其中,时长伸缩类型包括以下类型中的任意一种:时间线性伸缩类型;时间重复类型;时间倒序重复类型。In some embodiments, the duration scaling logic includes duration scaling intervals and corresponding duration scaling types; the extraction of duration scaling logic from the video effects file in step 101 can be achieved through the following technical solution: decoding the video effects file to obtain at least one duration scaling interval and corresponding duration scaling type of the corresponding video effects file; wherein, the duration scaling type includes any one of the following types: time linear scaling type; time repeating type; time reverse repeating type.
作为示例,视频特效文件可以为上述PAG贴纸动画文件,是一种针对特效对象的描述文件,在进行解码后可以提取到基于用户配置的时长伸缩区间与对应的时长伸缩类型,时长伸缩区间的数目通常为1个,但是在较为复杂的应用场景下,时长伸缩区间的数目为多个,针对每个时长伸缩区间,分别对应有用户配置的时长伸缩类型,对于用户配置功能,可以通过终端为用户提供配置入口,接收用户输入的时长伸缩区间与时长伸缩类型,参见图6A,图6A是本发明实施例提供的视频特效的处理方法的标注示意图,即通过各个应用场景下的客户端提供的配置入口601和602来接收用户输入的时长伸缩区间与时长伸缩类型,在接收到时长伸缩逻辑之后,还可以发生页面跳转,以继续接收输入的对应各个时长伸缩区间的目标播放时长,或者在设置完时长伸长逻辑之后,将所接收的配置信息通过进程间通信发送到AE客户端,以结合AE客户端中获取的特效数据进行编码处理,获取最终的视频特效文件,从视频特效文件中提取伸缩逻辑之后,再提供目标播放时长的配置入口603,通过这种实施方式能够有利于任意应用场景的客户端灵活设置动画特效文件的伸缩逻辑,还可以通过AE客户端进行时长伸缩区间与时长伸缩类型的标注,参见图6B-6C,图6B-6C是本发明实施例提供的视频特效的处理方法的标注示意图,即直接通过AE客户端接收用户输入的时长伸缩区间与时长伸缩类型,以结合AE客户端中获取的特效数据进行编码处理,获取最终的视频特效文件,通过这种实施方式可以缓解各个应用场景的客户端的开发优化任务,各个客户端侧可以直接调用渲染SDK获取视频特效文件以执行后续的逻辑。As an example, the video effects file can be the aforementioned PAG sticker animation file, which is a description file for the effects object. After decoding, the duration extension interval and corresponding duration extension type based on user configuration can be extracted. The number of duration extension intervals is usually one, but in more complex application scenarios, there are multiple duration extension intervals. For each duration extension interval, there is a corresponding duration extension type configured by the user. For the user configuration function, a configuration entry can be provided to the user through the terminal to receive the duration extension interval and duration extension type input by the user. See Figure 6A. Figure 6A is a schematic diagram of the video effects processing method provided by the embodiment of the present invention. That is, the duration extension interval and duration extension type input by the user are received through the configuration entry 601 and 602 provided by the client in various application scenarios. After receiving the duration extension logic, a page jump can also occur to continue to receive the target playback duration corresponding to each duration extension interval, or after setting the duration extension logic. After processing, the received configuration information is sent to the AE client via inter-process communication. This information is then combined with the special effects data obtained from the AE client for encoding processing to obtain the final video effects file. After extracting the scaling logic from the video effects file, a configuration entry 603 for the target playback duration is provided. This implementation allows clients in any application scenario to flexibly set the scaling logic for animation effects files. The AE client can also annotate the duration scaling range and duration scaling type. See Figures 6B-6C, which are schematic diagrams illustrating the video effects processing method provided in this embodiment. Specifically, the duration scaling range and duration scaling type are directly received from the user through the AE client and combined with the special effects data obtained from the AE client for encoding processing to obtain the final video effects file. This implementation alleviates the development and optimization tasks for clients in various application scenarios, allowing each client to directly call the rendering SDK to obtain the video effects file and execute subsequent logic.
在步骤102中,终端获取需要所述视频特效文件所实现的目标播放时长,其中,目标播放时长区别于视频特效文件的原始播放时长。In step 102, the terminal obtains the target playback duration required by the video effects file, wherein the target playback duration is different from the original playback duration of the video effects file.
基于图3A,参见图3B,图3B是本发明实施例提供的视频特效的处理方法的一个可选的流程示意图,步骤102中获取需要所述视频特效文件所实现的目标播放时长可以通过步骤1021至步骤1022实现,将结合各步骤进行说明。Based on Figure 3A, and referring to Figure 3B, Figure 3B is an optional flowchart of the video effects processing method provided in the embodiment of the present invention. In step 102, obtaining the target playback duration to be achieved by the video effects file can be achieved through steps 1021 to 1022, which will be explained in conjunction with each step.
在步骤1021中,当时长伸缩区间的数目为多个时,将视频特效文件拆分为与数目一致的多个视频特效子文件,并分别获取针对每个视频特效子文件的目标播放时长间。In step 1021, when there are multiple time-scaling intervals, the video effects file is split into multiple video effects sub-files of the same number, and the target playback duration for each video effects sub-file is obtained.
作为示例,在实施过程中并不限定视频特效文件拆分的方式,只需要保证拆分后得到的每个视频特效子文件中均包含有且仅包含有一个时长伸缩区间,而针对于每个时长伸缩区间的目标播放时长可以是对视频特效文件的目标播放时长进行分配得到的,例如,视频特效文件的目标播放时长为10秒,视频特效文件中存在两个时长伸缩区间,分别是1秒-2秒的第一时长伸缩区间、以及3秒-4秒的第二时长伸缩区间这两个区间,那么针对于第一时长伸缩区间的第一目标播放时长仅需要保证结合对应第二时长伸缩区间的第二目标播放时长满足视频特效文件的目标播放时长,即若第一时长伸缩类型是重复类型,那么第一目标播放时长至少大于2秒(0秒-2秒),且第一目标播放时长和第二目标播放时长的总和为10秒,由于限制条件较少,即仅限定了对应各子文件的目标播放时长的和为视频特效文件的目标播放时长,以及各个子文件的目标播放时长满足对应时长伸缩区间,在不需要用户人为干预的情形下,避免了用户进行设置的麻烦,从而提供了多样化且随机的渲染效果。As an example, the method of splitting the video effects file is not limited during implementation. It only needs to ensure that each sub-file contains one and only one duration scaling interval. The target playback duration for each duration scaling interval can be obtained by allocating the target playback duration of the video effects file. For example, if the target playback duration of the video effects file is 10 seconds, and the file contains two duration scaling intervals: a first duration scaling interval of 1 second to 2 seconds and a second duration scaling interval of 3 seconds to 4 seconds, then the first target playback duration for the first duration scaling interval only needs to ensure... The second target playback duration, combined with the second duration scaling interval, satisfies the target playback duration of the video effects file. That is, if the first duration scaling type is a repeating type, then the first target playback duration is at least greater than 2 seconds (0 seconds - 2 seconds), and the sum of the first target playback duration and the second target playback duration is 10 seconds. Since there are few restrictions, namely, only the sum of the target playback durations of each corresponding sub-file is limited to be the target playback duration of the video effects file, and the target playback durations of each sub-file satisfy the corresponding duration scaling interval, the trouble of user settings is avoided without the need for user intervention, thus providing diverse and random rendering effects.
作为示例,每个视频特效子文件的目标播放时长间实际涉及到视频特效文件的目标播放时长的分配问题,在进行分配的过程中可以按照上述满足一定条件的约束下进行任意分配之外,还可以为用户提供分配方案配置功能,在图6C的用户配置入口中还可以提供相关入口以方便用户输入为每个时长伸缩区间所配置的目标播放时长,例如,由用户设定每个时长伸缩区间对应的视频特效子文件的目标播放时长,通过这种实施方式有利于用户以更细粒度的方式灵活控制各个子文件的渲染效果,进而控制整个文件的渲染效果。As an example, the target playback duration of each video effects sub-file actually involves the allocation of the target playback duration of the video effects file. In the allocation process, in addition to arbitrary allocation under the constraints of the above-mentioned conditions, the user can also be provided with an allocation scheme configuration function. In the user configuration entry in Figure 6C, relevant entries can also be provided to facilitate the user to input the target playback duration configured for each duration expansion interval. For example, the user can set the target playback duration of the video effects sub-file corresponding to each duration expansion interval. This implementation method is conducive to the user flexibly controlling the rendering effect of each sub-file in a more granular way, thereby controlling the rendering effect of the entire file.
作为示例,当时长伸缩区间的数目为多个时,且存在需要与特效进行适配呈现的原生视频时,可以直接将原生视频的时长作为视频特效文件对应的目标播放时长,针对不同伸缩区间对原生视频的时长进行分配,使得每个伸缩区间的目标播放时长满足上述限制条件,若分配的目标播放时长不满足对应特效子文件的时长伸缩逻辑中的时长伸缩类型,则选择其他的视频特效文件,在素材库中可以存在相同特效对象对应不同时长伸缩逻辑的视频特效文件。As an example, when there are multiple duration scaling intervals and there are native videos that need to be adapted to the special effects, the duration of the native video can be directly used as the target playback duration of the video special effects file. The duration of the native video is allocated for different scaling intervals so that the target playback duration of each scaling interval meets the above constraints. If the allocated target playback duration does not meet the duration scaling type in the duration scaling logic of the corresponding special effects sub-file, then other video special effects files are selected. In the material library, there can be video special effects files with the same special effects object corresponding to different duration scaling logics.
在步骤1022中,当时长伸缩区间的数目为一个时,获取针对视频特效文件的整体的目标播放时长。In step 1022, when the number of time-scaling intervals is one, the overall target playback duration for the video effects file is obtained.
作为示例,当时长伸缩区间的数目为一个时,并不存在需要对视频特效文件的目标播放时长进行分配的问题,直接将用户配置的目标播放时长作为视频特效文件的整体的目标播放时长,当用户输入的目标播放时长不符合时长伸缩区间的时长伸缩类型时,会返回用户提示错误信息,并再次开放入口供接收用户输入目标播放时长。As an example, when there is only one duration scaling interval, there is no need to allocate the target playback duration of the video effects file. The target playback duration configured by the user is directly used as the overall target playback duration of the video effects file. When the target playback duration entered by the user does not conform to the duration scaling type of the duration scaling interval, an error message will be returned to the user, and the entry will be reopened to receive the target playback duration entered by the user.
作为示例,当时长伸缩区间的数目为一个时,且存在需要与特效进行适配呈现的原生视频时,可以直接将原生视频的时长作为特效的目标播放时长,若原生视频的时长不满足对应特效文件的时长伸缩逻辑中的时长伸缩类型,则选择其他的视频特效文件,在素材库中可以存在相同特效对象对应不同时长伸缩逻辑的视频特效文件。As an example, when there is only one duration scaling interval and there is a native video that needs to be adapted to the special effect, the duration of the native video can be directly used as the target playback duration of the special effect. If the duration of the native video does not meet the duration scaling type in the duration scaling logic of the corresponding special effect file, then other video special effect files are selected. In the material library, there can be video special effect files with the same special effect object but different duration scaling logic.
由于不同的应用场景下对于目标播放时长的需求是多种多样的,同一个视频特效文件可以同时复用于众多视频的播放过程以及编辑过程中,可以减少服务器重复生成视频的计算资源消耗,减少了用户侧的等待延迟。Since the requirements for target playback duration vary in different application scenarios, the same video effects file can be reused in the playback and editing processes of many videos simultaneously. This can reduce the computational resource consumption of the server in repeatedly generating videos and reduce the waiting latency on the user side.
在一些实施例中,在执行步骤102获取需要所述视频特效文件所实现的目标播放时长之后,还可以执行以下技术方案:当时长伸缩区间的数目为多个时,针对每个视频特效子文件执行以下处理:从视频特效子文件的时间轴中获取对应特效对象的原始时间轴,即子文件的时间轴中出现特效对象的部分时间轴;保持原始时间轴的帧率不变,对原始时间轴进行时长伸缩处理,得到对应目标播放时长的目标时间轴;当时长伸缩区间的数目为一个时,针对视频特效文件执行以下处理:从视频特效文件中获取对应特效对象的原始时间轴;保持原始时间轴的帧率不变,对原始时间轴进行时长伸缩处理,得到对应目标播放时长的目标时间轴。In some embodiments, after obtaining the target playback duration required by the video effects file in step 102, the following technical solutions can also be implemented: When there are multiple duration scaling intervals, the following processing is performed for each video effects sub-file: the original timeline of the corresponding effect object is obtained from the timeline of the video effects sub-file, that is, the part of the timeline in which the effect object appears in the timeline of the sub-file; the frame rate of the original timeline is kept constant, and the original timeline is subjected to duration scaling processing to obtain the target timeline of the corresponding target playback duration; when there is only one duration scaling interval, the following processing is performed for the video effects file: the original timeline of the corresponding effect object is obtained from the video effects file; the frame rate of the original timeline is kept constant, and the original timeline is subjected to duration scaling processing to obtain the target timeline of the corresponding target playback duration.
作为示例,当时长伸缩区间的数目为多个时,从视频特效子文件的时间轴中出现特效对象的部分时间轴作为原始时间轴,保持原始时间轴的帧率不变,对原始时间轴进行时长伸缩处理,得到对应目标播放时长的目标时间轴。当时长伸缩区间的数目为一个时,直接将视频特效文件中对应特效对象的原始时间轴进行时长伸缩处理,得到对应目标播放时长的目标时间轴,上述这两种情形中所进行的伸缩处理时,均保持帧率不变,即保证最小时间单位不变,从而使得特效的时长伸缩处理的效果是播放进度发生改变,而不是播放帧率发生改变。As an example, when there are multiple time-scaling intervals, the portion of the timeline containing the effect object in the video effect sub-file's timeline is used as the original timeline. The frame rate of the original timeline remains constant, and the time-scaling process is applied to this original timeline to obtain the target timeline for the corresponding playback duration. When there is only one time-scaling interval, the original timeline of the corresponding effect object in the video effect file is directly scaled to obtain the target timeline for the corresponding playback duration. In both of these scenarios, the frame rate remains constant during the scaling process, ensuring that the minimum time unit remains unchanged. Therefore, the effect of the effect's time-scaling process is a change in playback progress, not a change in the playback frame rate.
在步骤103中,终端根据时长伸缩逻辑,确定视频特效文件中与目标时间轴对应的特效帧;其中,目标时间轴的长度与目标播放时长一致。In step 103, the terminal determines the special effects frame in the video effects file that corresponds to the target timeline according to the duration scaling logic; wherein the length of the target timeline is consistent with the target playback duration.
基于图3A,参见图3C,图3C是本发明实施例提供的视频特效的处理方法的一个可选的流程示意图,当时长伸缩区间的数目为多个时,步骤103中根据时长伸缩逻辑,确定视频特效文件中与目标时间轴对应的特效帧可以通过针对每个时长伸缩区间执行步骤1031A至步骤1032A实现,将结合各步骤进行说明。Based on Figure 3A, and referring to Figure 3C, Figure 3C is an optional flowchart of the video effects processing method provided in the embodiment of the present invention. When there are multiple time-scaling intervals, in step 103, according to the time-scaling logic, determining the effect frame corresponding to the target time axis in the video effect file can be achieved by executing steps 1031A to 1032A for each time-scaling interval. The following will be explained in conjunction with each step.
在步骤1031A中,从视频特效子文件中获取包括特效对象的多个特效帧、以及每个特效帧在原始时间轴上对应的时间戳,以作为每个特效帧的原始特效帧时间戳。In step 1031A, multiple effect frames including the effect object and the timestamp corresponding to each effect frame on the original timeline are obtained from the video effect sub-file, so as to serve as the original effect frame timestamp for each effect frame.
作为示例,在不需要进行时长伸缩处理时,所依赖的渲染逻辑即是视频特效子文件中各个特效帧在原始时间轴上对应的时间戳,例如,存在特效帧1至特效帧24,帧率是24帧每秒,即每1/24秒为一个时间戳,例如0,1/24,2/24,…,23/24,在这24个时间戳上分别呈现特效帧1至24,上述时间戳0,1/24,2/24,…,23/24分别为特效帧1至特效帧24的原始特效帧时间戳。As an example, when no duration scaling is required, the rendering logic relies on the timestamps of each effect frame in the video effect sub-file on the original timeline. For example, there are effect frames 1 to 24, with a frame rate of 24 frames per second, meaning each 1/24th of a second is a timestamp, such as 0, 1/24, 2/24, ..., 23/24. Effect frames 1 to 24 are presented at these 24 timestamps. The timestamps 0, 1/24, 2/24, ..., 23/24 are the original effect frame timestamps of effect frames 1 to 24.
在步骤1032A中,基于时长伸缩区间、以及每个特效帧对应的原始特效帧时间戳,在多个特效帧中确定与目标时间轴上每个时间戳对应的特效帧。In step 1032A, based on the duration scaling interval and the original effect frame timestamp corresponding to each effect frame, the effect frame corresponding to each timestamp on the target timeline is determined among multiple effect frames.
作为示例,进行时长伸缩处理的过程实际上是确定目标时间轴上每个时间戳对应的特效帧,假设原始时间轴是1秒,帧率是24帧每秒,即每1/24秒为一个时间戳,目标时间轴是2秒,帧率仍然是24帧每秒,则目标时间轴上每个时间戳为0,1/24,2/24,…,23/24,24/24,…,47/24,在进行伸缩处理时,可以通过时长伸缩区间以及对应的时长伸缩类型来确定目标时间轴上的时间戳与原始时间轴上时间戳的映射关系以及映射范围,从而基于映射关系以及映射范围确定目标时间轴上的每个时间戳所对应的原始时间轴上时间戳,所对应的原始时间轴上时间戳中有的时间戳是原始特效帧时间戳,有的时间戳没有呈现特效帧,例如时间戳为1/48,对于没有呈现特效帧的时间戳采取就近原则,来确定需要呈现的特效帧。As an example, the process of duration scaling is actually to determine the effect frame corresponding to each timestamp on the target timeline. Assuming the original timeline is 1 second and the frame rate is 24 frames per second, that is, each 1/24 second is a timestamp, and the target timeline is 2 seconds, the frame rate is still 24 frames per second, then each timestamp on the target timeline is 0, 1/24, 2/24, ..., 23/24, 24/24, ..., 47/24. When scaling, the mapping relationship and mapping range between the timestamps on the target timeline and the timestamps on the original timeline can be determined by the duration scaling interval and the corresponding duration scaling type. Based on the mapping relationship and mapping range, the timestamp on the original timeline corresponding to each timestamp on the target timeline is determined. Some timestamps on the original timeline are original effect frame timestamps, and some timestamps do not present effect frames, such as timestamp 1/48. For timestamps that do not present effect frames, the nearest principle is adopted to determine the effect frame that needs to be presented.
基于图3A,参见图3D,图3D是本发明实施例提供的视频特效的处理方法的一个可选的流程示意图,当时长伸缩区间的数目为一个时,步骤103中根据时长伸缩逻辑,确定视频特效文件中与目标时间轴对应的特效帧可以通过步骤1031B至步骤1032B实现,将结合各步骤进行说明。Based on Figure 3A, and referring to Figure 3D, Figure 3D is an optional flowchart of the video effects processing method provided in the embodiment of the present invention. When the number of time-scaling intervals is one, in step 103, the determination of the effect frame corresponding to the target time axis in the video effect file according to the time-scaling logic can be achieved through steps 1031B to 1032B, which will be explained in conjunction with each step.
在步骤1031B中,从视频特效文件中获取包括特效对象的多个特效帧、以及每个特效帧在原始时间轴上对应的时间戳,以作为每个特效帧的原始特效帧时间戳。In step 1031B, multiple effect frames including the effect object and the timestamp corresponding to each effect frame on the original timeline are obtained from the video effect file, so as to serve as the original effect frame timestamp for each effect frame.
作为示例,在不需要进行时长伸缩处理时,所依赖的渲染逻辑即是视频特效文件中各个特效帧在原始时间轴上对应的时间戳,例如,存在特效帧1至特效帧24,帧率是24帧每秒,即每1/24秒为一个时间戳,例如0,1/24,2/24,…,23/24,在这24个时间戳上分别呈现特效帧1至24,上述时间戳0,1/24,2/24,…,23/24分别为特效帧1至特效帧24的原始特效帧时间戳。As an example, when no duration scaling is required, the rendering logic relies on the timestamps corresponding to each effect frame in the video effects file on the original timeline. For example, there are effect frames 1 to 24, with a frame rate of 24 frames per second, meaning each 1/24th of a second is a timestamp, such as 0, 1/24, 2/24, ..., 23/24. Effect frames 1 to 24 are presented at these 24 timestamps. The timestamps 0, 1/24, 2/24, ..., 23/24 are the original effect frame timestamps for effect frames 1 to 24.
在步骤1032B中,基于时长伸缩区间、以及每个特效帧对应的原始特效帧时间戳,在多个特效帧中确定与目标时间轴上每个时间戳对应的特效帧。In step 1032B, based on the duration scaling interval and the original effect frame timestamp corresponding to each effect frame, the effect frame corresponding to each timestamp on the target timeline is determined among multiple effect frames.
作为示例,进行时长伸缩处理的过程实际上是确定目标时间轴上每个时间戳对应的特效帧,假设原始时间轴是1秒,帧率是24帧每秒,即每1/24秒为一个时间戳,目标时间轴是2秒,帧率仍然是24帧每秒,则目标时间轴上每个时间戳为0,1/24,2/24,…,23/24,24/24,…,47/24,在进行伸缩处理时,可以通过时长伸缩区间以及对应的时长伸缩类型来确定目标时间轴上的时间戳与原始时间轴上时间戳的映射关系以及映射范围,从而基于映射关系以及映射范围确定目标时间轴上的每个时间戳所对应的原始时间轴上时间戳,所对应的原始时间轴上时间戳中有的时间戳是原始特效帧时间戳,有的时间戳没有呈现特效帧,例如时间戳为1/48,对于没有呈现特效帧的时间戳采取就近原则,来确定需要呈现的特效帧。As an example, the process of duration scaling is actually to determine the effect frame corresponding to each timestamp on the target timeline. Assuming the original timeline is 1 second and the frame rate is 24 frames per second, that is, each 1/24 second is a timestamp, and the target timeline is 2 seconds, the frame rate is still 24 frames per second, then each timestamp on the target timeline is 0, 1/24, 2/24, ..., 23/24, 24/24, ..., 47/24. When scaling, the mapping relationship and mapping range between the timestamps on the target timeline and the timestamps on the original timeline can be determined by the duration scaling interval and the corresponding duration scaling type. Based on the mapping relationship and mapping range, the timestamp on the original timeline corresponding to each timestamp on the target timeline is determined. Some timestamps on the original timeline are original effect frame timestamps, and some timestamps do not present effect frames, such as timestamp 1/48. For timestamps that do not present effect frames, the nearest principle is adopted to determine the effect frame that needs to be presented.
在一些实施例中,步骤1032A或者1032B中基于时长伸缩区间、以及每个特效帧对应的原始特效帧时间戳,在多个特效帧中确定与目标时间轴上每个时间戳对应的特效帧,可以通过以下技术方案实现:依次将目标时间轴上每个时间戳作为目标时间戳,以执行以下处理:基于时长伸缩区间,确定目标时间戳在原始时间轴上对应的时间戳;当目标时间戳在原始时间轴上对应的时间戳与任一原始特效帧时间戳重叠时,将重叠的原始特效帧时间戳对应的特效帧确定为目标时间戳对应的特效帧;当目标时间戳在原始时间轴上对应的时间戳未与任一原始特效帧时间戳重叠时,确定与目标时间戳在原始时间轴上对应的时间戳距离最小的原始时间戳,并将确定原始特效帧时间戳对应的特效帧确定为目标时间戳对应的特效帧。In some embodiments, the step 1032A or 1032B, which determines the effect frame corresponding to each time stamp on the target timeline among multiple effect frames based on the duration scaling interval and the original effect frame timestamp corresponding to each effect frame, can be implemented through the following technical solution: Each time stamp on the target timeline is sequentially used as the target time stamp to perform the following processing: Based on the duration scaling interval, the time stamp corresponding to the target time stamp on the original timeline is determined; when the time stamp corresponding to the target time stamp on the original timeline overlaps with any original effect frame timestamp, the effect frame corresponding to the overlapping original effect frame timestamp is determined as the effect frame corresponding to the target time stamp; when the time stamp corresponding to the target time stamp on the original timeline does not overlap with any original effect frame timestamp, the original time stamp with the smallest distance from the time stamp corresponding to the target time stamp on the original timeline is determined, and the effect frame corresponding to the determined original effect frame timestamp is determined as the effect frame corresponding to the target time stamp.
作为示例,假设原始时间轴是1秒,帧率是24帧每秒,即每1/24秒为一个时间戳,存在特效帧1至特效帧24,帧率是24帧每秒,即每1/24秒为一个时间戳,例如0,1/24,2/24,…,23/24,在这24个时间戳上分别呈现特效帧1至24,上述时间戳0,1/24,2/24,…,23/24分别为特效帧1至特效帧24的原始特效帧时间戳,目标时间轴是2秒,帧率仍然是24帧每秒,则目标时间轴上每个时间戳为0,1/24,2/24,…,23/24,24/24,…,47/24,将目标时间轴上每个时间戳作为目标时间戳,并分别确定各个目标时间戳对应的原始时间戳,分别对应的原始时间戳是0,0,1/24,1/24,2/24,2/24,…,23/24,23/24,由于目标时间戳在原始时间轴上对应的时间戳与原始特效帧时间戳重叠,则将这些原始特效帧时间戳所对应的特效帧分别确定为各个目标时间戳上的特效帧,则目标时间轴上每个时间戳为0,1/24,2/24,…,23/24,24/24,…,47/24分别对应的特效帧为特效帧1,特效帧1,…,特效帧24,特效帧24,但是这种变换情况是理想状态下的变换,在一些情形下,目标时间轴上每个目标时间戳所对应的原始时间轴上的时间戳并不一定都是原始特效帧时间戳,例如,假设目标时间戳1/24在原始时间轴上对应的时间戳为1/48,但是在帧率为24帧每秒的情况下原始时间轴上的时间戳1/48并没有对应的特效帧,因此采取就近原则,将时间距离最近的特效帧A作为时间戳1/48的特效帧,进而确定为目标时间戳1/24对应的特效帧,出于存在两个距离最近时间戳的原因,这里特效帧A可以是时间戳0上的特效帧,也可以是时间戳1/24的特效帧,若是目标时间戳1/24在原始时间轴上对应的时间戳为1/36,则距离其最近的时间戳是时间戳1/48,这里的特效帧A为时间戳1/24的特效帧。As an example, suppose the original timeline is 1 second and the frame rate is 24 frames per second, meaning each 1/24th of a second is a timestamp. There are effect frames 1 to 24, with a frame rate of 24 frames per second, also with timestamps of 1/24th of a second, such as 0, 1/24, 2/24, ..., 23/24. Effect frames 1 to 24 are presented at these 24 timestamps. These timestamps 0, 1/24, 2/24, ..., 23/24 are the original effect frame timestamps for effect frames 1 to 24. The target timeline is 2 seconds, and the frame rate remains 24 frames per second. Therefore, each time on the target timeline... The timestamps are 0, 1/24, 2/24, ..., 23/24, 24/24, ..., 47/24. Each timestamp on the target timeline is taken as the target timestamp, and the corresponding original timestamps are determined separately. The corresponding original timestamps are 0, 0, 1/24, 1/24, 2/24, 2/24, ..., 23/24, 23/24. Since the timestamps corresponding to the target timestamps on the original timeline overlap with the timestamps of the original effect frames, the effect frames corresponding to these original effect frame timestamps are determined as the effect frames on each target timestamp. Each timestamp on the target timeline is 0, 1/24, 2/24, ..., 23/24, 24/24, ..., 47/24, corresponding to effect frames 1, 24, ..., 24 respectively. However, this transformation is an ideal scenario. In some cases, the original timestamp on the timeline corresponding to each target timestamp on the target timeline may not be the original effect frame timestamp. For example, suppose the target timestamp 1/24 corresponds to the original timestamp 1/48, but at a frame rate of 24 frames per second, the original timestamp... Since there is no corresponding effect frame for timestamp 1/48 on the timeline, the nearest effect frame A is chosen as the effect frame for timestamp 1/48, and thus determined as the effect frame corresponding to the target timestamp 1/24. Because there are two closest timestamps, effect frame A can be the effect frame at timestamp 0 or the effect frame at timestamp 1/24. If the target timestamp 1/24 corresponds to timestamp 1/36 on the original timeline, then the closest timestamp is timestamp 1/48, and effect frame A is the effect frame for timestamp 1/24.
在一些实施例中,上述基于时长伸缩区间,确定目标时间戳在原始时间轴上对应的时间戳,可以通过以下技术方案实现:针对每个时长伸缩区间执行以下处理:当目标时间戳不大于时长伸缩区间的起始时间戳时,将目标时间戳确定为在原始时间轴上对应的原始时间戳;当目标时间戳大于时长伸缩区间的起始时间戳,且小于时长伸缩区间的终止时间戳时,对目标时间戳进行基于时长伸缩类型的映射,得到对应的原始时间戳;当目标时间戳大于或者等于终止时间戳,且小于目标播放时长时,确定原始播放时长与目标播放时长之间的第一差值,将第一差值与目标时间戳进行求和处理,并将求和处理结果确定目标时间戳在原始时间轴上对应的时间戳。In some embodiments, the determination of the target timestamp on the original timeline based on the duration scaling interval can be achieved through the following technical solution: For each duration scaling interval, the following processing is performed: when the target timestamp is not greater than the start timestamp of the duration scaling interval, the target timestamp is determined as the corresponding original timestamp on the original timeline; when the target timestamp is greater than the start timestamp of the duration scaling interval and less than the end timestamp of the duration scaling interval, the target timestamp is mapped based on the duration scaling type to obtain the corresponding original timestamp; when the target timestamp is greater than or equal to the end timestamp and less than the target playback duration, a first difference between the original playback duration and the target playback duration is determined, the first difference is summed with the target timestamp, and the summation result is used to determine the timestamp corresponding to the target timestamp on the original timeline.
作为示例,由于时长伸缩逻辑中的时长伸缩区间已经限定了需要进行伸缩的区间,因此针对于目标时间轴上不同的时间戳,将根据不同的映射关系,映射得到在原始时间轴上对应的时间戳,参见图7,原始时间轴的长度是m,目标时间轴的长度是n,时长伸缩区间是从a至b,时长伸缩区间的长度是b-a,经过时长拉伸处理之后,时长伸缩区间的起始时间戳是a,终止时间戳是n-(m-b),若目标时间戳t在0至a之间,则对应在原始时间轴上的时间戳也是t,因为这个时间段属于片头固定的区间,若目标时间戳t在n-(m-b)至n之间,则对应在原始时间轴上的时间戳是m-n+t,若目标时间戳t在a至n-m+b之间,则需要根据不同的时长伸缩类型进行映射处理。As an example, since the duration scaling interval in the duration scaling logic has already defined the interval that needs to be scaled, for different timestamps on the target timeline, the corresponding timestamps on the original timeline will be mapped according to different mapping relationships. See Figure 7. The length of the original timeline is m, the length of the target timeline is n, the duration scaling interval is from a to b, and the length of the duration scaling interval is b-a. After duration scaling, the starting timestamp of the duration scaling interval is a, and the ending timestamp is n-(m-b). If the target timestamp t is between 0 and a, then the corresponding timestamp on the original timeline is also t, because this time period belongs to the fixed interval of the opening sequence. If the target timestamp t is between n-(m-b) and n, then the corresponding timestamp on the original timeline is m-n+t. If the target timestamp t is between a and n-m+b, then mapping processing is required according to different duration scaling types.
在一些实施例中,上述对目标时间戳进行基于时长伸缩类型的映射,得到对应的原始时间戳,可以通过以下技术方案实现:当时长伸缩类型为时间线性缩减类型、或者时间线性拉伸类型时,将目标播放时长与原始播放时长的第二差值确定为伸缩长度,并将伸缩长度与时长伸缩区间的长度进行求和处理;对时长伸缩区间的长度与求和处理结果进行求比值处理,得到伸缩系数;确定目标时间戳与起始时间戳之间的第三差值,将第三差值与伸缩系数进行相乘处理;对相乘处理结果与起始时间戳进行求和处理,得到对应的原始时间戳。In some embodiments, the above-mentioned mapping of the target timestamp based on the duration scaling type to obtain the corresponding original timestamp can be achieved through the following technical solution: when the duration scaling type is a linear time reduction type or a linear time stretching type, the second difference between the target playback duration and the original playback duration is determined as the scaling length, and the scaling length is summed with the length of the duration scaling interval; the length of the duration scaling interval is compared with the summation result to obtain the scaling coefficient; the third difference between the target timestamp and the starting timestamp is determined, and the third difference is multiplied with the scaling coefficient; the multiplication result is summed with the starting timestamp to obtain the corresponding original timestamp.
作为示例,当目标时间戳t在a至n-m+b之间,则需要根据不同的时长伸缩类型进行映射处理,若时长伸缩类型为时间线性伸缩时,将目标播放时长n与原始播放时长m的第二差值确定为伸缩长度,并将伸缩长度与时长伸缩区间的长度b-a进行求和处理;对时长伸缩区间的长度b-a与求和处理结果进行求比值处理,得到伸缩系数k;确定目标时间戳t与起始时间戳a之间的第三差值,将第三差值与伸缩系数k进行相乘处理;对相乘处理结果与起始时间戳a进行求和处理,得到对应的原始时间戳,具体计算原理可以参见以下公式:f(t)=a+k(t-a),a<t<n-m+b。As an example, when the target timestamp t is between a and n-m+b, mapping processing is required according to different duration scaling types. If the duration scaling type is linear time scaling, the second difference between the target playback duration n and the original playback duration m is determined as the scaling length, and the scaling length is summed with the length of the duration scaling interval b-a. The scaling coefficient k is obtained by comparing the length of the duration scaling interval b-a with the summation result. The third difference between the target timestamp t and the starting timestamp a is determined, and the third difference is multiplied with the scaling coefficient k. The multiplication result is summed with the starting timestamp a to obtain the corresponding original timestamp. The specific calculation principle can be found in the following formula: f(t)=a+k(t-a), a<t<n-m+b.
在一些实施例中,上述对目标时间戳进行基于时长伸缩类型的映射,得到对应的原始时间戳,可以通过以下技术方案实现:当时长伸缩类型为时间重复类型时,确定目标时间戳与起始时间戳之间的第四差值,对第四差值与时长伸缩区间的长度进行求余数处理;将求余数处理结果与起始时间戳进行求和处理,得到对应的原始时间戳。In some embodiments, the above-mentioned mapping of the target timestamp based on the duration scaling type to obtain the corresponding original timestamp can be achieved by the following technical solution: when the duration scaling type is the time repetition type, the fourth difference between the target timestamp and the starting timestamp is determined, and the remainder of the fourth difference and the length of the duration scaling interval is processed; the remainder processing result is summed with the starting timestamp to obtain the corresponding original timestamp.
作为示例,当目标时间戳t在a至n-m+b之间,则需要根据不同的时长伸缩类型进行映射处理,若时长伸缩类型为时间重复类型时,确定目标时间戳t与起始时间戳a之间的第四差值,对第四差值与时长伸缩区间的长度(b-a)进行求余数处理;将求余数处理结果与起始时间戳a进行求和处理,得到对应的原始时间戳,具体计算原理可以参见以下公式:f(t)=a+(t-a)%(b-a),a<t<n-m+b。As an example, when the target timestamp t is between a and n-m+b, mapping processing is required according to different duration scaling types. If the duration scaling type is time repetition, the fourth difference between the target timestamp t and the starting timestamp a is determined, and the remainder of the fourth difference and the length of the duration scaling interval (b-a) is calculated. The remainder result is then summed with the starting timestamp a to obtain the corresponding original timestamp. The specific calculation principle can be found in the following formula: f(t)=a+(t-a)%(b-a), a<t<n-m+b.
在一些实施例中,上述对目标时间戳进行基于时长伸缩类型的映射,得到对应的原始时间戳,可以通过以下技术方案实现:当时长伸缩类型为时间倒序重复类型时,确定目标时间戳与起始时间戳之间的第五差值,对第五差值与时长伸缩区间的长度进行求余数处理;针对对应求余数处理结果的比值结果进行取整处理,得到取整结果;当取整结果为偶数时,将求余数处理结果与起始时间戳进行求和处理,得到对应的原始时间戳;当取整结果为奇数时,确定时长伸缩区间的长度与求余数处理结果之间的第六差值,对第六差值与起始时间戳进行求和处理,得到对应的原始时间戳。In some embodiments, the above-described mapping of the target timestamp based on the duration scaling type to obtain the corresponding original timestamp can be achieved through the following technical solution: when the duration scaling type is a time-reverse repeating type, the fifth difference between the target timestamp and the starting timestamp is determined, and the remainder of the fifth difference and the length of the duration scaling interval is calculated; the ratio of the remainder result is rounded to obtain the rounded result; when the rounded result is even, the remainder result is summed with the starting timestamp to obtain the corresponding original timestamp; when the rounded result is odd, the sixth difference between the length of the duration scaling interval and the remainder result is determined, and the sixth difference is summed with the starting timestamp to obtain the corresponding original timestamp.
作为示例,当目标时间戳t在a至n-m+b之间,则需要根据不同的时长伸缩类型进行映射处理,若时长伸缩类型为时间倒序重复类型时,确定目标时间戳t与起始时间戳a之间的第五差值,对第五差值与时长伸缩区间的长度(b-a)进行求余数处理;例如,对8与3进行求余数处理,得到的求余数处理结果为2,对应的比值结果为8/3,取整处理之后得到的取整结果为2,针对对应求余数处理结果的比值结果进行取整处理,得到取整结果;当取整结果为偶数时,将求余数处理结果与起始时间戳a进行求和处理,得到对应的原始时间戳;当取整结果为奇数时,确定时长伸缩区间的长度(b-a)与求余数处理结果之间的第六差值,对第六差值与起始时间戳a进行求和处理,得到对应的原始时间戳,具体计算原理可以参见以下公式:f(t)=a+(t-a)%(b-a),a<t<n-m+b。As an example, when the target timestamp t is between a and n-m+b, mapping processing is required according to different duration scaling types. If the duration scaling type is a time-reverse repetition type, the fifth difference between the target timestamp t and the starting timestamp a is determined, and the remainder of the fifth difference and the length of the duration scaling interval (b-a) is calculated. For example, the remainder of 8 and 3 is 2, and the corresponding ratio is 8/3. After rounding, the rounded result is 2. The corresponding remainder processing results are then used to calculate the remainder. The ratio of the results is rounded to obtain the rounded result. When the rounded result is even, the remainder result is summed with the starting timestamp a to obtain the corresponding original timestamp. When the rounded result is odd, the sixth difference between the length of the duration expansion interval (b-a) and the remainder result is determined. The sixth difference is summed with the starting timestamp a to obtain the corresponding original timestamp. The specific calculation principle can be found in the following formula: f(t)=a+(t-a)%(b-a), a<t<n-m+b.
在步骤104中,终端根据与目标时间轴对应的特效帧进行渲染,以形成符合目标播放时长的视频特效播放过程。In step 104, the terminal renders the special effects frames corresponding to the target timeline to form a video special effects playback process that conforms to the target playback duration.
作为示例,终端根据目标时间轴上每个时间戳的特效帧,在对应时间戳上进行渲染处理,从而得到符合目标播放时长的视频特效播放过程。As an example, the terminal performs rendering processing on the corresponding timestamp based on the effect frames of each timestamp on the target timeline, thereby obtaining a video effect playback process that conforms to the target playback duration.
作为示例,在进行短视频编辑的场景下,终端响应接收到用户拍摄的原生视频或者从服务器返回的原生视频,获取原生视频的原生视频时长,终端对素材库中的对应某一特效的视频特效文件进行解码以执行相应的时长伸缩处理,将原生视频时长作为目标播放时长,使得该特效适配于原生视频,将该特效与原生视频进行拼接处理后可以进行实时渲染,作为最终效果的预览,进行预览后对拼接处理结果进行编码处理,形成一个新视频文件分享给其他用户。As an example, in a short video editing scenario, the terminal receives a native video shot by the user or returned from the server, obtains the native video duration, decodes the video effect file corresponding to a certain effect in the media library to perform corresponding duration scaling, uses the native video duration as the target playback duration to make the effect fit the native video, and then splices the effect with the native video for real-time rendering as a preview of the final effect. After previewing, the splicing result is encoded to form a new video file to be shared with other users.
作为示例,在进行短视频编辑的场景下,视频特效文件中的特效还可以作为若干个原生视频之间的衔接动画,终端对素材库中的对应某一特效的视频特效文件进行解码,且接收针对目标播放时长的设置操作以执行相应的时长伸缩处理,使得经过时长伸缩处理之后的特效处在若干个原生视频之间,将该特效与原生视频进行时间轴拼接处理后可以进行实时渲染,作为最终效果的预览,进行预览后对拼接处理结果进行编码处理,形成一个新视频文件分享给其他用户。As an example, in the scenario of short video editing, the special effects in the video effects file can also serve as a connecting animation between several native videos. The terminal decodes the video effects file corresponding to a certain effect in the material library and receives the setting operation for the target playback duration to perform the corresponding duration scaling processing, so that the effect after duration scaling processing is placed between several native videos. After the effect and the native videos are spliced together on the timeline, they can be rendered in real time as a preview of the final effect. After previewing, the splicing result is encoded to form a new video file to be shared with other users.
作为示例,在不涉及到文件分享的场景中,例如,游戏战报场景,终端响应接收到从服务器返回的原生视频以及特效视频文件,获取原生视频的原生视频时长,并对视频特效文件进行解码以执行相应的时长伸缩处理,将原生视频时长作为目标播放时长,使得该特效适配于原生视频的播放时长,将该特效与原生视频进行渲染并同时显示。As an example, in scenarios that do not involve file sharing, such as game battle reports, the terminal receives the original video and special effects video files returned from the server, obtains the original video duration, decodes the video special effects file to perform corresponding duration scaling, uses the original video duration as the target playback duration, so that the special effects are adapted to the playback duration of the original video, and renders and displays the special effects and the original video simultaneously.
参见图3E,图3E是本发明实施例提供的视频特效的处理方法的一个可选的流程示意图,上述实施例在实施过程中仅通过终端执行具体处理流程,除此之外,还可以结合终端和服务器来实现上述处理流程,在步骤201中,终端向服务器发出渲染请求,在步骤202中,服务器获取视频特效文件,并从视频特效文件中提取时长伸缩逻辑,在步骤203中,服务器将提取的时长伸缩逻辑返回至终端,在步骤204中,终端接收输入的目标播放时长,在步骤205中,终端将目标播放时长发送至服务器,在步骤206中,服务器根据时长伸缩逻辑,确定视频特效文件中与目标时间轴对应的特效帧;在步骤207中,服务器根据与目标时间轴对应的特效帧进行渲染,以形成符合目标播放时长的视频特效播放过程;在步骤208中,服务器将视频特效返回至终端,在步骤209中,终端呈现视频特效,上述过程涉及到终端与服务器之间的交互过程,将需要大量计算资源的渲染处理分配给服务器来完成,终端仅负责接收用户的配置需求,以及呈现渲染得到的视频特效,在其他实施方式中,还可以将上述服务器所完成的逻辑通过调用渲染SDK来完成,或者通过渲染SDK远程调用云服务器资源完成。Referring to Figure 3E, which is an optional flowchart of the video effects processing method provided in this embodiment of the invention, the above embodiment executes the specific processing flow only through the terminal. Alternatively, the processing flow can be implemented by combining a terminal and a server. In step 201, the terminal sends a rendering request to the server. In step 202, the server obtains the video effects file and extracts the duration scaling logic from the video effects file. In step 203, the server returns the extracted duration scaling logic to the terminal. In step 204, the terminal receives the input target playback duration. In step 205, the terminal sends the target playback duration to the server. In step 206, the server determines the desired playback duration based on the duration scaling logic. The server defines the effect frames in the video effect file that correspond to the target timeline. In step 207, the server renders the effect frames corresponding to the target timeline to form a video effect playback process that conforms to the target playback duration. In step 208, the server returns the video effect to the terminal. In step 209, the terminal presents the video effect. The above process involves the interaction between the terminal and the server. The rendering processing, which requires a lot of computing resources, is assigned to the server. The terminal is only responsible for receiving the user's configuration requirements and presenting the rendered video effect. In other embodiments, the logic completed by the server can also be completed by calling the rendering SDK or by remotely calling cloud server resources through the rendering SDK.
本发明实施例提供一种视频特效的处理方法,可以支持固定动画文件的时间伸缩,并且外部应用平台只需要设置动画文件的目标播放时间,动画文件就可以按照用户配置的伸缩逻辑进行时间伸缩。视频特效文件的播放时长伸缩处理是由视频特效文件中的时长伸缩逻辑控制,对视频特效文件解码后,根据时长伸缩逻辑处理并渲染即可实现目标播放时长的视频特效播放过程;能够直接应用于各种应用和各种平台,且不受平台的操作系统的限制,实现流程极其简洁。This invention provides a method for processing video effects, which supports time scaling of fixed animation files. External application platforms only need to set the target playback time of the animation file, and the animation file can then scale according to the user-configured scaling logic. The playback duration scaling of the video effect file is controlled by the duration scaling logic within the video effect file. After decoding the video effect file, processing and rendering according to the duration scaling logic achieves the desired playback duration of the video effect. This method can be directly applied to various applications and platforms, and is not limited by the platform's operating system; the implementation process is extremely simple.
下面,将说明本发明实施例提供的视频特效的处理方法在一个实际的应用场景中的示例性应用。The following will describe an exemplary application of the video effects processing method provided in this embodiment of the invention in a real-world application scenario.
本发明实施例提供的视频特效的处理方法在游戏周战报视频中有着广泛的应用,参见图4,图4是本发明实施例提供的视频特效的处理方法在游戏周战报视频的场景中的应用效果示意图,终端需要进行呈现的是中间区域的横向视频(原生视频)及上下区域的贴纸动画(对应视频特效文件的特效对象),通过PAG贴纸动画来实现上下区域的贴纸动画,这是一个竖屏动画,呈现在视频的上下边缘区域,并伴随有周期性的动画效果,在其他的应用场景中,还存在贴纸动画的片头以及片尾固定,中间部分的内容根据需求进行时间拉伸的情况,需求可以是目标播放时长,目标播放时长可以为横向视频的时长(原生视频的时长),图4中的应用效果示意图可以通过如下步骤实现,客户端触发了请求服务器下发每周战报视频的下发逻辑,使得服务器向客户端下发每周战报视频,客户端响应接收到从服务器200返回的每周战报视频(原生视频)以及对应的视频特效文件,获取每周战报视频的时长作为目标播放时长,并基于目标播放时长对视频特效文件进行解码以执行相应的时长伸缩处理,使得经过时长伸缩处理的特效对象适配于每周战报视频的时长,最后将该特效对象进行渲染并与每周战报视频进行同时显示,显示出的效果即为带有特效对象的每周战报视频。The video effects processing method provided in this embodiment of the invention has wide applications in game weekly battle report videos. Referring to Figure 4, Figure 4 is a schematic diagram illustrating the application effect of the video effects processing method provided in this embodiment of the invention in a game weekly battle report video scenario. The terminal needs to present the horizontal video (native video) in the middle area and the sticker animations (effect objects corresponding to the video effects file) in the upper and lower areas. The sticker animations in the upper and lower areas are achieved through PAG sticker animations. This is a vertical animation, presented in the upper and lower edge areas of the video, accompanied by periodic animation effects. In other application scenarios, there are also cases where the beginning and end of the sticker animation are fixed, and the content in the middle is stretched according to requirements. The requirement can be a target playback duration. The duration of the horizontal video (the duration of the original video) can be used. The application effect diagram in Figure 4 can be implemented through the following steps: The client triggers the logic of requesting the server to send the weekly battle report video, so that the server sends the weekly battle report video to the client. The client responds by receiving the weekly battle report video (original video) and the corresponding video effect file returned from the server 200. It obtains the duration of the weekly battle report video as the target playback duration, and decodes the video effect file based on the target playback duration to perform the corresponding duration scaling processing, so that the duration scaling processing effect object is adapted to the duration of the weekly battle report video. Finally, the effect object is rendered and displayed simultaneously with the weekly battle report video. The displayed effect is the weekly battle report video with the effect object.
参见图5,图5是本发明实施例提供的视频特效的处理系统的流程图,首先在AE中通过插件设置贴纸动画的伸缩区间及伸缩类型,参见图6B,图6B是本发明实施例提供的视频特效的处理方法的标注示意图,在贴纸动画的总合成中添加标注,AE中的插件可以支持对图层添加标注,(1)通过点击空白区域的操作,使得没有图层被选择,(2)响应于点击图层控件的操作,呈现图层菜单,(3)响应于添加标记的操作实现标记添加过程,从而结合具体的使用场景,可以添加相关标识,例如时长伸缩区间和时长伸缩类型,便于后续通过渲染SDK按照时长伸缩区间和时长伸缩类型进行渲染处理,参见图6C,图6C是本发明实施例提供的视频特效的处理方法的标注示意图,具体可以设置时长伸缩区间以及四种时长伸缩类型,具体设置过程如下:(1)响应于双击标注的操作,呈现设置页面;(2)在设置页面中接收时长伸缩类型(即所填写的内容),(3)在设置页面中接收修改的起始时间,(4)在设置页面接收到确认保存操作,时长伸缩类型包括以下几种:1、无伸缩类型:表示无需进行时长伸缩;2、线性伸缩类型:当设置整个PAG贴纸动画的目标播放时长长于原始PAG贴纸动画的原始播放时长时,在时长伸缩区间进行线性拉伸,当设置整个PAG贴纸动画的目标播放时长短于原始PAG贴纸动画的原始播放时长时,在时长伸缩区间进行线性缩减;3、重复类型:时间伸缩类型为重复类型,当设置整个PAG贴纸动画的目标播放时长长于原始PAG贴纸动画的原始播放时长时,在时长伸缩区间进行周期性拉伸;4、重复倒转类型:当设置整个PAG贴纸动画的目标播放时长长于原始PAG贴纸动画的原始播放时长时,在时长伸缩区间进行倒序周期性拉伸,即先进行正序播放,再进行倒序播放,然后再进行正序播放,接着再进行倒序播放,依此类推。Referring to Figure 5, which is a flowchart of the video effects processing system provided in this embodiment of the invention, firstly, the scaling range and scaling type of the sticker animation are set in AE through a plugin. Referring to Figure 6B, which is a schematic diagram of the video effects processing method provided in this embodiment of the invention, annotations are added to the overall composition of the sticker animation. The plugin in AE can support adding annotations to layers. (1) By clicking on the blank area, no layer is selected. (2) In response to clicking on the layer control, the layer menu is presented. (3) In response to adding a mark, the mark addition process is realized. Thus, in combination with the specific usage scenario, relevant labels can be added, such as the duration scaling range and duration scaling type, so that subsequent rendering processing can be performed according to the duration scaling range and duration scaling type by the rendering SDK. Referring to Figure 6C, which is a schematic diagram of the video effects processing method provided in this embodiment of the invention, the duration scaling range and four duration scaling types can be set. The specific setting process is as follows: (1) In response to the double-clicking of the annotation, the setting page is presented. (2) The duration scaling type is received in the setting page. (i.e., the content filled in), (3) receive the modified start time in the settings page, (4) receive the confirmation and save operation in the settings page. The duration scaling types include the following: 1. No scaling type: indicates that no duration scaling is required; 2. Linear scaling type: when the target playback duration of the entire PAG sticker animation is set to be longer than the original playback duration of the original PAG sticker animation, linear scaling is performed in the duration scaling range; when the target playback duration of the entire PAG sticker animation is set to be shorter than the original playback duration of the original PAG sticker animation, linear scaling is performed in the duration scaling range. 3. Repeat type: When the time stretching type is repeat type, if the target playback duration of the entire PAG sticker animation is set to be longer than the original playback duration of the original PAG sticker animation, the time stretching will be performed periodically within the duration stretching range; 4. Repeat reverse type: When the target playback duration of the entire PAG sticker animation is set to be longer than the original playback duration of the original PAG sticker animation, the time stretching will be performed periodically in reverse order within the duration stretching range, that is, first play in forward order, then play in reverse order, then play in forward order again, then play in reverse order again, and so on.
对特效对象进行编码处理得到了PAG贴纸动画文件,当时长伸缩区间及类型设置成功后,可以导出PAG贴纸动画文件,通过修改PAG贴纸动画文件的数据结构,在文件根路径的层级增加时长伸缩类型和时长伸缩区间,便于进行编码处理,具体到平台端使用时,渲染SDK的解码模块需要进行相应数据的解码读取,渲染SDK可以是客户端SDK或者是服务器SDK,客户端SDK在客户端完成渲染,服务器端SDK在服务器完成渲染。The PAG sticker animation file is obtained by encoding the special effects object. After the duration scaling range and type are successfully set, the PAG sticker animation file can be exported. By modifying the data structure of the PAG sticker animation file, the duration scaling type and duration scaling range are added at the level of the file root path to facilitate encoding. When used on the platform side, the decoding module of the rendering SDK needs to decode and read the corresponding data. The rendering SDK can be a client SDK or a server SDK. The client SDK completes the rendering on the client side, and the server SDK completes the rendering on the server side.
为了在PAG贴纸动画上增加支持时长伸缩的功能,并且因为基于AE设计的动画的渲染逻辑比较复杂,例如带有轨迹计算、时间缓动等相关效果,如果通过修改PAG贴纸动画的具体图层的动画特性来实现动画时间拉伸功能,其实现复杂度会相当高,因此不宜修改PAG贴纸动画的图层的具体动画特性,于是渲染侧中可以在原始渲染时间计算逻辑上进行封装,通过改变原始动画文件的渲染进度来实现时长伸缩的功能,计算时长伸缩区间的具体渲染进度。To add duration scaling support to PAG sticker animations, and because the rendering logic of animations designed based on After Effects is quite complex, including effects such as trajectory calculation and time easing, it would be too complex to implement the animation duration scaling function by modifying the animation characteristics of specific layers in the PAG sticker animation. Therefore, it is not advisable to modify the specific animation characteristics of the layers in the PAG sticker animation. Instead, the rendering side can encapsulate the original rendering time calculation logic and implement the duration scaling function by changing the rendering progress of the original animation file, calculating the specific rendering progress of the duration scaling interval.
参见图7,图7是本发明实施例提供的视频特效的处理方法的时间轴示意图,原始时间轴和目标时间轴的最小时间单位均为帧,若帧率为24帧每秒,则表示一秒时间内呈现24帧,最小时间单位为1/24秒,PAG贴纸动画文件的原始播放时长为m,其中包含一个时长伸缩区间(a,b),如果时长伸缩类型为无伸缩类型,则渲染逻辑和之前的逻辑保持一致,不会进行时长伸缩处理,如果时长伸缩类型为其他几种类型,且经过伸缩后的目标播放时长为n,则具体渲染进度的计算过程如下:首先计算时间伸缩系数k,k=(b-a)/(n–m+b-a);t为伸缩后的渲染时间点,即目标时间轴上的目标时间戳,f(t)为PAG贴纸动画的原始时间轴上进行实际渲染的原始时间戳,当时间伸缩类型为线性伸缩类型时,按照如下公式(1)计算PAG贴纸动画的原始时间轴上进行实际渲染的原始时间戳:Referring to Figure 7, Figure 7 is a timeline diagram of the video effects processing method provided in the embodiment of the present invention. The minimum time unit of the original timeline and the target timeline is a frame. If the frame rate is 24 frames per second, it means that 24 frames are presented in one second. The minimum time unit is 1/24 second. The original playback duration of the PAG sticker animation file is m, which includes a duration scaling interval (a, b). If the duration scaling type is no scaling type, the rendering logic is consistent with the previous logic and no duration scaling processing is performed. If the duration scaling type is one of the other types, and the target playback duration after scaling is n, the specific rendering progress calculation process is as follows: First, calculate the time scaling coefficient k, k = (b-a)/(n-m+b-a); t is the rendering time point after scaling, that is, the target timestamp on the target timeline. f(t) is the original timestamp of the PAG sticker animation on the original timeline for actual rendering. When the time scaling type is linear scaling type, the original timestamp of the PAG sticker animation on the original timeline for actual rendering is calculated according to the following formula (1):
当时间伸缩类型为重复类型时,按照如下公式(2)计算PAG贴纸动画的原始时间轴上进行实际渲染的原始时间戳:When the time scaling type is repeating, the original timestamp for actual rendering on the original timeline of the PAG sticker animation is calculated according to the following formula (2):
当时间伸缩类型为重复倒转类型时,当a<t<n-m+b时,分两种情况计算PAG贴纸动画的原始时间轴上进行实际渲染的原始时间戳:当(t-a)/(b-a)计算结果取整为偶数时,f(t)=a+(t-a)%(b-a),当(t-a)/(b-a)计算结果取整为奇数时,f(t)=b-(t-a)%(b-a),当t为其它范围的取值时,与上面的计算相同,当PAG贴纸动画中有多个时长伸缩区间时,计算方法类似,需要针对多个时长伸缩区间进行计算,当通过以上公式计算出f(t)后,渲染SDK中的渲染模块便可以根据对应的原始时间戳渲染出最终需要的特效对应的动画画面,最后将该特效对象的动画画面与每周战报视频进行同时显示,显示出的效果即为带有特效对象的每周战报视频。When the time scaling type is repeating and reversing, and when a < t < n-m+b, the original timestamp for actual rendering on the original timeline of the PAG sticker animation is calculated in two cases: when the result of (t-a)/(b-a) is an even number, f(t) = a + (t-a)%(b-a); when the result of (t-a)/(b-a) is an odd number, f(t) = b - (t-a)%(b-a). When t is in other ranges, the calculation is the same as above. When there are multiple time scaling intervals in the PAG sticker animation, the calculation method is similar, and calculations need to be performed for multiple time scaling intervals. After f(t) is calculated using the above formula, the rendering module in the rendering SDK can render the animation screen corresponding to the final effect according to the corresponding original timestamp. Finally, the animation screen of the effect object is displayed simultaneously with the weekly battle report video, and the displayed effect is the weekly battle report video with the effect object.
本发明实施例提供一种视频特效的处理方法,能够很好地解决了用户界面动画(例如,视频编辑)、服务器端特效视频渲染场景下对于特效动画的时长需求不固定与设计师设计的贴纸动画文件时长固定之间的矛盾,在设计贴纸动画效果时,当设计师设定好时长伸缩区间及时长伸缩类型后,任意平台端使用过程中只需要设置贴纸动画的目标播放时长,便可实现动画的时间拉伸效果。This invention provides a method for processing video special effects, which can effectively solve the contradiction between the variable duration requirements of special effects animations in user interface animations (e.g., video editing) and server-side special effects video rendering scenarios and the fixed duration of sticker animation files designed by designers. When designing sticker animation effects, once the designer sets the duration stretching range and duration stretching type, any platform only needs to set the target playback duration of the sticker animation to achieve the time stretching effect of the animation.
下面继续说明本发明实施例提供的视频特效的处理装置455的实施为软件模块的示例性结构,在一些实施例中,如图2所示,存储在存储器450的视频特效的处理装置455中的软件模块可以包括:文件获取模块4551,用于获取视频特效文件,并从视频特效文件中提取时长伸缩逻辑;时长获取模块4552,用于获取需要所述视频特效文件所实现的目标播放时长,其中,目标播放时长区别于视频特效文件的原始播放时长;特效帧确定模块4553,用于根据时长伸缩逻辑,确定视频特效文件中与目标时间轴对应的特效帧;其中,目标时间轴的长度与目标播放时长一致;渲染模块4554,用于根据与目标时间轴对应的特效帧进行渲染,以形成符合目标播放时长的视频特效播放过程。The following description continues to illustrate the exemplary structure of the video effects processing device 455 provided in the embodiments of the present invention as a software module. In some embodiments, as shown in FIG2, the software module stored in the video effects processing device 455 in the memory 450 may include: a file acquisition module 4551, used to acquire a video effects file and extract duration scaling logic from the video effects file; a duration acquisition module 4552, used to acquire the target playback duration to be achieved by the video effects file, wherein the target playback duration is different from the original playback duration of the video effects file; an effects frame determination module 4553, used to determine the effects frame in the video effects file corresponding to the target timeline according to the duration scaling logic; wherein the length of the target timeline is consistent with the target playback duration; and a rendering module 4554, used to render according to the effects frame corresponding to the target timeline to form a video effects playback process that conforms to the target playback duration.
在一些实施例中,文件获取模块4551,还用于:执行以下处理之一以得到对应特效对象的编码导出文件:对特效对象的多个图层结构进行编码处理,得到对应特效对象的编码导出文件;对特效对象的多个特效帧进行编码处理,得到对应特效对象的编码导出文件;对特效对象的多个特效帧进行视频格式压缩处理,并对得到的视频格式压缩处理结果进行编码处理,得到对应特效对象的编码导出文件;将时长伸缩类型以及时长伸缩区间封装在编码导出文件中,得到对应特效对象的视频特效文件。In some embodiments, the file acquisition module 4551 is further configured to: perform one of the following processes to obtain an encoded export file of the corresponding special effects object: encode multiple layer structures of the special effects object to obtain an encoded export file of the corresponding special effects object; encode multiple special effects frames of the special effects object to obtain an encoded export file of the corresponding special effects object; perform video format compression processing on multiple special effects frames of the special effects object, and encode the obtained video format compression processing result to obtain an encoded export file of the corresponding special effects object; encapsulate the duration extension type and duration extension interval in the encoded export file to obtain a video special effects file of the corresponding special effects object.
在一些实施例中,所述时长伸缩逻辑包括时长伸缩区间以及对应的时长伸缩类型;文件获取模块4551,还用于:对视频特效文件进行解码处理,得到对应视频特效文件的至少一个时长伸缩区间以及对应的时长伸缩类型;其中,时长伸缩类型包括以下类型中的任意一种:时间线性伸缩类型;时间重复类型;时间倒序重复类型。In some embodiments, the duration scaling logic includes duration scaling intervals and corresponding duration scaling types; the file acquisition module 4551 is further configured to: decode the video effects file to obtain at least one duration scaling interval and corresponding duration scaling type of the corresponding video effects file; wherein, the duration scaling type includes any one of the following types: time linear scaling type; time repeating type; time reverse repeating type.
在一些实施例中,时长获取模块4552,还用于:当时长伸缩区间的数目为多个时,将视频特效文件拆分为与数目一致的多个视频特效子文件,并分别获取针对每个视频特效子文件的目标播放时长间;当时长伸缩区间的数目为一个时,获取针对视频特效文件的整体的目标播放时长。In some embodiments, the duration acquisition module 4552 is further configured to: when the number of duration scaling intervals is multiple, split the video effect file into multiple video effect sub-files of the same number, and acquire the target playback duration for each video effect sub-file respectively; when the number of duration scaling intervals is one, acquire the overall target playback duration for the video effect file.
在一些实施例中,时长获取模块4552,还用于:在获取需要所述视频特效文件所实现的目标播放时长之后,当时长伸缩区间的数目为多个时,针对每个视频特效子文件执行以下处理:从视频特效子文件中获取对应特效对象的原始时间轴;保持原始时间轴的帧率不变,对原始时间轴进行时长伸缩处理,得到对应目标播放时长的目标时间轴;当时长伸缩区间的数目为一个时,针对视频特效文件执行以下处理:从视频特效文件中获取对应特效对象的原始时间轴;保持原始时间轴的帧率不变,对原始时间轴进行时长伸缩处理,得到对应目标播放时长的目标时间轴。In some embodiments, the duration acquisition module 4552 is further configured to: after acquiring the target playback duration to be achieved by the video effects file, when the number of duration scaling intervals is multiple, perform the following processing for each video effects sub-file: acquire the original timeline of the corresponding effects object from the video effects sub-file; keep the frame rate of the original timeline unchanged, and perform duration scaling processing on the original timeline to obtain the target timeline of the corresponding target playback duration; when the number of duration scaling intervals is one, perform the following processing for the video effects file: acquire the original timeline of the corresponding effects object from the video effects file; keep the frame rate of the original timeline unchanged, and perform duration scaling processing on the original timeline to obtain the target timeline of the corresponding target playback duration.
在一些实施例中,当时长伸缩区间的数目为多个时,特效帧确定模块4553,还用于:针对每个时长伸缩区间执行以下处理:从视频特效子文件中获取包括特效对象的多个特效帧、以及每个特效帧在原始时间轴上对应的时间戳,以作为每个特效帧的原始特效帧时间戳;基于时长伸缩区间、以及每个特效帧对应的原始特效帧时间戳,在多个特效帧中确定与目标时间轴上每个时间戳对应的特效帧。In some embodiments, when the number of duration scaling intervals is multiple, the effect frame determination module 4553 is further configured to: perform the following processing for each duration scaling interval: obtain multiple effect frames including effect objects and the timestamp corresponding to each effect frame on the original timeline from the video effect sub-file, as the original effect frame timestamp of each effect frame; and determine the effect frame corresponding to each timestamp on the target timeline among the multiple effect frames based on the duration scaling interval and the original effect frame timestamp corresponding to each effect frame.
在一些实施例中,当时长伸缩区间的数目为一个时,特效帧确定模块4553,还用于:从视频特效文件中获取包括特效对象的多个特效帧、以及每个特效帧在原始时间轴上对应的时间戳,以作为每个特效帧的原始特效帧时间戳;基于时长伸缩区间、以及每个特效帧对应的原始特效帧时间戳,在多个特效帧中确定与目标时间轴上每个时间戳对应的特效帧。In some embodiments, when the number of duration scaling intervals is one, the special effects frame determination module 4553 is further configured to: obtain from the video special effects file a plurality of special effects frames including special effects objects, and the timestamp corresponding to each special effects frame on the original timeline, as the original special effects frame timestamp of each special effects frame; and determine the special effects frame corresponding to each timestamp on the target timeline among the plurality of special effects frames based on the duration scaling intervals and the original special effects frame timestamps corresponding to each special effects frame.
在一些实施例中,特效帧确定模块4553,还用于:依次将目标时间轴上每个时间戳作为目标时间戳,以执行以下处理:基于时长伸缩区间,确定目标时间戳在原始时间轴上对应的时间戳;当目标时间戳在原始时间轴上对应的时间戳与任一原始特效帧时间戳重叠时,将重叠的原始特效帧时间戳对应的特效帧确定为目标时间戳对应的特效帧;当目标时间戳在原始时间轴上对应的时间戳未与任一原始特效帧时间戳重叠时,确定与目标时间戳在原始时间轴上对应的时间戳距离最小的原始时间戳,并将确定原始特效帧时间戳对应的特效帧确定为目标时间戳对应的特效帧。In some embodiments, the special effects frame determination module 4553 is further configured to: sequentially use each timestamp on the target timeline as the target timestamp to perform the following processing: based on the duration scaling interval, determine the timestamp corresponding to the target timestamp on the original timeline; when the timestamp corresponding to the target timestamp on the original timeline overlaps with any original special effects frame timestamp, determine the special effects frame corresponding to the overlapping original special effects frame timestamp as the special effects frame corresponding to the target timestamp; when the timestamp corresponding to the target timestamp on the original timeline does not overlap with any original special effects frame timestamp, determine the original timestamp with the smallest distance from the timestamp corresponding to the target timestamp on the original timeline, and determine the special effects frame corresponding to the determined original special effects frame timestamp as the special effects frame corresponding to the target timestamp.
在一些实施例中,特效帧确定模块4553,还用于:针对每个时长伸缩区间执行以下处理:当目标时间戳不大于时长伸缩区间的起始时间戳时,将目标时间戳确定为在原始时间轴上对应的原始时间戳;当目标时间戳大于时长伸缩区间的起始时间戳,且小于时长伸缩区间的终止时间戳时,对目标时间戳进行基于时长伸缩类型的映射,得到对应的原始时间戳;当目标时间戳大于或者等于终止时间戳,且小于目标播放时长时,确定原始播放时长与目标播放时长之间的第一差值,将第一差值与目标时间戳进行求和处理,并将求和处理结果确定目标时间戳在原始时间轴上对应的时间戳。In some embodiments, the special effects frame determination module 4553 is further configured to: perform the following processing for each duration scaling interval: when the target timestamp is not greater than the start timestamp of the duration scaling interval, determine the target timestamp as the corresponding original timestamp on the original timeline; when the target timestamp is greater than the start timestamp of the duration scaling interval and less than the end timestamp of the duration scaling interval, perform a mapping based on the duration scaling type on the target timestamp to obtain the corresponding original timestamp; when the target timestamp is greater than or equal to the end timestamp and less than the target playback duration, determine the first difference between the original playback duration and the target playback duration, sum the first difference with the target timestamp, and determine the timestamp corresponding to the target timestamp on the original timeline using the summation result.
在一些实施例中,特效帧确定模块4553,还用于:当时长伸缩类型为时间线性缩减类型、或者时间线性拉伸类型时,将目标播放时长与原始播放时长的第二差值确定为伸缩长度,并将伸缩长度与时长伸缩区间的长度进行求和处理;对时长伸缩区间的长度与求和处理结果进行求比值处理,得到伸缩系数;确定目标时间戳与起始时间戳之间的第三差值,将第三差值与伸缩系数进行相乘处理;对相乘处理结果与起始时间戳进行求和处理,得到对应的原始时间戳。In some embodiments, the special effects frame determination module 4553 is further configured to: when the duration scaling type is a time linear reduction type or a time linear stretch type, determine the second difference between the target playback duration and the original playback duration as the scaling length, and sum the scaling length with the length of the duration scaling interval; perform ratio processing on the length of the duration scaling interval and the summation processing result to obtain the scaling coefficient; determine the third difference between the target timestamp and the starting timestamp, and multiply the third difference with the scaling coefficient; sum the multiplication processing result with the starting timestamp to obtain the corresponding original timestamp.
在一些实施例中,特效帧确定模块4553,还用于:当时长伸缩类型为时间重复类型时,确定目标时间戳与起始时间戳之间的第四差值,对第四差值与时长伸缩区间的长度进行求余数处理;将求余数处理结果与起始时间戳进行求和处理,得到对应的原始时间戳。In some embodiments, the special effects frame determination module 4553 is further configured to: when the duration extension type is a time repetition type, determine the fourth difference between the target timestamp and the starting timestamp, perform a remainder operation on the fourth difference and the length of the duration extension interval; and sum the remainder operation result with the starting timestamp to obtain the corresponding original timestamp.
在一些实施例中,特效帧确定模块4553,还用于:当时长伸缩类型为时间倒序重复类型时,确定目标时间戳与起始时间戳之间的第五差值,对第五差值与时长伸缩区间的长度进行求余数处理;针对对应求余数处理结果的比值结果进行取整处理,得到取整结果;当取整结果为偶数时,将求余数处理结果与起始时间戳进行求和处理,得到对应的原始时间戳;当取整结果为奇数时,确定时长伸缩区间的长度与求余数处理结果之间的第六差值,对第六差值与起始时间戳进行求和处理,得到对应的原始时间戳。In some embodiments, the special effects frame determination module 4553 is further configured to: when the duration extension type is a time-reverse repetition type, determine the fifth difference between the target timestamp and the starting timestamp, and perform a remainder operation on the fifth difference and the length of the duration extension interval; perform a rounding operation on the ratio of the corresponding remainder operation result to obtain a rounded result; when the rounded result is even, sum the remainder operation result with the starting timestamp to obtain the corresponding original timestamp; when the rounded result is odd, determine the sixth difference between the length of the duration extension interval and the remainder operation result, and sum the sixth difference with the starting timestamp to obtain the corresponding original timestamp.
本发明实施例提供一种存储有可执行指令的计算机可读存储介质,其中存储有可执行指令,当可执行指令被处理器执行时,将引起处理器执行本发明实施例提供的电子红包的发送方法,例如,如图3A-3D示出的视频特效的处理方法。This invention provides a computer-readable storage medium storing executable instructions. When the executable instructions are executed by a processor, the processor will execute the electronic red envelope sending method provided in this invention, such as the video effects processing method shown in Figures 3A-3D.
在一些实施例中,计算机可读存储介质可以是FRAM、ROM、PROM、EPROM、EEPROM、闪存、磁表面存储器、光盘、或CD-ROM等存储器;也可以是包括上述存储器之一或任意组合的各种设备。In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
在一些实施例中,可执行指令可以采用程序、软件、软件模块、脚本或代码的形式,按任意形式的编程语言(包括编译或解释语言,或者声明性或过程性语言)来编写,并且其可按任意形式部署,包括被部署为独立的程序或者被部署为模块、组件、子例程或者适合在计算环境中使用的其它单元。In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
作为示例,可执行指令可以但不一定对应于文件系统中的文件,可以可被存储在保存其它程序或数据的文件的一部分,例如,存储在超文本标记语言(HTML,Hyper TextMarkup Language)文档中的一个或多个脚本中,存储在专用于所讨论的程序的单个文件中,或者,存储在多个协同文件(例如,存储一个或多个模块、子程序或代码部分的文件)中。As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hypertext Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).
作为示例,可执行指令可被部署为在一个计算设备上执行,或者在位于一个地点的多个计算设备上执行,又或者,在分布在多个地点且通过通信网络互连的多个计算设备上执行。As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
综上,通过本发明实施例,通过视频特效文件中封装时长伸缩逻辑,使得一个视频特效文件自由伸缩为不同应用场景所需求的播放时长,具有普遍的适用性,再次基础上进行渲染形成视频特效播放过程,节约了制作大量不同播放时长的视频特效文件所带来的计算资源和时间资源的巨大消耗。In summary, through the embodiments of the present invention, by encapsulating duration scaling logic in video effects files, a single video effects file can be freely scaled to the playback duration required by different application scenarios, thus possessing universal applicability. Furthermore, rendering is performed on this basis to form the video effects playback process, saving the enormous consumption of computational and time resources associated with creating numerous video effects files with varying playback durations.
以上,仅为本发明的实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和范围之内所作的任何修改、等同替换和改进等,均包含在本发明的保护范围之内。The above are merely embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of the present invention are included within the scope of protection of the present invention.
Claims (15)
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK40028958A HK40028958A (en) | 2021-02-11 |
| HK40028958B true HK40028958B (en) | 2023-11-24 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12041372B2 (en) | Video special effect processing method and apparatus, and electronic device | |
| CN112184856B (en) | Multimedia processing device supporting multi-layer special effect and animation mixing | |
| CN111899322B (en) | Video processing method, animation rendering SDK, equipment and computer storage medium | |
| CN110505511B (en) | A method, device, system and computing device for playing video in webpage | |
| CN109325145A (en) | Acquisition methods, terminal and the computer readable storage medium of video thumbnails | |
| CN115250335B (en) | Video processing method, device, equipment and storage medium | |
| CN109672902A (en) | A kind of video takes out frame method, device, electronic equipment and storage medium | |
| CN115134658A (en) | Video processing method, device, equipment and storage medium | |
| WO2020220773A1 (en) | Method and apparatus for displaying picture preview information, electronic device and computer-readable storage medium | |
| CN115510347A (en) | Presentation file conversion method and device, electronic equipment and storage medium | |
| CN113938750A (en) | Video processing method and device, electronic equipment and storage medium | |
| WO2025035355A1 (en) | Real-time rendering system and method | |
| CN113744377A (en) | Animation processing system, method, device, equipment and medium | |
| CN111242688B (en) | Animation resource production method, device, mobile terminal and storage medium | |
| CN115955583B (en) | Video synthesis method and device | |
| CN109766150A (en) | Implementation method, device and the terminal device of interactive animation | |
| HK40028958B (en) | Method and apparatus for processing video special effect and electronic device | |
| CN117065357B (en) | Media data processing method, device, computer equipment and storage medium | |
| CN111866508B (en) | Video processing method, device, medium and electronic equipment | |
| CN115904592A (en) | Method and device for displaying virtual desktop | |
| HK40028958A (en) | Method and apparatus for processing video special effect and electronic device | |
| CN115695903A (en) | Video processing method, related device and equipment | |
| CN115086282A (en) | Video playing method, device and storage medium | |
| CN113849157B (en) | Animation playing management method, device, equipment and storage medium | |
| US20250118337A1 (en) | Video processing method and apparatus |