Time-lapse photography video synthesis method and device, electronic equipment and storage medium

文档序号:1941728 发布日期:2021-12-07 浏览:22次 中文

阅读说明:本技术 一种延时摄影视频合成方法、装置、电子设备及存储介质 (Time-lapse photography video synthesis method and device, electronic equipment and storage medium ) 是由 不公告发明人 于 2020-11-09 设计创作,主要内容包括:本申请实施例提供一种延时摄影视频合成方法、装置、电子设备及存储介质,涉及延时摄影技术领域。该方法包括:根据预设的摄影参数进行照片拍摄;将拍摄的照片存储至缓存中;检测所述缓存中是否有照片;若有,则按照拍摄顺序将所述照片合成视频文件;能够在照片拍摄的同时合成视频,节省时间且使用方便,解决了现有方法需要用户手动点击才能进行视频合成,造成时间的浪费的问题。(The embodiment of the application provides a method and a device for synthesizing delayed shooting video, electronic equipment and a storage medium, and relates to the technical field of delayed shooting. The method comprises the following steps: taking pictures according to preset shooting parameters; storing the shot pictures in a cache; detecting whether a photo exists in the cache; if so, synthesizing the pictures into a video file according to the shooting sequence; the method has the advantages that the video can be synthesized while the picture is shot, time is saved, the use is convenient, and the problem that the video synthesis can be carried out only by manually clicking by a user in the conventional method, so that time is wasted is solved.)

1. A method for delayed photography video compositing, the method comprising:

taking pictures according to preset shooting parameters;

storing the shot pictures in a cache;

detecting whether a photo exists in the cache;

and if so, synthesizing the pictures into a video file according to the shooting sequence.

2. The method for synthesizing delayed video camera according to claim 1, wherein the preset parameters include a shooting interval and a shooting number, and the shooting of the picture according to the preset parameters includes:

judging whether the current shooting number reaches the shooting number or not;

if not, continuing shooting until the current shooting number reaches the shooting number.

3. The method of claim 2, wherein said composing said photos into video files in order of capture if any, comprises:

traversing the timestamps of all the photos in the current cache to determine the shooting sequence of the photos from morning to evening according to the timestamps;

sequentially analyzing the photos based on the shooting sequence to obtain analysis data;

converting the analysis data into video data;

synthesizing a video file based on the video data.

4. The method of delayed photographic video composition of claim 3, further comprising:

judging whether the current analysis number of the photos reaches the shooting number or not;

if not, continuously detecting whether the pictures exist in the cache or not until the current analysis number reaches the shooting number.

5. A delayed photographic video compositing apparatus, characterized in that the apparatus comprises:

the photo shooting module is used for shooting photos according to preset shooting parameters;

the storage module is used for storing the shot pictures into a cache;

the first detection module is used for detecting whether a photo exists in the cache;

and the video synthesis module is used for synthesizing the photos into a video file according to the shooting sequence if the photos exist in the cache.

6. The apparatus of claim 5, wherein the preset photographing parameters comprise a photographing interval and a photographing number, and the photo photographing module comprises:

the quantity judging module is used for judging whether the current shooting quantity reaches the set shooting quantity;

and the shooting module is used for continuing shooting until the shooting number is up to the shooting number if the shooting number is not up to the shooting number.

7. The apparatus of claim 6, wherein the video composition module comprises:

the timestamp traversing module is used for traversing timestamps of all photos in the current cache so as to determine the shooting sequence of the photos from morning to evening according to the timestamps;

the analysis module is used for sequentially analyzing the photos based on the shooting sequence to obtain analysis data;

the video data module is used for converting the analysis data into video data;

and the synthesis module is used for synthesizing the video file based on the video data.

8. The apparatus for delayed camerawork video compositing according to claim 7, said apparatus further comprising:

the analysis number judging module is used for judging whether the current analysis number of the photos reaches the shooting number or not;

and the second detection module is used for continuously detecting whether the pictures exist in the cache or not if the current analysis number of the pictures does not reach the shooting number until the current analysis number reaches the shooting number.

9. An electronic device, comprising a memory for storing a computer program and a processor for executing the computer program to cause the computer device to perform the method of delayed photographic video composition according to any one of claims 1 to 4.

10. A readable storage medium having stored thereon computer program instructions which, when read and executed by a processor, perform the method of video composition with delayed photography of any one of claims 1 to 4.

Technical Field

The present disclosure relates to the field of delayed photography, and in particular, to a method and an apparatus for synthesizing a video by delayed photography, an electronic device, and a storage medium.

Background

The existing time-delay shooting method is to shoot pictures by clicking on an APP interface, a camera shoots the pictures according to a certain time interval, and after the pictures last for a period of time, a synthesis button is clicked on the APP interface to synthesize videos. The time consumed by the method is the sum of the shooting time and the synthesis time, and the video synthesis can be performed only by manually clicking by a user, so that the time is wasted.

