Media file switching method and device

By adding marker bit fields to the track basic information of multimedia files, the problem of high cost and poor support for multi-track media file switching in the browser is solved, and seamless media file switching and cost reduction are achieved.

CN118890524APending Publication Date: 2024-11-01SHANGHAI BILIBILI TECH CO LTD

Patent Information

Application Number
CN202410903630.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

Prior Art When playing multimedia videos in a browser, multi-track media files need to be preprocessed into multiple media files, resulting in increased usage costs and difficulty in reusing existing server and client systems, and browsers use multi-track media formats. poor support.

Method used

By adding mark bit fields to the track basic information of multimedia files, using mark bits to indicate the main track that needs to be played, adjust mark bits in response to switching events to control media file switching in web page embedded player, achieving seamless switching of audio or Video track.

Benefits of technology

It realizes switching media files without any sense in the browser, avoids lag, black screen and playback time jumps, reduces usage costs, and is easy to reuse in existing systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890524A_ABST
    Figure CN118890524A_ABST
Patent Text Reader

Abstract

Embodiments of the invention provide a media file switching method and apparatus. The method comprises the steps of obtaining track basic information corresponding to a multimedia file; the multi-media file corresponds to a plurality of media files with different tracks, the track basic information comprises a mark bit, and the mark bit is used for indicating a main track needing to be played currently; in response to a switching event for the played media file, adjusting a flag bit in the track basic information; and controlling to switch the media file played in the embedded player of the webpage according to the flag bit. A flag bit field is added, the flag bit field is used for indicating a main track needing to be played currently, when a media file of the track needing to be played currently needs to be switched, seamless audio or video track switching which is the same as that of a local player can be achieved in a webpage / browser by directly modifying a flag bit in track basic information; and lagging, black screen and playing time jump are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of Internet technology, and in particular, to a method, apparatus, computer device, computer-readable storage medium, and computer program product for switching media files. Background Art

[0002] Although multi-track media is an industry standard, it is currently only used in local playback scenarios because only a few browsers support it. When playing multimedia videos in a browser, although the media files of multiple tracks can be pre-processed into multiple media files on the server to achieve playback and track switching, the pre-processing and playback logic is quite different from the ordinary media playback logic. The difference is that previously, only one media file needed to be downloaded to play the media, but with this solution, at least two media files need to be downloaded. Therefore, the cost of use increases, and it is difficult to reuse the existing server and client systems.

[0003] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for switching media files to solve or alleviate one or more of the technical problems mentioned above.

[0005] One aspect of an embodiment of the present application provides a method for switching media files, the method comprising:

[0006] Acquire basic track information corresponding to a multimedia file; the multimedia file corresponds to a plurality of media files with different tracks, and the basic track information includes a mark bit, wherein the mark bit is used to indicate a main track that needs to be played currently;

[0007] In response to a switching event for the played media file, adjusting a mark bit in the track basic information;

[0008] The media file played in the embedded player of the webpage is switched according to the flag bit.

[0009] Optionally, the acquiring of basic track information corresponding to the multimedia file includes:

[0010] A multimedia file is obtained, and basic track information corresponding to the multimedia file is obtained from the multimedia file.

[0011] Optionally, after the step of acquiring the track basic information corresponding to the multimedia file, the method further includes:

[0012] Cache the track basic information corresponding to the multimedia file in a preset cache area;

[0013] The step of adjusting the mark bit in the track basic information in response to a switching event for the played media file includes:

[0014] In response to a switching event for the played media file, a mark bit in the track basic information cached in the preset cache area is adjusted.

[0015] Optionally, the controlling the switching of the media file played in the embedded player of the webpage according to the mark bit includes:

[0016] When the embedded player of the webpage completes playing the media file, reading the mark bit in the track basic information cached in the preset buffer area;

[0017] The media file played in the embedded player of the webpage is switched according to the flag bit.

[0018] Optionally, the controlling the switching of the media file played in the embedded player of the webpage according to the mark bit includes:

[0019] Determine a target media file from the media files in the multiple different tracks according to the marker bit;

