Cross-device sound and picture synchronization method and device, electronic device and storage medium

By calculating and adjusting audio and video data on the sending device, the problem of delays of audio and video screens in cross-device projection is solved, the synchronization efficiency is improved, and real-time audio and video alignment is achieved.

CN119110120APending Publication Date: 2024-12-10GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310670651.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-07
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

During cross-device video projection, the audio and video images are prone to delays and cause out-synchronization. The existing methods require waiting for the receiver to receive the audio and video before synchronizing, which is relatively inefficient.

Method used

By obtaining cross-device delay information and local delay information on the sending device, the total delay information is calculated, and the video screen or audio is adjusted in advance to send the adjusted audio and video data, so that the audio and video screen progress of the receiving device are consistent when playing the audio and video screen during playback. .

Benefits of technology

The efficiency of cross-device audio and video synchronization is improved, and synchronization processing is avoided waiting for the receiving end to complete the reception, real-time synchronization of audio and video images is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119110120A_ABST
    Figure CN119110120A_ABST
Patent Text Reader

Abstract

The invention relates to a cross-device sound and picture synchronization method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring cross-device delay information from receiving equipment; the cross-device delay information is used for representing delay caused by cross-device video transmission; determining total delay information according to the cross-device delay information and the local delay information; the local delay information is used for representing delay caused by local video playing of the sending equipment; adjusting at least one of a video picture and an audio of the video according to the total delay information to obtain adjusted audio and video data; and sending the adjusted audio and video data to the receiving equipment, so that the playing progress of audio and video pictures is consistent when the receiving equipment plays the audio and video data. By adopting the method, the cross-device audio and picture synchronization efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, electronic device and storage medium for synchronizing audio and video across devices. Background Art

[0002] With the development of computer technology, there are more and more scenarios for cross-device video projection, that is, while the sender is playing the video, the video is also projected to the receiver for playback, for example: the video played on the mobile phone is projected to a computer, tablet, or car computer for playback. Since the cross-device transmission process will cause delays in audio and video images, the audio and video played by the receiver are not synchronized, that is, the audio and video images of the video are not synchronized. Therefore, it is very important to solve the problem of the audio and video being out of sync when the video is played on the receiver.

[0003] In the traditional method, after receiving the audio and video images sent by the sending end, the receiving end generally aligns the progress of the video image with the progress of the audio according to the progress of the audio. However, this method requires the receiving end to receive both the audio and video images before alignment can be performed, resulting in a relatively delayed synchronization of audio and video, and very low efficiency. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for cross-device audio and video synchronization, which can improve the efficiency of audio and video synchronization.

[0005] In a first aspect, the present application provides a method for synchronizing audio and video across devices. The method is applied to a sending device; the method comprises:

[0006] Obtaining cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices;

[0007] Determine total delay information according to the cross-device delay information and the local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device;

[0008] Adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data;

[0009] The adjusted audio and video data are sent to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

[0010] In a second aspect, the present application provides a method for synchronizing audio and video across devices. The method is applied to a receiving device; the method comprises:

[0011] Obtaining cross-device delay information; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices;

[0012] The cross-device delay information is transmitted to a sending device; the sending device is used to determine total delay information according to the cross-device delay information and the local delay information, and adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data; the local delay information is used to characterize the delay caused by playing the video locally on the sending device;

[0013] Receive the adjusted audio and video data transmitted by the sending device, play the audio and video data, and keep the playing progress of the audio and video consistent during the playing.

[0014] In a third aspect, the present application further provides a device for synchronizing audio and video across devices. The device is arranged in a sending device, and the device includes:

[0015] A first acquisition module is used to acquire cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by cross-device video transmission;

[0016] A total delay determination module, used to determine total delay information based on the cross-device delay information and local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device;

[0017] An audio and video adjustment module, configured to adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data;

[0018] The first sending module is used to send the adjusted audio and video data to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

[0019] In a fourth aspect, the present application further provides a device for synchronizing audio and video across devices. The device is arranged in a receiving device, and the device includes:

[0020] A second acquisition module is used to acquire cross-device delay information; the cross-device delay information is used to characterize the delay caused by the cross-device video transmission;

[0021] A second sending module is used to transmit the cross-device delay information to a sending device; the sending device is used to determine total delay information according to the cross-device delay information and the local delay information, and adjust at least one of the video picture and the audio of the video according to the total delay information to obtain adjusted audio and video data; the local delay information is used to characterize the delay caused by playing the video locally on the sending device;