Disclosure of Invention

An object of the embodiments of the present application is to provide a method and an apparatus for synthesizing a delayed video shot, an electronic device, and a storage medium, which can synthesize a video while shooting a picture, save time, and are convenient to use, and solve the problem that the video synthesis can be performed only by manually clicking by a user in the conventional method, thereby wasting time.

The embodiment of the application provides a method for synthesizing delayed photography video, which comprises the following steps:

taking pictures according to preset shooting parameters;

storing the shot pictures in a cache;

detecting whether a photo exists in the cache;

and if so, synthesizing the pictures into a video file according to the shooting sequence.

In the implementation process, the shot pictures are placed in the cache, once the pictures in the cache are detected, the pictures are synthesized, the time interval of picture shooting is far longer than the time of synthesizing each frame of video, the total consumed time is the time required for picture shooting, the time is saved, the synthesis can be started as long as the pictures are placed in the cache, the operation of manually clicking by a user to synthesize the video is avoided, the use is convenient, the problem that the video synthesis can be carried out only by manually clicking by the user in the existing method, and the time is wasted is solved.

Further, the preset shooting parameters include shooting intervals and shooting quantity, and the shooting of the picture according to the preset shooting parameters includes:

judging whether the current shooting number reaches the shooting number or not;

if not, continuing shooting until the current shooting number reaches the shooting number.

In the implementation process, the shooting interval and the shooting quantity can be set according to the shooting requirement, in the shooting process, whether the shooting is required to be continued or not can be judged by detecting the current shooting quantity, and the shooting is stopped until the current shooting quantity reaches the set shooting quantity, so that the picture shooting is finished according to the preset shooting parameters.

Further, if yes, synthesizing the photos into a video file according to a shooting sequence, including:

traversing the timestamps of all the photos in the current cache to determine the shooting sequence of the photos from morning to evening according to the timestamps;

sequentially analyzing the photos based on the shooting sequence to obtain analysis data;

converting the analysis data into video data;

synthesizing a video file based on the video data.

In the implementation process, the video data can be decoded and encoded according to the sequence from the morning to the evening of the picture shooting by traversing the timestamps, so that the synthesized video file is played according to the picture shooting sequence.

Further, the method further comprises:

judging whether the current analysis number of the photos reaches the shooting number or not;

if not, continuously detecting whether the pictures exist in the cache or not until the current analysis number reaches the shooting number.

In the implementation process, whether the analysis number of the pictures reaches the set shooting number or not is continuously detected, all the pictures are ensured to be analyzed and synthesized videos, and the pictures are prevented from being lost or not being completely synthesized videos.

An embodiment of the present application further provides a device for synthesizing a delayed video shot, where the device includes:

the photo shooting module is used for shooting photos according to preset shooting parameters;

the storage module is used for storing the shot pictures into a cache;

the first detection module is used for detecting whether a photo exists in the cache;

and the video synthesis module is used for synthesizing the photos into a video file according to the shooting sequence if the photos exist in the cache.

In the implementation process, the video is synthesized while the picture is shot, so that the required total time is the picture shooting time, the video synthesis time is saved, the operation of manually clicking the video synthesis is performed, and the problem that the video synthesis can be performed only by manually clicking by a user in the conventional method, and the time is wasted is solved.

Further, the preset photographing parameters include a photographing interval and a photographing number, and the photograph photographing module includes:

the quantity judging module is used for judging whether the current shooting quantity reaches the set shooting quantity;

and the shooting module is used for continuing shooting until the shooting number is up to the shooting number if the shooting number is not up to the shooting number.

In the implementation process, whether the current shooting number reaches the set shooting number or not is continuously detected, the shooting number is ensured to reach the set shooting number, and more or less shooting is avoided.

Further, the video composition module comprises:

the timestamp traversing module is used for traversing timestamps of all photos in the current cache so as to determine the shooting sequence of the photos from morning to evening according to the timestamps;

the analysis module is used for sequentially analyzing the photos based on the shooting sequence to obtain analysis data;

the video data module is used for converting the analysis data into video data;

and the synthesis module is used for synthesizing the video file based on the video data.

In the implementation process, the shooting sequence can be determined by traversing the time stamps of the photos, and the photos are analyzed and transcoded according to the shooting sequence of the photos, so that the photos are converted into video data, and the video data are sequentially synthesized to form a final video file.

Further, the apparatus further comprises:

the analysis number judging module is used for judging whether the current analysis number of the photos reaches the shooting number or not;

and the second detection module is used for continuously detecting whether the pictures exist in the cache or not if the current analysis number of the pictures does not reach the shooting number until the current analysis number reaches the shooting number.

