Script generation method, apparatus, device, and computer program product
By analyzing video frames of the page operation process, the target document is generated and the script document is arranged, which solves the problem that script recording files cannot be reused in the existing technology, and realizes efficient script generation and automated testing.
Patent Information
- Application Number
- CN202111077576.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-14
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2041-09-14
AI Technical Summary
Existing script recording files cannot be reused, resulting in a large workload for script recording. Furthermore, existing recording and playback tools are complex to use and cannot support all device systems, making it impossible to effectively automate testing.
By analyzing video frames based on page operation flow, scene switching frames are determined, image frame sets are obtained, and target templates and variable domain coordinates are matched in preset templates to generate target documents. Finally, script documents are arranged to achieve automated script generation.
It improves the reusability of recorded scripts, reduces the workload of script recording, and improves the efficiency and accuracy of script generation.
Smart Images

Figure CN113868123B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a script generation method, device, equipment and computer program product. BACKGROUND
[0002] With the rapid development of mobile Internet, the software function of terminal is more and more, the corresponding software test work becomes more and more complex, the front-end interface test is a routine operation of interface development, the traditional interface test method usually needs to arrange the test personnel in advance, and the test personnel repeatedly clicks the DOM (Document Object Model, Document Object Model) node on the test interface in each interface test process, however, this kind of way is extremely dependent on manual operation, the test efficiency is low, and the difference of manual operation may cause the test result to be inaccurate.
[0003] In order to solve the above problems, in a possible implementation, the software automation test based on the recording playback principle is adopted, so that a large amount of manual test work is achieved through automation test, which greatly improves the software test efficiency. However, the existing various recording playback tools have complex use steps and cannot support all device systems, and can only record a certain type in the web application. With the acceleration of software iteration speed and the improvement of software function integration complexity, the terminal software automation test script recording time is urgent, a large number of automation test script functions cannot be reused, multiple script recording files cannot be combined to form a new script recording file, resulting in large script recording workload.
[0004] The above content is only used to assist in understanding the technical solutions of the present application, and does not represent the acknowledgement of the above content as prior art. SUMMARY
[0005] The main purpose of the present application is to provide a script generation method, device, equipment and computer program product, which aims to solve the technical problem of large script recording workload caused by the fact that the existing script recording file cannot be reused.
[0006] In order to achieve the above purpose, the present application provides a script generation method, which comprises the following steps:
[0007] Based on each video frame of the first video corresponding to the page operation process, the first scene switching frame corresponding to the first video is determined, and an image frame set is obtained;
[0008] In each preset template, the target template corresponding to each first scene switching frame in the image frame set is obtained, and the preset variable domain coordinate corresponding to the target template is obtained;
[0009] In each first scene switching frame of the image frame set, a variable value corresponding to the preset variable domain coordinate is obtained, and each variable value is assigned to a corresponding target template to obtain a target document;
[0010] Based on the order of each first scene switching frame in the image frame set, each target document is arranged to obtain a script document corresponding to the first video.
[0011] Further, the step of obtaining, in each preset template, a target template corresponding to each first scene switching frame in the image frame set comprises:
[0012] A first similarity between each first scene switching frame in the image frame set and each preset template is determined respectively;
[0013] Based on the first similarity, a target template corresponding to each first scene switching frame in the image frame set is determined.
[0014] Further, the step of determining, based on each video frame of the first video corresponding to the page operation process, a first scene switching frame corresponding to the first video to obtain an image frame set comprises:
[0015] The number of pixel points in each video frame falling into each preset pixel range is determined, and based on the number of pixel points, a second similarity between adjacent two frames in each video frame is determined;
[0016] Based on the second similarity, a first scene switching frame corresponding to the first video is determined to obtain an image frame set.
[0017] Further, the target template comprises a plurality of, and the preset variable domain coordinate comprises a plurality of; the step of obtaining, in each first scene switching frame of the image frame set, a variable value corresponding to the preset variable domain coordinate, and assigning each variable value to a corresponding target template to obtain a target document comprises:
[0018] For each target template, a current scene switching frame corresponding to the current target template is determined in each first scene switching frame;
[0019] Based on the preset variable domain coordinate corresponding to the current target template, a current variable value is obtained in the current scene switching frame;
[0020] The current variable value is assigned to the current target template to obtain a target document corresponding to the current scene switching frame.
[0021] Further, before the step of determining, based on each video frame of the first video corresponding to the page operation process, a first scene switching frame corresponding to the first video to obtain an image frame set, the method further comprises:
[0022] obtain a second scene switching frame corresponding to the second video based on the page operation process;
[0023] determine an intermediate document corresponding to each page operation step in the second video based on the second scene switching frame;
[0024] obtain script information in each intermediate document, and determine a preset template corresponding to the second video and preset variable domain coordinates corresponding to the preset template based on the script information.
[0025] Further, the step of determining the preset template corresponding to the second video and the preset variable domain coordinates corresponding to the preset template based on the script information comprises:
[0026] obtain each script content in each script information, and determine a number of occurrences of each script content in the script information;
[0027] determine a support degree corresponding to each script content based on the number of occurrences, and determine a variable domain and a template script in the script information based on the support degree;
[0028] determine the preset template based on the template script, and determine preset variable domain coordinates corresponding to the preset template based on the variable domain.
[0029] Further, the step of determining the intermediate document corresponding to each page operation step in the second video based on the second scene switching frame comprises:
[0030] perform video analysis on each second scene switching frame to obtain page information corresponding to each second scene switching frame;
[0031] perform page structure analysis on each page information to obtain the intermediate document.
[0032] In addition, to achieve the above object, the present application further provides a script generation device, which comprises:
[0033] a determination module configured to determine a first scene switching frame corresponding to a first video based on each video frame of the first video corresponding to a page operation process, and obtain an image frame set;
[0034] a first obtaining module configured to obtain a target template corresponding to each first scene switching frame in the image frame set in each preset template, and obtain preset variable domain coordinates corresponding to the target template;
[0035] A second acquisition module is configured to acquire a variable value corresponding to the preset variable domain coordinate in each first scene switching frame of the image frame set, and assign each variable value to a corresponding target template to obtain a target document;
[0036] A script arrangement module is configured to arrange each target document based on the sequence of each first scene switching frame in the image frame set to obtain a script document corresponding to the first video.
[0037] In addition, to achieve the above object, the present application also provides a script generation device, which comprises a memory, a processor, and a script generation program stored in the memory and executable on the processor, and the script generation program implements the steps of the script generation method when executed by the processor.
[0038] In addition, to achieve the above object, the present application also provides a computer program product comprising a computer program, which implements the steps of the script generation method when executed by a processor.
[0039] The present application determines a first scene switching frame corresponding to a first video based on each video frame of the first video corresponding to a page operation process, obtains an image frame set, then acquires a target template corresponding to each first scene switching frame in the image frame set in each preset template, and acquires a preset variable domain coordinate corresponding to the target template, then acquires a variable value corresponding to the preset variable domain coordinate in each first scene switching frame of the image frame set, and assigns each variable value to a corresponding target template to obtain a target document, then arranges each target document based on the sequence of each first scene switching frame in the image frame set to obtain a script document corresponding to the first video, realizes intermediate document template variable replacement or automatic arrangement of a newly uploaded first video through a stored preset template, and further quickly generates a new business scenario script document, greatly improves the reuse capability of a recorded script, and reduces the workload of script recording. BRIEF DESCRIPTION OF DRAWINGS
[0040] Figure 1 is a structural schematic diagram of a script generation device in a hardware running environment related to an embodiment scheme of the present application;
[0041] Figure 2 is a flowchart of a first embodiment of a script generation method of the present application;
[0042] Figure 3 is a schematic diagram of a corresponding relationship between script content and support degree in the script generation method of the present application;
[0043] Figure 4 is a flowchart of an embodiment of a script generation device of the present application.
[0044] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0045] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0046] like Figure 1 As shown, Figure 1 This is a schematic diagram of the structure of the script generation device in the hardware operating environment involved in the embodiments of the present invention.
[0047] The script generation device in this embodiment of the invention can be a PC, or a smartphone, tablet computer, e-book reader, MP3 (Moving Picture Experts Group Audio Layer III) player, MP4 (Moving Picture Experts Group Audio Layer IV) player, portable computer, or other portable terminal device with display function.
[0048] like Figure 1 As shown, the script generation device may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to establish communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0049] Optionally, the script generation device may also include a camera, RF (Radio Frequency) circuitry, sensors, audio circuitry, a WiFi module, and so on. These sensors may include, for example, light sensors, motion sensors, and other sensors. Of course, the script generation device may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which will not be elaborated upon here.
[0050] Those skilled in the art will understand that Figure 1The terminal structure shown in the figure does not constitute a limitation on the script generation device, and can include more or fewer components than shown, or combine certain components, or different component arrangements.
[0051] As shown in Figure 1 The memory 1005 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a script generation program.
[0052] In the script generation device shown in Figure 1 The network interface 1004 is mainly used to connect the background server and communicate data with the background server; the user interface 1003 is mainly used to connect the client (user end) and communicate data with the client; and the processor 1001 can be used to call the script generation program stored in the memory 1005.
[0053] In this embodiment, the script generation device includes a memory 1005, a processor 1001, and a script generation program stored in the memory 1005 and executable on the processor 1001, wherein the processor 1001 calls the script generation program stored in the memory 1005 and executes the steps of the script generation method in each embodiment.
[0054] The present application also provides a script generation method, referring to Figure 2 , Figure 2 The flowchart of the first embodiment of the script generation method of the present application.
[0055] In this embodiment, the script generation method includes the following steps:
[0056] Step S101, based on each video frame of the first video corresponding to the page operation process, determining the first scene switching frame corresponding to the first video, and obtaining an image frame set;
[0057] In this embodiment, the user shoots a video of the page operation process of a new web page that needs to be generated, and uploads the video to the script generation device (server) of the present application.
[0058] When receiving the first video corresponding to the page operation process uploaded by the user, the first scene switching frame corresponding to the first video is determined according to each video frame of the first video, the first scene switching frame is a video frame with large page difference in the first video, and then an image frame set is obtained.
[0059] Specifically, similarity between two adjacent frames in each video frame can be calculated, if the similarity is less than a preset similarity, it is determined that the difference between the corresponding two adjacent frames is large, and then the previous frame in the two adjacent frames is added to the image frame set as the first scene switching frame. Wherein, the similarity between the two adjacent frames can be calculated according to the pixel value of each pixel point in the previous frame and the pixel value of each pixel point in the next frame.
[0060] In step S102, in each preset template, the target template corresponding to each first scene switching frame in the image frame set is obtained, and the preset variable domain coordinate corresponding to the target template is obtained.
[0061] It should be noted that before the script is automatically generated, a video of a page operation process recorded by a user is used to generate a plurality of preset templates and variable domain coordinates corresponding to each preset template. The preset variable domain coordinate is a coordinate range, that is, the preset variable domain coordinate can be the coordinate range of the preset variable domain. The preset variable domain refers to a variable region formed in the corresponding target template. The preset variable domain coordinate is the coordinate range of the variable region in the coordinate system of the preset template. The preset template is a DOM tree template, and the target template is a target DOM tree template.
[0062] In this embodiment, after obtaining the image frame set, the image frame set is matched with each preset template to obtain the target template corresponding to each first scene switching frame in the image frame set. For example, each first scene switching frame is respectively matched with each preset template for similarity matching to obtain a preset template similar to each first scene switching frame. The similar preset template is taken as the target template of the corresponding first scene switching frame, and the preset variable domain coordinate corresponding to the target template is obtained.
[0063] In step S103, in each first scene switching frame of the image frame set, the variable value corresponding to the preset variable domain coordinate is obtained, and each variable value is assigned to the corresponding target template to obtain a target document.
[0064] In this embodiment, after the target template and the corresponding preset variable domain coordinate are obtained, in each first scene switching frame of the image frame set, the variable value corresponding to the preset variable domain coordinate is obtained, and each variable value is assigned to the corresponding target template to obtain a target document. Specifically, the preset variable domain coordinate is a coordinate range, that is, the preset variable domain coordinate can be a coordinate range of a preset variable domain. The preset variable domain coordinate forms a variable region in the corresponding target template. For each first scene switching frame, the content (region image) in the variable region corresponding to the preset variable domain coordinate in the first scene switching frame is taken as a variable value, the variable region corresponding to the preset variable domain coordinate in the corresponding target template is replaced by the variable value, and the target document corresponding to the first scene switching frame is obtained. That is, the variable value of each first scene switching frame is assigned to the corresponding target template to obtain the target document corresponding to the first scene switching frame.
[0065] In step S104, based on the order of each first scene switching frame in the image frame set, each target document is arranged to obtain a script document corresponding to the first video.
[0066] In this embodiment, after the target document is obtained, each target document is arranged according to the order of each first scene switching frame in the image frame set, that is, each target document is combined according to the order of each first scene switching frame, and a script document corresponding to the first video is obtained. The script document is a DOM tree script document.
[0067] It should be noted that if the target template corresponding to each first scene switching frame in the image frame set is not obtained, or there is an image frame in each first scene switching frame for which the target template is not obtained, the first video is taken as a second video, and the subsequent process of generating a preset template in the fifth embodiment is performed.
[0068] The script generation method provided in the embodiment determines first scene switching frames corresponding to a first video based on each video frame of the first video corresponding to a page operation process, and obtains an image frame set; then in each preset template, a target template corresponding to each first scene switching frame in the image frame set is obtained, and a preset variable domain coordinate corresponding to the target template is obtained; then in each first scene switching frame of the image frame set, a variable value corresponding to the preset variable domain coordinate is obtained, and each variable value is assigned to the corresponding target template to obtain a target document; then based on the order of each first scene switching frame in the image frame set, each target document is arranged to obtain a script document corresponding to the first video, which realizes intermediate document template variable replacement or automatic arrangement of a newly uploaded first video based on a stored preset template, and further quickly generates a new business scenario script document, greatly improves the reuse capability of a recorded script, and reduces the workload of script recording.
[0069] Based on the first embodiment, a second embodiment of the script generation method is provided.
[0070] Step S201: respectively determine a first similarity between each first scene switching frame in the image frame set and each preset template;
[0071] Step S202: based on the first similarity, determine a target template corresponding to each first scene switching frame in the image frame set.
[0072] In this embodiment, after obtaining the image frame set, the first similarity between each first scene switching frame in the image frame set and each preset template is determined respectively. Specifically, the first similarity between each first scene switching frame and each preset template can be calculated according to the pixel value of each pixel point in each first scene switching frame and the pixel value of each pixel point in each preset template. Alternatively, to improve processing efficiency, the pixel RGB value is divided into multiple R / G / B intervals according to 0-255, and then combined to obtain multiple preset pixel ranges. For example, if the pixel RGB is divided into 8 intervals, 8*8*8 preset pixel ranges can be obtained. Then, the number of pixel points in each first scene switching frame falling into each preset pixel range and the number of pixel points in each preset template falling into each preset pixel range are determined. Then, the first similarity between each first scene switching frame and each preset template is calculated according to the number of pixel points corresponding to each first scene switching frame and the number of pixel points corresponding to each preset template. For example, for a certain first scene switching frame, the number of pixel points falling into each preset pixel range is A1, A2, A3...An, and for a certain preset template, the number of pixel points falling into each preset pixel range is B1, B2, B3...Bn. The formula of the first similarity can be:
[0073]
[0074] wherein cos(θ) is the first similarity.
[0075] Then, based on the first similarity, the target template corresponding to each first scene switching frame in the image frame set is determined. Specifically, for each first scene switching frame, it is determined whether there is a similarity greater than a preset similarity threshold value corresponding to each first similarity of the current first scene switching frame. If there is, the preset template corresponding to the similarity greater than the preset similarity threshold value is taken as the target template. If there are multiple preset templates corresponding to the similarity greater than the preset similarity threshold value, the preset template corresponding to the maximum similarity is selected as the target template.
[0076] The script generation method provided in this embodiment can accurately determine the target template through the first similarity between the first scene switching frame and each preset template, and thus improve the accuracy of the script document.
[0077] Based on the first embodiment, a third embodiment of the script generation method of the present application is provided. In this embodiment, step S101 comprises:
[0078] In step S301, the number of pixel points in each video frame falling into each preset pixel range is determined, and the second similarity between two adjacent frames in each video frame is determined based on the number of pixel points.
[0079] In step S302, the first scene switching frame corresponding to the first video is determined based on the second similarity, and a set of image frames is obtained.
[0080] In this embodiment, the pixel RGB values are classified into multiple R / G / B intervals according to 0-255, and then combined to obtain multiple preset pixel ranges. The number of pixel points in each video frame falling into each preset pixel range is determined, and the second similarity between two adjacent frames in each video frame is calculated based on the number of pixel points. The second similarity is calculated using the same formula as the first similarity, and will not be described here.
[0081] Then, the first scene switching frame corresponding to the first video is determined based on the second similarity, and a set of image frames is obtained. Specifically, for each group of two adjacent frames, if the corresponding second similarity is less than a preset similarity, it is determined that the difference between the two adjacent frames is large, and then the previous frame in the two adjacent frames is added to the set of image frames as the first scene switching frame. Until all the second similarities are compared to obtain the set of image frames.
[0082] The script generation method proposed in this embodiment determines the number of pixel points in each video frame falling into each preset pixel range, and determines the second similarity between two adjacent frames in each video frame based on the number of pixel points. Then, the first scene switching frame corresponding to the first video is determined based on the second similarity, and a set of image frames is obtained. The second similarity between two adjacent frames can accurately obtain the scene switching frame of the first video, thereby improving the accuracy of the script document.
[0083] Based on the first embodiment, a fourth embodiment of the script generation method of the present application is proposed. In this embodiment, the target template includes multiple, and the preset variable domain coordinates include multiple. Step S103 includes:
[0084] In step S401, for each target template, the current scene switching frame corresponding to the current target template is determined in each first scene switching frame.
[0085] In step S402, the current variable value is obtained in the current scene switching frame based on the preset variable domain coordinates corresponding to the current target template.
[0086] In step S403, the current variable value is assigned to the current target template, and the target document corresponding to the current scene switching frame is obtained.
[0087] In this embodiment, if the target templates include multiple templates, each target template can be traversed in sequence.
[0088] For each target template, such as the currently traversed target template, the current target template corresponding current scene switching frame is determined in each first scene switching frame, and the current variable value is obtained in the current scene switching frame based on the preset variable domain coordinates corresponding to the current target template. Specifically, the preset variable domain coordinates are coordinate ranges, and the content (region image) in the variable region corresponding to the preset variable domain coordinates in the current scene switching frame is taken as the current variable value.
[0089] Then, the current variable value is assigned to the current target template to obtain the target document corresponding to the current scene switching frame, that is, the variable region corresponding to the preset variable domain coordinates in the current target template is replaced by the variable value to obtain the target document corresponding to the current scene switching frame. Of course, if the current scene switching frame includes multiple frames, the current variable value is assigned to the current target template to obtain multiple target documents, that is, each current scene switching frame corresponds to a target document.
[0090] It should be noted that, in general, each target template has multiple DOM documents that match one video frame in the first scene switching frame, for example, the first scene switching frame includes [Z1, Z2... Z5], wherein Z1-Z3 match the template steps 1-3 of business 1, and Z4-Z5 match the template steps 1-2 of business 2, that is, Z1-Z3 respectively match the first-3 intermediate documents in the target template of business 1, and Z4-Z4 respectively match the first-2 intermediate documents in the target template of business 2, then the target document is determined according to the corresponding intermediate document of the template.
[0091] It is easy to understand that after the preset template is traversed, the target template corresponding to each first scene switching frame can be obtained.
[0092] The script generation method proposed in this embodiment determines the current target template corresponding current scene switching frame in each first scene switching frame for each target template, then obtains the current variable value in the current scene switching frame based on the preset variable domain coordinates corresponding to the current target template, and then assigns the current variable value to the current target template to obtain the target document corresponding to the current scene switching frame. The target document obtained by replacing the variable domain according to different target templates can further obtain a new business scene script document according to multiple different preset templates, greatly improving the reuse ability of the recorded script and further reducing the workload of script recording.
[0093] Based on the above various embodiments, a fifth embodiment of the script generation method of the present application is proposed, in which, before step S101, the script generation method further comprises:
[0094] Step S501, based on the second video corresponding to the page operation process, obtaining a second scene switching frame corresponding to the second video;
[0095] Step S502, based on the second scene switching frame, determining an intermediate document corresponding to each page operation step in the second video;
[0096] Step S503, obtaining script information in each intermediate document, and determining a preset template corresponding to the second video and a preset variable domain coordinate corresponding to the preset template based on the script information.
[0097] In this embodiment, the second video can be multiple, including multiple page operation process videos of the same service and page operation process videos of multiple services. Based on the second video corresponding to the page operation process, the second scene switching frame corresponding to the second video is obtained, wherein the acquisition method of the second scene switching frame is similar to the acquisition method of the first scene switching frame in the third embodiment, which will not be described here.
[0098] After obtaining the second scene switching frame, the intermediate document corresponding to each page operation step in the second video is determined based on the second scene switching frame, that is, the intermediate document corresponding to each second scene switching frame is obtained. Specifically, the existing OCR video analysis algorithm is used to analyze the video of the second scene switching frame to obtain the page information corresponding to each second scene switching frame, and then the page structure of each page information is analyzed to obtain the DOM tree structure of each page, that is, the intermediate document, which is a DOM tree document.
[0099] Then, the script information in each intermediate document is obtained, that is, the script in each intermediate document is determined. For example, the intermediate document of operation process a has script information {platinum-1.jpg, class, img, src}, the intermediate document of operation process b has script information {class, img, src, div}, the intermediate document of operation process c has script information {class, img}, and the intermediate document of operation process d has script information {src, div, reading}. Then, based on the script information, the preset template corresponding to the second video and the preset variable domain coordinate corresponding to the preset template are determined. Specifically, the preset variable domain is determined according to the number of occurrences of each script in each intermediate document, the template intermediate document in each intermediate document after excluding the corresponding preset variable domain is taken as the preset template, and then the preset template corresponding to the second video is obtained, which includes the template intermediate document corresponding to each second scene switching frame.
[0100] Further, in an embodiment, step S503 comprises:
[0101] Step a, obtaining each script content in each script information, and determining the occurrence times of each script content in the script information;
[0102] Step b, determining the support degree corresponding to each script content based on the occurrence times, and determining the variable domain and the template script in the script information based on the support degree;
[0103] Step c, determining the preset template based on the template script, and determining the preset variable domain coordinate corresponding to the preset template based on the variable domain.
[0104] In the embodiment, each script content in each script information is obtained first, for example, the script content of operation flow a-operation flow d includes platinum-1.jpg, class, img, src, div and reading, and then the occurrence times of each script content in the script information are counted.
[0105] Then, the support degree corresponding to each script content is determined based on the occurrence times, wherein for each script, the support degree = the occurrence times / the number of the second scene switching frames, and the support degrees of the script content of platinum-1.jpg, class, img, src, div and reading are respectively given in Figure 3 , Figure 3 Then, the variable domain and the template script in the script information are determined based on the support degree, specifically, the script content with a support degree less than a preset support degree in each intermediate document is taken as the variable domain, and the content other than the variable domain in each intermediate document is taken as each template script.
[0106] Finally, each template script is taken as the preset template, and the coordinate of each variable domain in the corresponding preset template is taken as the corresponding preset variable domain coordinate.
[0107] Further, in another embodiment, step S502 comprises:
[0108] Step d, performing video analysis on each second scene switching frame to obtain the page information corresponding to each second scene switching frame;
[0109] Step e, performing page structure analysis on each page information to obtain the intermediate document.
[0110] In this embodiment, when the second scene switching frame is acquired, video analysis is performed on each second scene switching frame to obtain page information corresponding to each second scene switching frame. Specifically, the existing OCR video analysis algorithm can be used to perform video analysis on the second scene switching frame to obtain the page information corresponding to each second scene switching frame.
[0111] Then, page structure analysis is performed on each page information to obtain a DOM tree structure of each page, i.e., an intermediate document, which is a DOM tree document.
[0112] The script generation method provided in this embodiment acquires second scene switching frames corresponding to a second video based on a page operation process. Then, intermediate documents corresponding to each page operation step in the second video are determined based on the second scene switching frames. Then, script information in each intermediate document is acquired, and a preset template corresponding to the second video and a preset variable domain coordinate corresponding to the preset template are determined based on the script information. By generating the preset template and the preset variable domain coordinate corresponding to the second video, it is convenient to automatically generate a script document corresponding to other videos based on the preset template, which greatly reduces the workload and complexity of script recording.
[0113] The script generation device provided in this embodiment comprises: Figure 4
[0114] The determining module 10 is configured to determine first scene switching frames corresponding to a first video based on each video frame of the first video corresponding to a page operation process, and obtain a set of image frames.
[0115] The first acquiring module 20 is configured to acquire a target template corresponding to each first scene switching frame in the set of image frames from each preset template, and acquire a preset variable domain coordinate corresponding to the target template.
[0116] The second acquiring module 30 is configured to acquire a variable value corresponding to the preset variable domain coordinate from each first scene switching frame in the set of image frames, and assign each variable value to a corresponding target template to obtain a target document.
[0117] The script arrangement module 40 is configured to arrange each target document based on the order of each first scene switching frame in the set of image frames to obtain a script document corresponding to the first video.
[0118] The method performed by each program unit can refer to each embodiment of the script generation method of the present application, and will not be described here.
[0119] The present application also provides a computer readable storage medium.
[0120] The computer readable storage medium of the present application stores a script generation program, which, when executed by a processor, implements the steps of the script generation method described above.
[0121] The method implemented when the script generation program running on the processor is executed can refer to the embodiments of the script generation method of the present application, which will not be described here.
[0122] In addition, the embodiments of the present application also propose a computer program product, which includes a script generation program, and the script generation program, when executed by a processor, implements the steps of the script generation method described above.
[0123] It should be noted that in this document, the term "comprising" or "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article or system. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or system including the element.
[0124] The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0125] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platforms, of course, they can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present application.
[0126] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent flow transformation made by using the content of the present application specification and drawings, or directly or indirectly applied to other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A script generation method characterized by, The script generation method comprises the following steps: Based on the first video corresponding to the page operation process, the first scene switching frame corresponding to the first video is determined, and a set of image frames is obtained; In each preset template, the target template corresponding to each first scene switching frame in the set of image frames is obtained, and the preset variable domain coordinates corresponding to the target template are obtained, wherein a plurality of preset templates are generated by recording the video of the page operation process by the user, the preset variable domain is a variable region formed in the corresponding target template, and the preset variable domain coordinates are the coordinate range of the variable region in the coordinate system of the target template; In each first scene switching frame of the set of image frames, the variable value corresponding to the preset variable domain coordinates is obtained, and each variable value is assigned to the corresponding target template to obtain a target document; Based on the order of each first scene switching frame in the set of image frames, each target document is arranged to obtain a script document corresponding to the first video; The step of obtaining the target template corresponding to each first scene switching frame in the set of image frames in each preset template comprises: The first similarity between each first scene switching frame in the set of image frames and each preset template is determined respectively, wherein the number of pixel points in each first scene switching frame falling into each preset pixel range and the number of pixel points in each preset template falling into each preset pixel range are determined, and then the first similarity between each first scene switching frame and each preset template is calculated according to the number of pixel points corresponding to each first scene switching frame and the number of pixel points corresponding to each preset template; Based on the first similarity, the target template corresponding to each first scene switching frame in the set of image frames is determined.
2. The script generation method of claim 1, wherein, The step of determining the first scene switching frame corresponding to the first video based on each video frame of the first video corresponding to the page operation process, and obtaining a set of image frames comprises: The number of pixel points in each video frame falling into each preset pixel range is determined, and based on the number of pixel points, the second similarity between adjacent two frames in each video frame is determined; Based on the second similarity, the first scene switching frame corresponding to the first video is determined, and a set of image frames is obtained.
3. The script generation method of claim 1, wherein, The target template comprises a plurality of target templates, and the preset variable domain coordinates comprise a plurality of preset variable domain coordinates; the step of obtaining the target document by obtaining the variable value corresponding to the preset variable domain coordinates in each first scene switching frame of the set of image frames and assigning each variable value to the corresponding target template comprises: For each target template, the current scene switching frame corresponding to the current target template is determined in each first scene switching frame; Based on the preset variable domain coordinates corresponding to the current target template, the current variable value is obtained in the current scene switching frame; The current variable value is assigned to the current target template to obtain the target document corresponding to the current scene switching frame.
4. The script generation method according to any one of claims 1 to 3, characterized by, Before the step of determining the first scene switching frame corresponding to the first video based on each video frame of the first video corresponding to the page operation process and obtaining a set of image frames, the following steps are further included: obtaining a second scene switching frame corresponding to the second video based on the page operation process; determining an intermediate document corresponding to each page operation step in the second video based on the second scene switching frame; obtaining script information in each intermediate document, and determining a preset template corresponding to the second video and preset variable domain coordinates corresponding to the preset template based on the script information.
5. The script generation method of claim 4, wherein, The step of determining the preset template corresponding to the second video and the preset variable domain coordinates corresponding to the preset template based on the script information comprises: obtaining each script content in each script information, and determining a number of occurrences of each script content in the script information; determining a support degree corresponding to each script content based on the number of occurrences, and determining a variable domain and a template script in the script information based on the support degree; determining the preset template based on the template script, and determining the preset variable domain coordinates corresponding to the preset template based on the variable domain.
6. The script generation method of claim 4, wherein, The step of determining the intermediate document corresponding to each page operation step in the second video based on the second scene switching frame comprises: performing video analysis on each second scene switching frame to obtain page information corresponding to each second scene switching frame; performing page structure analysis on each page information to obtain the intermediate document.
7. A script generation apparatus characterized by comprising: The script generation device comprises: a determination module configured to determine a first scene switching frame corresponding to a first video based on each video frame of the first video of the page operation process, and obtain an image frame set; a first obtaining module configured to obtain a target template corresponding to each first scene switching frame in the image frame set in each preset template, and obtain preset variable domain coordinates corresponding to the target template, wherein a plurality of preset templates are generated by a video of the page operation process recorded by a user, the preset variable domain is a variable region formed in the corresponding target template, the preset variable domain coordinates are a coordinate range of the variable region in a coordinate system of the target template, a first similarity between each first scene switching frame in the image frame set and each preset template is determined, wherein a number of pixel points of each first scene switching frame falling into each preset pixel range and a number of pixel points of each preset template falling into each preset pixel range are determined, and then the first similarity between each first scene switching frame and each preset template is calculated according to the number of pixel points corresponding to each first scene switching frame and the number of pixel points corresponding to each preset template; and the target template corresponding to each first scene switching frame in the image frame set is determined based on the first similarity; a second obtaining module configured to obtain a variable value corresponding to the preset variable domain coordinates in each first scene switching frame of the image frame set, and assign each variable value to the corresponding target template to obtain a target document; a script arrangement module configured to arrange each target document based on an order of each first scene switching frame in the image frame set to obtain a script document corresponding to the first video.
8. A script generation device characterized by comprising: The script generation device includes a memory, a processor, and a script generation program stored on the memory and executable on the processor, the script generation program, when executed by the processor, implements the steps of the script generation method according to any one of claims 1 to 6.
9. A computer program product comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the steps of the script generation method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Network test method and device
CN104253718A
Video scene switching detection method and apparatus
CN108804980A
Test script generation method and device and computer readable storage medium
CN111104315A