[0022] The playing module is used to receive the adjusted audio and video data transmitted by the sending device, and play the audio and video data, and the playing progress of the audio and video images is consistent during the playing.

[0023] In a fifth aspect, the present application further provides an electronic device. The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0024] Obtaining cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices;

[0025] Determine total delay information according to the cross-device delay information and the local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device;

[0026] Adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data;

[0027] The adjusted audio and video data are sent to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

[0028] In a sixth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0029] Obtaining cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices;

[0030] Determine total delay information according to the cross-device delay information and the local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device;

[0031] Adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data;

[0032] The adjusted audio and video data are sent to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

[0033] In a seventh aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0034] Obtaining cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices;

[0035] Determine total delay information according to the cross-device delay information and the local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device;

[0036] Adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data;

[0037] The adjusted audio and video data are sent to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

[0038] The above-mentioned cross-device audio and video synchronization method, apparatus, electronic device, computer-readable storage medium and computer program product, the sending device obtains cross-device delay information from the receiving device, determines the total delay information based on the cross-device delay information and the local delay information, and adjusts at least one of the video picture and audio of the video in advance according to the total delay information on the sending device to obtain adjusted audio and video data, thereby offsetting the subsequent delay effect, and sending the adjusted audio and video data to the receiving device, which can make the receiving device consistent in the playback progress of the audio and video picture when playing the audio and video data, and there is no need to wait until the receiving device receives both the audio and video pictures before performing audio and video synchronization processing, thereby improving the efficiency of cross-device audio and video synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A diagram of an application environment of a method for synchronizing audio and video across devices in an embodiment;

[0041] Figure 2 A flowchart of a method for synchronizing audio and video across devices in one embodiment;

[0042] Figure 3 is an overall flow chart of a method for synchronizing audio and video across devices in one embodiment;

[0043] Figure 4 is a timing diagram of a method for synchronizing audio and video across devices in one embodiment;

[0044] Figure 5A flowchart of a method for synchronizing audio and video across devices in another embodiment;

[0045] Figure 6 A structural block diagram of a cross-device audio and video synchronization device in one embodiment;

[0046] Figure 7 It is a structural block diagram of a cross-device audio and video synchronization apparatus in another embodiment;

[0047] Figure 8 FIG. 1 is a schematic diagram of the internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0049] The cross-device audio and video synchronization method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the sending device 102 and the receiving device 104 communicate through the network. The sending device 102 can send the audio and video data of the video to the receiving device 104 when playing the video, so that the receiving device 104 plays the video to achieve screen projection playback. The receiving device 104 can obtain cross-device delay information, and the sending device 102 can obtain the cross-device delay information from the receiving device 104, determine the total delay information based on the cross-device delay information and the local delay information, and then the sending device 102 can adjust at least one of the video picture and audio of the video according to the total delay information to obtain the adjusted audio and video data, and send the adjusted audio and video data to the receiving device 104. The receiving device 104 can play the audio and video data, and the playback progress of the audio and video pictures is consistent during playback, so that the audio and video pictures in the video played by the receiving device 104 are synchronized (that is, audio and video synchronization). The sending device 102 and the receiving device 104 may be, but are not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc., and portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. For example, the sending device is a mobile phone, and the receiving device is a personal computer, tablet computer, or smart vehicle-mounted device, etc., so as to realize video projection from a mobile phone to a personal computer, tablet computer, or smart vehicle-mounted device, etc.

[0050] In some embodiments, Figure 2 As shown, a method for synchronizing audio and video across devices is provided, and the method is applied to Figure 1Taking the sending device 102 in the example as an example, the following steps are included:

[0051] Step 202, obtaining cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices.

[0052] In some embodiments, the receiving device may determine the cross-device delay information, and the sending device may obtain the cross-device delay information from the receiving device. In some embodiments, the sending device may obtain the cross-device delay information from the receiving device through capability negotiation.

[0053] In some embodiments, when the sending device does not obtain the cross-device delay information from the receiving device, the sending device may obtain preset cross-device delay information, wherein the preset cross-device delay information is the cross-device delay information pre-set to the sending device.

[0054] In some embodiments, the cross-device delay information may be the delay duration of the audio and video data caused by transmitting the video across devices.

[0055] In some embodiments, the cross-device delay information includes at least one of network delay information, hardware delay information, and codec delay information. Among them, the network delay information is the delay of audio and video data caused by network delay during the cross-device video transmission process. The hardware delay information is the delay of audio and video data caused by the underlying driver of the device during the cross-device video transmission process. The codec delay information is the delay of audio and video data caused by the encoding and decoding process of audio and video data.

