Video processing method
By separating the video stream and interface stream in the cloud TV solution, and transmitting video stream data only when the interface stream changes, the problem of high bandwidth pressure in the cloud TV solution is solved, and the video playback quality and efficiency are improved.
Patent Information
- Application Number
- CN202411139409.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-11-05
AI Technical Summary
The existing cloud TV solution has a high bandwidth pressure in data transmission between cloud servers and local TVs, resulting in a large amount of data, affecting the quality and efficiency of video playback.
By separating video streams and interface streams between cloud servers and local devices, video stream data will only be sent when the interface stream data changes. Otherwise, video stream data will be sent only to reduce unnecessary alpha data transmission and reduce bandwidth pressure .
It effectively reduces the amount of data transmission between the cloud server and the local device, reduces the bandwidth pressure of the cloud server, improves the quality and efficiency of video playback, and significantly reduces the load of the cloud server when multiple users request video at the same time.
Smart Images

Figure CN118900332A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing technology, and in particular to a video processing method. Background Art
[0002] Cloud TV technology was born to solve the problems of traditional TVs being unable to install and run large applications, having few application services, and being difficult to adapt. Cloud TV is a simulation system built on a cloud server, and its functions are basically the same as those of an actual TV or TV box. By transferring applications originally running on the local TV to the cloud, and transmitting data to the local TV through the end-cloud collaborative engine, the video can be played on the local TV, reducing the application's dependence on the local TV's hardware storage and computing power, allowing the local TV to carry more applications.
[0003] Although the existing cloud TV solutions can reduce the application's dependence on the local TV's hardware storage and computing power to a certain extent, the amount of data transmitted between the cloud and the local TV is still large, and the cloud's bandwidth pressure is relatively high. Summary of the invention
[0004] The embodiment of the present application provides a video processing method, which can reduce the amount of data transmitted between the cloud and the local TV and reduce the bandwidth pressure of the cloud.
[0005] In a first aspect, an embodiment of the present application provides a video processing method, which is applied to a cloud server, and the cloud server is communicatively connected with an electronic device. The video processing method includes:
[0006] In response to a received video playback request sent by the electronic device, playing a target video corresponding to the video playback request;
[0007] Collecting screen data corresponding to the target video at the current moment, the screen data includes video stream data and alpha data of the target video at the current moment;
[0008] When the alpha data at the current moment is the same as the alpha data at the moment before the current moment, the video stream data at the current moment is sent to the electronic device and played by the electronic device.
[0009] In a second aspect, an embodiment of the present application provides a video processing method, which is applied to an electronic device, where the electronic device is communicatively connected to a cloud server, and the video processing method includes:
[0010] In response to the received first input, sending a video playback request to a cloud server;
[0011] Receiving a data packet sent by the cloud server in response to a video playback request; wherein, if the alpha data of the target video corresponding to the video playback request at the current moment is the same as the alpha data at the moment before the current moment, the data packet includes the video stream data at the current moment;
[0012] In the case where the data packet only contains video stream data, decoding and rendering the video stream data in the data packet are performed to obtain processed video stream data;
[0013] Play the processed video stream data.
[0014] In a third aspect, an embodiment of the present application provides a video processing device, which is applied to a cloud server, and the cloud server is communicatively connected with an electronic device, and the video processing device includes:
[0015] A playing module, configured to respond to a video playing request received from an electronic device and play a target video corresponding to the video playing request;
[0016] An acquisition module, used for acquiring screen data corresponding to the target video at the current moment, the screen data including video stream data and alpha data of the target video at the current moment;
[0017] The sending module is used to send the video stream data at the current moment to the electronic device for playing when the alpha data at the current moment is the same as the alpha data at the moment before the current moment.
[0018] In a fourth aspect, an embodiment of the present application provides a video processing device, which is applied to an electronic device, and the electronic device is communicatively connected to a cloud server, and the video processing device includes:
[0019] A sending module, configured to send a video playback request to a cloud server in response to the received first input;
[0020] A receiving module, configured to receive a data packet sent by the cloud server in response to a video playback request; wherein, if the alpha data of the target video corresponding to the video playback request at the current moment is the same as the alpha data at the moment before the current moment, the data packet includes the video stream data at the current moment;
[0021] A processing module, used for decoding and rendering the video stream data in the data packet to obtain processed video stream data when the data packet only contains video stream data;
[0022] The playback module is used to play the processed video stream data.
[0023] In a fifth aspect, an embodiment of the present application provides a cloud server, including:
[0024] processor;
[0025] a memory for storing computer program instructions;
[0026] When the computer program instructions are executed by a processor, the method according to the first aspect is implemented.
[0027] In a sixth aspect, an embodiment of the present application provides an electronic device, including:
[0028] processor;
[0029] a memory for storing computer program instructions;
[0030] When the computer program instructions are executed by a processor, the method described in the second aspect is implemented.
[0031] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the method described in the first aspect or the method described in the second aspect.
[0032] In an eighth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method described in the first aspect or the method described in the second aspect.
[0033] When the cloud server of the embodiment of the present application sends a target video corresponding to a video playback request to an electronic device, it first determines whether the alpha data of the target video at the current moment has changed. If it has not changed, only the video stream data is sent to the electronic device, and the alpha data corresponding to the video stream data is no longer sent, thereby reducing the amount of data transmitted between the cloud server and the electronic device and reducing the bandwidth pressure of the cloud server. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0035] Figure 1 A schematic diagram of an application scenario of a video processing method provided in an embodiment of the present application;
[0036] Figure 2 A flowchart of a video processing method provided in an embodiment of the present application;
[0037] Figure 3 A flowchart of another video processing method provided in an embodiment of the present application;
[0038] Figure 4 A flowchart of another video processing method provided in an embodiment of the present application;
[0039] Figure 5 A flowchart of a process for processing a data packet provided in an embodiment of the present application;
[0040] Figure 6 A schematic diagram of the interaction process between a cloud server and an electronic device provided in an embodiment of the present application;
[0041] Figure 7 A schematic diagram of interaction between a cloud server and a front-end and back-end switching of an electronic device provided in an embodiment of the present application;
[0042] Figure 8 A schematic diagram of the structure of a video processing device provided in an embodiment of the present application;
[0043] Fig. 9 A schematic diagram of the structure of a video processing device provided in an embodiment of the present application;
[0044] Fig.10 A structural diagram of a cloud server provided in an embodiment of the present application;
[0045] Fig.11 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0047] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0048] As mentioned above, cloud TV technology was born to solve the problems of transmission TV, such as the inability to install and run large applications, few application services, and difficult adaptation. That is, to build a simulation system on the cloud server, and transfer the applications originally running on the local TV to the cloud to run, so as to reduce the application's dependence on the hardware storage and computing power of the local TV, so that the local TV can carry more applications.
[0049] The currently used cloud TV solution still has the problem of large data volume transmission between cloud servers and electronic devices, which creates a large bandwidth pressure on cloud servers.
[0050] To this end, an embodiment of the present application provides a video processing method, which can reduce the amount of data transmitted between the cloud server and the electronic device and reduce the bandwidth pressure of the cloud server while meeting the playback requirements of the electronic device.
[0051] The video processing method provided in the embodiment of the present application is described in detail below in conjunction with specific embodiments.
[0052] Figure 1 A schematic diagram of an application scenario of a video processing method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the application scenario may include a cloud server 100 and an electronic device 101, and the cloud server 100 and the electronic device 101 are communicatively connected, for example, the cloud server 100 and the electronic device 101 may communicate through a network.
[0053] The cloud server 100 is installed with a cloud TV, and the functions of the cloud TV are substantially the same as those of a local TV. For example, the cloud server 100 can play videos through the cloud TV.
[0054] There may be one or more electronic devices 101, that is, the cloud server 100 may communicate with one or more electronic devices 101. The electronic devices 101 may include mobile phones, laptops, tablet computers, televisions, and other devices that can play videos. Figure 1 Take an electronic device 101 as an example.
[0055] Figure 2 A flowchart of a video processing method provided in an embodiment of the present application, the video processing method can be applied to Figure 1 The cloud server shown in Figure 1. Figure 2 As shown, the video processing method may include the following steps:
[0056] S210: In response to a received video playback request sent by the electronic device, play a target video corresponding to the video playback request.
[0057] S220: Collect screen data corresponding to the target video at the current moment.
[0058] The screen data includes the video stream data and alpha data of the target video at the current moment.
[0059] S230: When the alpha data at the current moment is the same as the alpha data at the moment before the current moment, the video stream data at the current moment is sent to the electronic device, and the electronic device plays the video stream data.
[0060] When the cloud server of the embodiment of the present application sends a target video corresponding to a video playback request to an electronic device, it first determines whether the alpha data of the target video at the current moment has changed. If it has not changed, only the video stream data is sent to the electronic device, and the alpha data corresponding to the video stream data is no longer sent, thereby reducing the amount of data transmitted between the cloud server and the electronic device and reducing the bandwidth pressure of the cloud server.
[0061] The above steps are described in detail below:
[0062] In S210, the video play request is used to request the cloud server for the video to be played. For example, the video play request may include information such as the name and identifier of the video. The video play request may be transmitted between the electronic device and the cloud server in the form of a message or a data packet.
[0063] The target video is the video corresponding to the video playback request, and the specific content of the target video is not limited in the embodiment of the present application. In the embodiment of the present application, after the cloud server receives the video playback request sent by the electronic device, the target video corresponding to the video playback request can be obtained from the cloud server locally, or the target video corresponding to the video playback request can be downloaded through the network.
[0064] After the cloud server obtains the target video, it can play the target video, providing a basis for subsequent data transmission.
[0065] In S220, the screen data is a frame of ARGB format data collected by the cloud server during the process of playing the target video. The screen data may include the video stream data and alpha data of the target video at the current moment. The video stream data is also called media stream data, and the alpha data is the display data in the playback interface other than the video stream data, also called interface stream data. Exemplarily, the alpha data may include the transparency information of each pixel of the target video at the current moment.
[0066] For example, during the process of playing the target video, the cloud server can collect the screen data of the target video at the current moment, obtain the video stream data and transparency information of the target video at the current moment, and provide a basis for the next step of data transmission. For example, the cloud server can collect the screen data of the target video at the current moment through minicap.
[0067] In S230, after the cloud server collects the screen data, alpha data can be extracted from the screen data. The extraction method is not limited in the embodiment of the present application. For example, alpha data can be extracted from the screen data through the ARGBExtractAlphaRow function provided by LibYUV.
[0068] After the alpha data is extracted, the cloud server may compare the alpha data at the current moment with the alpha data at the previous moment to determine whether the alpha data at the current moment has changed.
[0069] When the alpha data at the current moment has not changed, the cloud server only sends the video stream data at the current moment to the electronic device, and no longer sends the alpha data. At this time, the electronic device can keep the alpha data of the previous moment unchanged. In this way, the amount of data between the cloud server and the electronic device can be reduced, reducing the bandwidth pressure of the cloud server.
[0070] The video stream data here may include the storage address, link and other information of the target video. Based on the storage address or link, the electronic device can obtain the corresponding video, thereby reducing the amount of transmitted data and reducing the bandwidth pressure of the cloud server. At the same time, it can also ensure the video quality and picture clarity played by the electronic device.
[0071] Figure 3 A flowchart of another video processing method provided in an embodiment of the present application, Figure 3 and Figure 2 The difference is that Figure 3 Also includes S310-S320.
[0072] S310. When the alpha data at the current moment is different from the alpha data at the moment before the current moment, encode the video stream data at the current moment to obtain encoded data, and compress the alpha data at the current moment to obtain compressed data.
[0073] For example, if the alpha data at the current moment changes relative to the alpha data at the previous moment, the cloud server may send the alpha data together with the video stream data to the electronic device to keep the playback content synchronized.
[0074] Specifically, the cloud server can encode the video stream data at the current moment to obtain the encoded data. Exemplarily, the cloud service can encode the video stream data into data in H264 format. For example, the cloud server can first use the function provided by libYUV to convert the video stream data from ARGB format to YUVI420 format, and then use FFmpeg to encode the video stream data in YUVI420 format into H264 format.
[0075] For alpha data, the cloud server can use compression to reduce the amount of data transmitted. That is, in the embodiment of the present application, the cloud server can use different processing methods for video stream data and alpha data to ensure the accuracy of data transmission.
[0076] S320: Encapsulate the encoded data and the compressed data to obtain a data packet, and send the data packet to an electronic device for playback.
[0077] For example, the cloud server can encapsulate the encoded video stream data and the compressed alpha data into a data packet, and send it to the electronic device through a transmission protocol, and the electronic device plays it. The embodiment of the present application does not limit the transmission protocol, for example, the WebSocket protocol can be used for data transmission.
[0078] In the embodiment of the present application, when the alpha data changes, the alpha data and the video stream data are processed separately, and the processed data are encapsulated into a data packet, which is sent to the electronic device. While reducing the amount of data, the accuracy of data transmission and the synchronization of the end and the cloud are ensured.
[0079] It is understandable that during the video playback process, the playback position, view size, etc. of the cloud-side video may change. In order to ensure the synchronization between the end and the cloud, in some embodiments, after S210, the video processing method may further include the following steps:
[0080] Obtaining playback parameters of the screen data at the current moment, where the playback parameters include at least one of the following: playback position and view size of the screen data;
[0081] When the playback parameters at the current moment are different from the playback parameters at the previous moment, the playback parameters at the current moment are sent to the electronic device, so that the electronic device adjusts the locally played screen data according to the playback parameters at the current moment.
[0082] The playback position of the screen data is the position of the screen data in the current interface, which can be represented by coordinates. The view size is the size of the view of the interface playing the screen data. The screen data here can include video stream data and alpha data, that is, the cloud server can detect the playback position and view size of the video stream data and alpha data in real time.
[0083] For example, the cloud server can compare the playback parameters of the screen data at the current moment with the playback at the previous moment. As long as one parameter changes, it is considered that the playback parameters of the screen data have changed. When the playback parameters of the screen data change, the cloud server can send the playback parameters at the current moment to the electronic device, and the electronic device can adjust them adaptively.
[0084] The current playback parameters here can be parameters that have changed. For example, when only the playback position of the alpha data has changed, the cloud server only sends the playback position of the alpha data to the electronic device. When the playback parameters of both the video stream data and the alpha data have changed, the cloud server can send the playback parameters of the video stream data and the alpha data to the electronic device at the same time. That is, the cloud server can only transmit the parameters that have actually changed, thereby reducing the amount of data transmitted and reducing the bandwidth pressure of the cloud server.
[0085] Exemplarily, when the cloud server detects that the playback parameters of the screen data have changed, it can call the updatewindow method in SurfaceView.java and adaptively modify the corresponding class according to the actual situation.
[0086] The cloud server of the embodiment of the present application can monitor the playback parameters of the screen data in real time and dynamically, and notify the electronic device in a timely manner when the playback parameters change, thereby ensuring the synchronization between the end and the cloud.
[0087] In some embodiments, the above S210 may include the following steps:
[0088] In response to a video playback request received from an electronic device, creating a first player object;
[0089] Calling a first interface of a first player object to play a target video corresponding to the video playback request;
[0090] A first message is sent to the electronic device, where the first message includes interface information of the first interface.
[0091] The first player object is used to play the target video. Exemplarily, after receiving the video play request sent by the electronic device, the cloud server can create the first player object MediaPlayer in the Framework layer to provide a basis for the subsequent play of the target video.
[0092] The first interface is an interface in the first player object, which is used to play the target video. After the cloud server creates the first player object, it can call the first interface of the first player object to play the target video.
[0093] At the same time, the cloud server sends a first message containing the interface information of the first interface to the electronic device, so that the electronic device calls the same interface to play the target video. A player object on the cloud side corresponds to a player object on the terminal side. For example, if the cloud server calls the pause interface, the electronic device also calls the pause interface of the corresponding player object to play the target video.
[0094] In order to ensure that the players on both sides of the end cloud correspond one to one, after creating the first player object, the cloud server can assign a unique identifier to the first player object, and the unique identifier can be generated in the method of creating the first player object. The embodiment of the present application does not limit the form of the unique identifier, for example, it can be represented by the player object name_8-bit random number.
[0095] After receiving a video playback request, the cloud server of the embodiment of the present application creates a corresponding player object and calls the corresponding interface to play the video. At the same time, the interface information is sent to the electronic device, so that the electronic device calls the same interface to play the video, thereby ensuring the consistency of video playback on both sides of the cloud.
[0096] In actual application, the user may switch applications locally, for example, switching the application currently playing the video from the foreground to the background, or from the background to the foreground. In order to ensure the synchronization of the application status on both sides of the end and the cloud, the video processing method may also include the following steps:
[0097] Receiving a foreground-background switching message sent by an electronic device, where the foreground-background switching message is used to instruct a target application playing a target video to be switched from the foreground to the background, or from the background to the foreground;
[0098] In response to the foreground / background switching message, a foreground / background switching operation is performed on the target application.
[0099] Exemplarily, when the target application switches between the foreground and background on the terminal side, the electronic device synchronously sends a foreground and background switching message to the cloud server, instructing the cloud server to perform the same operation on the local target application.
[0100] For example, when the current background switching message indicates that the target application is switched from the foreground to the background, the cloud server may suspend the target application to switch the target application from the foreground to the background. When the current background switching message indicates that the target application is switched from the background to the foreground, the cloud server may switch the target application from the background to the foreground.
[0101] In the embodiment of the present application, when the application state on the terminal side changes, the electronic device will synchronize the application state to the cloud side, so that the cloud server performs the same operation, thereby ensuring the synchronization of the application state on both sides of the terminal and the cloud.
[0102] Figure 4 A flowchart of another video processing method provided in an embodiment of the present application, which can be applied to Figure 1 The electronic equipment shown, such as Figure 4 As shown, the video processing method may include the following steps:
[0103] S410: In response to the received first input, send a video playback request to a cloud server.
[0104] S420: Receive a data packet sent by the cloud server in response to a video playback request.
[0105] In which, when the alpha data of the target video corresponding to the video playback request at the current moment is the same as the alpha data at the moment before the current moment, the data packet includes the video stream data at the current moment.
[0106] S430: When the data packet only includes video stream data, decode and render the video stream data in the data packet to obtain processed video stream data.
[0107] S440: Play the processed video stream data.
[0108] In the embodiment of the present application, when the alpha data at the current moment has not changed, the electronic device will only receive the video stream data sent by the cloud server, thereby reducing the amount of data transmitted between the end and the cloud, and reducing the bandwidth pressure of the cloud server. At the same time, the electronic device decodes and renders the video stream data when only receiving the video stream data, which effectively improves the picture quality and clarity on the end side, and also reduces the CPU usage of the cloud server, especially when multiple users request videos from the cloud server at the same time, which can greatly reduce the bandwidth pressure of the cloud server.
[0109] The above steps are described in detail below:
[0110] In S410, the first input is the input for playing the target video. Exemplarily, the first input may include but is not limited to: the user's touch input to the remote control of the electronic device through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs, which can be determined according to actual use requirements and are not limited in the embodiments of the present application. The specific gesture in the embodiments of the present application may be any one of a single-click gesture, a sliding gesture, a dragging gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double-press gesture, and a double-click gesture; the click input in the embodiments of the present application may be a single-click input, a double-click input, or any number of click inputs, etc., and may also be a long press input or a short press input.
[0111] For example, the first input mentioned above may be: a user clicking input on a button on a remote control, and the button is associated with a target video.
[0112] After receiving the first input, the electronic device can determine that the user wants to play the target video. At this time, the electronic device can determine the name, identifier and other information of the target video based on the first input, and generate a video playback request based on the information and send it to the cloud server.
[0113] In S420, the data packet may include video stream data, or video stream data and alpha data. The content of the data packet is related to whether the alpha data changes. For example, when the alpha data changes, the data packet may include both the video stream data and the alpha data. When the alpha data does not change, the data packet only includes the video stream data. This can reduce the amount of data transmitted between the end and the cloud, and reduce the bandwidth pressure of the cloud server.
[0114] Exemplarily, the electronic device can split the received data through the WebSocket thread to determine the content of the data packet, and the split data can be placed in the corresponding cache queue, that is, the WebSocket thread cyclically receives the data packet and places the split data into the corresponding cache queue.
[0115] The content of the data packet is different, and the subsequent data processing strategy adopted by the electronic device is also different, which can improve the efficiency and accuracy of the playback. For example, when the data packet contains only video stream data, the electronic device can adopt a diversion processing strategy, that is, directly process the video stream data and then play it. When the data packet contains both video stream data and alpha data, a confluence processing strategy can be adopted, that is, first obtain the video stream data and alpha data separately, then merge the video stream data and alpha data, and then process the merged data.
[0116] In S430, the data packet contains video stream data in H264 format. Therefore, after the electronic device splits the data packet to obtain the video stream data, it first decodes the video stream data to obtain data in YUVI420 format, and then renders the data in YUVI420 format to obtain rendered data.
[0117] Exemplarily, the electronic device can decode the video stream data through a decoding thread, and the decoding thread will cyclically read the cache queue for decoding. It should be noted that the video stream data and the alpha data are stored in different cache queues, and the decoding thread is used to decode the video stream data.
[0118] When decoding video stream data, hard decoding or soft decoding can be used, wherein soft decoding can use ffmpeg codec, and hard decoding can use codec. For example, when an electronic device needs to play multiple videos at the same time, soft decoding can be used to decode, avoid data frame loss, and ensure data integrity.
[0119] When performing data rendering, illustratively, GLSurfaceView may be used for data rendering.
[0120] In the embodiment of the present application, the electronic device performs decoding and rendering operations on the video, which can greatly reduce the CPU usage of the cloud server and improve the video playback effect.
[0121] In S440, after the data is rendered, the electronic device can play the rendered data, thereby satisfying the user's playback needs.
[0122] During video playback, electronic devices can report the video playback status to the cloud server in real time or at regular intervals to ensure consistency between the end and the cloud.
[0123] In some embodiments, when the data packet contains both video stream data and alpha data, the video processing method may further include the following steps:
[0124] In the case where the data includes alpha data and video stream data, decompressing the alpha data to obtain decompressed alpha data, and decoding the video stream data to obtain decoded video stream data;
[0125] Merging the decompressed alpha data and the decoded video stream data to obtain merged data;
[0126] Render the merged data, and play the rendered data.
[0127] When a data packet contains both video stream data and alpha data, the video stream data and the alpha data are processed differently. For example, a decoding operation needs to be performed on the video stream data, and a decompression operation needs to be performed on the alpha data. The decompression operation is performed by a decompression thread.
[0128] After the decompression operation and the decoding operation are completed, the decoded video stream data and the decompressed alpha data can be merged to obtain merged data, and then the merged data can be rendered using GLSurfaceView, and then the rendered data can be played.
[0129] Figure 5 A flowchart of a data packet processing process provided by an embodiment of the present application, such as Figure 5 As shown, the process may include the following steps:
[0130] S501, the WebSocket thread receives a data packet, and splits the received data packet to obtain H264 data, that is, encoded video stream data.
[0131] S502: Put the H264 data into the video stream data cache queue.
[0132] S503, determine whether there is alpha data in the data packet, if not, return to execute S501, if yes, execute S504.
[0133] S504: Acquire alpha data.
[0134] S505: Put the alpha data into the alpha data cache queue.
[0135] The above are the operations performed by the WebSocket thread of the cloud service.
[0136] S506, after the cloud server splits the data to obtain H264 data, it starts the decoding thread, and the decoding thread cyclically reads the video stream data cache queue. If no data is read, it continues to read the video stream data cache queue. If data is read, execute S507.
[0137] S507: Decode the video stream data using a decoder to obtain decoded video stream data.
[0138] S508. If the split data also includes alpha data, the cloud server starts a decompression thread, and the decompression thread reads the alpha data cache queue. If no data is read, the decompression thread continues to read the alpha data cache queue. If data is read, execute S509.
[0139] S509: Decompress the alpha data to obtain decompressed alpha data.
[0140] S510 , combining the decoded video stream data and the decompressed alpha data to obtain combined data.
[0141] S511. Use GLSurfaceView to render the merged data.
[0142] In the embodiment of the present application, when a data packet contains both alpha data and video stream data, the alpha data and the video stream data are first processed separately, and then the processed data are merged, and finally the merged data is rendered, thereby improving the picture quality and playback effect of the video while reducing resource consumption on the cloud side.
[0143] In some embodiments, after S440, the video processing method may further include the following steps:
[0144] Receiving playback parameters sent by the cloud server, where the playback parameters include at least one of the following: playback position and view size of screen data of the target video at the current moment;
[0145] Adjust the local screen data corresponding to the target video according to the playback parameters.
[0146] For the relevant contents of the playback parameters, please refer to the above embodiments and will not be described in detail here.
[0147] That is, when the playback parameters on the cloud side change, the cloud server will synchronously send the changed playback parameters to the electronic device. Based on the received new playback parameters, the electronic device can synchronously adjust the local playback parameters of the target video to maintain the synchronization of playback on both sides of the cloud.
[0148] In some embodiments, before S420, the video processing method may further include the following steps:
[0149] Receive a first message sent by the cloud server, where the first message includes interface information of a first interface, where the first interface is an interface of a first player object called by the cloud server to play a target video;
[0150] Create a second player object;
[0151] Accordingly, the above S440 may include the following steps:
[0152] The second interface in the second player object that has a mapping relationship with the first interface is called to play the processed video stream data.
[0153] The second player object is a player object created locally by the electronic device and is used to play the target video locally. The second player object has a unique identifier and has a corresponding relationship with the first player object in the cloud server. The second player object may include multiple interfaces. The second interface is one of the interfaces included in the second player object. The second interface has a mapping relationship with the first interface, and the second interface and the first interface may be the same or have a binding relationship to ensure the accuracy and consistency of the playback.
[0154] After the cloud server creates the first player object, it calls an interface of the first player object to play the target video, and sends the information of the called interface to the electronic device through the first message. After the electronic device receives the first message, it creates a second player object locally and calls the same interface to play the target video according to the interface information in the first message.
[0155] For example, if the cloud server calls the pause interface, the electronic device also calls the pause interface to ensure the consistency of playback.
[0156] Combine the following Figure 6 , the interaction process between the cloud server and the electronic device is described. Taking the electronic device including a television as an example, the television may include a set-top box.
[0157] like Figure 6 As shown, the user can use the remote control 601 to control the set-top box 602 on the terminal side. After receiving the user's key information, the set-top box 602 generates a video playback request and transmits it to the cloud server through the WebSocket protocol. After receiving the video playback request, the cloud server's cloud virtual machine 603 distributes it to the corresponding APP 604. Based on the video playback request, APP 604 creates a first player object 605 and calls the corresponding interface to play the target video. At the same time, the interface information is transmitted to the proxy module 607 on the terminal side through the proxy module 606. After receiving the interface information, the proxy module 607 sends it to the local processor 608 on the terminal side through the WebSocket protocol. After receiving the interface information, the local processor 608 creates a second player object 609 locally and calls the same interface to achieve terminal-side playback.
[0158] During video playback, the client side will also report the playback status, such as onError, onComplete, etc., to the proxy module 606 of the cloud server. After receiving the playback status, the proxy module 606 reports it to the first player object 605, which then reports it to the upper-layer APP, such as APP 604. In this way, the independence of the upper-layer APP can be guaranteed.
[0159] The embodiment of the present application achieves consistency of playback on both sides of the end and the cloud by creating a mapping of players on both sides of the end and the cloud.
[0160] In some embodiments, the video processing method may further include the following steps:
[0161] Receiving an application switching input, where the application switching input is used to switch a target application playing a target video from the foreground to the background, or from the background to the foreground;
[0162] In response to the application switching input, a foreground-background switching operation is performed on the target application corresponding to the target video, and a foreground-background switching message is sent to the cloud server, so that the cloud server performs a foreground-background switching operation on the target application playing the target video.
[0163] Different application switching inputs may correspond to different buttons or controls. For example, when a user needs to switch a target application from the foreground to the background, the user may click the "Settings" button on the remote control. That is, when the electronic device receives the user's input to the "Settings" button, it assumes that the user wishes to switch the target application from the foreground to the background.
[0164] In this case, the electronic device may send a first switching message to the cloud server to instruct the cloud server to switch the target application from the foreground to the background.
[0165] For example, when the user needs to switch the target application from the background to the foreground, the user can click the "back" button on the remote control. That is, when the electronic device receives the user's input on the "back" button, it believes that the user wants to switch the target application from the background to the foreground.
[0166] In this case, the electronic device may send a second switching message to the cloud server to instruct the cloud server to switch the target application from the background to the foreground. The foreground and background switching message may specifically include a first switching message and a second switching message.
[0167] Figure 7 A schematic diagram of the interaction between a cloud server and a front-end and back-end switching of an electronic device provided in an embodiment of the present application. Figure 7 The interactive process of switching between the front and back ends of the cloud server and the electronic device is explained.
[0168] S710: The electronic device receives a user input on a “settings” button.
[0169] S720. In response to the input, the electronic device sends a first switching message to the cloud server.
[0170] S730. After receiving the first switching message, the proxy module of the cloud server starts the transparent application, thereby switching the target application from the foreground to the background.
[0171] S740: The electronic device receives a user input on a “return” button.
[0172] S750. In response to the input, the electronic device sends a second switching message to the cloud server.
[0173] S760. After receiving the second switching message, the proxy module of the cloud server sends a broadcast message to notify the transparent application.
[0174] S770: After receiving the broadcast message, the transparent application ends its own process, and the target application in the background is switched back to the foreground for display.
[0175] In the embodiment of the present application, when the application state on the terminal side changes, the electronic device will synchronize the application state to the cloud side, so that the cloud server performs the same operation, thereby ensuring the synchronization of the application state on both sides of the terminal and the cloud.
[0176] The embodiment of the present application adopts a method of separating the video stream and the interface stream, and moves the tasks of pulling streams, decoding and rendering from the cloud side to the terminal side for execution, thereby reducing the resource consumption on the cloud side and improving the playback effect on the terminal side. At the same time, by separating the video stream and the interface stream, and determining the data to be sent to the terminal side based on whether the interface stream changes, the data transmission volume between the terminal and the cloud is further reduced, thereby reducing the bandwidth pressure on the cloud side.
[0177] Based on the same inventive concept, the embodiment of the present application also provides a video processing device, which is applied to a cloud server, and the cloud server is connected to the electronic device for communication. Figure 8 The video processing device provided in the embodiment of the present application is described in detail.
[0178] Figure 8 A schematic diagram of the structure of a video processing device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the video processing device 800 may include:
[0179] The playing module 801 is used to respond to the video playing request sent by the electronic device and play the target video corresponding to the video playing request;
[0180] The acquisition module 802 is used to acquire screen data corresponding to the target video at the current moment, where the screen data includes video stream data and alpha data of the target video at the current moment;
[0181] The sending module 803 is used to send the video stream data at the current moment to the electronic device for playing when the alpha data at the current moment is the same as the alpha data at the moment before the current moment.
[0182] When the cloud server of the embodiment of the present application sends a target video corresponding to a video playback request to an electronic device, it first determines whether the alpha data of the target video at the current moment has changed. If it has not changed, only the video stream data is sent to the electronic device, and the alpha data corresponding to the video stream data is no longer sent, thereby reducing the amount of data transmitted between the cloud server and the electronic device and reducing the bandwidth pressure of the cloud server.
[0183] In some embodiments, the video processing device 800 may further include:
[0184] A processing module, configured to encode the video stream data at the current moment to obtain encoded data, and to compress the alpha data at the current moment to obtain compressed data, if the alpha data at the current moment is different from the alpha data at the previous moment, and to encapsulate the encoded data and the compressed data to obtain a data packet;
[0185] The sending module 803 is further used to send the data packet to the electronic device for playing.
[0186] In some embodiments, the video processing device 800 may further include:
[0187] The acquisition module is used to acquire the playback parameters of the screen data at the current moment after the playback module 801 plays the target video corresponding to the video playback request in response to the received video playback request sent by the electronic device, wherein the playback parameters include at least one of the following: the playback position and the view size of the screen data;
[0188] The sending module 803 is also used to send the current moment's playing parameters to the electronic device when the current moment's playing parameters are different from the previous moment's playing parameters, so that the electronic device adjusts the locally played screen data according to the current moment's playing parameters.
[0189] In some embodiments, the playback module 801 is specifically used to:
[0190] In response to a video playback request received from an electronic device, creating a first player object;
[0191] Calling a first interface of a first player object to play a target video corresponding to the video playback request;
[0192] The sending module 803 is further configured to send a first message to the electronic device, where the first message includes interface information of the first interface.
[0193] In some embodiments, the video processing device 800 may further include:
[0194] A receiving module, used to receive a foreground-background switching message sent by an electronic device, where the foreground-background switching message is used to instruct a target application playing a target video to switch from the foreground to the background, or from the background to the foreground;
[0195] The processing module is also used to respond to the foreground and background switching message and perform a foreground and background switching operation on the target application.
[0196] Figure 8 Each module in the device shown has the function of realizing Figure 1-Figure 3 The functions of each step in the process can achieve the corresponding technical effects, so for the sake of brevity, they will not be described in detail here.
[0197] Based on the same inventive concept, the embodiment of the present application further provides a video processing device, which is applied to an electronic device, and the electronic device is connected to a cloud server for communication. Fig. 9 The video processing device provided in the embodiment of the present application is described in detail.
[0198] Fig. 9 A schematic diagram of the structure of a video processing device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the video processing device 900 may include:
[0199] The sending module 901 is used to send a video playback request to the cloud server in response to the received first input;
[0200] The receiving module 902 is used to receive a data packet sent by the cloud server in response to a video playback request; wherein, if the alpha data of the target video corresponding to the video playback request at the current moment is the same as the alpha data at the moment before the current moment, the data packet includes the video stream data at the current moment;
[0201] The processing module 903 is used to decode and render the video stream data in the data packet to obtain processed video stream data when the data packet only contains video stream data;
[0202] The playing module 904 is used to play the processed video stream data.
[0203] In the embodiment of the present application, when the alpha data at the current moment has not changed, the electronic device will only receive the video stream data sent by the cloud server, thereby reducing the amount of data transmitted between the end and the cloud, and reducing the bandwidth pressure of the cloud server. At the same time, the electronic device decodes and renders the video stream data when only receiving the video stream data, which effectively improves the picture quality and clarity on the end side, and also reduces the CPU usage of the cloud server, especially when multiple users request videos from the cloud server at the same time, which can greatly reduce the bandwidth pressure of the cloud server.
[0204] In some embodiments, the processing module 903 is further configured to:
[0205] In the case where the data includes alpha data and video stream data, decompressing the alpha data to obtain decompressed alpha data, and decoding the video stream data to obtain decoded video stream data;
[0206] Merging the decompressed alpha data and the decoded video stream data to obtain merged data;
[0207] Render the merged data, and play the rendered data.
[0208] In some embodiments, the receiving module 902 is further used to receive the playback parameters sent by the cloud server after the playback module 904 plays the processed video stream data, and the playback parameters include at least one of the following: the playback position and view size of the screen data of the target video at the current moment;
[0209] The processing module 903 is further used to adjust the screen data corresponding to the target video locally according to the playback parameters.
[0210] In some embodiments, the receiving module 902 is further used to receive a first message sent by the cloud server before receiving a data packet sent by the cloud server in response to a video playback request, where the first message includes interface information of a first interface, where the first interface is an interface of a first player object called by the cloud server to play the target video;
[0211] The processing module 903 is also used to create a second player object;
[0212] The playback module 904 is specifically used for:
[0213] The second interface in the second player object that has a mapping relationship with the first interface is called to play the processed video stream data.
[0214] In some embodiments, the receiving module 902 is further used to receive an application switching input, where the application switching input is used to switch a target application playing a target video from the foreground to the background, or from the background to the foreground;
[0215] The processing module 903 is further used to perform a foreground-background switching operation on the target application corresponding to the target video in response to the application switching input;
[0216] The sending module 901 is also used to send a foreground-background switching message to the cloud server, so that the cloud server performs a foreground-background switching operation on the target application playing the target video.
[0217] Fig. 9 Each module in the device shown has the function of realizing Figure 4-Figure 7 The functions of each step in the process can achieve the corresponding technical effects, so for the sake of brevity, they will not be described in detail here.
[0218] Based on the same inventive concept, the present application embodiment also provides a cloud server. Fig.10 The cloud server provided in the embodiment of the present application is described in detail.
[0219] like Fig.10 As shown, the cloud server 1000 may include a processor 1010 and a memory 1020 for storing computer program instructions.
[0220] The processor 1010 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0221] The memory 1020 may include a large capacity memory for data or instructions. For example, but not limitation, the memory 1020 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 1020 may include a removable or non-removable (or fixed) medium, or the memory 1020 is a non-volatile solid-state memory. In one example, the memory 1020 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0222] The processor 1010 reads and executes the computer program instructions stored in the memory 1020 to implement Figure 1-Figure 3 The method in the embodiment shown in the figure is achieved Figure 1-Figure 3 The corresponding technical effects achieved by executing the method in the illustrated embodiment are not described in detail here for the sake of brevity.
[0223] In one example, the cloud server 1000 may further include a communication interface 1030 and a bus 1040. Fig.10As shown, the processor 1010, the memory 1020, and the communication interface 1030 are connected via a bus 1040 and communicate with each other.
[0224] The communication interface 1030 is mainly used to implement communication between various modules, devices and / or equipment in the embodiments of the present application.
[0225] The bus 1040 includes hardware, software or both, and couples the components of the cloud server 1000 to each other. For example, but not limitation, the bus 1040 may include an accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, an enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, a front side bus (Front Side Bus, FSB), a hypertransport (Hyper Transport, HT) interconnection, an industry standard architecture (Industry Standard Architecture, ISA) bus, an infinite bandwidth interconnection, a low pin count (LPC) bus, a memory bus, a micro channel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus or a combination of two or more of these. In appropriate cases, the bus 1040 may include one or more buses. Although the present application embodiment describes and illustrates a specific bus, the present application considers any suitable bus or interconnection.
[0226] The cloud server responds to the video playback request sent by the received electronic device, plays the target video corresponding to the video playback request, and then executes the video processing method in the embodiment of the present application, thereby realizing the combination Figure 1-Figure 3 The video processing method described and Figure 8 A video processing apparatus is described.
[0227] Based on the same inventive concept, the present application embodiment also provides an electronic device. Fig.11 The electronic device provided in the embodiments of the present application is described in detail.
[0228] like Fig.11 As shown, the electronic device 1100 may include a processor 1110 and a memory 1120 for storing computer program instructions.
[0229] The processor 1110 may include a central processing unit (CPU) or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0230] The memory 1120 may include a large capacity memory for data or instructions. For example, but not limitation, the memory 1120 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 1120 may include a removable or non-removable (or fixed) medium, or the memory 1120 is a non-volatile solid-state memory. In one example, the memory 1120 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.
[0231] The processor 1110 reads and executes the computer program instructions stored in the memory 1120 to implement Figure 4-Figure 7 The method in the embodiment shown in the figure is achieved Figure 4-Figure 7 The corresponding technical effects achieved by executing the method in the illustrated embodiment are not described in detail here for the sake of brevity.
[0232] In one example, the electronic device 1100 may further include a communication interface 1130 and a bus 1140. Fig.11 As shown, the processor 1110, the memory 1120, and the communication interface 1130 are connected via a bus 1140 and communicate with each other.
[0233] The communication interface 1130 is mainly used to implement communication between various modules, devices and / or equipment in the embodiments of the present application.
[0234] Bus 1140 includes hardware, software or both, and each component of electronic device 1100 is coupled to each other. For example, but not limitation, bus 1140 may include accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, front side bus (Front Side Bus, FSB), Hyper Transport (Hyper Transport, HT) interconnection, industry standard architecture (Industry Standard Architecture, ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnect (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1140 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0235] The electronic device responds to the received first input and sends a video playback request to the cloud server, and then executes the video processing method in the embodiment of the present application, thereby realizing the combination Figure 4-Figure 7 The video processing method described and Fig. 9 A video processing apparatus is described.
[0236] In addition, in combination with the video processing method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the video processing methods in the above embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0237] In addition, an embodiment of the present application also provides a computer program product, including a computer program, which is executed by at least one processor to implement the various processes of the above-mentioned video processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0238] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0239] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0240] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0241] The above reference is according to the method of the present application embodiment, the flow chart of the device (system) and the computer program product and / or the block diagram of the present application embodiment. It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0242] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A video processing method, characterized in that: Applied to a cloud server, the cloud server is communicatively connected with an electronic device, and the video processing method includes: In response to the received video playback request sent by the electronic device, play a target video corresponding to the video playback request; Collecting screen data corresponding to the target video at the current moment, wherein the screen data includes video stream data and alpha data of the target video at the current moment; In the case where the alpha data at the current moment is the same as the alpha data at the moment before the current moment, the video stream data at the current moment is sent to the electronic device and played by the electronic device.
2. The method according to claim 1, characterized in that: The method further comprises: In a case where the alpha data at the current moment is different from the alpha data at a moment before the current moment, encoding the video stream data at the current moment to obtain encoded data, and compressing the alpha data at the current moment to obtain compressed data; The encoded data and the compressed data are encapsulated to obtain a data packet, and the data packet is sent to the electronic device for playback by the electronic device.
3. The method according to claim 1, characterized in that After responding to the received video playback request sent by the electronic device and playing the target video corresponding to the video playback request, the method further includes: Acquire playback parameters of the screen data at the current moment, where the playback parameters include at least one of the following: playback position and view size of the screen data; When the playback parameters at the current moment are different from the playback parameters at the moment before the current moment, the playback parameters at the current moment are sent to the electronic device, so that the electronic device adjusts the locally played screen data according to the playback parameters at the current moment.
4. The method according to any one of claims 1 to 3, characterized in that: The step of responding to the received video playback request sent by the electronic device and playing a target video corresponding to the video playback request comprises: In response to a received video playback request sent by the electronic device, creating a first player object; Calling the first interface of the first player object to play the target video corresponding to the video playback request; A first message is sent to the electronic device, where the first message includes interface information of the first interface.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Receiving a foreground-background switching message sent by the electronic device, wherein the foreground-background switching message is used to instruct a target application playing the target video to be switched from the foreground to the background, or from the background to the foreground; In response to the foreground / background switching message, a foreground / background switching operation is performed on the target application.
6. A video processing method, characterized in that: Applied to an electronic device, the electronic device is communicatively connected to a cloud server, and the video processing method includes: In response to the received first input, sending a video playback request to the cloud server; Receiving a data packet sent by the cloud server in response to the video playback request; wherein, when the alpha data of the target video corresponding to the video playback request at the current moment is the same as the alpha data at the moment before the current moment, the data packet includes the video stream data at the current moment; In the case where the data packet only contains video stream data, decoding and rendering the video stream data in the data packet to obtain processed video stream data; Play the processed video stream data.
7. The method according to claim 6, characterized in that The method further comprises: In the case where the data includes alpha data and video stream data, decompressing the alpha data to obtain decompressed alpha data, and decoding the video stream data to obtain decoded video stream data; Merging the decompressed alpha data and the decoded video stream data to obtain merged data; The combined data is rendered, and the rendered data is played.
8. The method according to claim 6, characterized in that After playing the processed video stream data, the method further includes: Receiving playback parameters sent by the cloud server, the playback parameters including at least one of the following: playback position and view size of screen data of the target video at the current moment; The screen data corresponding to the target video locally is adjusted according to the playback parameters.
9. The method according to any one of claims 6 to 8, characterized in that: Before receiving the data packet sent by the cloud server in response to the video playback request, the method further includes: Receive a first message sent by the cloud server, where the first message includes interface information of a first interface, where the first interface is an interface of a first player object called by the cloud server to play the target video; Create a second player object; The playing of the processed video stream data includes: The second interface in the second player object that has a mapping relationship with the first interface is called to play the processed video stream data.
10. The method according to any one of claims 6 to 8, characterized in that: The method further comprises: Receiving an application switching input, wherein the application switching input is used to switch a target application playing the target video from the foreground to the background, or from the background to the foreground; In response to the application switching input, a foreground-background switching operation is performed on the target application corresponding to the target video, and a foreground-background switching message is sent to the cloud server so that the cloud server performs a foreground-background switching operation on the target application playing the target video.
