Detailed Description
In order to make the purpose, screen recording method and advantages of the present application more clear, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
"and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality" means two or more, and "at least one", "one or more" means one, two or more, unless otherwise specified.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The method of the embodiment of the present application may be applied to various terminals, for example, a mobile phone, a tablet computer, an in-vehicle device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA), and other terminals that need to perform screen recording, and the embodiment of the present application does not limit the specific type of the terminal.
Take the above terminal as an example of a mobile phone. Fig. 1 is a schematic diagram illustrating a partial structure of a mobile phone provided in an embodiment of the present application. Referring to fig. 1, the cellular phone includes: radio Frequency (RF) circuit 110, memory 120, input unit 130, display unit 140, sensor 150, audio circuit 160, wireless fidelity (Wi-Fi) module 170, processor 180, and power supply 190. Those skilled in the art will appreciate that the handset configuration shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The memory 120 may be used to store software programs and modules, and the processor 180 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 120.
The processor 180 is a control center of the mobile phone, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120.
For example, the processor 180 may implement the following steps of the screen recording method when executing the software program stored in the memory 120:
storing a first image acquired in a screen recording process to obtain screen recording data of the first image;
compressing and storing the (N + 1) th image acquired in the screen recording process based on the first image to the (N) th image acquired in the screen recording process to obtain screen recording data of each image except the first image in the screen recording process;
and N is an integer greater than or equal to 1, and the screen recording data is used for generating a screen recording file after the screen recording is finished.
Optionally, the processor 180 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. When the processor 180 includes multiple processing cores, the terminal can implement the screen recording method of the present application by creating a new screen recording thread on the basis of a thread that has been created currently, so as to fully utilize the remaining multi-core computing capability of the terminal, so that a server (e.g., a server) does not need to deploy corresponding capability, thereby reducing the deployment cost of the server, and avoiding affecting the running process of an application that the terminal is running.
It is to be understood that the illustrated structure of the embodiments of the present application does not constitute a specific limitation to the terminal. In other embodiments of the present application, an apparatus may include more or fewer components than illustrated, or some components may be combined, some components may be separated, or a different arrangement of components may be provided. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Fig. 2 is a schematic diagram of a software structure of the mobile phone 100 according to the embodiment of the present application. Taking the operating system of the mobile phone 100 as an Android system as an example, in some embodiments, the Android system is divided into four layers, which are an application layer, an application Framework (FWK) layer, a system layer and a hardware abstraction layer, and the layers communicate with each other through a software interface.
As shown in fig. 2, the application layer may include a series of application packages, and the application packages may include a browser, a payment-type application, an insurance-type application, a social-type application, a screen recording application for implementing the screen recording method of the present application, and other applications.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer may include some predefined functions, such as functions for receiving events sent by the application framework layer.
As shown in FIG. 2, the application framework layers may include a window manager, a resource manager, and a notification manager, among others.
The notification manager enables the application program to display notification information in the status bar, can be used for conveying notification type messages, can automatically disappear after short-time stopping, and does not need user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
In the embodiment of the application, in the process of detecting whether the display content of the terminal display interface changes, the operation state of the notification manager can be monitored.
For example, when it is monitored that the notification manager outputs the notification in the status bar, it is determined that the change of the display content of the terminal display interface is detected.
The following embodiments may be implemented on a mobile phone having the above-described hardware structure/software structure. The following describes a screen recording method, device, chip and terminal provided by the embodiment of the application.
Currently, in order to save the operation record of the user on the terminal, a screen recording method is generally used to record the screen of the terminal.
For example, an interface provided by a browser is used for intercepting a frame image on a display screen of the terminal, and then the intercepted frame image is stored in a video stream form.
However, the screen recording file obtained in this way has a large data size, occupies a large storage space, and is not favorable for file transmission.
In addition, a screen recording method exists at present, which uploads html content of a webpage to a server, then monitors operation of a user on the webpage and change data of the webpage, uploads the operation data of the user and the change data of the webpage to the server, and the server stores the operation data and the change data of the webpage as a screen recording file.
However, the screen recording file obtained in this way only contains picture links in html content, and has no picture specific content. Therefore, when video playback is performed based on the screen recording file, the picture corresponding to the picture link may have been off-shelf, so that the background image may be absent during video playback. Therefore, to deal with such problems, it is common practice to store the pictures permanently, which greatly increases the server cost. In addition, when the video is played back, a corresponding browsing tool such as a chrome browser needs to be configured at the server side to create the played back video, which causes a problem of high restoration cost.
In addition, since html content only contains link addresses of Cascading Style Sheets (css), and does not contain css specific content, css may affect the display effect of pages, the following two problems may occur: firstly, the css link address is unchanged, but the content is changed, so that the css link address in the html-based content cannot be restored back to the corresponding display interface during screen recording; and secondly, the css link address in the html content cannot be accessed, so that the corresponding display interface cannot be restored when the screen is recorded. Therefore, in order to deal with such problems, a common solution is to perform version management and perform permanent version control on the css link. However, these all add significantly to the cost of development and maintenance of css.
Based on the above problems, embodiments of the present application provide a method, an apparatus, a chip, and a terminal for screen recording, which can reduce a storage space occupied by a screen recording file, and facilitate data transmission of the screen recording file, and since an image corresponding to a display interface of the terminal is directly acquired to perform compression storage, instead of only storing access links corresponding to page elements, a problem that a corresponding display interface cannot be restored when the screen is recorded does not occur.
In order to better understand the screen recording method provided by the embodiment of the present application, a specific implementation process is described below in an implementation level with reference to the accompanying drawings.
For example, fig. 3 shows a flowchart of a screen recording method provided in an embodiment of the present application. The screen recording method may be executed by a screen recording apparatus configured by the terminal, and specifically includes the following steps 301 to 302.
Step 301, storing a first image acquired in the screen recording process to obtain screen recording data of the first image.
In the embodiment of the present application, the storing of the first image acquired in the screen recording process may refer to directly storing the first image without performing compression processing.
Step 302, based on the first image to the nth image acquired in the screen recording process, compressing and storing the (N + 1) th image acquired in the screen recording process to obtain the screen recording data of each image except the first image in the screen recording process.
In this embodiment, N in the step 302 is an integer greater than or equal to 1.
The compressing and storing the (N + 1) th image acquired in the screen recording process based on the first to nth images acquired in the screen recording process to obtain the screen recording data of each image except the first image in the screen recording process may refer to that when the images except the first image acquired in the screen recording process are stored, the compressing and storing are performed based on the images acquired in history.
For example, after a first image acquired in the screen recording process is stored, a second image is compressed and stored based on the first image to obtain screen recording data of the second image in the screen recording process, then, a third image is compressed and stored based on the first image and the second image to obtain screen recording data of the third image in the screen recording process, and so on to obtain screen recording data of each image in the screen recording process.
In this embodiment of the application, after the screen recording is finished, a final screen recording file may be generated based on the screen recording data stored in the step 301 and the step 302.
For example, in an embodiment, the terminal may send the screen recording data stored in the step 301 and the step 302 to a server, and the server collects and compresses the screen recording data obtained in the step 301 and the step 302 to obtain a screen recording file, or directly collects and compresses the screen recording data obtained in the step 301 and the step 302 locally to obtain the screen recording file, which is not limited in this application.
In the embodiment of the application, the (N + 1) th image collected in the screen recording process is compressed and stored based on the first image to the (N) th image collected in the screen recording process, so that the data volume of the screen recording file is effectively reduced, the storage space occupied by the screen recording file is reduced, and the data transmission of the screen recording file is facilitated. In addition, because the image corresponding to the terminal display interface is directly acquired for compression storage, rather than only the access link corresponding to the page element, the problem that the corresponding display interface cannot be restored to the screen recording is solved.
It should be noted that, in this embodiment of the application, the first to nth images and the (N + 1) th image in the step 302 may refer to the first to nth images and the (N + 1) th image acquired in a single screen recording cycle, and the determining of the screen recording cycle may include the following two ways: the first is to directly use the single screen recording process as a screen recording period, and the second is to divide the single screen recording process into one or more screen recording periods according to preset rules.
For example, when the screen recording is a screen recording for a web page, in the screen recording process, images acquired on the same web page may be used as images acquired in the same screen recording period, and images acquired on different web pages may be used as images acquired in different screen recording periods. So as to reduce the calculation amount of compressing and storing the (N + 1) th image based on the first image to the Nth image.
Based on the preset rule, when no webpage jump exists in the single screen recording process, the single screen recording process can be directly used as a screen recording period; when the single screen recording process has webpage skipping, the images acquired on the same webpage can be used as the images acquired in the same screen recording period, the images acquired on different webpages can be used as the images acquired in different screen recording periods, and the single screen recording process is divided into a plurality of screen recording periods.
Specifically, because the similarity of the images acquired on the same webpage is large, and the similarity of the images acquired on different webpages is small, when the images acquired on the same webpage are compressed, the maximum compression ratio can be achieved by extracting the same image content for combination, and the data volume of a compression dictionary in the compression process can be reduced, or the data volume needing image comparison is reduced, so that the calculation amount for compressing and storing the (N + 1) th image based on the first image to the Nth image is reduced, and meanwhile, when the recorded file is played back, the image acquired on the basis of a single screen recording period can be played back, so that the recorded file has greater flexibility.
For example, a user only needs to watch the playback of a certain webpage, and then only needs to play back the images acquired in the screen recording period corresponding to the webpage.
Similarly, when the screen recording is the screen recording for video playing, in the screen recording process, the images acquired on the same video can be used as the images acquired in the same screen recording period, and the images acquired on different videos can be used as the images acquired in different screen recording periods. So as to reduce the calculation amount of compressing and storing the (N + 1) th image based on the first image to the Nth image.
It should be noted that the foregoing is only an example of the determination method of the preset rule, and is not meant to limit the scope of the present application, and it is understood that the present application may determine the screen recording period by using different partition rules according to different screen recording scenes. Moreover, the screen recording file may be a screen recording file obtained based on all the acquired images in a single screen recording process.
In order to reduce the amount of computation of the compression storage, in some embodiments of the present application, the nth image and the (N + 1) th image in the above embodiments may be sampled based on preset sampling time intervals, or sampled when there is a change in the display content of the terminal display interface, or sampled when each preset sampling time interval arrives and when there is a change in the display content of the terminal display interface is detected.
The preset sampling time interval can be set according to actual requirements, for example, for a scene with a low frame rate requirement, the preset sampling time interval can be increased, and otherwise, the preset sampling time interval is decreased.
In addition, in the screen recording process, the image corresponding to the display content of the terminal display interface is acquired only when the display content of the terminal display interface changes, so that the situation that the images obtained by sampling two adjacent frames are the same image can be avoided, the data size of the screen recording file can be reduced, and the calculation amount of compressed storage is reduced.
Optionally, in this embodiment of the application, the first to nth images and the (N + 1) th image are images corresponding to display contents of a display interface of the terminal, that is, display images corresponding to the display interface seen by a user in a screen recording process.
In order to avoid influencing the running process of the application running at the terminal, in the embodiment of the application, in the screen recording process, a screen recording thread may be newly created, then, a virtual display image is constructed by using the screen recording thread based on the display content, then, the virtual display image is converted into an image in an svg format, and the image in the svg format is used as an image corresponding to the display content of the terminal display interface, that is, the first image to the nth image and the (N + 1) th image are obtained.
In this embodiment of the application, when the screen recording is a screen recording for a web page, the display content may include one or more of a user touch operation, a user slide operation, a user click operation, a page jump, a cursor position, a DOM element in a document object model tree corresponding to the web page, and an activation state of the DOM element.
According to the method and the device, the first image to the Nth image and the (N + 1) th image corresponding to the display content of the terminal display interface in the screen recording process are directly obtained and compressed for storage, so that the screen recording file is obtained, and when the image (video) is played back based on the screen recording file, the problem that the corresponding display interface cannot be restored to the screen recording file cannot occur.
In the embodiment of the application, since the image in the svg format is an image based on the text description, when the image is compressed by using a compression algorithm supporting automatic merging of the same content, a part with the same content in the image in the svg format can be extracted, thereby achieving a large compression effect, and when the image is amplified, the distortion rate is low.
Alternatively, the compression algorithm supporting the automatic merging of the same content may include a compression algorithm of a 7Z format.
As shown in fig. 4, which is a schematic view illustrating an implementation flow of another screen recording method provided in the embodiment of the present application, the screen recording method may be executed by the screen recording apparatus configured in the terminal, and specifically includes the following steps 401 to 402.
Step 401, compressing and storing a first image acquired in the screen recording process by using a 7Z format compression algorithm to obtain screen recording data of the first image.
That is, in this embodiment, the screen recording data of the first image is obtained after the compression processing is performed on the first image, and is obtained by performing the compression processing using the compression algorithm of the 7z format.
In the embodiment of the present application, 7z is a file compression format with a high compression ratio, and it employs a plurality of compression algorithms for data compression, such as LZMA, LZMA2, BZip2, and the like. Therefore, the resulting compressed document is small compared to other compressed formats.
And step 402, based on a compression dictionary obtained by compressing and storing the first image to the Nth image acquired in the screen recording process, compressing and storing the (N + 1) th display image by using a 7z format compression algorithm to obtain screen recording data of each image except the first image in the screen recording process.
In this embodiment of the application, the compressing and storing the (N + 1) th display image by using a compression algorithm in a 7z format based on the compression dictionaries obtained by compressing and storing the first to nth images acquired in the screen recording process may refer to that when images other than the first image acquired in the screen recording process are stored, the compressing and storing needs to be performed based on the compression dictionary obtained by compressing and storing the images acquired in the history.
For example, a first image acquired in the screen recording process is compressed and stored by using a 7Z format compression algorithm to obtain an initial compression dictionary, then a second image acquired in the screen recording process is compressed and stored based on the initial compression dictionary to obtain an updated compression dictionary, then a third image acquired in the screen recording process is compressed and stored according to the updated compression dictionary, and so on to obtain screen recording data of each image in the screen recording process.
In this embodiment of the application, after the screen recording is finished, a final screen recording file may be generated based on the screen recording data stored in the step 401 and the step 402.
For example, in an embodiment, the terminal may send the screen recording data stored in the step 401 and the step 402 to a server, and the server collects and compresses the screen recording data obtained in the step 401 and the step 402 to obtain a screen recording file, or directly collects and compresses the screen recording data obtained in the step 401 and the step 402 locally to obtain the screen recording file, which is not limited in this application.
In the embodiment of the application, each image acquired in the screen recording process is compressed and stored by using the compression algorithm with the 7z format and the high compression ratio, so that the data volume of the screen recording file is effectively reduced, the storage space occupied by the screen recording file is reduced, and the data transmission of the screen recording file is facilitated. The method solves the problems that the screen recording file obtained by the traditional screen recording method has large data volume, needs to occupy large storage space and is not beneficial to file transmission. In addition, because the image corresponding to the terminal display interface is directly acquired for compression storage, rather than only the access link corresponding to the page element, the problem that the corresponding display interface cannot be restored to the screen recording is solved.
The first to nth images and the (N + 1) th image may be images in other formats such as png and jpeg, in addition to the svg format, and the present application is not limited thereto.
However, since the effect of compressing the image in the svg format is better when the 7Z format compression algorithm is used to compress and store the image acquired during the screen recording process, in some embodiments of the present application, the screen recording may be performed by acquiring the first to nth images and the N +1 st image in the svg format and then performing the screen recording based on the screen recording manner of the above steps 401 to 402.
It is understood that for images in other formats, a compression algorithm in 7Z format may be used for compression storage. That is, in other embodiments of the present application, images in other formats acquired during the screen recording process may be compressed and stored by using a compression algorithm in the 7Z format.
It should be further noted that the first to nth images and the (N + 1) th image may also be acquired in a screenshot manner, and the acquisition manner of the image corresponding to the display content of the terminal display interface is not limited in the present application.
Similarly, in this embodiment of the application, the first to nth images and the (N + 1) th image in the step 402 may refer to the first to nth images and the (N + 1) th image acquired in a single screen recording cycle, and the determining of the screen recording cycle may include the following two ways: the first is to directly use the single screen recording process as a screen recording period, and the second is to divide the single screen recording process into one or more screen recording periods according to preset rules, which are not described herein again.
Alternatively, in a practical application, the screen recording method shown in fig. 4 can be implemented through the following steps a 41-a 48.
A41, inquiring about the recording privacy protocol of the user screen.
That is, when the user agrees to screen recording, the following steps A42-A48 are performed to avoid violating the user's privacy.
A42, creating a screen recording thread Worker.
For example, when the number of cores of the terminal processor is multi-core, one or more separate screen recording threads are created, so as to avoid influencing the running process of the application running at the terminal and improve the fluency of the terminal operation performed by the user.
A43, constructing a virtual display image js-dom by utilizing the screen recording thread based on the display content of the terminal display interface;
optionally, in the process of constructing the virtual display image js-dom based on the display content of the terminal display interface by using the screen recording thread, a timer, page monitoring (i.e., for example, monitoring the running state of the notification manager) and user operation monitoring may be set, and when each preset sampling time interval arrives and it is detected that there is a change in the display content of the terminal display interface, the virtual display image js-dom is constructed based on the display content of the terminal display interface by using the screen recording thread.
The virtual display image is image data which is not displayed on a display interface of the terminal but only rendered in a background of the terminal.
In addition, when the screen recording scene is screen recording for webpage content, the display content of the terminal display interface may include one or more of user touch operation, user sliding operation, user clicking operation, page jump, cursor position, DOM element in the document object model tree corresponding to the webpage and activation state of the DOM element, and the virtual js-DOM may be constructed by transmitting the display content to the Worker.
And A44, converting the virtual display image js-dom generated by the A43 into an image in svg format.
In the embodiment of the application, since the image in the svg format is an image based on the text description, when the image is compressed by using a compression algorithm supporting automatic merging of the same content, a part with the same content in the image in the svg format can be extracted, thereby achieving a large compression effect, and when the image is amplified, the distortion rate is low.
And A45, compressing the image in the svg format generated by the A44 by using a compression algorithm in the 7Z format to obtain screen recording data.
In the process of compressing the image in the svg format by using the compression algorithm in the 7Z format, the generated image in the svg format can be sequentially compressed, the parts with the same content in each svg image are extracted and automatically combined, and meanwhile, a compression dictionary is generated, so that the later generated image in the svg format can calculate difference data based on the compression dictionary obtained by compressing the earlier generated image in the svg format, the difference data is compressed by using the compression algorithm in the 7Z format, screen recording data of the later generated image in the svg format is obtained, and meanwhile, the compression dictionary is updated.
For example, firstly, a first image in the svg format is compressed and stored to obtain screen recording data of the first image in the svg format, and an initial compression dictionary is generated; then, calculating difference data of a second image in the svg format based on the most initial compression dictionary, compressing the difference data, updating the most initial compression dictionary, and obtaining screen recording data for compressing the second image in the svg format; and repeating the steps to obtain the screen recording data of each image in the svg format.
A46, sending the screen recording data of the image in the svg format to the server.
For example, the screen recording data of the svg format images is sent to the server in batches (e.g., after each preset number of screen recording data of the svg format images are generated, the screen recording data is sent to the server), so as to avoid occupying a large data transmission resource of the terminal at one time.
And A47, after finishing screen recording, the server collects and compresses the received screen recording data to obtain a screen recording file.
A48, when the playback of the screen recording file is required, the server can decompress the screen recording file, reversely calculate the image in svg format, and then use FFmpeg image to video tool to convert the image in svg format into the video file in mp4 format.
In the embodiment of the application, the image in the svg format is compressed at the terminal side and then sent to the server, so that the data volume of data transmission can be reduced, the terminal flow is saved, and the storage space of the server for storing the screen recording file can be saved. The method solves the problems that the screen recording file obtained by the traditional screen recording method has large data volume, needs to occupy large storage space and is not beneficial to file transmission. In addition, because the image corresponding to the terminal display interface is directly acquired for compression storage, rather than only the access link corresponding to the page element, the problem that the corresponding display interface cannot be restored to the screen recording is solved.
Optionally, in some embodiments of the present application, in addition to compressing and storing the image acquired in the screen recording process by using a compression algorithm in a 7z format, in some embodiments of the present application, the image acquired in the screen recording process may also be compressed and stored in an image comparison manner.
Specifically, as shown in fig. 5, a schematic view of an implementation flow of a screen recording method according to another embodiment of the present application is provided, where the screen recording method may be executed by a screen recording apparatus configured in the terminal, and specifically includes the following steps 501 to 503.
Step 501, storing a first image acquired in a screen recording process to obtain screen recording data of the first image.
In the embodiment of the present application, the storing of the first image acquired in the screen recording process may refer to directly storing the first image without performing compression processing.
Step 502, determining whether the images same as the (N + 1) th image exist in the first to the Nth images; n is an integer greater than or equal to 1.
For example, the image comparison is performed on the first to nth images and the (N + 1) th image, so as to determine whether the same image as the (N + 1) th image exists in the first to nth images.
Step 503, when the image same as the (N + 1) th image exists in the first to nth images, taking the identification data of the image same as the (N + 1) th image in the first to nth images as the screen recording data of the (N + 1) th image.
In this embodiment of the application, in the step 502, determining whether the image that is the same as the (N + 1) th image exists in the first to nth images may be to determine whether the image that is the same as the (N + 1) th image exists in the first to nth images based on the image collected in history when storing the images collected in the screen recording process except for the first image, so as to implement compression storage of the (N + 1) th image.
For example, a first image collected in the screen recording process is directly stored, then a second image collected in the screen recording process is compared with the first image to determine whether the second image is the same as the first image, if so, the identification data of the first image is taken as the screen recording data of the second image, if not, the second image is directly stored, then, a third image collected in the screen recording process is respectively compared with the first image and the second image collected in history to determine whether the first image and the second image have the same image as the third image, if so, the identification data of the image in the first image and the second image which is the same as the third image is taken as the screen recording data of the third image, and if not, the third image is directly stored, and by analogy, the image collected in the screen recording process is compressed and stored.
The screen recording method based on the embodiment can effectively reduce the data volume of the screen recording file, reduce the storage space occupied by the screen recording file, and is favorable for carrying out data transmission on the screen recording file. The method solves the problems that the screen recording file obtained by the traditional screen recording method has large data volume, needs to occupy large storage space and is not beneficial to file transmission.
The principle of reducing the data volume of the screen recording file and reducing the storage space occupied by the screen recording file in the application is explained based on two practical application scenes.
In practical applications, there may be a case of page jump on the display interface of the terminal, or a case of pop-up window, and after the page changes in the two cases, the two cases are generally restored to the original display interface, so that the same image is acquired in the screen recording process, and therefore, the acquired image can be compressed by the embodiments of fig. 3 to 5.
For example, as shown in fig. 6, a user opens a web page 1 first, at this time, a display interface of a terminal is 61, then, the user opens a web page 2 on the basis of the web page 1, at this time, the display interface of the terminal is 62, then, the user closes the web page 2, at this time, the display interface of the terminal is 63, and it can be seen that the display interface 63 is the same as the display interface 61, so that when comparing an image corresponding to the display interface 63 with an image corresponding to the display interface 61 collected in history, it can be determined that the image corresponding to the display interface 63 is the same as the image corresponding to the display interface 61, and therefore, the identification data of the image corresponding to the display interface 61 can be used as screen recording data of the image corresponding to the display interface 63, and further compression of the image corresponding to the display interface 63 can be realized.
For another example, as shown in fig. 7, the user opens the web page 1 first, at this time, the display interface of the terminal is 71, then the display interface of the terminal pops up the pop-up window 72, at this time, the display interface of the terminal is 73, then, the user closes the pop-up window 72, at this time, the display interface of the terminal is 74, and it can be seen that the display interface 74 is the same as the display interface 71, and therefore, when the image corresponding to the display interface 74 is compared with the image corresponding to the display interface 71 acquired in the history, it can be determined that the image corresponding to the display interface 74 is the same as the image corresponding to the display interface 71, and therefore, the identification data of the image corresponding to the display interface 71 can be recorded as the screen data of the image corresponding to the display interface 74, and the image corresponding to the display interface 74 can be compressed.
According to the method and the device, the N +1 th image is compared with the first image to the nth image, and the identification data of the image, which is the same as the N +1 th image, in the first image to the nth image is used as the screen recording data of the N +1 th image, so that the image corresponding to the display interface of the terminal is compressed in the screen recording process.
It should be noted that, in a general screen recording method for reducing the data amount of screen recording files by acquiring images corresponding to a display interface when the display interface of a terminal is changed, the web page 2 is opened on the basis of the web page 1, and the images are acquired and stored once, and when the web page 2 is closed, the change of the display interface of the terminal is also detected, and therefore, the images are acquired and stored once, so that the compression ratio of the images is lower than that of the screen recording method of fig. 5 to 7. It can be understood that the same is true for the case where the pop-up window appears on the display interface, and the description is omitted here.
According to the embodiment of the application, on the basis of the webpage 1, the webpage 2 is opened, the image can be collected and stored once, when the webpage 2 is closed, the image corresponding to the display interface of the terminal can be detected to be the same as the image collected historically, so that the image can be compressed and stored instead of being directly stored, the data volume of the screen recording file can be effectively reduced, the storage space occupied by the screen recording file is reduced, and data transmission of the screen recording file is facilitated.
Optionally, in some embodiments of the present application, the identification data in the embodiments shown in fig. 5 to 7 may be a number identification used to characterize an acquisition sequence of the corresponding images. For example, the number identifier may be the acquisition time of the image, or a serial number identifier of the first sheet, the second sheet, and the like.
Optionally, the screen recording data may carry a serial number identifier of the image. According to the method and the device, the number identification of each image collected in the screen recording process is recorded, so that when video playback is carried out based on the screen recording file, the playback sequence of the images can be determined based on the number identification.
It should be noted that, in the screen recording process, the screen recording data may be generated in real time and then sent to the server for storage, and the server may determine, based on the receiving time of the screen recording data, the acquisition sequence of the image corresponding to the received screen recording data, and therefore, in some embodiments of the present application, the screen recording data may not need to carry a serial number identifier for representing the acquisition sequence of the corresponding image.
In a practical application, the screen recording scene can be a recording scene of insurance online sales or large article online sales, so as to ensure that the user insurance application process or the article buying and selling process is successfully recorded, and facilitate subsequent positioning of dispute responsibilities.
When the screen recording scene may be an insurance online sale, optionally, the screen recording method provided by the embodiment of the present application may include the following steps a01 to a 06.
A01, when the terminal opens the insurance page, applying for the screen recording id associated with the insurance order number from the server;
a02, storing a first image acquired in the screen recording process to obtain screen recording data of the first image, and sending the screen recording data to a server;
a03, based on the first image to the Nth image collected in the screen recording process, compressing and storing the (N + 1) th image collected in the screen recording process to obtain screen recording data of each image except the first image in the screen recording process, and sending the screen recording data to a server;
a04, generating a screen recording file in a server after finishing screen recording;
a05, jumping to an insurance payment page to complete insurance application when the screen recording file of the server is successfully saved;
and A06, intercepting the order and prompting the user to operate again when the screen recording file is not successfully stored.
In the embodiment of the application, when the insurance is sold on line, the screen recording is carried out on the insurance application process, so that the subsequent dispute responsibilities can be conveniently positioned.
In addition, in some embodiments of the application, the insurance application operation data of the user can be analyzed by using the screen recording file obtained by the screen recording method of the application, so that developers can improve the operation experience of the user conveniently.
For example, the verification code input function is analyzed based on the insurance application operation data of the user, so that the operation experience of inputting the verification code by the user is improved.
While, for purposes of simplicity of explanation, the foregoing method embodiments are described as a series of acts or combinations, it will be appreciated by those of ordinary skill in the art that the present application is not limited by the illustrated ordering of acts, as some steps may occur in other orders in some implementations of the present application.
Fig. 8 shows a schematic structural diagram of a screen recording apparatus 800 provided in an embodiment of the present application, which includes a first storage unit 801 and a second storage unit 802.
The first storage unit is used for storing a first image acquired in the screen recording process to obtain screen recording data of the first image;
the second storage unit is used for compressing and storing the (N + 1) th image acquired in the screen recording process based on the first image to the (N) th image acquired in the screen recording process to obtain screen recording data of each image except the first image in the screen recording process;
and N is an integer greater than or equal to 1, and the screen recording data is used for generating a screen recording file after the screen recording is finished.
Optionally, in some embodiments of the present application, the nth image and the (N + 1) th image are sampled based on a preset sampling time interval;
or,
the Nth image and the (N + 1) th image are obtained by sampling when the display content of the terminal display interface changes;
or,
and when the Nth image and the (N + 1) th image reach each preset sampling time interval and the display content of the terminal display interface is detected to be changed, sampling is carried out.
Optionally, in some embodiments of the present application, the first to nth images and the (N + 1) th image are the first to nth images and the (N + 1) th image acquired in a single screen recording cycle;
wherein the single screen recording period is determined based on:
and dividing the single screen recording process into one or more screen recording periods according to a preset rule.
Optionally, in some embodiments of the application, when the screen recording is a screen recording for a web page, the dividing the single screen recording process into one or more screen recording periods according to a preset rule includes:
in the single screen recording process, images acquired on the same webpage are used as images acquired in the same screen recording period, and images acquired on different webpages are used as images acquired in different screen recording periods.
Optionally, in some embodiments of the application, the first to nth images and the (N + 1) th image are images corresponding to display contents of a terminal display interface, and the screen recording device is further configured to:
newly building a screen recording thread;
constructing a virtual display image based on the display content by utilizing a screen recording thread;
and converting the virtual display image into an image in an svg format, and taking the image in the svg format as an image corresponding to the display content of the terminal display interface.
Optionally, in some embodiments of the present application, the first storage unit is specifically configured to: compressing and storing a first image acquired in the screen recording process by using a compression algorithm in a 7Z format to obtain screen recording data of the first image; the second storage unit is specifically configured to: and based on a compression dictionary obtained by compressing and storing the first image to the Nth image acquired in the screen recording process, compressing and storing the (N + 1) th display image by using a 7z format compression algorithm to obtain screen recording data of each image except the first image in the screen recording process.
Optionally, in some embodiments of the present application, the second storage unit is further specifically configured to:
determining whether the same image as the (N + 1) th image exists in the first to nth images;
and when the images identical to the (N + 1) th image exist in the first image to the (N) th image, taking the identification data of the images identical to the (N + 1) th image in the first image to the (N) th image as screen recording data of the (N + 1) th image.
It should be noted that, for convenience and brevity of description, the specific working process of the screen recording apparatus 800 described above may refer to the corresponding process of the method in fig. 1 to fig. 7, and will not be described in detail herein.
Illustratively, an embodiment of the present application further provides a chip, which includes a processor, and the processor is configured to read and execute a computer program stored in a memory to implement the steps of the screen recording method described above.
Illustratively, the embodiment of the present application further provides a terminal, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the screen recording method when executing the computer program.
Illustratively, the embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and the computer program, when executed by a processor, implements the steps of the screen recording method.
The present application further provides a computer product, which stores computer instructions, and when the computer instructions are executed, the steps of the screen recording method are implemented.
In the above embodiments of the present application, the N +1 th image collected in the screen recording process is compressed and stored by the first image to the nth image collected in the screen recording process, so that in the screen recording process, the image corresponding to the display interface of the terminal is compressed, the data volume of the screen recording file is effectively reduced, the storage space occupied by the screen recording file is reduced, and data transmission of the screen recording file is facilitated. The method solves the problems that the screen recording file obtained by the traditional screen recording method has large data volume, needs to occupy large storage space and is not beneficial to file transmission.
In addition, because the image corresponding to the terminal display interface is directly acquired for compression storage, rather than only the access link corresponding to the page element, the problem that the corresponding display interface cannot be restored to the screen recording is solved.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of each functional unit is illustrated, and in practical applications, the above-mentioned functional allocation may be performed by different functional units or modules according to requirements, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functions are performed in hardware or software depends on the particular application of the screen recording method and design constraints. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/user terminal and method may be implemented in other manners. For example, the above-described apparatus/user terminal embodiments are merely illustrative, and for example, a division of modules or units is only one logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method according to the embodiments described above may be implemented by a computer program, which is stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, in accordance with legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunications signals.
The above embodiments are only used to illustrate the screen recording method of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the screen recording method described in each of the foregoing embodiments may still be modified, or some of the method features may be equivalently replaced; such modifications or substitutions do not substantially depart from the spirit and scope of the screen recording method according to the embodiments of the present application and are intended to be included within the scope of the present application.