[0056] Step 204, determining total delay information based on the cross-device delay information and the local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device.

[0057] Among them, the delay caused by local video playback refers to the duration from the start of playback to the end of playback.

[0058] In some embodiments, the local delay information may be the delay duration caused by playing the video locally on the sending device. In some embodiments, the total delay information may be the total delay duration.

[0059] In some embodiments, the sending device may determine the total delay duration based on the sum of the delay durations in the cross-device delay information and the local delay information.

[0060] Step 206: adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data.

[0061] The adjusted audio and video data includes audio and video images.

[0062] In some embodiments, the sending device can adjust the playing progress of the video picture according to the total delay information so that the playing progress of the video picture is consistent with the playing progress of the audio, and obtain the adjusted video picture. The adjusted audio and video data includes audio and the adjusted video picture.

[0063] In other embodiments, the sending device can adjust the audio playback progress according to the total delay information so that the audio playback progress is consistent with the video playback progress to obtain the adjusted audio. The adjusted audio and video data includes the video and the adjusted audio.

[0064] In other embodiments, the sending device can adjust the progress of the audio and video images according to the total delay information so that the playing progress of the audio and video images are consistent, and obtain the adjusted audio and the adjusted video images. The adjusted audio and video data includes the adjusted audio and the adjusted video images.

[0065] Step 208: Send the adjusted audio and video data to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

[0066] In some embodiments, the sending device can send the adjusted audio and video data to the receiving device, and the receiving device can directly play based on the received audio and video data to achieve consistency in the playback progress of the audio and video images.

[0067] In other embodiments, the sending device can send the adjusted audio and video data to the receiving device, and the receiving device can perform further audio and video synchronization processing on the received audio and video data and then play it to achieve consistency in the playback progress of the audio and video images.

[0068] In the above-mentioned cross-device audio and video synchronization method, the sending device obtains cross-device delay information from the receiving device, determines the total delay information based on the cross-device delay information and the local delay information, and adjusts at least one of the video picture and audio of the video in advance based on the total delay information on the sending device to obtain adjusted audio and video data, thereby offsetting the subsequent delay effect, and sending the adjusted audio and video data to the receiving device. This can make the receiving device play the audio and video data in a consistent manner, without waiting until the receiving device receives both the audio and video pictures before performing audio and video synchronization processing, thereby improving the efficiency of cross-device audio and video synchronization.

[0069] In some embodiments, cross-device delay information is obtained from a receiving device, including: obtaining cross-device delay information from the receiving device through a screen projection service, and setting the cross-device delay information to an audio system; determining total delay information based on the cross-device delay information and the local delay information, including: determining total delay information based on the cross-device delay information and the local delay information through an audio system; adjusting at least one of the video picture and audio of the video according to the total delay information to obtain adjusted audio and video data, including: querying the total delay information from the audio system through a video playback application, and adjusting at least one of the video picture and audio of the video according to the total delay information to obtain adjusted audio and video data.

[0070] Among them, the screen projection service is a service used by the sending device to project the screen to the receiving device. The audio system is a system used by the sending device to process and play audio. The video playback application is an application used by the sending device to play videos. The sending device can use the screen projection service to project the video being played in the video playback application to the receiving device for playback.

[0071] In some embodiments, the sending device can obtain cross-device delay information from the receiving device through the screen projection service through capability negotiation, and the screen projection service can set the cross-device delay information to the audio system.

[0072] In some embodiments, the audio system of the sending device may determine the total delay duration based on the sum of the delay durations in the cross-device delay information and the local delay information.

[0073] In some embodiments, the video playback application of the sending device can call the interface for audio and video synchronization in the framework layer, query the total delay information from the audio system, and adjust at least one of the video picture and audio of the video according to the total delay information to obtain adjusted audio and video data.

[0074] In some embodiments, the screen projection service of the sending device can obtain audio from the audio system and obtain the adjusted video picture from the video playback application, and the screen projection service can send the audio and the adjusted video picture to the receiving device. The screen projection service of the receiving device can play the video based on the received audio and video picture.

[0075] In the above embodiment, the cross-device delay information is set to the audio system through the screen projection service, the video playback application queries the total delay information from the audio system, and then adjusts the audio and video, thereby realizing early audio and video synchronization adjustment on the sending device side to offset the subsequent delay impact. There is no need to wait until the receiving device receives both the audio and video images before performing audio and video synchronization processing by the receiving device, thereby improving the efficiency of cross-device audio and video synchronization.