[0020] Control to switch the media file played in the embedded player of the webpage to the target media file.

[0021] Optionally, the data structure of the multimedia file includes a data area; before the step of determining the target media file from the media files of the multiple different tracks according to the mark bit, the method further includes:

[0022] A plurality of media files of different tracks corresponding to the multimedia file are obtained by parsing the data area of ​​the multimedia file.

[0023] Optionally, in response to a switching event for the played media file, adjusting a mark bit in the track basic information includes:

[0024] In response to a switching event for the played media file, determining a first track that needs to be played currently and a second track that does not need to be played currently; wherein the second track contains one or more media files;

[0025] The first track is set as a main track in the mark position, and the second track is set as a non-main track.

[0026] Another aspect of an embodiment of the present application provides a device for switching media files, the device comprising:

[0027] A track basic information acquisition module is used to acquire the track basic information corresponding to the multimedia file; the multimedia file corresponds to a plurality of media files of different tracks, and the track basic information includes a mark bit, wherein the mark bit is used to indicate the main track that needs to be played currently;

[0028] A mark bit adjustment module, used for adjusting the mark bit in the track basic information in response to a switching event for the played media file;

[0029] The media file switching module is used to control the switching of the media files played in the embedded player of the web page according to the mark position.

[0030] Another aspect of an embodiment of the present application provides a computer device, including:

[0031] at least one processor; and

[0032] a memory communicatively coupled to the at least one processor;

[0033] Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method for switching media files.

[0034] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the above-mentioned method for switching media files is implemented.

[0035] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the above-mentioned method for switching media files when executed by a processor.

[0036] The technical solution adopted in the embodiment of the present application may include the following advantages: by adding a mark bit field in the track basic information corresponding to the multimedia file, the mark bit field is used to indicate the main track that needs to be played currently. When the media file of the track currently being played needs to be switched, the track to be switched to is set as the main track and other tracks are set as non-main tracks by directly modifying the mark bit in the track basic information. The switching of media files in the embedded player of the web page can be achieved through the mark bit. The switching process can achieve the seamless switching of media files on the user side, so that the audio or video track can be seamlessly switched in the web page / browser just like the local player without freezes, black screens or playback time jumps. The solution has a low cost and is easy to reuse in existing servers and client systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0038] Figure 1 A diagram schematically shows an operating environment of a method for switching media files according to Embodiment 1 of the present application;

[0039] Figure 2 A flowchart schematically shows a method for switching media files according to the first embodiment of the present application;

[0040] Figure 3 A module block diagram for switching a media file in MP4 format is schematically shown;

[0041] Figure 4 A block diagram schematically shows a device for switching media files according to a second embodiment of the present application; and

[0042] Figure 5 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions 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 intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0044] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0045] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.

[0046] First, the following terms are explained:

[0047] Encapsulation format: generally called encapsulation format or container format, it is a format used to store audio and video data.

[0048] MP4: MP4 or MPEG-4 Part 14 is a standard digital multimedia container format. The extension of MPEG-4 Part 14 is .mp4. It is mainly used to store digital audio and digital video, but can also store subtitles and static images. Because it can accommodate video streams that support bitstreams (such as advanced video coding), it is a streaming media. In the MP4 format, various data are stored in boxes, where a box can contain another box.

[0049] Track: Common media files contain audio and video, which are generally called audio tracks and video tracks respectively. Generally, media files only contain one audio track and one video track, but many packaging formats support multiple tracks.

[0050] MediaSource: Media Source Extensions API or MSE, is a media playback interface provided by the browser to developers, allowing the playback of audio and video files generated by program code, rather than only being able to play audio and video from files or network addresses.

[0051] Key frame: a frame with complete content that can be used as a start frame. Non-key frame is a frame that needs to refer to one or more frames to synthesize complete content.

[0052] MIME Type: Multipurpose Internet Mail Extensions (MIME) is an Internet standard. Browsers usually use MIME types (rather than file extensions) to determine how to handle URLs, so it is very important that the web server adds the correct MIME type in the response header. If it is not configured correctly, the browser may not be able to parse the file content, the website will not work properly, and the downloaded file will be processed incorrectly. In MediaSource, MIME Type is needed to tell the browser the current audio and video format.

