Disclosure of Invention
The embodiment of the invention provides a desktop sharing method, a desktop sharing device and a storage medium based on sharing type judgment, which can adjust the acquisition frame rate and the coding parameters aiming at different types of shared contents, reasonably utilize bandwidth resources and improve the sharing effect under the condition of certain transmission bandwidth.
An embodiment of the present invention provides a desktop sharing method based on sharing type determination, including: acquiring a picture to be shared of a sharing sending terminal within a preset time length to obtain a plurality of continuous image frames;
judging the sharing type of the picture content of the picture to be shared according to the picture change amplitude of the plurality of continuous image frames; wherein the sharing type comprises a text class or a video class;
if the picture content of the picture to be shared is a text type, selecting a preset first frame rate as an image acquisition frame rate when the sharing sending terminal shares, calculating a first image coding quality parameter when the sharing sending terminal shares according to the first frame rate and a preset transmission bandwidth, then generating a shared image according to the first frame rate and the first image coding quality parameter, and sending the shared image to a sharing receiving terminal;
if the picture content of the picture to be shared is a video type, selecting a preset second frame rate as an image acquisition frame rate when the sharing sending terminal shares, calculating a second image coding quality parameter when the sharing sending terminal shares according to the second frame rate and a preset transmission bandwidth, then generating a shared image according to the second frame rate and the second image coding quality parameter, and sending the shared image to the sharing receiving terminal; wherein the first frame rate is less than the second frame rate, and the first image encoding quality parameter is higher than the second image encoding quality parameter.
Further, the determining the sharing type to which the picture content of the picture to be shared belongs according to the picture variation amplitude of the plurality of continuous image frames specifically includes:
respectively calculating the picture change area between two adjacent image frames, controlling the preset counting reference value to be increased by one unit when the picture change area between the two adjacent image frames is higher than a preset area threshold value, and controlling the counting reference value to be decreased by one unit when the picture change area between the two adjacent image frames is lower than or equal to the area threshold value;
judging whether the total variation amplitude of the counting reference value is larger than a preset variation threshold value or not, if so, judging that the picture content of the picture to be shared is a video type; if not, the picture content of the picture to be shared is judged to be a text type.
Further, the text class includes any one or more of the following combinations: PPT, Word, Excel, and Web pages.
On the basis of the above method item embodiments, the present invention correspondingly provides apparatus item embodiments.
The invention provides a desktop sharing device based on sharing type judgment, which comprises an image acquisition module, a type judgment module, a text type sharing transmission module and a video type sharing transmission module;
the image acquisition module is used for acquiring the to-be-shared images of the shared sending terminal within a preset time length to obtain a plurality of continuous image frames;
the type distinguishing module is used for judging the sharing type of the picture content of the picture to be shared according to the picture change amplitude of the plurality of continuous image frames; wherein the sharing type comprises a text class or a video class;
the text type sharing transmission module is used for selecting a preset first frame rate as an image acquisition frame rate when the picture content of the picture to be shared is a text type, calculating a first image coding quality parameter when the sharing transmitting terminal is shared according to the first frame rate and a preset transmission bandwidth, then generating a sharing image according to the first frame rate and the first image coding quality parameter, and transmitting the sharing image to a sharing receiving terminal;
the video sharing transmission module is configured to, when the picture content of the picture to be shared is a video, select a preset second frame rate as an image acquisition frame rate when the sharing sending terminal shares the picture, calculate a second image coding quality parameter when the sharing sending terminal shares the picture according to the second frame rate and a preset transmission bandwidth, generate a shared image according to the second frame rate and the second image coding quality parameter, and send the shared image to the sharing receiving terminal; wherein the first frame rate is less than the second frame rate, and the first image encoding quality parameter is higher than the second image encoding quality parameter.
Further, the type determination module is configured to determine, according to the picture variation amplitude of the multiple consecutive image frames, a sharing type to which the picture content of the picture to be shared belongs, and specifically includes:
respectively calculating the picture change area between two adjacent image frames, controlling the preset counting reference value to be increased by one unit when the picture change area between the two adjacent image frames is higher than a preset area threshold value, and controlling the counting reference value to be decreased by one unit when the picture change area between the two adjacent image frames is lower than or equal to the area threshold value;
judging whether the total variation amplitude of the counting reference value is larger than a preset variation threshold value or not, if so, judging that the picture content of the picture to be shared is a video type; if not, the picture content of the picture to be shared is judged to be a text type.
On the basis of the above method item embodiments, the invention correspondingly provides storage medium item embodiments.
Another embodiment of the present invention provides a storage medium, where the storage medium includes a stored computer program, and when the computer program runs, a device where the storage medium is located is controlled to execute the desktop sharing method based on the sharing type determination according to the above embodiment of the present invention.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a desktop sharing method, a device and a storage medium based on sharing type judgment, wherein the method comprises the steps of firstly collecting a picture to be shared of a sharing sending terminal within a preset duration to obtain a plurality of continuous image frames within the preset duration, then judging whether the picture belongs to a text type or a video type according to the variation amplitude of the image frames, if the picture belongs to the text type, generating a shared image by adopting a first frame rate and a first image coding quality parameter, and if the picture belongs to the video type, generating the shared image by adopting a second frame rate and a second image coding quality parameter, wherein the first frame rate to be described is smaller than the second frame rate, and the first image coding quality parameter is higher than the second image coding quality parameter. That is, when the transmission bandwidth is constant, the shared image to be transmitted is generated using the high encoding quality parameter at the low frame rate for the text-type shared picture, and the shared image to be transmitted is generated using the low encoding quality parameter at the high frame rate for the video-type shared picture. Compared with the traditional desktop sharing mode, the scheme can reasonably utilize the existing bandwidth resources and improve the sharing effect.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, an embodiment of the present invention provides a desktop sharing method based on sharing type determination, including the following steps:
step S101: and acquiring the pictures to be shared of the sharing sending terminal within a preset time length to obtain a plurality of continuous image frames.
Step S102: judging the sharing type of the picture content of the picture to be shared according to the picture change amplitude of the plurality of continuous image frames; wherein the sharing type comprises a text class or a video class.
Step S103: if the picture content of the picture to be shared is a text type, selecting a preset first frame rate as an image acquisition frame rate when the sharing sending terminal shares, calculating a first image coding quality parameter when the sharing sending terminal shares according to the first frame rate and a preset transmission bandwidth, then generating a shared image according to the first frame rate and the first image coding quality parameter, and sending the shared image to a sharing receiving terminal.
Step S104: if the picture content of the picture to be shared is a video type, selecting a preset second frame rate as an image acquisition frame rate when the sharing sending terminal shares, calculating a second image coding quality parameter when the sharing sending terminal shares according to the second frame rate and a preset transmission bandwidth, then generating a shared image according to the second frame rate and the second image coding quality parameter, and sending the shared image to the sharing receiving terminal; wherein the first frame rate is less than the second frame rate, and the first image encoding quality parameter is higher than the second image encoding quality parameter.
For step S101, first, a display image of the shared sending terminal is collected within a preset time period to obtain the plurality of continuous image frames, where the preset time period may be set according to an actual situation, and may range from 1 second to 2 seconds, where the preset time period is illustratively 1 second, and it is assumed that 30 images are obtained.
For step S102, because of text sharing, such as PPT, Word, web page, etc., the shared screen of this type of content will not have frequent large-scale screen changes in a short time, the image change is slow and the change area is small; for the shared picture shared by the video class, the picture changes greatly in a short time, for example, a video picture played by an ordinary video player has an image change of about 30 frames per second, so that the sharing type of the picture content of the shared picture can be determined according to the picture change amplitude of the acquired image frame, in a preferred embodiment, the specific determination method is as follows:
respectively calculating the picture change area between two adjacent image frames, controlling the preset counting reference value to be increased by one unit when the picture change area between the two adjacent image frames is higher than a preset area threshold value, and controlling the counting reference value to be decreased by one unit when the picture change area between the two adjacent image frames is lower than or equal to the area threshold value; judging whether the total variation amplitude of the counting reference value is larger than a preset variation threshold value or not, if so, judging that the picture content of the picture to be shared is a video type; if not, the picture content of the picture to be shared is judged to be a text type.
Firstly, setting a calculation reference value, then calculating the area of picture change between two adjacent image frames one by one, wherein the area of picture change refers to the area of different areas of pictures in the two images, the two images can be compared by adopting the existing image comparison method, the areas with different picture contents are extracted, then the area of the area is calculated, so that the area of picture change between the two adjacent image frames is obtained, if the area of picture change is lower than a preset area threshold value, the calculation reference value is reduced by one unit, otherwise, the calculation reference value is increased by one unit; and finally counting the variation amplitude of the reference value, if the variation amplitude exceeds a preset variation threshold value, indicating that the video is a video class, otherwise, indicating that the video is a text class.
Illustratively, assuming that there are A, B, C, D image frames, the initial count reference value is 10, the screen change area between a and B is calculated, the screen change area between B and C is calculated, the screen change area between C and D is calculated, assuming that the screen change area between a and B is greater than the preset area threshold, the count reference value is increased by 1, i.e., 10+1 is 11, the screen change area between B and C is less than the preset area threshold, the count reference value is decreased by 1, i.e., 11-1 is 10, the screen change area between C and D is equal to the preset area threshold, the count reference value is decreased by 1, i.e., 10-1 is 9, and the total change amplitude of the count reference value is 10-9 is 1. If the change threshold is set to 10, 1 < 10 indicates sharing of the text class. It should be noted that this example is merely illustrative, and the specific values can be adjusted according to actual situations.
And the text class comprises any one or more of the following items: PPT, Word, Excel, and Web pages.
For step S103, if it is determined in step S102 that the picture content of the picture to be shared is a text type, since the picture change range of the shared content of the text type is small, and the requirement on the acquisition frame rate is low, a lower acquisition frame rate, such as 5-10 frames, may be selected. The first frame rate is used as the frame rate for acquiring the images during sharing, and a preferred first frame rate may be 5 frames per second, and after the frame rate for acquiring the images is selected, the maximum image coding quality parameter is calculated according to the transmission bandwidth and the first frame rate set in advance on the premise that the transmission bandwidth is not exceeded, so as to obtain the first image coding quality parameter. It should be noted that, the setting of the first image coding quality parameter must be calculated by combining the set acquisition frame rate and the set transmission bandwidth, so that the situation of transmission blocking or packet loss due to insufficient transmission bandwidth caused by excessively high image coding quality parameter setting can be prevented, and the first image coding quality parameter is the maximum image coding quality parameter under the limitation of the set bandwidth and the first acquisition frame rate, so that the quality of the shared picture can be improved as much as possible, and the sharing effect can be ensured. The preferred preset transmission bandwidth may be set to 1 Mbps. And after the acquisition frame rate and the image coding quality parameters are set, recoding the picture to be shared to generate a shared image, and finally sending the shared image to a shared receiving terminal.
For step S104, this step is similar to step S103, except that the second frame rate needs to be set in a higher range of acquisition frame rates, such as 20-30 frames, and the preferred second frame rate may be set to 30 frames per second. And then, according to the set transmission bandwidth, calculating the maximum image coding quality parameter under the second frame rate and the preset transmission bandwidth to obtain the second image coding quality parameter.
By implementing the embodiment of the invention, different image acquisition frame rates and image coding quality parameters can be set according to different sharing types on the premise of not exceeding the preset transmission bandwidth, thereby realizing the effects of reasonably reason of bandwidth and improvement of sharing quality.
On the basis of the above method item embodiments, the present invention correspondingly provides apparatus item embodiments.
As shown in fig. 2, an embodiment of the present invention provides a desktop sharing device based on sharing type determination, which includes an image acquisition module, a type determination module, a text sharing transmission module, and a video sharing transmission module;
the image acquisition module is used for acquiring the to-be-shared images of the shared sending terminal within a preset time length to obtain a plurality of continuous image frames;
the type distinguishing module is used for judging the sharing type of the picture content of the picture to be shared according to the picture change amplitude of the plurality of continuous image frames; wherein the sharing type comprises a text class or a video class;
the text type sharing transmission module is used for selecting a preset first frame rate as an image acquisition frame rate when the picture content of the picture to be shared is a text type, calculating a first image coding quality parameter when the sharing transmitting terminal is shared according to the first frame rate and a preset transmission bandwidth, then generating a sharing image according to the first frame rate and the first image coding quality parameter, and transmitting the sharing image to a sharing receiving terminal;
the video sharing transmission module is configured to, when the picture content of the picture to be shared is a video, select a preset second frame rate as an image acquisition frame rate when the sharing sending terminal shares the picture, calculate a second image coding quality parameter when the sharing sending terminal shares the picture according to the second frame rate and a preset transmission bandwidth, generate a shared image according to the second frame rate and the second image coding quality parameter, and send the shared image to the sharing receiving terminal; wherein the first frame rate is less than the second frame rate, and the first image encoding quality parameter is higher than the second image encoding quality parameter.
In a preferred embodiment, the type determining module is configured to determine a sharing type to which the picture content of the picture to be shared belongs according to the picture variation amplitude of the multiple consecutive image frames, and specifically includes:
respectively calculating the picture change area between two adjacent image frames, controlling the preset counting reference value to be increased by one unit when the picture change area between the two adjacent image frames is higher than a preset area threshold value, and controlling the counting reference value to be decreased by one unit when the picture change area between the two adjacent image frames is lower than or equal to the area threshold value;
judging whether the total variation amplitude of the counting reference value is larger than a preset variation threshold value or not, if so, judging that the picture content of the picture to be shared is a video type; if not, the picture content of the picture to be shared is judged to be a text type.
In a preferred embodiment, the text class includes any one or more of the following in combination: PPT, Word, Excel, and Web pages.
It should be noted that the embodiment of the apparatus of the present invention corresponds to the embodiment of the method of the present invention, and can implement the desktop sharing method based on the sharing type determination according to any one of the above embodiments of the method of the present invention. The above-described embodiments of the apparatus are merely illustrative, and the 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
On the basis of the above method item embodiments, the invention correspondingly provides storage medium item embodiments.
Another embodiment of the present invention provides a storage medium, where the storage medium includes a stored computer program, where when the computer program runs, a device on which the storage medium is located is controlled to execute the desktop sharing method based on the sharing type determination according to any one of the preceding claims.
It should be noted that the storage medium is a computer-readable storage mechanism, and the computer program may be stored in a computer-readable storage medium, and when being executed by a processor, the computer program may implement the steps of the above-mentioned method embodiments. 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 the 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.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.