[0076] In some embodiments, querying the total delay information from the audio system through the video playback application includes: calling the interface for audio and video synchronization in the framework layer through the video playback application to call the delay information acquisition interface provided by the audio system to query the total delay information from the audio system.

[0077] Among them, the interface for audio and video synchronization in the framework layer is an interface for aligning the playback progress of the video image and the audio. The delay information acquisition interface is an interface for obtaining delay information. The interface for audio and video synchronization in the framework layer can directly or indirectly use the delay information acquisition interface provided by the audio system to query the total delay information from the audio system.

[0078] In some embodiments, the interface for audio and video synchronization in the framework layer may include at least one of AudioTrack, MediaSync, MediaClock, and AudioSystem. Among them, the AudioTrack interface is the original audio API interface for playing audio files. The MediaSync interface is used to coordinate the synchronization of audio and video to ensure synchronous playback of audio and video. The MediaClock interface is used to manage the hardware clock of the device, provide relative timestamps in the form of an electronic clock, and play an adjustment role in synchronizing audio and video images. The AudioSystem interface is used to control the audio parameters of the device.

[0079] In some embodiments, the latency information acquisition interface may be getTimestamp or getLatency, where getTimestamp is an interface for acquiring a timestamp and getLatency is an interface for acquiring latency information.

[0080] In some embodiments, the video playback application of the sending device can call the getTimestamp interface provided by the audio system through the interface for audio and video synchronization, obtain the timestamp after superimposing the total delay information, and then adjust the timestamp of the video picture according to the timestamp after superimposing the total delay information to obtain the adjusted video picture, and send the audio and the adjusted video picture to the receiving device for playback.

[0081] In other embodiments, the video playback application of the sending device can call the getLatency interface provided by the audio system through the interface for audio and video synchronization to obtain total delay information, and then adjust at least one of the video picture and audio of the video according to the total delay information to obtain adjusted audio and video data.

[0082] In the above embodiment, the video playback application calls the interface for audio and video synchronization in the framework layer to call the delay information acquisition interface provided by the audio system, and queries the total delay information from the audio system, so that the audio system can indirectly affect the cross-device delay information on the audio and video synchronization influencing parameters of the video playback application. It is realized that through the original audio and video synchronization interface of the video playback application, the total delay information after superimposing the cross-device delay information is queried, which can realize the audio and video synchronization adjustment in advance at the sending device end, offset the subsequent cross-device delay, and improve the efficiency of cross-device audio and video synchronization.

[0083] In some embodiments, at least one of the video picture and audio of the video is adjusted according to the total delay information to obtain adjusted audio and video data, including: determining a reference timestamp according to the timestamp of the audio of the video and the total delay information; adjusting the timestamp of the video picture of the video according to the reference timestamp to obtain adjusted audio and video data.

[0084] In some embodiments, the sending device can superimpose the total delay duration on the basis of the timestamp of the audio to obtain a reference timestamp, and then adjust the timestamp of the video picture according to the reference timestamp, so that the timestamp of the video picture is aligned with the reference timestamp to obtain the adjusted video picture. In some embodiments, the audio system of the sending device can superimpose the total delay duration on the basis of the timestamp of the audio to obtain a reference timestamp, and the video playback application of the sending device can call the getTimestamp interface provided by the audio system through the interface for audio and video synchronization to obtain the reference timestamp, and then adjust the timestamp of the video picture according to the reference timestamp. In other embodiments, the video playback application of the sending device can call the getLatency interface provided by the audio system through the interface for audio and video synchronization to obtain the total delay duration, and then superimpose the total delay duration on the basis of the timestamp of the audio through the video playback application to obtain the reference timestamp, and adjust the timestamp of the video picture according to the reference timestamp.

[0085] In other embodiments, the sending device may superimpose the total delay duration on the basis of the timestamp of the video image to obtain a reference timestamp, and then adjust the timestamp of the audio according to the reference timestamp to align the timestamp of the audio with the reference timestamp to obtain the adjusted audio.

[0086] In the above embodiment, a reference timestamp is determined based on the timestamp of the audio of the video and the total delay information, and the timestamp of the video picture of the video is adjusted based on the reference timestamp to obtain the adjusted audio and video data. The audio and video synchronization can be adjusted in advance on the sending device to offset the subsequent cross-device delay, avoiding the need to perform audio and video synchronization only after the receiving device has received both the video picture and audio, thereby improving the efficiency of audio and video synchronization, and being able to accurately align audio and video based on the timestamp and total delay information, thereby improving the accuracy of audio and video synchronization across devices.