In the implementation process, all the shot pictures can be ensured to be synthesized into the video file by judging the analysis number, and the shot pictures are prevented from being missed or lost.

An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to make a computer device execute any one of the foregoing methods for synthesizing a delayed video camera.

An embodiment of the present application further provides a readable storage medium, where computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the method for synthesizing a delayed video camera is performed.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.

Fig. 1 is a flowchart of a method for synthesizing a delayed shooting video according to an embodiment of the present disclosure;

fig. 2 is a flowchart illustrating photo shooting according to preset shooting parameters according to an embodiment of the present disclosure;

FIG. 3 is a flow chart of a composite video file provided by an embodiment of the present application;

fig. 4 is a flowchart of a process for determining the number of resolutions according to an embodiment of the present application;

fig. 5 is a flowchart of generating an MP4 file according to an embodiment of the present disclosure;

fig. 6 is a schematic diagram of a video composition apparatus for delayed photography according to an embodiment of the present application;

fig. 7 is a block diagram of a specific structure of a video synthesis apparatus for delayed shooting according to an embodiment of the present application.

Icon:

100-a photo taking module; 101-a quantity judgment module; 102-a camera module; 200-a storage module; 300-a first detection module; 400-a video composition module; 401-timestamp traversal module; 402-a resolution module; 403-video data module; 404-a synthesis module; 410-a resolution quantity judging module; 411 — second detection module.

Detailed Description

The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.

Example 1

Referring to fig. 1, fig. 1 is a flowchart illustrating a video composition method for delayed photography according to an embodiment of the present disclosure. The method is applied to time-lapse photography, the sum of the time spent on photograph shooting and the time spent on video synthesis is taken based on the time spent on the existing time-lapse photography and video synthesis, and manual operation is required for video synthesis. The method triggers video synthesis operation when a photo is shot, and the time interval of the photo shooting is generally between 1s (second) and 1min (minute), while the time required for synthesizing each frame of video is generally in the millisecond level, so that the video synthesis can be finished in the photo shooting process, the video synthesis does not need to spend additional time, the time consumed by delayed shooting is the photo shooting time, the video synthesis time is saved, the effect that the video synthesis can be finished after the photo shooting is finished can be achieved, and the user experience is improved; the method specifically comprises the following steps:

step S100: taking pictures according to preset shooting parameters;

before that, a delay shooting mode can be set for delay shooting, and after a shooting button is clicked, a video synthesis function can be started at the same time.

Step S200: storing the shot pictures in a cache;

step S300: detecting whether a photo exists in the cache;

step S400: and if so, synthesizing the pictures into a video file according to the shooting sequence.

In the implementation process, the shot pictures are stored in the cache, so that the shot pictures are prevented from being lost, for example, when the previous picture is synthesized, a plurality of new pictures are generated, and if the latest picture can be obtained without caching, the previous pictures are lost; on the other hand, the photos are placed in the cache, the operation of video synthesis is triggered by continuously detecting whether the photos exist in the cache, and the videos are synthesized when the photos are detected, so that the step of manual synthesis is omitted, the convenience is improved, the purpose of saving time is achieved, and the problem that the time is wasted because the video synthesis can be carried out only by manually clicking by a user in the conventional method is solved.

Specifically, the preset shooting parameters include a shooting interval and a shooting number, as shown in fig. 2, which is a flowchart for shooting a photo according to the preset shooting parameters, and specifically includes:

step S101: judging whether the current shooting number reaches the shooting number or not;

step S102: if not, continuing shooting until the current shooting number reaches the shooting number.

And starting to shoot pictures according to a preset shooting interval, if every 1min, the shooting quantity is 20, determining whether to continue shooting or not by detecting the current shooting quantity, if not, continuing shooting until the current shooting quantity reaches the shooting quantity, and stopping shooting.

And at the shooting interval, storing the shot pictures into a cache, acquiring the pictures to be synthesized when detecting that the pictures exist in the cache, and synthesizing the pictures to be synthesized.

As shown in fig. 3, which is a flowchart of synthesizing a video file, step S400 may specifically include:

step S401: traversing the timestamps of all the photos in the current cache to determine the shooting sequence of the photos from morning to evening according to the timestamps;

step S402: sequentially analyzing the photos based on the shooting sequence to obtain analysis data;

step S403: converting the analysis data into video data;

step S404: synthesizing a video file based on the video data.

Illustratively, the shooting order of the photos in the current cache can be determined by traversing the timestamps of all the photos in the current cache, taking out the earliest photo to begin parsing, and converting the parsed data, i.e., the image data into video data through decoding, encoding and other processes, for example, video encoding according to video encoding standards such as h.264, h.265 and the like, so as to obtain the video data, and the format of the video data may include, but is not limited to, MP4, MOV, AVI, WMV and the like, and the format of the video data is not limited herein.

