CN-115567752-B - Video template dynamic construction method, device and equipment based on data driving
Abstract
The invention discloses a video template dynamic construction method, a device and equipment based on data driving, wherein the method comprises the steps of reading the content of a dynamic data template and analyzing the content into element node trees, wherein a data source in the dynamic data template is analyzed into a data interface; the method comprises the steps of obtaining a data interface, obtaining return data, injecting the return data into an element node tree, traversing expressions of all element nodes by the return data, calculating assignment and simultaneously processing all logic conditions until the element node tree is traversed, checking the assigned element nodes, if the check is passed, constructing template content and outputting the template content to obtain a static video template. According to the method provided by the invention, the external data source in the dynamic data template is analyzed into the data interface, the data returned by the data interface is injected into the element node tree for calculation and assignment, and all logic conditions can be processed at the same time, so that the function of dynamically constructing video templates with different contents according to different data returned by the data interface can be realized.
Inventors
- CHEN WEIBIN
Assignees
- 深圳市思迪信息技术股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20220923
Claims (8)
- 1. A method for dynamically constructing a video template based on data driving, the method comprising: Acquiring a dynamic data template, reading the content of the dynamic data template and analyzing the content into an element node tree, wherein the content of the dynamic data template comprises a data source, and the data source is analyzed into a data interface, wherein the content of the dynamic data template further comprises an expansion script, and the expansion script can be used for realizing functions and exposing functions and is used for calculating complex expressions; Automatically requesting the data interface and obtaining return data, injecting the return data into the element node tree, traversing expressions of all element nodes of the element node tree through the return data, calculating and assigning the expressions while processing all logic conditions until the element node tree is traversed, wherein the return data is substituted into the element node tree, the element node tree comprises a plurality of element nodes, the element node comprises a plurality of expressions, and the expressions are Lamda expressions; Substituting the returned data into the Lamda expression, calculating, giving a value obtained by calculation to the Lamda expression, and simultaneously processing all logic conditions of the element nodes until the element nodes in the element node tree are traversed, wherein the logic conditions comprise condition branching and cyclic iteration logic; And when the element node tree is traversed, performing data verification on the assigned element node, and if the element node is verified, constructing the element node tree as template content and outputting the template content to obtain a static video template.
- 2. The method according to claim 1, wherein the performing data verification on the assigned element node, if the element node passes the verification, constructs the element node tree as template content and outputs the template content, and further comprising: if the element node does not pass the inspection, outputting data content of the inspection error and prompting correction.
- 3. The method of claim 1, wherein the obtaining a dynamic data template, reading the content of the dynamic data template and parsing into an element node tree, further comprises: Acquiring template content conforming to a video template language specification and storing the template content in an xml template file, wherein the xml template file stored with the template content is the dynamic data template; and importing the dynamic data template into a template analysis library, reading the content of the dynamic data template through the template analysis library, and analyzing the content into the element node tree.
- 4. The method of claim 1, wherein the data source is a user-defined data source and the return data is application/json formatted data.
- 5. The method of claim 1, wherein after obtaining the still video template, further comprising: and transmitting the static video template to a video editor or a rendering engine for video editing or video rendering output.
- 6. A data-driven video template dynamic construction device, the device comprising: The analysis module is used for acquiring a dynamic data template, reading the content of the dynamic data template and analyzing the content into an element node tree, wherein the content of the dynamic data template comprises a data source which is analyzed into a data interface, and the content of the dynamic data template further comprises an expansion script which can be used for realizing functions and exposure functions and is used for calculating complex expressions; The assignment module is used for automatically requesting the data interface and obtaining return data, injecting the return data into the element node tree, traversing expressions of all element nodes of the element node tree through the return data, calculating and assigning the expressions and simultaneously processing all logic conditions until the element node tree is traversed, wherein the return data is substituted into the element node tree, the element node tree comprises a plurality of element nodes, the element nodes comprise a plurality of expressions, and the expressions are Lamda expressions; Substituting the returned data into the Lamda expression, calculating, giving a value obtained by calculation to the Lamda expression, and simultaneously processing all logic conditions of the element nodes until the element nodes in the element node tree are traversed, wherein the logic conditions comprise condition branching and cyclic iteration logic; And the verification module is used for carrying out data verification on the assigned element nodes when the element node tree is traversed, and if the element node is verified, constructing the element node tree as template content and outputting the template content to obtain a static video template.
- 7. A data-driven based video template dynamic construction device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the data-driven based video template dynamic construction method according to any of claims 1-5 when the computer program is executed.
- 8. A storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data-driven video template dynamic construction method according to any of claims 1-5.
Description
Video template dynamic construction method, device and equipment based on data driving Technical Field The present invention relates to the field of video template construction technologies, and in particular, to a method, an apparatus, a device, and a storage medium for dynamically constructing a video template based on data driving. Background At present, along with the lifting of short video hot flashes, more and more industries have higher requirements on video output efficiency, and in combination with the continuous rise of big data economy, a video output mode is gradually changed from the traditional professional video clipper production to the automatic video production driven by big data. The traditional implementation scheme of dynamic processing of the video template is limited, such as global replacement of variable names for the content of the video template by using a data dictionary form, and is difficult to meet more complex dynamic requirements, or related fetch processing logic is stored in a code in a hard-coded form to cause a large amount of code redundancy, and is difficult to maintain and expand. In view of this, there is a need for further improvements to the current video template dynamic construction methods. Disclosure of Invention Therefore, the invention aims to at least solve the defects in the prior art to a certain extent, thereby providing a method, a device and equipment for dynamically constructing a video template based on data driving. In a first aspect, the present invention provides a method for dynamically constructing a video template based on data driving, the method comprising: acquiring a dynamic data template, reading the content of the dynamic data template and analyzing the content into an element node tree, wherein the content of the dynamic data template comprises a data source, and the data source is analyzed into a data interface; Automatically requesting the data interface and obtaining return data, injecting the return data into the element node tree, traversing expressions of all element nodes of the element node tree through the return data, calculating and assigning the expressions and simultaneously processing all logic conditions until the element node tree is traversed; And when the element node tree is traversed, performing data verification on the assigned element node, and if the element node is verified, constructing the element node tree as template content and outputting the template content to obtain a static video template. In a second aspect, the present invention provides a data-driven-based video template dynamic construction apparatus, the apparatus comprising, The analysis module is used for acquiring a dynamic data template, reading the content of the dynamic data template and analyzing the content into an element node tree, wherein the content of the dynamic data template comprises a data source, and the data source is analyzed into a data interface; The assignment module is used for automatically requesting the data interface and obtaining return data, injecting the return data into the element node tree, traversing the expressions of all element nodes of the element node tree through the return data, calculating and assigning the expressions and simultaneously processing all logic conditions until the element node tree is traversed; And the verification module is used for carrying out data verification on the assigned element nodes when the element node tree is traversed, and if the element node is verified, constructing the element node tree as template content and outputting the template content to obtain a static video template. In a third aspect, the present invention also provides a data-driven-based video template dynamic construction device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps in the data-driven-based video template dynamic construction method according to the first aspect when executing the computer program. In a fourth aspect, the present invention also provides a storage medium having stored thereon a computer program which, when executed, implements the steps of the data-driven video template dynamic construction method according to the first aspect. The invention provides a dynamic construction method, device and equipment of a video template based on data driving, which comprises the steps of obtaining a dynamic data template, reading the content of the dynamic data template and analyzing the content into an element node tree, wherein the content of the dynamic data template comprises a data source which is analyzed into a data interface, automatically requesting the data interface and obtaining return data, injecting the return data into the element node tree, traversing expressions of all element nodes of the element node tree through the return data, calculating and assigning all logic conditions while proc