[0087] In some embodiments, the cross-device delay information includes at least one of network delay information, hardware delay information, and codec delay information.

[0088] In some embodiments, the cross-device delay information includes network delay information, hardware delay information, and codec delay information.

[0089] In the above embodiment, cross-device delay information of multiple dimensions, including network delay information, hardware delay information, and encoding and decoding delay information, can be obtained, so that the cross-device delay can be measured more accurately, and then cross-device audio and video synchronization adjustment can be performed based on the accurate cross-device delay information, thereby improving the accuracy of cross-device audio and video synchronization.

[0090] In some embodiments, total delay information is determined based on cross-device delay information and local delay information, including: predicting the cross-device delay information at the current moment based on cross-device delay information obtained at a preset number of time nodes before the current moment; determining total delay information based on the cross-device delay information and local delay information at the current moment.

[0091] In some embodiments, the sending device may use a smooth prediction algorithm to predict the cross-device delay information at the current moment based on the cross-device delay information obtained at a preset number of time nodes before the current moment.

[0092] The smooth prediction algorithm is an algorithm that uses historical data to predict future trends. In some embodiments, the smooth prediction algorithm can be any one of a moving average method, an exponential smoothing method, a random walk model, and an ARIMA model.

[0093] In some embodiments, the sending device may predict the cross-device delay information at the current moment based on a weighted average of the cross-device delay information obtained at a preset number of time nodes before the current moment.

[0094] In the above embodiment, since the cross-device delay information may change in real time during the screen projection process, the cross-device delay information at the current moment is predicted by obtaining the cross-device delay information based on a preset number of time nodes before the current moment. The cross-device delay information at the current moment can be dynamically predicted, thereby improving the accuracy and real-time performance of the cross-device delay information, and further improving the accuracy of cross-device audio and video synchronization.

[0095] In some embodiments, the method further includes: obtaining preset cross-device delay information corresponding to the video playback application without obtaining cross-device delay information from the receiving device; determining total delay information based on the cross-device delay information and the local delay information, including: determining the total delay information based on the preset cross-device delay information and the local delay information.

[0096] In some embodiments, corresponding preset cross-device delay information can be set in advance for different video playback applications on the sending device. If the cross-device delay information is not obtained from the receiving device, the sending device can obtain the preset cross-device delay information corresponding to the video playback application, and determine the total delay information based on the preset cross-device delay information and the local delay information.

[0097] In the above embodiment, when the cross-device delay information is not obtained from the receiving device, the sending device can obtain the preset cross-device delay information corresponding to the video playback application, thereby ensuring that cross-device audio and video synchronization can be performed accurately and efficiently even when the cross-device delay information is not obtained from the receiving device. In addition, by setting corresponding preset cross-device delay information for different video playback applications, more fine-grained audio and video synchronization control can be performed on different video playback applications. By obtaining cross-device delay information or preset cross-device delay information through capability negotiation, customization and optimization of audio and video synchronization requirements in different devices and different application scenarios can be achieved.

[0098] In some embodiments, Figure 3 As shown, a schematic diagram of the overall process of the cross-device audio and video synchronization method is provided, including the following steps:

[0099] Step 302: The sending device obtains the cross-device delay information of the receiving device through capability negotiation or preset parameters (ie, preset cross-device delay information).

[0100] Step 304: The sending device sets the cross-device delay information to the audio system.

[0101] Step 306: The audio system of the sending device indirectly affects the cross-device delay information on the audio and video synchronization influencing parameters of the video playback application.

[0102] Step 308: The video playback application of the sending device adjusts the playback progress of the audio and video data.

[0103] Step 310: The sending device transmits the adjusted audio and video data to the receiving device.

[0104] Step 312: The receiving device plays the audio and video data.

[0105] In the above embodiment, the sending device obtains the cross-device delay information of the receiving device through capability negotiation or preset parameters, and sets the cross-device delay information to the audio system. The audio system indirectly affects the audio and video synchronization influencing parameters of the video playback application. The video playback application adjusts the playback progress of the audio and video data, and transmits the adjusted audio and video data to the receiving device. The receiving device plays the audio and video data, thereby realizing early audio and video synchronization at the sending device end, offsetting the subsequent delay effect, and making the playback progress of the audio and video screen of the receiving device consistent when playing the audio and video data. There is no need to wait until the receiving device receives both the audio and video screen before performing audio and video synchronization processing, thereby improving the efficiency of cross-device audio and video synchronization.