[0053] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below:

[0054] The MP4 format container supports storing multiple audio and video tracks. Most local players support switching the currently playing track at any time when playing multi-track media files.

[0055] In the web browser standard, tracks can be switched by controlling the enabled property of audioTracks and videoTracks, but the new version and most browser kernels on the market do not support this function.

[0056] Due to the poor browser support for multi-track media formats, most solutions store tracks in multiple media files, so that each media file has only one audio or video track. Each time the file is played, the video track file and audio track file to be played are downloaded, and then played through the MediaSource interface provided by the browser.

[0057] Although multi-track media is an industry standard, it is currently only used in local playback scenarios because only a few browsers support it. When playing multimedia videos in a browser, although the media files of multiple tracks can be pre-processed into multiple media files on the server to achieve playback and track switching, the pre-processing and playback logic is quite different from the ordinary media playback logic. The difference is that previously, only one media file needed to be downloaded to play the media, but with this solution, at least two media files need to be downloaded. Therefore, the cost of use increases, and it is difficult to reuse the existing server and client systems.

[0058] To this end, an embodiment of the present application provides a technical solution for switching media files. In the technical solution, by obtaining the basic track information corresponding to the multimedia file; wherein the multimedia file corresponds to a plurality of media files of different tracks, the basic track information includes a mark bit, wherein the mark bit is used to indicate the main track that needs to be played currently; in response to a switching event for the played media file, the mark bit in the basic track information is adjusted; and the media file played in the embedded player of the switching webpage is controlled according to the mark bit. By adding a mark bit field to the track basic information corresponding to the multimedia file, the mark bit field is used to indicate the main track that needs to be played currently. When the media file of the currently played track needs to be switched, the track to be switched to is set as the main track and other tracks are set as non-main tracks by directly modifying the mark bit in the track basic information. The switching of media files in the embedded player of the web page can be realized through the mark bit. The switching process has a small delay and the media files can be switched seamlessly on the user side. Therefore, the audio or video track can be seamlessly switched in the web page / browser like the local player without freeze, black screen or play time jump. The solution has a low cost and is easy to reuse in existing server and client systems. See below for details.

[0059] Finally, for ease of understanding, an exemplary operating environment is provided below.

[0060] Figure 1 The following schematically shows an environmental application diagram according to an embodiment of the present application.

[0061] The environment diagram may include a service platform 2 , one or more clients 4 , and a network 6 .

[0062] The service platform 2 and one or more clients 4 may be coupled via a network 6 to achieve information transmission interaction.

[0063] The service platform 2, the client 4, and the network 6 are respectively described in detail below.

[0064] The service platform 2 can be composed of a single or multiple computing devices. The one or more computing devices may include virtualized computing instances. The virtualized computing instances may include virtual machines, such as simulations of computer systems, operating systems, servers, etc. The computing device may load the virtual machine based on a virtual image and / or other data defining a specific software (e.g., operating system, dedicated application, server) for simulation. As the demand for different types of processing services changes, different virtual machines may be loaded and / or terminated on one or more computing devices. A hypervisor may be implemented to manage the use of different virtual machines on the same computing device. The service platform 2 may run one or more services or software applications that enable execution according to the method described in the present application. The service platform 2 may also provide other services or software applications, which may include non-virtual environments and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of the client 4 under a software as a service (SaaS) model.

[0065] The service platform 2 may include one or more components that implement the functions performed by the service platform 2. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. In some embodiments, the service platform 2 may provide services such as storage, reading, writing, querying, and deletion, such as providing a switching service for media files for the client. In other embodiments, a user operating the client 4 may sequentially use one or more client applications to interact with the service platform 2 to utilize the services provided by these components.

[0066] The client 4 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other electronic devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE ChromeOS); or include various mobile operating systems, such as MICROSOFT Windows, Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants, etc. Wearable devices may include head-mounted displays (such as smart glasses), etc. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.

