Video resource generation method, device, equipment and storage medium
By performing serialization processing and historical sequence value judgment when generating requests for video resources, repeated generation of video resources is avoided, problems of high resource occupation and low reuse rate in the prior art are solved, and more efficient video resource management is achieved.
Patent Information
- Application Number
- CN202010617741.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2040-06-30
AI Technical Summary
When existing video generation technology frequently uses too much processor and memory resources, and the reuse rate of historical video resources is low, resulting in waste of resources.
When receiving the video resource generation request, the requested picture data and video generation parameters are extracted, and the video sequence value is obtained by serializing the video sequence value, and whether the video sequence value exists in the historical sequence value set. If it does not exist, the target video resource is generated based on the requested image data and the video generation parameters.
It effectively avoids the duplicate generation of the same video resources, reduces the use of processor and memory resources, and improves the reuse rate of video resources.
Smart Images

Figure CN113873321B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video processing technology, and in particular to a video resource generation method, device, equipment and storage medium. Background Art
[0002] With the rapid development of computer technology and Internet technology, the number of mobile users is also growing rapidly, and more and more mobile products such as application apps, microservices, and mini programs have emerged.
[0003] Currently, when mobile product developers or users produce video advertisements, they usually submit the images that users need for advertising video production to the corresponding video generation tool or service. The video generation tool or service then generates the corresponding advertising video resources based on these images and then delivers the advertisements.
[0004] In the prior art, for each image file uploaded by a user, the mobile terminal will call a video generation tool or service to produce a video. However, in actual situations, frequent video generation requests will greatly increase the demand for video production on the mobile terminal. When the video template is fixed, the content of the video resources generated by the same image is basically the same. The repeated production of video resources will, on the one hand, occupy a large amount of processor and memory resources on the mobile terminal. On the other hand, it will also lead to a low reuse rate of pre-generated historical video resources, resulting in a waste of resources.
[0005] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0006] The main purpose of the present invention is to provide a video resource generation method, device, equipment and storage medium, aiming to solve the technical problems that the existing video generation technology occupies a large amount of processor and memory resources and has a low reuse rate of historical video resources.
[0007] To achieve the above object, the present invention provides a method for generating video resources, the method comprising the following steps:
[0008] When receiving a video resource generation request, extracting requested image data and video generation parameters from the video resource generation request;
[0009] Serializing the requested image data and the video generation parameters to obtain a video sequence value;
[0010] Determine whether the video sequence value exists in the historical sequence value set;
[0011] When the video sequence value does not exist in the historical sequence value set, a target video resource is generated according to the requested image data and the video generation parameters.
[0012] Preferably, the video generation parameters include: a video template identifier;
[0013] The step of serializing the requested image data and the video generation parameters to obtain a video sequence value includes:
[0014] The video template identifier and the requested image data are serialized to obtain a video sequence value.
[0015] Preferably, the video generation parameters include: a user identifier and a video template identifier;
[0016] The step of serializing the requested image data and the video generation parameters to obtain a video sequence value includes:
[0017] The user identifier, the video template identifier and the requested image data are serialized to obtain a video sequence value.
[0018] Preferably, after the step of determining whether the video sequence value exists in the historical sequence value set, the method further comprises:
[0019] When the video sequence value exists in the historical sequence value set, searching a preset mapping table for a video resource identifier corresponding to the video sequence value, wherein the preset mapping table stores a correspondence between the video sequence value and the video resource identifier;
[0020] The target video resource is determined according to the video resource identifier.
[0021] Preferably, after the step of generating the target video resource according to the requested picture data and the video generation parameters when the video sequence value does not exist in the historical sequence value set, the method further comprises:
[0022] The target video resource is stored, and a video resource identifier corresponding to the target video resource is obtained;
[0023] The video sequence value is associated with the video resource identifier, and the association result is written into a preset mapping table.
[0024] Preferably, after the step of determining the target video resource according to the video resource identifier, the method further comprises:
[0025] Determining whether the target video resource meets user needs according to the requested image data;
[0026] When the target video resource meets the user demand, the target video resource is fed back to the video resource requesting end.
[0027] Preferably, the step of generating a target video resource according to the requested image data and the video generation parameters includes:
[0028] Reading the image to be spliced contained in the requested image data and the video template identifier contained in the video generation parameters;
[0029] Searching for a target video template corresponding to the video template identifier in a template database;
[0030] Splicing the pictures to be spliced in the target video template to obtain a spliced picture sequence;
[0031] The image sequence is rendered to obtain a target video resource.
[0032] In addition, to achieve the above-mentioned purpose, the present invention also proposes a video resource generation device, the video resource generation device comprising:
[0033] A parameter extraction module, configured to extract requested image data and video generation parameters from the video resource generation request when receiving the video resource generation request;
[0034] A parameter processing module, used for serializing the requested image data and the video generation parameters to obtain a video sequence value;
[0035] A value judgment module, used for judging whether the video sequence value exists in the historical sequence value set;
[0036] The video generation module is used to generate a target video resource according to the requested image data and the video generation parameters when the video sequence value does not exist in the historical sequence value set.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also proposes a video resource generation device, which includes: a memory, a processor, and a video resource generation program stored in the memory and executable on the processor, and the video resource generation program is configured to implement the steps of the video resource generation method described above.
[0038] In addition, to achieve the above-mentioned purpose, the present invention further proposes a storage medium, on which a video resource generation program is stored, and when the video resource generation program is executed by a processor, the steps of the video resource generation method described above are implemented.
[0039] The present invention extracts request image data and video generation parameters from a video resource generation request when receiving a video resource generation request; then serializes the request image data and video generation parameters to obtain a video sequence value; then determines whether the video sequence value exists in a historical sequence value set; if not, generates a target video resource according to the request image data and video generation parameters. Since the present invention does not directly generate video resources according to the request when receiving a video resource generation request, but first serializes the request image data and video generation parameters in the request to obtain a video sequence value, then determines whether the video sequence value exists in a historical sequence value set, and generates video resources for the user if it does not exist, it can effectively avoid repeated generation of the same video resources, reduce the occupation of processor and memory resources, and improve the reuse rate of video resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a structural diagram of a video resource generating device in a hardware operating environment involved in an embodiment of the present invention;
[0041] Figure 2 It is a flowchart of the first embodiment of the method for generating video resources of the present invention;
[0042] Figure 3 It is a flowchart of a second embodiment of the method for generating video resources of the present invention;
[0043] Figure 4 A schematic diagram of a flow chart of a third embodiment of a method for generating video resources according to the present invention;
[0044] Figure 5 This is a schematic diagram of video resource generation according to a third embodiment of the video resource generation method of the present invention;
[0045] Figure 6 This is a structural block diagram of the first embodiment of the video resource generation device of the present invention.
[0046] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0048] Reference Figure 1 , Figure 1 The present invention is a schematic diagram of the structure of a video resource generation device in a hardware operating environment according to an embodiment of the present invention.
[0049] like Figure 1As shown, the video resource generation device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0050] Those skilled in the art will understand that Figure 1 The structure shown in does not constitute a limitation on the video resource generating device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0051] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module and a video resource generation program.
[0052] exist Figure 1 In the video resource generating device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the video resource generating device of the present invention can be set in the video resource generating device, and the video resource generating device calls the video resource generating program stored in the memory 1005 through the processor 1001, and executes the video resource generating method provided by the embodiment of the present invention.
[0053] The embodiment of the present invention provides a method for generating video resources, referring to Figure 2 , Figure 2 It is a flowchart diagram of the first embodiment of the method for generating video resources of the present invention.
[0054] In this embodiment, the video resource generation method includes the following steps:
[0055] Step S10: when receiving a video resource generation request, extracting requested image data and video generation parameters from the video resource generation request;
[0056] It should be noted that the execution subject of the method of this embodiment can be a computing service device (such as a mobile phone, a tablet computer, a personal computer, etc.) with image (video) processing, network communication and program running functions, or an application client (hereinafter referred to as the client) loaded on the computing service device and with image processing and video generation functions. This embodiment and the following embodiments illustrate the video resource generation method of the present invention with the client as the above-mentioned execution subject.
[0057] In this step, the video resource generation request can be generated by the user triggering the video generation button through the client page, and the video resource generation request can carry the requested image data and video generation parameters. The requested image data can be obtained by the client according to the image uploaded by the user, which may include the image of the video resource to be produced, the name of the image, the resolution, size and / or format of the image; the video generation parameters may include the video template selected by the user, the identifier corresponding to the video template, the format, resolution, bit rate and / or duration of the generated video resource, and other data.
[0058] In a specific implementation, when the client receives a video resource generation request, it can parse the request and then extract the corresponding requested image data and video generation parameters from the parsing result.
[0059] Step S20: performing serialization processing on the requested image data and the video generation parameters to obtain a video sequence value;
[0060] It should be noted that the serialization process can be to characterize various types of data and then sort and combine the characterized data to obtain ordered character data. The so-called characterization is to convert data into data composed of letters, numbers or a combination of the two. For example, if the "name of the picture" in the requested picture data is "Picture 1", then characterizing "Picture 1" can obtain data composed of letters and numbers such as "tupian1" or "picture1".
[0061] It should be understood that, in actual applications, the content of the video resources finally generated by the same request image data and video generation parameters is basically the same. In order to ensure that video resources can be reused, the occupation of the mobile terminal processor and memory is reduced. In this embodiment, the client can determine whether the video resource that the user wants to generate this time has been generated in advance based on the request image data and video generation parameters contained in the video resource generation request submitted by the user. If so, the client can directly read the video resource directly from the corresponding database and send it to the user, thereby avoiding the repeated production of video resources and improving the reuse rate of video resources.
[0062] Furthermore, considering that in actual applications, if the client determines whether the video resource has been generated each time based on the requested image data and video generation parameters in the video resource generation request, it is bound to cause too many objects involved in the judgment process and too much calculation. To overcome this defect, in this embodiment, the client preferentially serializes the requested image data and video generation parameters contained in each received video generation request, and then directly determines whether the video resources required to be generated by different video generation requests are consistent based on the obtained sequence value (i.e., the video sequence value).
[0063] Furthermore, in order to reduce the amount of computation in the process of generating video sequence values and ensure that the generated video sequence values have high accuracy and reliability, as an implementation method of generating video sequence values, in this step, the client can generate video sequence values only based on the video template identifier included in the request image data and the video generation parameters. Specifically, the client can serialize the video template identifier and the request image data to obtain the video sequence value. The video template identifier can be information that can characterize the uniqueness of the video template, such as the template number, code and / or name.
[0064] Furthermore, considering the actual situation, generating video sequence values only based on requested image data and video template identifiers will make it easy for video resources generated by some users through the client to be obtained or stolen by other users. For example, when the video templates and uploaded images selected by users A and B are the same, the video sequence values ultimately generated by the client will be the same. At this time, if the above method is used, the client may directly push the video resources generated in advance for user A to user B for use. On the one hand, this will cause the video resources ultimately obtained by user B to be different from the video resources that he wants to generate, and on the other hand, it will also leak user A's video resources to user B.
[0065] To overcome the above problems, as another implementation method of generating a video sequence value, in this embodiment, the client can generate a video sequence value based on the requested image data, the video template identifier and the user identifier included in the video generation parameters. Specifically, the client can serialize the user identifier, the video template identifier and the requested image data to obtain a video sequence value. Among them, the user identifier can be the identification information corresponding to the user who initiated the video generation request, and the identification information can be the client login account, mobile phone number or other information that can represent the uniqueness of the user.
[0066] Furthermore, in order to ensure that the video sequence values generated by the client are the same when the same user triggers the same video resource generation request at different times (i.e., the user submits the same request image data and video generation parameters at different time periods), this embodiment further limits the generation of video sequence values. Specifically, the client may first detect whether there is non-character data in the user identifier, the video template identifier, and the requested image data; when the non-character data does not exist in the user identifier, the video template identifier, and the requested image data, the user identifier, the video template identifier, and the image information to be spliced are spliced in lexicographic order to obtain the spliced target characters; then the target characters are serialized to obtain the video sequence value.
[0067] It should be understood that the so-called lexicographic order, in mathematics, a dictionary or lexicographic order (also called lexical order, dictionary order, alphabetical order or lexicographic order) is a method of arranging words in alphabetical order based on alphabetical order. This embodiment sorts and combines the characters corresponding to the user identifier, the video template identifier and the requested image data in lexicographic order, so that the video sequence values generated by the same video resource generation request are the same, thereby ensuring the uniqueness of the video sequence value.
[0068] Furthermore, in this embodiment, the client can calculate the hash value corresponding to the target character through a preset message digest algorithm, and use the hash value as the video sequence value. The preset message digest algorithm can be a hash algorithm, an MD5 (Message Digest Algorithm MD5) algorithm, etc. In practical applications, the generation method of the video sequence value can be set according to actual conditions, and this embodiment does not impose specific restrictions on this.
[0069] Step S30: determining whether the video sequence value exists in the historical sequence value set;
[0070] It should be noted that, in this step, the historical sequence value set is used to store the video sequence values corresponding to the video resource generation requests of the generated video resources; if the video sequence value corresponding to a video resource generation request exists in the set, it indicates that the client has generated video resources for the video resource generation request, otherwise it indicates that the client has not generated video resources for the video resource generation request.
[0071] In a specific implementation, when generating a video sequence value, the client may first search in a historical sequence value set whether the video sequence value exists, and then perform corresponding operations according to the search result.
[0072] Step S40: When the video sequence value does not exist in the historical sequence value set, a target video resource is generated according to the requested image data and the video generation parameters.
[0073] It should be understood that if the client detects that the currently generated video sequence value does not exist in the historical sequence value set, it means that the client has not previously generated video resources for the currently received video resource generation request. At this time, the client needs to generate the corresponding target video resource for the user based on the requested image data and video generation parameters.
[0074] In a specific implementation, the client may first read the images to be spliced contained in the requested image data, and then splice and render these images to be spliced according to the video generation parameters to obtain the target video resources.
[0075] This embodiment extracts the requested image data and video generation parameters from the video resource generation request when receiving the video resource generation request; then serializes the requested image data and video generation parameters to obtain a video sequence value; then determines whether the video sequence value exists in the historical sequence value set; if not, generates the target video resource according to the requested image data and video generation parameters. Since this embodiment does not directly generate the video resource according to the request when receiving the video resource generation request, but first serializes the requested image data and video generation parameters in the request to obtain a video sequence value, then determines whether the video sequence value exists in the historical sequence value set, and generates the video resource for the user if it does not exist, it can effectively avoid the repeated generation of the same video resource, reduce the occupation of processor and memory resources, and improve the reuse rate of video resources.
[0076] refer to Figure 3 , Figure 3 Schematic diagram of the flow of the second embodiment of the method for generating video resources of the present invention.
[0077] Based on the first embodiment above, in this embodiment, after step S30, the method further includes:
[0078] Step S40': when the video sequence value exists in the historical sequence value set, searching for the video resource identifier corresponding to the video sequence value in a preset mapping table, wherein the preset mapping table stores the correspondence between the video sequence value and the video resource identifier;
[0079] It is understandable that the existence of a video sequence value in the historical sequence value set indicates that the client has generated a corresponding historical video resource for the user. In this case, the client can search for the video resource and send it to the user.
[0080] It should be understood that in order to facilitate the client to quickly and accurately find the historical video resource. A mapping table can be established in advance in the database corresponding to the client to store the corresponding relationship between the video sequence value and the video resource identifier, so that when the client determines that there is a video sequence value in the historical sequence value set, the mapping table can be used to quickly determine the video resource identifier, and then accurately obtain the corresponding target video resource according to the video resource identifier. The video resource identifier can be unique identification information of each video resource, such as the name, number, storage path, etc. corresponding to the video resource.
[0081] Step S50': Determine the target video resource according to the video resource identifier.
[0082] In a specific implementation, after the client finds the video resource identifier corresponding to the video sequence value in the preset mapping table, the client can quickly acquire the target video resource according to the video resource identifier.
[0083] In addition, it should be noted that the data in the above mapping table in this embodiment is not fixed, and the client can update or modify the data in the mapping table at any time according to actual conditions. Accordingly, after the above step S40 in this embodiment, the following steps are further included:
[0084] Step S50: storing the target video resource and obtaining a video resource identifier corresponding to the target video resource;
[0085] In a specific implementation, after the client generates the target video resource according to the requested image data and video generation parameters, it can also store the generated target video resource in the corresponding database, and then obtain the video resource identifier corresponding to the target video resource, so as to update the preset mapping table according to the video resource identifier.
[0086] Of course, in this embodiment, after storing the target video resource, the client will also update the video sequence value corresponding to the target video resource to the above historical sequence value set to achieve timely update of the historical sequence value set.
[0087] Step S60: Associating the video sequence value with the video resource identifier, and writing the association result into a preset mapping table.
[0088] In a specific implementation, the client may associate the video sequence value with the obtained video resource identifier, and then write the association result into a preset mapping table, so that the data in the preset mapping table is basically the latest data, thereby improving the efficiency of subsequent users in video generation.
[0089] It should be understood that in the actual video generation scenario, such a situation may occur: after a user submits a video resource generation request for the first time, he finds that the target video resource obtained is not the video resource he wants, so he resubmits the same video resource generation request. If the client still pushes the video resource found according to the video sequence value to the user at this time, the user's usage experience will be reduced, resulting in user loss. Therefore, in order to solve such problems, in this embodiment, after the step S50', the client will also perform the following steps to ensure the user's higher usage experience as much as possible.
[0090] Step S60': judging whether the target video resource meets the user's needs according to the requested image data;
[0091] In a specific implementation, the client can determine whether the found target video resource meets the user's needs based on certain parameters included in the requested image data. The user needs can be set by the user, for example, the resolution of the image needs to be higher or lower than a certain preset threshold, the resolution of the image when played in the video resource needs to be higher or lower than a certain preset threshold, the time point and duration of the image appearing in the video resource needs to meet certain time conditions, etc.
[0092] As an implementation method for determining whether the target video resource meets user requirements, in this embodiment, the client may prioritize the resolution determination of the target video resource. Specifically, the client may read the image resolution corresponding to the image to be spliced in the requested image data; and then determine whether the target video resource meets user requirements based on the image resolution. Furthermore, the client may also obtain the playback resolution of the image to be spliced in the target video resource; and then detect whether the image resolution is consistent with the playback resolution to obtain a detection result; and then determine whether the target video resource meets user requirements based on the detection result.
[0093] In a specific implementation, if the client detects that the target video resource does not meet the user's needs, the client can regenerate a video resource that meets the user's needs for the user according to the video resource generation request.
[0094] Step S70': when the target video resource meets the user's needs, the target video resource is fed back to the video resource requesting end.
[0095] If the client detects that the target video resource meets the user's needs, the obtained target video resource can be directly fed back to the video resource requesting end, that is, the user.
[0096] When the client of this embodiment detects that the currently obtained video sequence value exists in the historical sequence value set, it directly searches the preset mapping table for the video resource identifier corresponding to the video sequence value, and then determines the target video resource based on the video resource identifier, and then detects whether the target video resource meets the user's needs. If it does, the target video resource is pushed to the user. On the one hand, it can ensure that the video obtained by the user meets his own needs, and on the other hand, it reduces repeated video production and further improves the reuse rate of video resources.
[0097] refer to Figure 4 , Figure 4 FIG. 4 is a flow chart of a third embodiment of a method for generating video resources according to the present invention.
[0098] Based on the above first embodiment, in this embodiment, step S40 may specifically include:
[0099] Step S401: reading the image to be spliced contained in the requested image data and the video template identifier contained in the video generation parameters;
[0100] It should be understood that the pictures to be spliced are pictures uploaded by the user through the client for generating video resources. These pictures are generally in batches, and the size, resolution and / or picture format of the pictures are not necessarily the same.
[0101] In a specific implementation, the client may read the image to be spliced from the requested image data, and read the video template identifier from the video generation parameters.
[0102] Step S402: searching a template database for a target video template corresponding to the video template identifier;
[0103] It is understandable that after obtaining the video template identifier selected by the user, the client can search for the target video template corresponding to the video template identifier in the template database by using an exact matching search method according to the identifier.
[0104] Among them, the exact match search refers to a search method in which the search term is exactly the same as a field in the resource library. This embodiment adopts the exact match search method to ensure the accuracy of obtaining the target video template.
[0105] Step S403: stitching the pictures to be stitched in the target video template to obtain a stitched picture sequence;
[0106] In a specific implementation, after the client obtains the target video template, it can stitch the images to be stitched in the target video template to obtain a stitched image sequence.
[0107] Furthermore, considering that the resolution or aspect ratio is set for the advertising pictures or videos in the usual video templates, in order to make the video resources finally generated by the client meet the advertising delivery standards set by the video template. In this embodiment, before the client performs image stitching, it will also obtain the image resolution of the picture to be stitched and the reference image resolution corresponding to the target video template; then detect whether the image resolution of the picture to be stitched is consistent with the reference image resolution; if not, adjust the image resolution of the picture to be stitched according to the reference image resolution to obtain the target picture to be stitched; then stitch the target picture to be stitched in the target video template to obtain a stitched picture sequence.
[0108] Furthermore, after the resolution of the image meets the corresponding template standard, it is also necessary to ensure that the size of the image is consistent with the size of the display area in the template used to display the image or video resource. Specifically, the client can read the image position information corresponding to the image to be spliced from the requested image data; then determine the embedded area of the image to be spliced in the target video template according to the image position information; then adjust the image size of the image to be spliced according to the size of the embedded area, and splice the adjusted images to obtain a spliced image sequence.
[0109] Step S404: Render the picture sequence to obtain a target video resource.
[0110] In a specific implementation, after obtaining the image sequence, the client can render each frame of the image sequence to obtain the final target video resource.
[0111] Here, combined with Figure 5 The video resource generation method of this embodiment is described in detail.
[0112] refer to Figure 5 , Figure 5 This is a schematic diagram of video resource generation according to the third embodiment of the video resource generation method of the present invention.
[0113] like Figure 5 As shown, different video templates may have display areas with different sizes, positions and resolutions (such as display areas 1, 2, and 3). Different display areas may also have different display effects. For example, Figure 5 In the video template shown, display area 1 is used to display video resources, display area 2 is used to display pictures, and display area 3 is used to display picture sequences.
[0114] In a specific implementation, after the client reads a number of images to be spliced from the requested image data, it can first detect the number of images to be spliced; and then determine the image display area of the image to be spliced in the video template according to the number of images. Of course, in this embodiment, the determination of the image display area can also be directly determined according to the image position information corresponding to the image to be spliced.
[0115] After determining the image display area, the client can adjust the image to be stitched according to the reference image resolution and area size corresponding to the image display area, and then produce and display corresponding video resources or images based on the adjusted images.
[0116] As an implementation method, if the client detects that the number of pictures is higher than a certain threshold, it can roughly determine that the display area corresponding to these pictures to be spliced is display area 1. At this time, the client can first obtain the first reference image resolution and the first area size corresponding to display area 1, and then adjust the size of the pictures to be spliced according to the first area size, and then detect the resolution of the pictures to be spliced after the size adjustment according to the first reference image resolution. If the resolution needs to be adjusted, the pictures to be spliced are spliced after the resolution adjustment to obtain the spliced picture sequence, and finally the spliced picture sequence is rendered to obtain the target video resource. At this time, the client can embed the target video resource into display area 1 for display. Of course, in this embodiment, if the target video resource finally obtained is to be accompanied by sound effects, the corresponding audio file can also be embedded in the target video resource.
[0117] If the client detects that the number of pictures is lower than another threshold (i.e., the number of pictures uploaded by the user is too small to generate video resources), it can be roughly determined that the display area corresponding to these pictures to be spliced is display area 2. At this time, the client can first obtain the second reference image resolution and the second area size corresponding to display area 2, and then adjust the size of the pictures to be spliced according to the second area size, and then perform resolution detection on the resized pictures to be spliced according to the second reference image resolution. If the resolution needs to be adjusted, the resolution of the pictures to be spliced is adjusted, and the pictures with the adjusted resolution are embedded in display area 2. The pictures displayed in display area 2 can be displayed in the form of slides.
[0118] Correspondingly, if the client detects that the number of pictures is within a certain threshold range (i.e., the number of pictures uploaded by the user is not enough to generate video resources, but is suitable for display in the form of a single picture), it can be determined that the display area corresponding to these pictures to be spliced is display area 3. Similarly, at this time, the client can first obtain the third reference image resolution and the third area size corresponding to display area 3, and then adjust the size of the picture to be spliced according to the third area size, and then perform resolution detection on the resized picture to be spliced according to the third reference image resolution. If the resolution needs to be adjusted, after the resolution of the picture to be spliced is adjusted, the pictures with adjusted resolutions are combined according to the picture display order contained in the requested picture data to obtain a picture sequence, and then the picture sequence is embedded in display area 3. The picture sequence displayed in display area 3 can be displayed in a marquee manner.
[0119] This embodiment reads the to-be-joined pictures contained in the requested picture data and the video template identifier contained in the video generation parameters; then searches for the target video template corresponding to the video template identifier in the template database; then joins the to-be-joined pictures in the target video template to obtain a joined picture sequence; and finally renders the picture sequence to obtain the target video resource, thereby ensuring the smooth generation of the video resource. At the same time, by verifying the picture resolution, picture position, and picture size, the finally generated video resource can better meet the needs of the user, thereby improving the user's video generation experience.
[0120] In addition, an embodiment of the present invention further provides a storage medium, on which a video resource generation program is stored. When the video resource generation program is executed by a processor, the steps of the video resource generation method described above are implemented.
[0121] Since the storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.
[0122] Reference Figure 6 , Figure 6 This is a structural block diagram of the first embodiment of the video resource generation device of the present invention.
[0123] like Figure 6 As shown, the video resource generation device proposed in the embodiment of the present invention includes:
[0124] The parameter extraction module 501 is used to extract the requested image data and the video generation parameters from the video resource generation request when receiving the video resource generation request;
[0125] A parameter processing module 502 is used to perform serialization processing on the requested image data and the video generation parameters to obtain a video sequence value;
[0126] A value determination module 503, used to determine whether the video sequence value exists in the historical sequence value set;
[0127] The video generation module 504 is configured to generate a target video resource according to the requested image data and the video generation parameters when the video sequence value does not exist in the historical sequence value set.
[0128] This embodiment extracts the requested image data and video generation parameters from the video resource generation request when receiving the video resource generation request; then serializes the requested image data and video generation parameters to obtain a video sequence value; then determines whether the video sequence value exists in the historical sequence value set; if not, generates the target video resource according to the requested image data and video generation parameters. Since this embodiment does not directly generate the video resource according to the request when receiving the video resource generation request, but first serializes the requested image data and video generation parameters in the request to obtain a video sequence value, then determines whether the video sequence value exists in the historical sequence value set, and generates the video resource for the user if it does not exist, it can effectively avoid the repeated generation of the same video resource, reduce the occupation of processor and memory resources, and improve the reuse rate of video resources.
[0129] In one embodiment, the video generation parameters include: a video template identifier; accordingly, the parameter processing module 502 is further used to perform serialization processing on the video template identifier and the requested image data to obtain a video sequence value.
[0130] In one embodiment, the video generation parameters include: a user identifier and a video template identifier; accordingly, the parameter processing module 502 is further used to serialize the user identifier, the video template identifier and the requested image data to obtain a video sequence value.
[0131] In one embodiment, the parameter processing module 502 is also used to detect whether non-character data exists in the user identifier, the video template identifier and the requested image data; when the non-character data does not exist in the user identifier, the video template identifier and the requested image data, the user identifier, the video template identifier and the image information to be spliced are spliced in lexicographic order to obtain the spliced target characters; the target characters are serialized to obtain a video sequence value.
[0132] In one embodiment, the parameter processing module 502 is further configured to calculate a hash value corresponding to the target character by using a preset message digest algorithm, and use the hash value as a video sequence value.
[0133] In one embodiment, the numerical judgment module 503 is also used to search for a video resource identifier corresponding to the video sequence value in a preset mapping table when the video sequence value exists in the historical sequence value set, and the preset mapping table stores the correspondence between the video sequence value and the video resource identifier; and determine the target video resource according to the video resource identifier.
[0134] In one embodiment, the video generation module 504 is further used to store the target video resource and obtain a video resource identifier corresponding to the target video resource; associate the video sequence value with the video resource identifier, and write the association result into a preset mapping table.
[0135] In one embodiment, the numerical judgment module 503 is further used to judge whether the target video resource meets the user's needs according to the requested image data; when the target video resource meets the user's needs, the target video resource is fed back to the video resource requesting end.
[0136] In one embodiment, the numerical determination module 503 is further configured to read the image resolution corresponding to the image to be spliced in the requested image data; and determine whether the target video resource meets the user's requirements based on the image resolution.
[0137] In one embodiment, the numerical judgment module 503 is also used to obtain the playback resolution of the image to be spliced in the target video resource; detect whether the image resolution is consistent with the playback resolution to obtain a detection result; and determine whether the target video resource meets user requirements based on the detection result.
[0138] In one embodiment, the video generation module 504 is also used to read the pictures to be spliced contained in the requested picture data and the video template identifier contained in the video generation parameters; search for the target video template corresponding to the video template identifier in the template database; splice the pictures to be spliced in the target video template to obtain a spliced picture sequence; and render the picture sequence to obtain a target video resource.
[0139] In one embodiment, the video generation module 504 is further used to obtain the image resolution of the picture to be spliced and the reference image resolution corresponding to the target video template; detect whether the image resolution of the picture to be spliced is consistent with the reference image resolution; when the image resolution of the picture to be spliced is inconsistent with the reference image resolution, adjust the image resolution of the picture to be spliced according to the reference image resolution to obtain the target picture to be spliced; and splice the target picture to be spliced in the target video template to obtain a spliced picture sequence.
[0140] In one embodiment, the video generation module 504 is also used to read the image position information corresponding to the image to be spliced from the requested image data; determine the embedded area of the image to be spliced in the target video template according to the image position information; adjust the image size of the image to be spliced according to the area size of the embedded area, and splice the adjusted images to obtain a spliced image sequence.
[0141] Other embodiments or specific implementations of the video resource generation device of the present invention can refer to the above-mentioned method embodiments, which will not be described in detail here.
[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0143] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0145] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for generating video resources, characterized in that: The video resource generation method comprises: When receiving a video resource generation request, extracting requested image data and video generation parameters from the video resource generation request, the video generation parameters including: a video template identifier; Serializing the requested image data and the video generation parameters to obtain a video sequence value; Determine whether the video sequence value exists in the historical sequence value set; When the video sequence value does not exist in the historical sequence value set, a target video resource is generated according to the requested image data and the video generation parameters.
2. The video resource generation method according to claim 1, characterized in that: The step of serializing the requested image data and the video generation parameters to obtain a video sequence value includes: The video template identifier and the requested image data are serialized to obtain a video sequence value.
3. The video resource generation method according to claim 1, characterized in that: The video generation parameters also include: user identification; The step of serializing the requested image data and the video generation parameters to obtain a video sequence value includes: The user identifier, the video template identifier and the requested image data are serialized to obtain a video sequence value.
4. The video resource generation method according to claim 3, characterized in that: The step of serializing the video template identifier and the requested image data to obtain a video sequence value includes: Detecting whether there is non-character data in the user identifier, the video template identifier, and the requested image data; When the non-character data does not exist in the user identifier, the video template identifier, and the requested image data, splicing the user identifier, the video template identifier, and the image information to be spliced contained in the requested image data in lexicographic order to obtain the spliced target character; The target characters are serialized to obtain video sequence values.
5. The video resource generation method according to claim 4, characterized in that: The step of performing serialization processing on the target characters to obtain a video sequence value comprises: A hash value corresponding to the target character is calculated by a preset message digest algorithm, and the hash value is used as a video sequence value.
6. The video resource generation method according to any one of claims 1 to 5, characterized in that: After the step of determining whether the video sequence value exists in the historical sequence value set, the method further includes: When the video sequence value exists in the historical sequence value set, searching a preset mapping table for a video resource identifier corresponding to the video sequence value, wherein the preset mapping table stores a correspondence between the video sequence value and the video resource identifier; The target video resource is determined according to the video resource identifier.
7. The video resource generation method according to claim 6, characterized in that: After the step of generating a target video resource according to the requested image data and the video generation parameters when the video sequence value does not exist in the historical sequence value set, the method further includes: The target video resource is stored, and a video resource identifier corresponding to the target video resource is obtained; The video sequence value is associated with the video resource identifier, and the association result is written into a preset mapping table.
8. The video resource generation method according to claim 6, characterized in that: After the step of determining the target video resource according to the video resource identifier, the method further includes: Determining whether the target video resource meets user needs according to the requested image data; When the target video resource meets the user demand, the target video resource is fed back to the video resource requesting end.
9. The video resource generation method according to claim 8, characterized in that: The step of judging whether the target video resource meets the user's requirements according to the requested image data comprises: Read the image resolution corresponding to the image to be stitched in the requested image data; It is determined whether the target video resource meets user requirements according to the image resolution.
10. The video resource generation method according to claim 9, characterized in that: The step of judging whether the target video resource meets the user's requirements according to the image resolution includes: Obtaining the playback resolution of the image to be spliced in the target video resource; Detecting whether the image resolution is consistent with the playback resolution, and obtaining a detection result; It is determined whether the target video resource meets the user's needs according to the detection result.
11. The video resource generation method according to any one of claims 1 to 5, characterized in that: The step of generating a target video resource according to the requested image data and the video generation parameters includes: Reading the image to be spliced contained in the requested image data and the video template identifier contained in the video generation parameters; Searching for a target video template corresponding to the video template identifier in a template database; Splicing the pictures to be spliced in the target video template to obtain a spliced picture sequence; The image sequence is rendered to obtain a target video resource.
12. The video resource generation method according to claim 11, characterized in that: Before the step of splicing the pictures to be spliced in the target video template to obtain a spliced picture sequence, the method further includes: Obtaining the image resolution of the image to be stitched and the reference image resolution corresponding to the target video template; Detecting whether the image resolution of the image to be stitched is consistent with the reference image resolution; When the image resolution of the picture to be stitched is inconsistent with the reference image resolution, adjusting the image resolution of the picture to be stitched according to the reference image resolution to obtain a target picture to be stitched; The step of splicing the pictures to be spliced in the target video template to obtain a spliced picture sequence includes: The target pictures to be spliced are spliced in the target video template to obtain a spliced picture sequence.
13. The video resource generation method according to claim 11, characterized in that: The step of splicing the pictures to be spliced in the target video template to obtain a spliced picture sequence includes: Reading the picture position information corresponding to the picture to be spliced from the requested picture data; Determine an embedding area of the image to be spliced in the target video template according to the image position information; The image size of the to-be-joined pictures is adjusted according to the area size of the embedded area, and the adjusted pictures are joined to obtain a joined picture sequence.
14. A video resource generation device, characterized in that: The video resource generating device comprises: A parameter extraction module is used to extract the requested image data and video generation parameters from the video resource generation request when receiving the video resource generation request, wherein the video generation parameters include: a video template identifier; A parameter processing module, used for serializing the requested image data and the video generation parameters to obtain a video sequence value; A value judgment module, used for judging whether the video sequence value exists in the historical sequence value set; The video generation module is used to generate a target video resource according to the requested image data and the video generation parameters when the video sequence value does not exist in the historical sequence value set.
15. A video resource generating device, characterized in that: The device comprises: a memory, a processor, and a video resource generation program stored in the memory and executable on the processor, wherein the video resource generation program is configured to implement the steps of the video resource generation method according to any one of claims 1 to 13.
16. A storage medium, characterized in that: The storage medium stores a video resource generation program, and when the video resource generation program is executed by the processor, the steps of the video resource generation method according to any one of claims 1 to 13 are implemented.
Citation Information
Patent Citations
Programme generating method and system
CN101072323A
Picture processing method and apparatus
CN105678688A
Picture segmentation processing storage method and system
CN106980655A