[0106] In some embodiments, Figure 4 As shown, a timing diagram of a method for synchronizing audio and video across devices is provided, including the following steps:

[0107] Step 402: The sending device obtains the cross-device delay information of the receiving device through capability negotiation.

[0108] Step 404, the screen projection service of the sending device sets the delay parameters (ie, sets the cross-device delay information to the audio system).

[0109] Step 406: The video playback application of the sending device outputs the audio to the audio system.

[0110] Step 408: The audio system of the sending device adjusts the timestamp of the audio, obtains a reference timestamp, encodes and packages the audio, and transmits it to the screen projection service.

[0111] Step 410: The video playback application of the sending device obtains a reference timestamp from the audio system.

[0112] Step 412: The video playback application of the sending device adjusts the timestamp of the video frame according to the reference timestamp.

[0113] Step 414: The video playback application of the sending device encodes and packages the adjusted video image and transmits it to the screen projection service.

[0114] Step 416, the screen projection service of the sending device transmits the audio and video data to the receiving device.

[0115] Step 418: The screen projection service of the receiving device plays the audio and video data.

[0116] In the above embodiment, the sending device obtains the cross-device delay information of the receiving device through capability negotiation, the screen projection service of the sending device sets the delay parameters, the video playback application outputs the audio to the audio system, the audio system adjusts the timestamp of the audio, obtains the reference timestamp, encodes and packages the audio and transmits it to the screen projection service, the video playback application obtains the reference timestamp from the audio system, the video playback application adjusts the timestamp of the video screen according to the reference timestamp, the video playback application encodes and packages the adjusted video screen and transmits it to the screen projection service, the screen projection service of the sending device transmits audio and video data to the receiving device, and the screen projection service of the receiving device plays the audio and video data, which can make the playback progress of the audio and video screen of the receiving device consistent when playing the audio and video data, and there is no need to wait until the receiving device receives both the audio and video screen before performing audio and video synchronization processing, thereby improving the efficiency of cross-device audio and video synchronization.

[0117] In some embodiments, Figure 5 As shown, a method for synchronizing audio and video across devices is provided, and the method is applied to Figure 1 Taking the receiving device 104 in the example as an example, the following steps are included:

[0118] Step 502, obtaining cross-device delay information; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices.

[0119] For example, the receiving device can obtain network delay information based on wifi p2p (wireless peer-to-peer network) through a ping tool. Another example is that the receiving device can determine the network delay information of an asymmetric network through statistics.

[0120] Step 504, transmit the cross-device delay information to the sending device; the sending device is used to determine the total delay information based on the cross-device delay information and the local delay information, and adjust at least one of the video picture and audio of the video based on the total delay information to obtain adjusted audio and video data; the local delay information is used to characterize the delay caused by playing the video locally on the sending device.

[0121] Step 506, receiving the adjusted audio and video data transmitted by the sending device, playing the audio and video data, and making the playing progress of the audio and video consistent during the playing.

[0122] In some embodiments, the receiving device can directly play based on the received audio and video data to achieve consistency in the playback progress of the audio and video images.

[0123] In other embodiments, the receiving device may perform further audio and video synchronization processing on the received audio and video data and then play it, so as to achieve consistency in the playback progress of the audio and video images.

[0124] In the above-mentioned cross-device audio and video synchronization method, the sending device obtains cross-device delay information from the receiving device, determines the total delay information based on the cross-device delay information and the local delay information, and adjusts at least one of the video picture and audio of the video in advance based on the total delay information on the sending device to obtain adjusted audio and video data, thereby offsetting the subsequent delay effect, and sending the adjusted audio and video data to the receiving device. This can make the receiving device play the audio and video data in a consistent manner, without waiting until the receiving device receives both the audio and video pictures before performing audio and video synchronization processing, thereby improving the efficiency of cross-device audio and video synchronization.

[0125] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0126] Based on the same inventive concept, the embodiment of the present application also provides a cross-device audio and video synchronization device for implementing the cross-device audio and video synchronization method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more cross-device audio and video synchronization device embodiments provided below can refer to the above limitations on the cross-device audio and video synchronization method, and will not be repeated here.

[0127] In some embodiments, Figure 6 As shown, a cross-device audio and video synchronization device 600 is provided, which is set in a sending device and includes: a first acquisition module 602, a total delay determination module 604, an audio and video adjustment module 606 and a first sending module 608, wherein:

[0128] The first acquisition module 602 is used to acquire cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by cross-device video transmission.

[0129] The total delay determination module 604 is used to determine the total delay information according to the cross-device delay information and the local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device.

[0130] The audio and video adjustment module 606 is used to adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data.

[0131] The first sending module 608 is used to send the adjusted audio and video data to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

[0132] In some embodiments, the first acquisition module 602 is also used to obtain cross-device delay information from the receiving device through the screen projection service, and set the cross-device delay information to the audio system. The total delay determination module 604 is also used to determine the total delay information through the audio system based on the cross-device delay information and the local delay information. The audio and video adjustment module 606 is also used to query the total delay information from the audio system through the video playback application, and adjust at least one of the video picture and audio of the video according to the total delay information to obtain the adjusted audio and video data.

[0133] In some embodiments, the audio and video adjustment module 606 is further used to call the interface for audio and video synchronization in the framework layer through the video playback application to call the delay information acquisition interface provided by the audio system to query the total delay information from the audio system.

[0134] In some embodiments, the audio and video adjustment module 606 is further used to determine a reference timestamp based on the timestamp of the audio of the video and the total delay information; and adjust the timestamp of the video picture of the video based on the reference timestamp to obtain adjusted audio and video data.

[0135] In some embodiments, the cross-device delay information includes at least one of network delay information, hardware delay information, and codec delay information.

[0136] In some embodiments, the total delay determination module 604 is also used to predict the cross-device delay information at the current moment based on the cross-device delay information obtained at a preset number of time nodes before the current moment; and determine the total delay information based on the cross-device delay information and local delay information at the current moment.

[0137] In some embodiments, the total delay determination module 604 is also used to obtain preset cross-device delay information corresponding to the video playback application when the cross-device delay information is not obtained from the receiving device; and determine the total delay information based on the preset cross-device delay information and the local delay information.

[0138] In the above-mentioned cross-device audio and video synchronization device, the sending device obtains cross-device delay information from the receiving device, determines the total delay information based on the cross-device delay information and the local delay information, and adjusts at least one of the video picture and audio of the video in advance based on the total delay information on the sending device to obtain adjusted audio and video data, thereby offsetting the subsequent delay effect, and sending the adjusted audio and video data to the receiving device, so that the receiving device can make the playback progress of the audio and video picture consistent when playing the audio and video data, without waiting until the receiving device receives both the audio and video pictures before performing audio and video synchronization processing, thereby improving the efficiency of cross-device audio and video synchronization.

[0139] In some embodiments, Figure 7 As shown, a cross-device audio and video synchronization device 700 is provided, which is arranged in a receiving device and includes: a second acquisition module 702, a second sending module 704 and a playing module 706, wherein:

[0140] The second acquisition module 702 is used to acquire cross-device delay information; the cross-device delay information is used to characterize the delay caused by cross-device video transmission.

[0141] The second sending module 704 is used to transmit the cross-device delay information to the sending device; the sending device is used to determine the total delay information based on the cross-device delay information and the local delay information, and adjust at least one of the video picture and audio of the video based on the total delay information to obtain adjusted audio and video data; the local delay information is used to characterize the delay caused by playing the video locally on the sending device.

[0142] The playing module 706 is used to receive the adjusted audio and video data transmitted by the sending device, and play the audio and video data, and the playing progress of the audio and video images is consistent during the playing.

[0143] In the above-mentioned cross-device audio and video synchronization device, the sending device obtains cross-device delay information from the receiving device, determines the total delay information based on the cross-device delay information and the local delay information, and adjusts at least one of the video picture and audio of the video in advance based on the total delay information on the sending device to obtain adjusted audio and video data, thereby offsetting the subsequent delay effect, and sending the adjusted audio and video data to the receiving device, so that the receiving device can make the playback progress of the audio and video picture consistent when playing the audio and video data, without waiting until the receiving device receives both the audio and video pictures before performing audio and video synchronization processing, thereby improving the efficiency of cross-device audio and video synchronization.

[0144] Each module in the above-mentioned cross-device audio and video synchronization device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in an electronic device in the form of hardware, or can be stored in a memory in an electronic device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.

[0145] In one embodiment, an electronic device is provided. The electronic device may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown. The electronic device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the electronic device is used to exchange information between the processor and the external device. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for synchronizing audio and video across devices is implemented. The display unit of the electronic device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the electronic device casing, or an external keyboard, touchpad or mouse.