[0067] Based on the operating system described above, the client 4 may also be installed with one or more application programs, such as a processing program for switching media files.

[0068] The client 4 may include an input / output interface. The input interface may include a touch pad, a touch screen, a mouse, a keyboard, or other sensing elements. The input interface may be configured to receive user instructions, which may enable the client 4 to perform various operations, such as switching of media files. The output interface is used to output information to the user, such as display information.

[0069] The service platform 2 and the client 4 may use a network 6 as a transmission medium. The network 6 includes various network devices, such as routers, switches, multiplexers, hubs, modems, bridges, repeaters, firewalls, proxy devices, and / or the like. The network may include physical links, such as coaxial cable links, twisted pair cable links, optical fiber links, combinations thereof, or wireless links, such as cellular links, satellite links, Wi-Fi links, and the like.

[0070] It should be noted that the above devices are exemplary, and the number and type of devices are adjustable in different scenarios or according to different needs.

[0071] Embodiment 1

[0072] Figure 2The flowchart of the method for switching media files according to the first embodiment of the present application is schematically shown.

[0073] like Figure 2 As shown, the method for switching media files may include steps S202 to S208, wherein:

[0074] Step S202, obtaining basic track information corresponding to the multimedia file; the multimedia file corresponds to a plurality of media files of different tracks, and the basic track information includes a mark bit, wherein the mark bit is used to indicate the main track that needs to be played currently;

[0075] Step S204, in response to a switching event for the played media file, adjusting a mark bit in the track basic information;

[0076] Step S206: Control switching of the media file played in the embedded player of the webpage according to the flag.

[0077] The method for switching media files provided in this embodiment is as follows: by adding a mark bit field in the track basic information corresponding to the multimedia file, the mark bit field is used to indicate the main track that needs to be played currently. When the media file of the track that is currently played needs to be switched, the track to be switched to is set as the main track and other tracks are set as non-main tracks by directly modifying the mark bit in the track basic information. The switching of media files in the embedded player of the web page can be achieved through the mark bit. The switching process can achieve the seamless switching of media files on the user side, so that the audio or video track can be seamlessly switched in the web page / browser just like the local player without freezing, black screen or play time jump. The solution has a low cost and is easy to be reused in existing servers and client systems.

[0078] The following combination Figure 2 , each step in steps S202 to S206 and other optional steps are described in detail.

[0079] Step S202 , obtaining basic track information corresponding to the multimedia file; wherein the multimedia file corresponds to a plurality of media files of different tracks, and the basic track information includes a mark bit, wherein the mark bit is used to indicate the main track that needs to be played currently;

[0080] The multimedia file corresponds to a plurality of media files with different tracks, such as two video tracks and two audio tracks. The media files with different tracks can be packaged in one multimedia file, and the media file to be currently played can be selected when playing in the embedded player of the web page.

[0081] In this embodiment, in order to achieve seamless switching of media files played in the embedded player of the web page, a mark bit field is added to the track basic information corresponding to the multimedia file, and the mark bit field is used to indicate the main track that needs to be played currently, wherein the main track is the track used by the player by default, so that when the track needs to be switched, the mark bit field can be directly modified. Specifically, each time the embedded player of the web page plays a multimedia file, it reads the main track indicated in the mark bit field and obtains the multimedia file corresponding to the main track for playback.

[0082] Step S204 , in response to a switching event for the played media file, adjusting a mark bit in the track basic information;

[0083] Specifically, by deploying a processing program for implementing the switching of media files in the embedded player of the web page, when the embedded player of the web page receives a switching event for the played media file, the processing program can respond to the switching event for the played media file and adjust the mark bit in the track basic information.

[0084] Step S206 , according to the flag bit, control switching of the media file played in the embedded player of the web page.

[0085] In this embodiment, each time the embedded player of the web page plays a multimedia file, it reads the main track recorded in the mark bit field and obtains the multimedia file corresponding to the main track for playback. Specifically, after the embedded player of the web page finishes playing the media file being played, it re-reads the mark bit in the track basic information, and then obtains the key frame of the media file corresponding to the main track according to the mark bit, sends the key frame to the MediaSource interface of the embedded player of the web page, and uses the MediaSource interface to play the media file corresponding to the main track.