As one embodiment, the shooting interval based on the delayed shooting and the video composition time are less than the shooting interval, so that the video data can be formed after the first parsing is completed, an unfinished video file can be generated from the video data, the video data formed after the second parsing and the unfinished video file of the first parsing are composited again, and so on, and when the number of the parses reaches the shooting number, the video data of the last photo and the unfinished video file are composited in a whole to generate the video file.

As another embodiment, the video data may be formed after the first photo is analyzed, the video data may be formed after the second photo is analyzed, and so on, when the number of the analyzed photos reaches the shooting number, the video data of all the photos are synthesized to generate the video file, and the method for synthesizing the video file is not limited herein.

In the process of analyzing the photos, the number of the analyzed photos needs to be determined to ensure that all the photos (the photos with the preset shooting number) are analyzed, so as to avoid omission or loss of the photos, as shown in fig. 4, a flow chart of the determination process of the number of the analyzed photos includes the following specific steps:

step S410: judging whether the current analysis number of the photos reaches the shooting number or not;

step S411: if not, continuously detecting whether the pictures exist in the cache or not until the current analysis number reaches the shooting number.

And judging whether the analysis number reaches the preset shooting number, if not, continuously detecting whether pictures exist in the cache or not, performing video synthesis, and if the analysis number reaches the shooting number, generating a video file, and finishing the whole operation.

Exemplarily, as shown in fig. 5, for the generation flowchart of the MP4 file, a delayed photography mode is set and delayed photography parameters (a photography interval and a photography number) are set so as to enter delayed photography, during which a photography function and a video synthesis function are started, and the photographed pictures are stored in a cache, and at the same time, it is continuously determined whether the photography number reaches a preset photography number, and the photography is completed until the photography number reaches the preset photography number, and the photography may be stopped; and judging whether a picture exists in the cache, if so, taking out the picture with the earliest shooting time for analysis to obtain analysis data, sending the analysis data to an MP4 packaging module for video synthesis, repeatedly judging whether the analysis number reaches the preset shooting number, if not, judging whether the picture exists in the cache again, synthesizing the video until the analysis number reaches the shooting number, completing the video synthesis, and generating an MP4 file.

The method can synthesize the video while taking the picture, saves the video synthesis time, is convenient to use, does not need to manually start the video synthesis operation after the picture is taken by a user, and solves the problem that the video synthesis can be carried out only by manually clicking by the user in the conventional method, so that the time is wasted.

Example 2

An embodiment of the present application provides a device for synthesizing a delayed video camera, which is applied to the method for synthesizing a delayed video camera in embodiment 1, as shown in fig. 6, which is a block diagram of the device, and the device specifically includes but is not limited to:

a photo shooting module 100, configured to take a photo according to preset shooting parameters;

the storage module 200 is used for storing the shot pictures into a cache;

a first detection module 300, configured to detect whether a photo exists in the cache;

and a video synthesizing module 400, configured to synthesize the photos into a video file according to a shooting order if there are photos in the cache.

As shown in fig. 7, the specific structural block diagram of the video synthesis apparatus for delayed photography is shown, where the preset photography parameters include a photography interval and a photography number, and the photograph shooting module 100 includes:

a quantity judgment module 101, configured to judge whether the current number of shots reaches a set shooting quantity;

the photographing module 102 is configured to continue photographing until the number of shots reaches the number of shots if the number of shots does not reach the number of shots.

The video composition module 400 includes:

a timestamp traversing module 401, configured to traverse timestamps of all photos currently in the cache, so as to determine a shooting order of the photos from morning to evening according to the timestamps;

an analyzing module 402, configured to sequentially analyze the photos based on the shooting order to obtain analysis data;

a video data module 403, configured to convert the analysis data into video data;

a composition module 404 for composing a video file based on the video data.

The device further comprises:

an analysis number judgment module 410, configured to judge whether the current analysis number of the photos reaches the shooting number;

a second detecting module 411, configured to, if the current parsing number of the photos does not reach the shooting number, continue to detect whether there are photos in the cache until the current parsing number reaches the shooting number.

The video synthesis is carried out while the picture is shot, so that the required total time is the picture shooting time, the video synthesis time is saved, the operation of manually clicking the video synthesis is carried out, and the problem of time waste caused by the fact that the video synthesis can be carried out only by manually clicking by a user in the conventional method is solved.

An embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to make the computer device execute the method for synthesizing a delayed video camera in embodiment 1.

An embodiment of the present application further provides a readable storage medium, where computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the method for synthesizing a time-lapse video camera in embodiment 1 is executed.

In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.

The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:字幕拼接图片的拼接方法、装置、电子设备和存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类