[0146] Those skilled in the art will understand that Figure 8 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0147] The embodiment of the present application also provides a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions, when the computer-executable instructions are executed by one or more processors, the processors execute the steps of the cross-device audio and video synchronization method.

[0148] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute a method for synchronizing audio and video across devices.

[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0150] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0151] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0152] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for synchronizing audio and video across devices. It is characterized in that The method is applied to a sending device, comprising: Obtaining cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices; Determine total delay information according to the cross-device delay information and the local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device; Adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data; The adjusted audio and video data are sent to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

2. The method according to claim 1, It is characterized in that The obtaining cross-device delay information from the receiving device includes: Obtain cross-device delay information from a receiving device through a screen projection service, and set the cross-device delay information to an audio system; The determining the total delay information according to the cross-device delay information and the local delay information includes: Determining total delay information by the audio system according to the cross-device delay information and the local delay information; The step of adjusting at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data includes: The total delay information is queried from the audio system through a video playback application, and at least one of the video picture and the audio of the video is adjusted according to the total delay information to obtain adjusted audio and video data.

3. The method according to claim 2, It is characterized in that The querying the total delay information from the audio system through the video playback application includes: The video playback application calls the interface for audio and video synchronization in the framework layer to call the delay information acquisition interface provided by the audio system, and queries the total delay information from the audio system.

4. The method according to claim 1, It is characterized in that The step of adjusting at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data includes: Determine a reference timestamp according to the timestamp of the audio of the video and the total delay information; The timestamp of the video frame of the video is adjusted according to the reference timestamp to obtain adjusted audio and video data.

5. The method according to any one of claims 1 to 4, It is characterized in that The cross-device delay information includes at least one of network delay information, hardware delay information and encoding and decoding delay information.

6. The method according to any one of claims 1 to 4, It is characterized in that The determining the total delay information according to the cross-device delay information and the local delay information includes: Predicting the cross-device delay information at the current moment based on the cross-device delay information obtained at a preset number of time nodes before the current moment; The total delay information is determined according to the cross-device delay information and the local delay information at the current moment.

7. The method according to any one of claims 1 to 4, It is characterized in that The method further comprises: In the case where the cross-device delay information is not obtained from the receiving device, obtaining preset cross-device delay information corresponding to the video playback application; The determining the total delay information according to the cross-device delay information and the local delay information includes: Total delay information is determined according to the preset cross-device delay information and the local delay information.

8. A method for synchronizing audio and video across devices. It is characterized in that The method is applied to a receiving device, comprising: Obtaining cross-device delay information; the cross-device delay information is used to characterize the delay caused by transmitting the video across devices; The cross-device delay information is transmitted to a sending device; the sending device is used to determine total delay information according to the cross-device delay information and the local delay information, and adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data; the local delay information is used to characterize the delay caused by playing the video locally on the sending device; Receive the adjusted audio and video data transmitted by the sending device, play the audio and video data, and keep the playing progress of the audio and video consistent during the playing.

9. A cross-device audio and video synchronization device, It is characterized in that The device is arranged in a sending device and includes: A first acquisition module is used to acquire cross-device delay information from a receiving device; the cross-device delay information is used to characterize the delay caused by cross-device video transmission; A total delay determination module, used to determine total delay information based on the cross-device delay information and local delay information; the local delay information is used to characterize the delay caused by playing the video locally on the sending device; An audio and video adjustment module, configured to adjust at least one of the video image and the audio of the video according to the total delay information to obtain adjusted audio and video data; The first sending module is used to send the adjusted audio and video data to the receiving device so that the receiving device can play the audio and video data in the same progress as the video.

10. A device for synchronizing audio and video across devices, It is characterized in that The device is arranged in a receiving device and includes: A second acquisition module is used to acquire cross-device delay information; the cross-device delay information is used to characterize the delay caused by the cross-device video transmission; A second sending module is used to transmit the cross-device delay information to a sending device; the sending device is used to determine total delay information according to the cross-device delay information and the local delay information, and adjust at least one of the video picture and the audio of the video according to the total delay information to obtain adjusted audio and video data; the local delay information is used to characterize the delay caused by playing the video locally on the sending device; The playing module is used to receive the adjusted audio and video data transmitted by the sending device, and play the audio and video data, and the playing progress of the audio and video images is consistent during the playing.

11. An electronic device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the computer program is executed by the processor, the processor executes the steps of the cross-device audio and video synchronization method according to any one of claims 1 to 8.

12. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

13. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.