[0086] In an optional embodiment of the present application, the obtaining of basic track information corresponding to the multimedia file includes:

[0087] A multimedia file is obtained, and basic track information corresponding to the multimedia file is obtained from the multimedia file.

[0088] In this embodiment, a processing program for implementing the switching of media files is deployed in the embedded player of the web page. When playing the media file, the multimedia file can be obtained through the processing program, and the basic track information corresponding to the multimedia file can be parsed from the multimedia file using the processing program.

[0089] Specifically, different packaging formats have different storage structures for multi-track files, but most formats contain a "track information area" and a "data area", such as Figure 3 Take the MP4 format as an example. This format calls each area a Box. TKHD and TFHD Box are used to store the basic track information (Track Header). MDAT is the audio and video data block. TKHD and TFHDBox can be used to match the track and data. In addition, the MP4 format also contains other types of Boxes. Figure 3 Omitted.

[0090] TKHD ​​contains a flag to indicate whether the current track is the main track (the main track is the track used by the player by default). If TFHD exists, the track number (track_id) in TKHD will be associated with the TFHD with the same track number.

[0091] In most browsers, you can list all the formats in the track in the codecs field in the MIME Type to allow the browser to play the video normally. For example, if the media file contains two AVC tracks and two AAC tracks, you can write video / mp4;codecs="avc1.64002a,avc1.64002a,mp4a.40.2,mp4a.40.2".

[0092] In an optional embodiment of the present application, after the step of obtaining the basic track information corresponding to the multimedia file, the method further includes:

[0093] The track basic information corresponding to the multimedia file is cached in a preset cache area.

[0094] In this embodiment, the embedded player of the web page may have a corresponding preset cache area. After acquiring the basic track information corresponding to the multimedia file, the basic track information corresponding to the multimedia file may be cached in the preset cache area.

[0095] In an optional embodiment of the present application, in response to a switching event for the played media file, adjusting a mark bit in the track basic information includes:

[0096] In response to a switching event for the played media file, a mark bit in the track basic information cached in the preset cache area is adjusted.

[0097] In this embodiment, a processing program for implementing the switching of media files is deployed in the embedded player of the web page. When the embedded player of the web page receives a switching event for the played media file, the processing program responds to the switching event for the played media file and adjusts the mark bit in the track basic information cached in the preset cache area, thereby implementing the switching of the media file.

[0098] In an optional embodiment of the present application, the controlling the switching of the media file played in the embedded player of the webpage according to the mark bit includes:

[0099] When the embedded player of the webpage finishes playing the media file, the mark bit in the track basic information cached in the preset buffer area is read; and the media file played in the embedded player of the webpage is switched according to the mark bit.

[0100] In this embodiment, when the embedded player of the web page finishes playing the media file being played, the embedded player of the web page is ready to play the next media file by reading the mark bit in the track basic information cached in the preset cache area. Since the mark bit in the track basic information cached in the preset cache area has been modified, the main track that needs to be played currently can be directly determined according to the modified mark bit, and the media file played in the embedded player of the web page can be switched according to the mark bit.

[0101] It should be noted that if the mark bit is not modified, the embedded player of the web page can play the multimedia file according to the initially set main track after reading the mark bit in the track basic information cached in the preset cache area.

[0102] In an optional embodiment of the present application, the controlling the switching of the media file played in the embedded player of the webpage according to the mark bit includes:

[0103] A target media file is determined from the media files of the multiple different tracks according to the marking bit; and a media file played in an embedded player of the webpage is controlled to be switched to the target media file.

[0104] In this embodiment, when the embedded player of the web page plays multimedia files, each time a media file is played, a target media file is determined from the media files of multiple different tracks according to the marker bit, and then the media file played in the embedded player of the web page is controlled to be switched to the target media file.

[0105] In an optional embodiment of the present application, the data structure of the multimedia file includes a data area; before the step of determining the target media file from the media files of the multiple different tracks according to the mark bit, the method further includes:

[0106] A plurality of media files of different tracks corresponding to the multimedia file are obtained by parsing the data area of ​​the multimedia file.

[0107] In this embodiment, the data structure of the multimedia file includes a data area. Before determining the target media file, the data area of ​​the multimedia file may be parsed to obtain multiple media files of different tracks corresponding to the multimedia file.

[0108] In an optional embodiment of the present application, in response to a switching event for the played media file, adjusting a mark bit in the track basic information includes:

[0109] In response to a switching event for a played media file, a first track that needs to be played currently and a second track that does not need to be played currently are determined; wherein the second track contains one or more media files; and the first track is set as a main track in the mark position, and the second track is set as a non-main track.

[0110] In this embodiment, a processing program for implementing the switching of media files is deployed in the embedded player of the webpage. When the embedded player of the webpage receives a switching event for the played media file, the processing program responds to the switching event for the played media file to determine the first track that needs to be played and the second track that does not need to be played; wherein the second track contains one or more media files; then, the first track is set as the main track in the mark bit, and the second track is set as the non-main track. For example, Figure 3 In the example, if you switch to video 2 and audio 1, set video 2 and audio 1 as the main tracks, and set video 1 and audio 2 as non-main tracks.

[0111] The processing program will cache the MP4 header information, specifically, it is called MOOV in MP4, which includes TKHD. Then, the mark indicating whether it is the main track in the cached TKHD will be modified, and the track to be switched will be set as the main track, and other tracks will be set as non-main tracks. When the embedded player of the web page is ready to insert the next audio or video key frame, the modified MP4 header information will be sent back to MediaSource, and then the key frame and subsequent content will be sent to complete the track switching.

[0112] Embodiment 2

[0113] Figure 4The block diagram of the media file switching device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Figure 4 As shown, the media file switching device 400 may include: a track basic information acquisition module 410, a mark bit adjustment module 420 and a media file switching module 430, wherein:

[0114] The track basic information acquisition module 410 is used to acquire the track basic information corresponding to the multimedia file; the multimedia file corresponds to a plurality of media files of different tracks, and the track basic information includes a mark bit, wherein the mark bit is used to indicate the main track that needs to be played currently;

[0115] A marker bit adjustment module 420, configured to adjust a marker bit in the track basic information in response to a switching event for the played media file;

[0116] The media file switching module 430 is used to control the switching of the media files played in the embedded player of the web page according to the flag bit.

[0117] In an optional embodiment of the present application, the track basic information acquisition module 410 includes:

[0118] The information acquisition submodule is used to acquire multimedia files and parse the multimedia files to obtain the basic track information corresponding to the multimedia files.

[0119] In an optional embodiment of the present application, the device further includes:

[0120] The track basic information cache module is used to cache the track basic information corresponding to the multimedia file in a preset cache area.

[0121] In an optional embodiment of the present application, the flag bit adjustment module 420 includes:

[0122] The first mark bit adjustment submodule is used to adjust the mark bit in the track basic information cached in the preset cache area in response to a switching event for the played media file.

[0123] In an optional embodiment of the present application, the media file switching module 430 includes:

[0124] A marker reading submodule, used for reading a marker in the track basic information cached in the preset buffer area when the embedded player of the webpage completes playing the media file being played;

[0125] The media file switching submodule is used to control the switching of the media files played in the embedded player of the web page according to the flag bit.

[0126] In an optional embodiment of the present application, the media file switching submodule includes:

[0127] a target media file determining unit, configured to determine a target media file from the media files of the multiple different tracks according to the marker bit;

[0128] The media file switching unit is used to control the media file played in the embedded player of the web page to be switched to the target media file.

[0129] In an optional embodiment of the present application, the data structure of the multimedia file includes a data area; the device further includes:

[0130] The media file parsing module is used to parse the data area of ​​the multimedia file to obtain multiple media files of different tracks corresponding to the multimedia file.

[0131] In an optional embodiment of the present application, the flag bit adjustment module 420 includes:

[0132] A track determination submodule, configured to determine, in response to a switching event for a played media file, a first track that needs to be played currently and a second track that does not need to be played currently; wherein the second track includes one or more media files;

