Playing control method and device, electronic equipment and computer readable storage medium
By caching audio data of multiple tracks and synchronizing playback based on time information, the method addresses audio and video desynchronization issues during track switching, ensuring smooth transitions and improving playback smoothness.
Patent Information
- Application Number
- CN202411322122.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-31
AI Technical Summary
Existing media playback systems experience audio data loss and playback freeze when switching tracks due to caching only a single audio stream, leading to desynchronization between audio and video.
A method and device that caches audio data of multiple tracks, allowing seamless switching by synchronizing audio and video playback based on playback time information, ensuring smooth transitions by retrieving audio data from the cache to play back in sync with the video data.
Ensures audio and video synchronization during track switching, enhancing the smoothness of playback by caching audio data of multiple tracks and synchronizing them with video data.
Smart Images

Figure CN119232994A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of audio and video processing, and specifically to a playback control method, device, electronic device, and computer-readable storage medium. Background Art
[0002] At present, in order to meet the different needs of users for audio, media files usually include audio data of multiple tracks. Each track corresponds to an independent audio stream. In a media file, different tracks usually correspond to audio streams of different language types or different sound qualities or different enhancement effects.
[0003] With different needs of different users, during the playback of a media file, a scenario of track switching is usually involved, that is, the current track of the media file is switched to a target track expected by the user to meet the playback needs of the user.
[0004] However, since when playing a multi-track media file, usually only the audio stream data of a single track being played is cached, problems such as audio data loss and playback freeze may occur after switching tracks. Summary of the invention
[0005] The embodiments of the present application provide a playback control method, device, electronic device and computer-readable storage medium, which can achieve audio and video synchronization when switching audio tracks and improve the smoothness of playback when switching audio tracks.
[0006] In a first aspect, an embodiment of the present application provides a playback control method, which is applied to a playback terminal, and the method includes:
[0007] Receiving multimedia data to be played, the multimedia data comprising video data and audio data of at least two audio tracks, the audio data of each audio track respectively matching the video data;
[0008] Storing the audio data of the at least two audio tracks in a buffer;
[0009] In response to an audio playback instruction, obtaining first audio data of a first audio track corresponding to the audio playback instruction from the cache, and synchronously playing the first audio data and the video data;
[0010] In response to the audio track switching instruction, the second audio data of the second audio track corresponding to the audio track switching instruction is obtained from the cache according to the playing time information of the video data, and the second audio data and the video data are played synchronously.
[0011] In a second aspect, an embodiment of the present application further provides a playback control device, which is applied to a playback terminal, and the device includes:
[0012] A receiving module, used for receiving multimedia data to be played, wherein the multimedia data includes video data and audio data of at least two tracks, and the audio data of each track matches the video data respectively;
[0013] A cache module, used for storing the audio data of the at least two audio tracks in a cache;
[0014] a playing module, configured to, in response to an audio playing instruction, obtain from the cache first audio data of a first audio track corresponding to the audio playing instruction, and synchronously play the first audio data and the video data;
[0015] The switching module is used to respond to the audio track switching instruction, obtain the second audio data of the second audio track corresponding to the audio track switching instruction from the cache according to the playback time information of the video data, and synchronously play the second audio data and the video data.
[0016] Optionally, in some embodiments of the present application, the audio data includes at least one audio segment data, and the switching module includes:
[0017] A first response unit, configured to determine a second audio track to be switched in response to an audio track switching instruction;
[0018] A first screening unit, configured to determine target audio segment data from at least one audio segment data corresponding to the second audio track in the cache according to the playback time information of the video data;
[0019] The determining unit is configured to use the target audio segment data as the second audio data.
[0020] In some embodiments of the present application, the audio segment data is based on the target media format, and the switching module includes:
[0021] A control unit is used to control the second audio data and the video data to be played synchronously according to the target media format corresponding to the target audio segment data.
[0022] In some embodiments of the present application, the control unit includes:
[0023] a screening subunit, configured to screen out target audio data from the second audio data with reference to the play time information of the video data;
[0024] The control subunit is used to control the synchronous playing of the target audio data and the video data according to the target media format corresponding to the target audio segment data.
[0025] In some embodiments of the present application, the device further includes a synchronization unit, and the synchronization unit includes:
[0026] The synchronization subunit is used to synchronously play the target audio data and the video data with reference to the playback time information of the target audio data if it is detected that the playback time information of the target audio data is equal to or later than the playback time information of the video data.
[0027] Among them, in some embodiments of the present application, the playback module includes:
[0028] A second response unit, configured to determine a first audio track to be played in response to an audio playback instruction;
[0029] An acquiring unit, configured to acquire first audio data of the first audio track from the cache;
[0030] The playing unit is used to synchronously play the first audio data and the video data with reference to the playing time information of the first audio data.
[0031] In some embodiments of the present application, the device further includes a deletion module, and the deletion module includes:
[0032] A second screening unit is used to screen out the to-be-deleted audio data for the at least two audio tracks that exceeds the cache duration information from the cache according to the cache duration information configured for the cache;
[0033] A deleting unit is used to delete the audio data to be deleted from the cache.
[0034] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps in the above-mentioned playback control method when executed by the processor.
[0035] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above-mentioned playback control method are implemented.
[0036] In a fifth aspect, the embodiments of the present application further provide a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations described in the embodiments of the present application.
[0037] In summary, the playback terminal of the embodiment of the present application receives multimedia data to be played, the multimedia data including video data and audio data of at least two audio tracks, the audio data of each audio track respectively matches the video data, the audio data of the at least two audio tracks are stored in a cache, and in response to an audio playback instruction, the first audio data of the first audio track corresponding to the audio playback instruction is obtained from the cache, and the first audio data and the video data are played synchronously, and in response to an audio track switching instruction, the second audio data of the second audio track corresponding to the audio track switching instruction is obtained from the cache according to the playback time information of the video data, and the second audio data and the video data are played synchronously.
[0038] Among them, by caching the audio data of each audio track, it is convenient to find the audio data of the audio track to be switched to from the cache when the audio track is switched, and then play the audio data of the audio track to be switched to synchronously with the video data, thereby achieving audio and video synchronization when switching audio tracks and improving the smoothness of playback when switching audio tracks. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 is a schematic diagram of a scenario of a playback control method provided in an embodiment of the present application;
[0041] Figure 2 is a flowchart of a playback control method provided in an embodiment of the present application;
[0042] Figure 3 is a flowchart of processing multimedia data provided by an embodiment of the present application;
[0043] Figure 4 is a schematic diagram of a transmission model of audio clip data provided in an embodiment of the present application;
[0044] Figure 5 is a structural diagram of a playback control device provided in an embodiment of the present application;
[0045] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in this application to clearly and completely describe the technical solutions in this application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0047] The embodiments of the present application provide a playback control method, device, electronic device, and computer-readable storage medium. Specifically, the embodiments of the present application provide a playback control device suitable for an electronic device, wherein the electronic device includes a playback terminal, and the playback terminal includes a device having a function of playing multimedia data, such as a laptop computer, a desktop computer, a mobile phone, a tablet computer, or an extended reality device.
[0048] For details, please refer to Figure 1 , Figure 1 : is a schematic diagram of a scenario in which a terminal device according to an embodiment of the present application executes the playback control method, wherein the specific execution process of the terminal device executing the playback control method is as follows:
[0049] The playback terminal 10 receives multimedia data to be played, the multimedia data including video data and audio data of at least two audio tracks, the audio data of each audio track respectively matching the video data, the playback terminal 10 stores the audio data of the at least two audio tracks in a cache, the playback terminal 10 responds to an audio playback instruction, obtains from the cache the first audio data of the first audio track corresponding to the audio playback instruction, and synchronously plays the first audio data and the video data, the playback terminal 10 responds to a track switching instruction, obtains from the cache the second audio data of the second audio track corresponding to the track switching instruction according to the playback time information of the video data, and synchronously plays the second audio data and the video data.
[0050] In summary, the embodiments of the present application cache the audio data of each audio track, so that when the audio track is switched, the audio data of the audio track to be switched to can be found from the cache, and then the audio data of the audio track to be switched to is played synchronously with the video data, thereby achieving audio and video synchronization when the audio track is switched, and improving the smoothness of the playback when the audio track is switched.
[0051] It should be noted that the order of description of the following embodiments is not intended to limit the priority order of the embodiments.
[0052] See also Figure 2 , Figure 2 A flowchart of a playback control method provided in an embodiment of the present application. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings. Specifically, the specific process of the playback control method is as follows:
[0053] 101. Receive multimedia data to be played, where the multimedia data includes video data and audio data of at least two tracks, and the audio data of each track matches the video data respectively.
[0054] The multimedia data may be received from a server or a cloud. The audio data is data that matches the image of the video data, for example, media data including video images and audio obtained by recording the image of a speaking scene, where the audio matches the image in the video.
[0055] The audio data of each audio track is matched with the video data respectively, that is, the audio data of each audio track differs in audio expressions such as language type and sound quality. For example, the same film and television video contains audio data of two audio tracks, Chinese and English.
[0056] 102. Store the audio data of the at least two audio tracks in a buffer.
[0057] By storing the audio data of each track in the cache, it is convenient to read the audio data of each track from the cache. In the embodiment of the present application, the cache action can be completed by a proxy server established locally.
[0058] 103. In response to an audio playing instruction, obtain first audio data of a first audio track corresponding to the audio playing instruction from the cache, and synchronously play the first audio data and the video data.
[0059] Among them, by storing audio data in the cache and reading the audio data from the cache for synchronous playback with the video data, it helps to improve the smoothness of multimedia data playback. For example, by storing audio data for a long enough time in the cache, audio data with matching timestamps can be filtered from the cache based on the video data, and then played synchronously.
[0060] 104. In response to the audio track switching instruction, obtain second audio data of the second audio track corresponding to the audio track switching instruction from the cache according to the playing time information of the video data, and synchronously play the second audio data and the video data.
[0061] The audio track switching instruction refers to an instruction for switching the audio track for playing audio. For example, when switching from Chinese to English playback, the audio track corresponding to English is the second audio track.
[0062] Among them, the second audio data of the second audio track corresponding to the audio track switching instruction is obtained from the cache through the playback time information of the video data, which facilitates the acquisition of the second audio data matching the playback time information of the video data and helps the synchronous playback processing of video and audio.
[0063] For example, see Figure 3 As shown, Figure 3 1 is a processing flow chart of multimedia data provided by an embodiment of the present application, wherein multimedia data is received by a receiving module, and after receiving the multimedia data, the audio data of each audio track in the multimedia data is stored in the cache by a cache module, and then the playing module reads the video data from the receiving module and reads the first audio data of the first audio track from the cache for synchronous playing. If an audio track switching instruction is detected, the switching module obtains the second audio data of the second audio track from the cache according to the audio track switching instruction and the playing time information of the video data, and synchronously plays the second audio data and the video data.
[0064] In summary, the embodiments of the present application cache the audio data of each audio track, so that when the audio track is switched, the audio data of the audio track to be switched to can be found from the cache, and then the audio data of the audio track to be switched to is played synchronously with the video data, thereby achieving audio and video synchronization when the audio track is switched, and improving the smoothness of the playback when the audio track is switched.
[0065] Optionally, the multimedia playback method based on caching audio data of each audio track is also applicable to audio segment data transmitted in the form of media segments. For example, based on the playback time information of the video data, the audio segment data is obtained from the cache, and the audio segment data is played synchronously with the video data. That is, optionally, in some embodiments of the present application, the audio data includes at least one audio segment data, and the step of "in response to the audio track switching instruction, according to the playback time information of the video data, obtaining the second audio data of the second audio track corresponding to the audio track switching instruction from the cache" includes:
[0066] In response to the audio track switching instruction, determining a second audio track to be switched;
[0067] Determine target audio segment data from at least one audio segment data corresponding to the second audio track in the buffer according to the playback time information of the video data;
[0068] The target audio segment data is used as the second audio data.
[0069] Among them, since the audio track switching instruction includes the audio to be switched to, the second audio track to be switched can be determined by parsing the audio track switching instruction.
[0070] The audio segment data is segment data containing a time interval, for example, the audio segment data may be audio data containing a timestamp of 5-7s or 7-10s. Accordingly, based on the playback time information of the video data, the target audio segment data can be determined from each audio segment data by the time interval corresponding to each audio segment data. For example, if the current playback time information of the video data is the timestamp 8s, the audio segment data with a timestamp of 7-10s can be screened and used as the target audio segment data.
[0071] Among them, since complete data packet information is usually required when playing audio segment data, for example, taking the FMP4 file format based on the ATSC3.0 standard as an example, ATSC3.0 is the next-generation broadcasting and television standard launched by the U.S. High Definition Standards Committee, which aims to provide higher quality video, audio and data transmission, and provide users with a higher quality TV viewing experience. The ATSC3.0 media container format adopts FMP4 (Fragmented MP4), which is a variant of the MP4 file format. A complete FMP4 file has the following important atoms (box), including: MOOV and MOOF atoms for loading metadata, and MDAT atoms for loading audio and video data. The loss of any data in an FMP4 file will cause the data of the entire FMP4 file to be unable to be decoded and rendered normally. Therefore, by caching the audio data of each audio track, the complete audio segment data can be read from the cache through the playback time information of the video data, so as to facilitate the synchronous playback of the audio segment data and the video data, for example, a complete FMP4 file is obtained from the cache, and then the FMP4 file can be played smoothly.
[0072] For example, see Figure 4 As shown, Figure 4 is a schematic diagram of a transmission model of audio segment data provided in an embodiment of the present application. In the transmission model, an ATSC3.0 bitstream includes a program, and the program includes one channel of video data and audio data of each audio track, wherein the video data and the audio data are transmitted as media segments in the FMP4 file format, such as Figure 4The video data V, the first audio data of the audio track A1 and the second audio data of the audio track A2 are all transmitted in the form of media segments in the FMP4 file format. When switching from the audio track A1 to the audio track A2 during playback, due to the randomness of the switching point, when the audio track switching time point occurs at the end of the A2 FMP4, at this time, the FMP4 data obtained by the terminal from the broadcast receiving end is no longer a complete file. For example, if the switching point is the 8th second of the timestamp, the A2 FMP4 does not have a cache, resulting in only the audio data of the 8th to 10th seconds, and lacks the packet header data of the 7th to 8th seconds, etc., then the Audio data with a PTS of 7 to 10 seconds cannot be correctly obtained, and the Video data continues to be played in a normal state. During the corresponding Video PTS of 7 to 10 seconds, since the FMP4 file data is incomplete, there is no sound output, and there will be no sound output until the next A2 FMP4 (PTS: 10 to 13 seconds) is received.
[0073] Based on the defects of ATSC3.0 in transmission and playback, the embodiment of the present application designs a cache to store the audio data of each audio track, so that after switching to the A2 audio track, the audio segment information matching the playback time information of the video data can be obtained from the mixed storage. For example, if the switching point is the 8th second of the timestamp, the audio segment data of the 7th to 10th seconds can be read from the cache, and a complete FMP4 file data can be obtained. Therefore, synchronous playback processing can be performed based on the playback time information of the video data and the complete audio segment data.
[0074] It can be understood that the characteristic that the audio segment data can be successfully played based on the complete audio segment data (such as an FMP4 file) depends on the media format of the audio segment data. For example, the above takes the media format of the FMP4 file as an example. Therefore, when the audio segment data and the video data are played synchronously, the synchronous playback can be controlled based on the target media format corresponding to the audio segment data. That is, optionally, in some embodiments of the present application, the audio segment data is based on the target media format, and the step of "synchronously playing the second audio data and the video data" includes:
[0075] According to the target media format corresponding to the target audio segment data, the second audio data and the video data are controlled to be played synchronously.
[0076] For example, based on the audio segment data in the FMP4 file format, the audio segment data may be decoded and rendered using the atoms (boxes) contained in the audio segment data to achieve playback of the audio segment data.
[0077] Among them, in the embodiment of the present application, since the video data continues to be played normally when the audio track is switched, when the audio track is switched, the video data and the second audio data can be played synchronously with reference to the video data, that is, optionally, in some embodiments of the present application, the step of "controlling the second audio data and the video data to be played synchronously according to the target media format corresponding to the target audio segment data" includes:
[0078] Taking the play time information of the video data as a reference, filtering out target audio data from the second audio data;
[0079] According to the target media format corresponding to the target audio segment data, the target audio data and the video data are controlled to be played synchronously.
[0080] The target audio data is audio frame data in the second audio data whose timestamp is greater than or equal to the timestamp corresponding to the playback time information of the video data.
[0081] Specifically, when switching audio tracks, stop the currently playing audio track, destroy all resources on the link, recreate the Audio playback link, obtain the FMP4 of the second audio track and parse the corresponding Audio PCM data. During this process, the video data needs to be played normally, but there is no corresponding audio data. If audio and video synchronization continues during this process, the video renderer will lose its reference. Therefore, before switching audio tracks, release audio and video synchronization so that the video is no longer synchronized with the reference audio, but is switched to the synchronization state of the video master, that is, the audio references the video for synchronous output.
[0082] When switching audio tracks, the corresponding audio segment information (i.e., Audio FMP4 segment) is found according to the playback time information (timestamp PTS) of the currently displayed video data, and the audio segment information is parsed to obtain frame data frame by frame. <video pts时,扔掉帧数据,直到audio pts>=Video PTS, and then sent to the audio renderer for rendering.
[0083] Correspondingly, after the switch, when Audio PTS>=Video PTS, the synchronization state of the audio master is switched back, that is, the video is output synchronously with the reference audio. That is, optionally, in some embodiments of the present application, after the step of "controlling the synchronous playback of the target audio data and the video data according to the target media format corresponding to the target audio segment data", the method further includes:
[0084] If it is detected that the play time information of the target audio data is equal to or later than the play time information of the video data, the target audio data and the video data are played synchronously with reference to the play time information of the target audio data.
[0085] Among them, in the embodiment of the present application, for the normal playback state before switching, the synchronous output of audio and video can also be achieved by using audio data as a synchronization reference and performing synchronous processing on video data, that is, optionally, in some embodiments of the present application, the step of "responding to the audio playback instruction, obtaining the first audio data of the first audio track corresponding to the audio playback instruction from the cache" includes:
[0086] In response to the audio playback instruction, determining a first audio track to be played;
[0087] Acquire first audio data of the first audio track from the buffer;
[0088] The synchronously playing the first audio data and the video data includes:
[0089] The video data is played synchronously with the first audio data and the video data with reference to the playing time information of the first audio data.
[0090] Among them, audio is used as a reference basis for audio and video synchronization, mainly utilizing the fact that audio signals are more stable in timing than video signals to ensure the smoothness and stability of multimedia data playback.
[0091] Among them, in the embodiment of the present application, since the audio segment data read from the cache during switching is mainly data within a certain range of timestamp differences adjacent to the current timestamp, for example, for the switching requirement of the timestamp 8s, the audio segment data with a timestamp of 7-10s is mainly obtained. Therefore, when too much historical data is stored in the cache, the cache pressure is increased and system resources are wasted. Therefore, in the embodiment of the present application, the cache duration information of the cache can be set to control the cache to delete the audio segment data stored earlier, that is, optionally, in some embodiments of the present application, after the step of "storing the audio data of the at least two tracks in the cache", the method also includes:
[0092] According to the cache duration information configured for the cache, the audio data to be deleted for the at least two audio tracks that exceeds the cache duration information are filtered out from the cache;
[0093] The audio data to be deleted is deleted from the cache.
[0094] The cache duration information refers to the historical duration information that can be cached based on the current time. For example, if the cache duration information is 5s and the current timestamp is the 8th second, the audio segment information with timestamps of 3-8s can be cached. The cache duration information can also be understood as the duration information for storing historical data, such as the cache can store the audio segment data of the previous 30s.
[0095] In order to better implement the playback control method of the present application, the present application also provides a playback control device based on the playback control method. The meanings of the terms are the same as those in the playback control method, and the specific implementation details can refer to the description in the method embodiment.
[0096] See also Figure 5 , Figure 5 : is a schematic diagram of the structure of a playback control device provided in an embodiment of the present application, wherein the playback control device is applied to a playback terminal, and specifically may include:
[0097] The receiving module 201 is used to receive multimedia data to be played, wherein the multimedia data includes video data and audio data of at least two tracks, and the audio data of each track matches the video data respectively;
[0098] A cache module 202, configured to store the audio data of the at least two audio tracks in a cache;
[0099] The playing module 203 is used for obtaining, in response to the audio playing instruction, the first audio data of the first audio track corresponding to the audio playing instruction from the cache, and synchronously playing the first audio data and the video data;
[0100] The switching module 204 is used to respond to the audio track switching instruction, obtain the second audio data of the second audio track corresponding to the audio track switching instruction from the cache according to the playback time information of the video data, and synchronously play the second audio data and the video data.
[0101] Optionally, in some embodiments of the present application, the audio data includes at least one audio segment data, and the switching module 204 includes:
[0102] A first response unit, configured to determine a second audio track to be switched in response to an audio track switching instruction;
[0103] A first screening unit, configured to determine target audio segment data from at least one audio segment data corresponding to the second audio track in the cache according to the playback time information of the video data;
[0104] The determining unit is configured to use the target audio segment data as the second audio data.
[0105] In some embodiments of the present application, the audio segment data is based on the target media format, and the switching module 204 includes:
[0106] A control unit is used to control the second audio data and the video data to be played synchronously according to the target media format corresponding to the target audio segment data.
[0107] In some embodiments of the present application, the control unit includes:
[0108] a screening subunit, configured to screen out target audio data from the second audio data with reference to the play time information of the video data;
[0109] The control subunit is used to control the synchronous playing of the target audio data and the video data according to the target media format corresponding to the target audio segment data.
[0110] In some embodiments of the present application, the device further includes a synchronization unit, and the synchronization unit includes:
[0111] The synchronization subunit is used to synchronously play the target audio data and the video data with reference to the playback time information of the target audio data if it is detected that the playback time information of the target audio data is equal to or later than the playback time information of the video data.
[0112] In some embodiments of the present application, the playback module 203 includes:
[0113] A second response unit, configured to determine a first audio track to be played in response to an audio playback instruction;
[0114] An acquiring unit, configured to acquire first audio data of the first audio track from the cache;
[0115] The playing unit is used to synchronously play the first audio data and the video data with reference to the playing time information of the first audio data.
[0116] In some embodiments of the present application, the device further includes a deletion module, and the deletion module includes:
[0117] A second screening unit is used to screen out the to-be-deleted audio data for the at least two audio tracks that exceeds the cache duration information from the cache according to the cache duration information configured for the cache;
[0118] A deleting unit is used to delete the audio data to be deleted from the cache.
[0119] In the embodiment of the present application, the receiving module 201 first receives multimedia data to be played, wherein the multimedia data includes video data and audio data of at least two audio tracks, and the audio data of each audio track is matched with the video data respectively. Then, the cache module 202 stores the audio data of the at least two audio tracks in the cache. Subsequently, the playing module 203 responds to the audio playing instruction, obtains the first audio data of the first audio track corresponding to the audio playing instruction from the cache, and synchronously plays the first audio data and the video data. Then, the switching module 204 responds to the audio track switching instruction, obtains the second audio data of the second audio track corresponding to the audio track switching instruction from the cache according to the playing time information of the video data, and synchronously plays the second audio data and the video data.
[0120] Among them, the embodiment of the present application caches the audio data of each audio track, so that when the audio track is switched, the audio data of the audio track to be switched to can be found from the cache, and then the audio data of the audio track to be switched to is played synchronously with the video data, thereby achieving audio and video synchronization when the audio track is switched, and improving the smoothness of the playback when the audio track is switched.
[0121] In addition, the present application also provides an electronic device, such as Figure 6 As shown, it shows a schematic diagram of the structure of the electronic device involved in this application, specifically:
[0122] The electronic device may include components such as a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, a power supply 303, and an input unit 304. Those skilled in the art will appreciate that Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0123] The processor 301 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 301 may include one or more processing cores; preferably, the processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 301.
[0124] The memory 302 can be used to store software programs and modules. The processor 301 executes various functional applications and data processing by running the software programs and modules stored in the memory 302. The memory 302 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 302 may also include a memory controller to provide the processor 301 with access to the memory 302.
[0125] The electronic device also includes a power supply 303 for supplying power to various components. Preferably, the power supply 303 can be logically connected to the processor 301 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 303 can also include any components such as one or more DC or AC power supplies, recharging systems, power supply device debugging circuits, power converters or inverters, and power status indicators.
[0126] The electronic device may further include an input unit 304, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0127] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 301 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 302 according to the following instructions, and the processor 301 will run the application programs stored in the memory 302, thereby implementing the steps in any one of the playback control methods provided in the embodiments of the present application.
[0128] The playback terminal of the embodiment of the present application receives multimedia data to be played, the multimedia data including video data and audio data of at least two audio tracks, the audio data of each audio track respectively matching the video data, the audio data of the at least two audio tracks being stored in a cache, and in response to an audio playback instruction, obtaining from the cache the first audio data of the first audio track corresponding to the audio playback instruction, and synchronously playing the first audio data and the video data, and in response to an audio track switching instruction, obtaining from the cache the second audio data of the second audio track corresponding to the audio track switching instruction according to the playback time information of the video data, and synchronously playing the second audio data and the video data.
[0129] Among them, by caching the audio data of each audio track, it is convenient to find the audio data of the audio track to be switched to from the cache when the audio track is switched, and then play the audio data of the audio track to be switched to synchronously with the video data, thereby achieving audio and video synchronization when switching audio tracks and improving the smoothness of playback when switching audio tracks.
[0130] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0131] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0132] To this end, the present application provides a computer-readable storage medium, on which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any one of the playback control methods provided in the present application.
[0133] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0134] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0135] Since the instructions stored in the computer-readable storage medium can execute the steps in any playback control method provided in the present application, the beneficial effects that can be achieved by any playback control method provided in the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0136] The above is a detailed introduction to a playback control method, device, electronic device and computer-readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.< / video>
Claims
1. A playback control method, characterized in that: Applied to a playback terminal, the method includes: Receiving multimedia data to be played, the multimedia data comprising video data and audio data of at least two audio tracks, the audio data of each audio track respectively matching the video data; Storing the audio data of the at least two audio tracks in a buffer; In response to the audio playing instruction, obtaining first audio data of a first audio track corresponding to the audio playing instruction from the cache, and synchronously playing the first audio data and the video data; In response to the audio track switching instruction, the second audio data of the second audio track corresponding to the audio track switching instruction is obtained from the cache according to the playing time information of the video data, and the second audio data and the video data are played synchronously.
2. The playback control method according to claim 1, characterized in that: The audio data includes at least one audio segment data, and the step of obtaining, in response to the audio track switching instruction, second audio data of a second audio track corresponding to the audio track switching instruction from the cache according to the playback time information of the video data includes: In response to the audio track switching instruction, determining a second audio track to be switched; Determine target audio segment data from at least one audio segment data corresponding to the second audio track in the buffer according to the playback time information of the video data; The target audio segment data is used as the second audio data.
3. The playback control method according to claim 2, characterized in that: The audio segment data is based on a target media format, and the synchronously playing the second audio data and the video data includes: According to the target media format corresponding to the target audio segment data, the second audio data and the video data are controlled to be played synchronously.
4. The playback control method according to claim 3, characterized in that: The controlling the second audio data and the video data to be played synchronously according to the target media format corresponding to the target audio segment data includes: Taking the play time information of the video data as a reference, filtering out target audio data from the second audio data; According to the target media format corresponding to the target audio segment data, the target audio data and the video data are controlled to be played synchronously.
5. The playback control method according to claim 4, characterized in that: After controlling the synchronous playback of the target audio data and the video data according to the target media format corresponding to the target audio segment data, the method further includes: If it is detected that the play time information of the target audio data is equal to or later than the play time information of the video data, the target audio data and the video data are played synchronously with reference to the play time information of the target audio data.
6. The playback control method according to claim 1, characterized in that: The step of obtaining, in response to the audio playback instruction, first audio data of a first audio track corresponding to the audio playback instruction from the cache includes: In response to the audio playback instruction, determining a first audio track to be played; Acquire first audio data of the first audio track from the buffer; The synchronously playing the first audio data and the video data includes: The video data is played synchronously with the first audio data and the video data with reference to the playing time information of the first audio data.
7. The playback control method according to claim 1, characterized in that: After storing the audio data of the at least two audio tracks in the buffer, the method further comprises: According to the cache duration information configured for the cache, the audio data to be deleted for the at least two audio tracks that exceeds the cache duration information are filtered out from the cache; The audio data to be deleted is deleted from the cache.
8. A playback control device, characterized in that: Applied to a playback terminal, the device comprises: A receiving module, used for receiving multimedia data to be played, wherein the multimedia data includes video data and audio data of at least two tracks, and the audio data of each track matches the video data respectively; A cache module, used for storing the audio data of the at least two audio tracks in a cache; a playing module, configured to, in response to an audio playing instruction, obtain from the cache first audio data of a first audio track corresponding to the audio playing instruction, and synchronously play the first audio data and the video data; The switching module is used to respond to the audio track switching instruction, obtain the second audio data of the second audio track corresponding to the audio track switching instruction from the cache according to the playback time information of the video data, and synchronously play the second audio data and the video data.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the playback control method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the playback control method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Double-audio-track audio playing control method and system, terminal and medium
CN112000308A
Audio track switching method and device, media playing equipment and computer storage medium
CN113596545A
Video playing method and device, electronic equipment and storage medium
CN114697722A
Audio track switching method and device, equipment and storage medium
CN116112717A
Extending audio tracks while avoiding audio discontinuities
US11392345B1