[0133] The mark position setting submodule is used to set the first track as the main track in the mark position, and set the second track as the non-main track.

[0134] Embodiment 3

[0135] Figure 5 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing a method for switching media files according to the third embodiment of the present application is shown schematically. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Figure 5As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:

[0136] The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as a hard disk or a memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 may also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program codes of the method for switching media files, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.

[0137] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0138] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0139] It should be pointed out that Figure 5 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0140] In this embodiment, the method for switching media files stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.

[0141] Embodiment 4

[0142] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the media file switching method in the embodiment are implemented.

[0143] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed on the computer device, such as the program code of the switching method of the media file in the embodiment, etc. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.

[0144] Embodiment 5

[0145] An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.

[0146] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0147] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for switching media files, characterized in that: The method comprises: Acquire basic track information corresponding to a multimedia file; the multimedia file corresponds to a plurality of media files with different tracks, and the basic track information includes a mark bit, wherein the mark bit is used to indicate a main track that needs to be played currently; In response to a switching event for the played media file, adjusting a mark bit in the track basic information; The media file played in the embedded player of the webpage is switched according to the flag bit.

2. The method for switching media files according to claim 1, characterized in that: The obtaining of the basic track information corresponding to the multimedia file includes: A multimedia file is obtained, and basic track information corresponding to the multimedia file is obtained from the multimedia file.

3. The method for switching media files according to claim 1 or 2, characterized in that: After the step of obtaining the basic track information corresponding to the multimedia file, the method further includes: Cache the track basic information corresponding to the multimedia file in a preset cache area; The step of adjusting the mark bit in the track basic information in response to a switching event for the played media file includes: In response to a switching event for the played media file, a mark bit in the track basic information cached in the preset cache area is adjusted.

4. The method for switching media files according to claim 3, characterized in that: The method of controlling the switching of the media files played in the embedded player of the webpage according to the mark bit includes: When the embedded player of the webpage completes playing the media file, reading the mark bit in the track basic information cached in the preset buffer area; The media file played in the embedded player of the webpage is switched according to the flag bit.

5. The method for switching media files according to claim 1, characterized in that: The method of controlling the switching of the media files played in the embedded player of the webpage according to the mark bit includes: Determine a target media file from the media files in the multiple different tracks according to the marker bit; Control to switch the media file played in the embedded player of the webpage to the target media file.

6. The method for switching media files according to claim 1, characterized in that: The data structure of the multimedia file includes a data area; before the step of determining the target media file from the media files of the multiple different tracks according to the mark bit, the method further includes: A plurality of media files of different tracks corresponding to the multimedia file are obtained by parsing the data area of ​​the multimedia file.

7. The method for switching media files according to claim 1, characterized in that: The step of adjusting the mark bit in the track basic information in response to a switching event for the played media file includes: In response to a switching event for the played media file, determining a first track that needs to be played currently and a second track that does not need to be played currently; wherein the second track contains one or more media files; The first track is set as a main track in the mark position, and the second track is set as a non-main track.

8. A device for switching media files, characterized in that: The device comprises: A track basic information acquisition module is used to acquire the track basic information corresponding to the multimedia file; the multimedia file corresponds to a plurality of media files of different tracks, and the track basic information includes a mark bit, wherein the mark bit is used to indicate the main track that needs to be played currently; A mark bit adjustment module, used for adjusting the mark bit in the track basic information in response to a switching event for the played media file; The media file switching module is used to control the switching of the media files played in the embedded player of the web page according to the mark position.

9. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the media file switching method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method for switching media files according to any one of claims 1 to 7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the media file switching method according to claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method and system for switching and playing video

    CN102739627A

  • Method and device for switching stream media audios

    CN105791971A

  • Video switching method, device and system

    CN106961624A

  • Audio track switching method and device, computing equipment and storage medium

    CN116528018A

  • Imaging system, imaging apparatus, imaging method, and imaging program

    JP2013145983A

Cited By

  • Media file switching method and apparatus

    WO2026007585A1