Media data transmission method and device, computer equipment and storage medium
By determining the target media slice and picture group positions through a pre-generated index file, media data is transmitted directly starting from the picture group position, which solves the playback stuttering problem in RTSP protocol video-on-demand services and achieves efficient media data transmission and smoothness.
Patent Information
- Application Number
- CN202511648884.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-02-27
AI Technical Summary
Existing video-on-demand services based on the RTSP protocol often experience playback stuttering during the startup phase and when the network fluctuates due to insufficient data filling or bitrate mismatch, which affects the user experience.
The media slices of the on-demand content are indexed by a pre-generated index file. The target media slice and the position of the picture group are determined based on the time information in the playback request. Media data is transmitted directly with the position of the picture group as the starting position, and redundant data is skipped during transmission.
It improves the efficiency of media data transmission, ensures the accuracy and smoothness of playback position, and reduces stuttering.
Smart Images

Figure CN121585840A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for transmitting media data. Background Technology
[0002] With the development of computer and internet technologies and the arrival of the 5G era, the internet has brought great convenience to modern life. The RTSP protocol, with its powerful control functions, flexibility, and compatibility, is widely used in IPTV (Internet Protocol Television) services. Set-top box users can use RTSP to play, pause, fast forward, rewind, position for playback, and stop videos, thus obtaining a viewing experience similar to traditional television.
[0003] However, in current media data transmission methods, video-on-demand services based on the RTSP protocol typically involve the set-top box terminal sending broadcast control messages and receiving RTP media data based on user playback operations, with all data transmission controlled by the RTSP media server. This means that traditional IPTV video-on-demand services often experience playback stuttering during startup and network fluctuations due to insufficient data filling or bitrate mismatch, impacting user experience. Therefore, how to improve media data transmission efficiency while simultaneously enhancing the smoothness of media data playback has become a pressing issue. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for transmitting media data, which can improve the efficiency of media data transmission and effectively enhance the smoothness of media data playback, in order to address the aforementioned technical problems.
[0005] In a first aspect, this application provides a method for transmitting media data. The method includes: upon receiving a playback request for on-demand content sent by a receiving terminal, obtaining an index file corresponding to the on-demand content based on identification information carried in the playback request; the index file being used to index media slices corresponding to the on-demand content; determining a target media slice from the index file based on playback time information carried in the playback request; determining a target frame group position within the target media slice corresponding to the playback time information based on frame group information of the target media slice; and transmitting media data to the terminal starting from the target frame group position; the media data being used to play the on-demand content.
[0006] Secondly, this application also provides a media data transmission apparatus. The apparatus includes: an acquisition module, configured to, upon receiving a playback request for on-demand content sent by a terminal, acquire an index file corresponding to the on-demand content based on identification information carried in the playback request; the index file is used to index media slices corresponding to the on-demand content; a determination module, configured to determine a target media slice from the index file based on playback time information carried in the playback request; and to determine a target frame group position in the target media slice corresponding to the playback time information based on frame group information of the target media slice; and a transmission module, configured to transmit media data to the terminal starting from the target frame group position; the media data is used to play the on-demand content.
[0007] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps described in the above-described media data transmission method.
[0008] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps described in the above-described media data transmission method.
[0009] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps described in the above-described media data transmission method.
[0010] The aforementioned media data transmission methods, apparatuses, computer devices, storage media, and computer program products, since the index file is a pre-generated file used to index media slices corresponding to on-demand content, can quickly and accurately determine the target media slice from the index file based on the playback time information carried in the playback request. Furthermore, based on the picture group information of the target media slice, the position of the target picture group corresponding to the playback time information can be quickly and accurately determined within the target media slice. Consequently, media data can be directly transmitted to the terminal starting from the position of the target picture group, i.e., automatically skipping redundant data in the media slice for transmission, making the playback position more accurate and the media data transmission efficiency higher. Thus, the technical effect of improving the smoothness of media data playback is achieved while simultaneously improving the efficiency of media data transmission. Attached Figure Description
[0011] Figure 1 This is an application environment diagram of a media data transmission method in one embodiment;
[0012] Figure 2 This is a flowchart illustrating a media data transmission method in one embodiment;
[0013] Figure 3 This is a schematic diagram of multi-party system interaction for the transmission of media data provided in one embodiment.
[0014] Figure 4 This is a schematic diagram of the overall process of a media data transmission method provided in one embodiment;
[0015] Figure 5 This is a schematic diagram illustrating the calculation of the playback position in one embodiment;
[0016] Figure 6 This is a schematic diagram of a segmented adaptive transmission control method based on GOP code rate in one embodiment;
[0017] Figure 7 This is a diagram illustrating the optimization effect of stuttering metrics in one embodiment;
[0018] Figure 8 This is a structural block diagram of a media data transmission device in one embodiment;
[0019] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0021] It should be noted that in the following description, the terms "first, second, and third" are used only to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, and third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0022] The media data transmission method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Terminal 102 can be a set-top box terminal, and the server can be an RTSP media server. Specifically, when server 104 receives a playback request for on-demand content sent by terminal 102, server 104 can obtain an index file corresponding to the on-demand content based on the identification information carried in the playback request. The index file is used to index the media slices corresponding to the on-demand content. Furthermore, server 104 can determine the target media slice from the index file based on the playback time information carried in the playback request, and based on the picture group information of the target media slice, determine the target picture group position corresponding to the playback time information within the target media slice. Starting from the target picture group position, server 104 transmits media data to terminal 102 so that terminal 102 can parse the transmitted media data to play the on-demand content. In other words, the media data in this application is used to play on-demand content.
[0023] Among them, terminal 102 can be a set-top box terminal, smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, Internet of Things (IoT) device and portable wearable device. IoT device can be smart speaker, smart TV, smart air conditioner and smart vehicle device, etc.
[0024] Server 104 can be a standalone physical server or a service node in a blockchain system.
[0025] In one embodiment, such as Figure 2 As shown, a method for transmitting media data is provided. This method can be executed by a server or a terminal alone, or by both a server and a terminal. This method can be applied to... Figure 1 Taking the server in the example, the following steps are included:
[0026] Step 202: When receiving a playback request for on-demand content sent by the receiving terminal, obtain the index file corresponding to the on-demand content based on the identification information carried in the playback request; the index file is used to index the media slices corresponding to the on-demand content.
[0027] In this context, "on-demand content" refers to the specific content requested by a user when making a video-on-demand request. For example, the on-demand content in this application can be different types of on-demand content such as on-demand videos, on-demand TV programs, and on-demand live programs. It can be understood that the on-demand content in this application can be any video requested by a user in an IPTV (Internet Protocol Television) service scenario.
[0028] A playback request refers to a request generated by a user through a triggering operation to play on-demand content. For example, in this application, a playback request can be a broadcast control message sent by the set-top box terminal to the media server, which requests the media server to play on-demand content. Furthermore, broadcast control messages include different types of player requests such as PLAY requests.
[0029] Identification information refers to an identifier used to uniquely identify on-demand content. For example, the identification information in this application could be an on-demand identifier, which includes a video identifier. That is, the media server can obtain the on-demand identifier of the on-demand content from the URL, i.e., the resource locator, of the playback request.
[0030] An index file is a file used to describe the media slices corresponding to the on-demand content. In other words, the index file in this application is used to index the media slices corresponding to the on-demand content. Each on-demand content corresponds to one index file. The index file can be pre-generated and includes at least the slice identifier (such as the file name), index identifier, and slice tag information for each media slice.
[0031] For example, the index file in this application could be an m3u8 index file of an HLS video-on-demand resource. Figure 3 The diagram illustrates the multi-party system interaction for media data transmission provided in this application. The IPTV slicing system can pre-download content files from the on-demand content source and slice them according to an agreed duration (e.g., 10 seconds) to generate HLS on-demand resources. Afterward, the IPTV slicing system can inject the generated HLS on-demand resource's m3u8 index file and slice files into the IPTV content center, enabling the RTSP media server to obtain the HLS on-demand resource's m3u8 index file and slice files from the IPTV content center. The HLS on-demand resource includes both the m3u8 index file and the slice files. It is understood that the IPTV slicing system and the RTSP media server in this application can be deployed on the same server or on different servers.
[0032] Media slicing refers to the process of pre-slicing the content file of on-demand content into segments (stored in file form) according to a preset duration (e.g., 10 seconds). In some cases, media slicing in this application can also be called media fragmentation. For example, the IPTV slicing system pre-slices the content file of video A into segments according to a preset duration (e.g., 10 seconds), generating HLS on-demand resources corresponding to video A, which include 5 media slices (slice files) and an index file.
[0033] Step 204: Determine the target media slice from the index file based on the playback time information carried in the playback request.
[0034] The playback time information refers to the playback position information for the on-demand content, also known as time offset position information. For example, the playback time information in this application can be time offset information or specific playback time position information (such as the playback moment). For instance, NPT = 15.000 passed from the set-top box terminal indicates that playback starts from the 15th second of the on-demand content. NPT (Network Presentation Time) is a playback timestamp defined in the RTSP protocol, used to specify the playback start time parameter, in seconds, indicating that playback starts from the 15th second of the video stream. If the Range field is not specified, playback defaults to the beginning of the video (0 seconds).
[0035] A target media slice refers to a specific media slice selected from multiple media slices corresponding to the on-demand content. For example, if the set-top box terminal sends NPT = 15.000, indicating that playback starts from the 15th second of the on-demand content, the server can calculate the target media slice as the third media slice, test_01_002.ts, based on the playback time information carried in the playback request, i.e., NPT = 15.000, from the index file corresponding to the on-demand content.
[0036] Specifically, let's take the application scenario of IPTV (Internet Protocol Television) service as an example. When a user makes a video-on-demand request, the user's set-top box terminal can initiate a playback request for the content via the RTSP protocol. This playback request (e.g., a PLAY request) transmits the specific playback position (time offset) requested by the user to the server. When the media server receives the player request for the content from the set-top box terminal, it can obtain the index file corresponding to the content based on the identification information carried in the player request. For example, the media server can obtain (download) the m3u8 index file corresponding to the player's identifier from the content center based on the player's URL (resource locator). Then, based on the playback time information (playback position information) carried in the playback request, it can determine the target media slice (slice identifier) from the m3u8 index file and obtain the target media slice (i.e., slice file) corresponding to the slice identifier of the target media slice from the content center.
[0037] In one embodiment, obtaining the index file corresponding to the on-demand content based on the identification information carried in the playback request includes: when the server receives a playback request for on-demand content sent by the terminal, the server can obtain the on-demand identifier carried in the resource locator of the playback request, and obtain (download) the index file corresponding to the on-demand content from the content center based on the on-demand identifier; the on-demand identifier is used to identify the on-demand content.
[0038] Step 206: Based on the picture group information of the target media slice, determine the position of the target picture group corresponding to the playback time information in the target media slice.
[0039] The group of pictures information refers to the GOP information of the target media slice. A GOP (Group of Pictures) is a group of consecutive pictures between two keyframes (I-frames). It can be understood that the GOP information of each media slice in this application can be obtained by parsing the slice tag information of each media slice. Furthermore, the group of pictures information in this application includes at least: the playback duration of each GOP, the length (data length) of each GOP, and the bitrate information of each GOP.
[0040] The target picture group position refers to the position of the picture group (GOP) in the target media slice that corresponds to the playback time information. For example, the target picture group position in this application can be determined based on the playback time information and the playback duration of each GOP contained in the target media slice.
[0041] Specifically, after the media server determines the target media slice from the index file based on the playback time information carried in the playback request, the media server can parse the slice tag information of the target media slice to obtain the picture group information of the target media slice. The picture group information includes at least the playback duration of each GOP. The media server can determine the position of the target picture group in the target media slice based on the playback time information and the playback duration of each GOP contained in the target media slice.
[0042] In one embodiment, the target group of frames (GOP) position can be calculated as follows:
[0043] The duration of all slices preceding the current slice in the m3u8 index file is accumulated to T, where T+t0+t1+…+t i If the playback position is greater than or equal to the playback time (e.g., NPT = 15), then the transmission starts from the i-th GOP, t i Let represent the playback duration of the i-th GOP, where the i-th GOP is the position of the target frame group.
[0044] Step 208: Starting from the target screen group position, transmit media data to the terminal; the media data is used to play on-demand content.
[0045] The starting position refers to the starting position of the media data sent by the terminal. For example, if the NPT = 15 is passed from the set-top box terminal, it means that the playback starts from the 15th second of the on-demand content. Then the starting position of the media server sending the media data to the terminal is the i-th GOP, which is the target picture group position.
[0046] Media data refers to data used to play on-demand content. For example, the media data in this application can be sent in the form of data packets. Another example is that the data packets can be RTP packets.
[0047] Specifically, such as Figure 4 The diagram illustrates the overall flow of the media data transmission method provided in this application. Based on the picture group information of the target media slice, the media server determines the position of the target picture group corresponding to the playback time information within the target media slice. Then, the media server can uniformly send media data based on the GOP bitrate. Specifically, the media server initializes the sending timer interval and calculates the number of transmissions and the amount of data sent per transmission based on the bitrate of the transmitted GOP and the playback duration. For example, the media server can execute a segmented adaptive media data transmission control method based on the bitrate of each GOP contained in the picture group information. That is, the media server starts at the target picture group position and, based on the bitrate of each GOP in the picture group information, sends media data to the terminal according to a preset time interval and the amount of media data sent each time. The amount of media data sent each time is determined based on the bitrate of each GOP in the picture group information and the preset time interval. Alternatively, the media server can use the target frame group position as the starting position, and based on the speed factor and the bitrate of each GOP in the frame group information, send media data to the terminal at preset time intervals and with a data volume for each transmission; where the data volume for each transmission is determined based on the bitrate of each GOP in the frame group information, the speed factor, and the preset time interval. Furthermore, the media server can also dynamically adjust the transmission strategy based on network conditions and the bitrate of each GOP in the target media slice's frame group information, obtaining an adjusted transmission strategy, and then transmit media data to the terminal based on this adjusted strategy.
[0048] In this embodiment, since the index file is a pre-generated file used to index the media slices corresponding to the on-demand content, the target media slice can be quickly and accurately determined from the index file based on the playback time information carried in the playback request. Then, based on the screen group information of the target media slice, the position of the target screen group corresponding to the playback time information can be quickly and accurately determined in the target media slice. Media data can then be transmitted to the terminal directly from the position of the target screen group, that is, the redundant data in the media slice is automatically skipped and sent, making the playback position more accurate and the media data transmission efficiency higher. Thus, the technical effect of improving the smoothness of media data playback is achieved while improving the efficiency of media data transmission.
[0049] In one embodiment, the playback time information includes the playback time; the step of determining the target media slice from the index file based on the playback time information carried in the playback request includes: determining the slice identifier of the target media slice from the index file based on the playback time; and obtaining the target media slice stored in file form based on the slice identifier.
[0050] Among them, the playback time information refers to the playback position information transmitted by the set-top box terminal through the playback request. For example, the playback time information in this application includes the playback time (i.e., time offset information). For example, the input npt=15.000- indicates that playback starts from the 15th second (i.e., the playback position).
[0051] Specifically, let's take the application scenario of IPTV (Internet Protocol Television) service as an example. After receiving a player request for on-demand content - Video A from the set-top box terminal, the RTSP media server can calculate that 15s falls in the second slice based on the playback time carried in the player request (e.g., npt=15.000-). That is, it determines the slice identifier of the target media slice as test_01_001.ts from the index file of Video A, and obtains the target media slice stored in file form based on the slice identifier. For example, the RTSP media server can download the file test_01_001.ts from the content center based on the slice identifier test_01_001.ts to obtain the target media slice (file). This allows for the quick and accurate acquisition of each media slice corresponding to the on-demand content by customizing the slice tags in the m3u8 index file, and data transmission can start from the target picture group position, automatically skipping redundant data in the TS slice, making the playback position more accurate and the media data transmission efficiency higher.
[0052] In one embodiment, the step of determining the slice identifier of the target media slice from the index file based on the playback time includes: obtaining the duration information of each media slice corresponding to the on-demand content from the index file; summing the duration information sequentially to obtain accumulated duration information; if the accumulated duration information is greater than or equal to the playback time, determining the media slice corresponding to the last duration information in the accumulated duration information as the target media slice; and using the slice identifier of the media slice corresponding to the last duration information as the slice identifier of the target media slice.
[0053] The duration of each media slice can be 10 seconds. That is, if the content file of the on-demand content is pre-processed into slices according to a preset duration (e.g., 10 seconds), the resulting slices are...
[0054] Specifically, assuming the IPTV slicing system pre-slices the content file of video A into segments according to a preset duration of 10 seconds, generating HLS on-demand resources corresponding to video A containing 5 media segments (slice files) and an index file, after a user initiates an on-demand request for video A, the RTSP media server can calculate, based on the playback time carried in the on-demand request (e.g., npt=15.000-), that the playback time of 15 seconds falls on the second segment, i.e., the duration of segment 1 (10 seconds) + the duration of segment 2 (10 seconds) = 20 seconds (cumulative duration information) > the playback position, i.e., the playback time of 15 seconds. Then, the segment 2 corresponding to the end duration information (i.e., the duration of segment 2, 10 seconds) is the current playback segment, i.e., the target media segment, and the segment identifier test_01_001.ts of the media segment corresponding to the end duration information (i.e., the duration of segment 2, 10 seconds) is the segment identifier of the target media segment. Therefore, the method specifically designed for calculating the slice ID in the embodiments of this application can quickly and accurately determine the slice to be played based on the accumulated slice duration information and playback position information, that is, automatically skip the redundant data in the TS slice and send it, so that the playback position is more accurate and the media data transmission efficiency is higher.
[0055] In one embodiment, the method further includes: parsing the slice tag information of the target media slice to obtain the picture group information of the target media slice; the picture group information includes the playback duration of each GOP; the step of determining the target picture group position corresponding to the playback time information in the target media slice based on the picture group information of the target media slice includes: determining the target picture group position in the target media slice based on the playback time information and the playback duration of each GOP contained in the target media slice.
[0056] The target picture group position is the position of the target GOP. For example, if the target media slice contains a total of 5 GOPs, the target picture group position can be determined to be the 3rd GOP position based on the preset GOP position calculation method, that is, data is sent starting from the 3rd GOP.
[0057] Specifically, let's take the application scenario of IPTV (Internet Protocol Television) service as an example. After determining the target media slice from the index file based on the playback time information carried in the playback request, the RTSP media server can parse the slice tag information of the target media slice. For example, the RTSP media server can parse the slice tag information of the target media slice test_01_001.ts. The image group information obtained from the target media slice includes:
[0058]
[0059]
[0060] That is, the picture group information of the target media slice parsed above includes at least: the slice bitrate fluctuation dispersion coefficient D, the PCR duration (i.e., playback duration) and bitrate of each GOP in the slice.
[0061] Furthermore, such as Figure 5 The diagram illustrates the calculation of playback position. An RTSP media server can determine the position of the target frame group within a target media slice based on the parsed PCR duration (i.e., playback duration of 2 seconds) of each GOP in the target media slice and the playback time information (npt=15.000-) carried in the playback request. For example, as shown... Figure 5 As shown, the RTSP media server calculates the GOP position corresponding to the playback position (npt=15.000-) based on the playback duration information of each GOP in the parsed TS slice: 10+2+2+2>15. This means the target frame group position in the target media slice is the third GOP position, allowing the RTSP media server to start sending media data from the third GOP position. This automatically skips redundant data in the TS slice, making the playback position more accurate and effectively improving the accuracy of media data transmission.
[0062] In one embodiment, the playback time information includes the playback time. The step of determining the target picture group position in the target media slice based on the playback time information and the playback duration of each GOP contained in the target media slice includes: obtaining the duration information of each preceding slice before the target media slice from the index file; summing the duration information with the playback duration of each GOP contained in the target media slice in sequence to obtain a sum value; and determining the GOP corresponding to the last playback duration in the sum value as the target picture group position if the sum value is greater than or equal to the playback time.
[0063] The duration of each preceding segment before the target media segment can be 10 seconds. That is, if the content file of the on-demand content is sliced according to a preset duration (e.g., 10 seconds), the duration of each media segment is equal, all being the preset duration of 10 seconds.
[0064] Specifically, let's take the application scenario of IPTV (Internet Protocol Television) service as an example. The RTSP media server can determine the position of the target picture group in the target media slice based on playback time information and the playback duration of each GOP contained in the target media slice. That is, the RTSP media server can obtain the duration information of each preceding slice before the target media slice (slice 2) from the index file; for example, the duration information of slice 1 is T=10s. Then, the RTSP media server will sum the duration information of slice 1 (10s, T=10s) with the playback duration of each GOP contained in the target media slice, i.e., T+t0+t1+…+t… i The sum is obtained as T + t0 + t1 + ... + t i ; at the sum of T+t0+t1+…+t i If the duration is greater than the playback time (e.g., NPT = 15), determine the playback duration t at the end of the sum. i The corresponding GOP is the target frame group position. That is, calculate the sum T + t0 + t1 + ... + t i If 10 + 2 + 2 + 2 > 15, then the third GOP corresponding to the last playback duration t3 in the sum is determined as the target frame group position. This allows for the automatic skipping of redundant data in the TS slice, resulting in more accurate playback positioning and effectively improving the accuracy of media data transmission.
[0065] In one embodiment, the step of transmitting media data to a terminal starting from a target group of screens includes: sending media data to the terminal at preset time intervals based on the bitrate of each Group of Pictures (GOP) in the group of screens information, starting from the target group of screens information; wherein the amount of media data sent each time is determined based on the bitrate of each GOP in the group of screens information and the preset time interval; or, sending media data to the terminal at preset time intervals based on a fast transmission factor and the bitrate of each GOP in the group of screens information, starting from the target group of screens information; wherein the amount of media data sent each time is determined based on the bitrate of each GOP in the group of screens information, the fast transmission factor, and the preset time interval.
[0066] The preset time interval can be the time interval for initializing the timer, so that the process of sending data packets according to the preset time interval is automatically triggered by the timer. The fast transmission coefficient can be adjusted according to the actual situation. For example, the fast transmission coefficient in this application can be set to... =0.02.
[0067] Specifically, let's take the application scenario of IPTV (Internet Protocol Television) service as an example. Assuming the RTSP media server determines the third Group of Pictures (GOP) in slice 2 as the target picture group location, the RTSP media server can start sending data from the third GOP in slice 2. For example, the RTSP media server can initialize a data transmission timer and set the interval of the data transmission timer to 40ms. Based on the transmission bitrate of the third GOP being Rb3 = 1151312 b / s and the playback duration of the third GOP being t3 = 2s, the number of transmissions c = 2 / 40 * 1000 = 50 times and the amount of data sent each time B = (1151312 * 40) / (8 * 1000) = 5756 bytes. That is, the RTSP media server sends a data packet every 40ms using the data transmission timer, sending 50 times, with each data packet containing B = 5756 bytes. Alternatively, the RTSP media server can initialize a data transmission timer and set the interval of the data transmission timer to 40ms, based on a fast transmission coefficient... =0.02 and the bitrate of each GOP in the group of pictures (GOPs), and send media data to the terminal at preset time intervals; where the amount of media data sent each time is determined based on the bitrate of each GOP in the group of pictures (GOPs), the speed factor, and the preset time interval. That is, the RTSP media server uses the speed factor... =0.02, the converted transmission bit rate Calculate the number of times sent The number of times and the amount of data sent each time The RTSP media server, using a data transmission timer, sends data packets every 40ms for 49 transmissions, with each packet containing B=5874 bytes. This allows for automatic and even packet transmission based on the GOP bitrate, with the timer calculating the number of transmissions and data size. Furthermore, to reduce stuttering, a fast transmission factor is added, adjusting the GOP transmission duration, bitrate, and data size to ensure smooth transmission and minimize packet loss and stuttering. This dynamic adjustment strategy not only ensures smooth and stable media data transmission but also effectively improves the continuity and stability of media playback.
[0068] In one embodiment, the picture group information includes the bitrate fluctuation coefficient of the target media slice; after sending media data to the terminal at a preset time interval based on the fast transmission coefficient and the bitrate of each GOP in the picture group information, with the target picture group position as the starting position, the method further includes: when the bitrate fluctuation coefficient meets the doubling fast transmission trigger condition, sending media data to the terminal at a preset time interval based on the doubling fast transmission coefficient, the number of doubling fast transmissions, the fast transmission coefficient, and the bitrate of each GOP in the picture group information;
[0069] The amount of media data sent each time is determined based on the bitrate, doubling speed factor, speed factor, and preset time interval of each GOP in the picture group information.
[0070] The bitrate fluctuation coefficient is used to reflect the difference in bitrate between different GOPs contained in each slice. It can be obtained by parsing the slice tag information of the target media slice. The bitrate fluctuation coefficient in this application can also be called the bitrate fluctuation dispersion coefficient D. The larger the dispersion coefficient, the greater the difference in bitrate between different GOPs. The smaller the dispersion coefficient, the more consistent the bitrate of the GOPs.
[0071] The doubling-faster-transmission trigger condition refers to the data transmission process used to trigger the execution of doubling-faster-transmission. For example, the doubling-faster-transmission trigger condition in this application can be set as: the bitrate fluctuation coefficient is greater than or equal to the coefficient threshold, i.e., sufficient... , .
[0072] Specifically, let's take the application scenario of IPTV (Internet Protocol Television) service as an example for illustration. For example... Figure 6 The diagram illustrates a segmented adaptive transmission control method based on GOP bitrate. It assumes the RTSP media server starts at the target frame group position (the 3rd GOP in slice 2) and uses a fast transmission coefficient... After the bitrate of each GOP in the picture group information of slice 2 is sent to the terminal via a timer at preset time intervals of 40ms, and the RTSP media server detects that the bitrate fluctuation coefficient D of the target media slice meets the doubling fast transmission trigger condition, then... Figure 6 The bitrate fluctuation coefficient of the target media slice is shown in the figure. In the following situation, the double-speed transmission processing logic is triggered, that is, the RTSP media server, based on the double-speed transmission coefficient K=5, the number of double-speed transmissions N=3, and the transmission coefficient... The media server sends media data to the terminal at preset time intervals of 40ms, based on the bitrate of each GOP in the group of pictures information. Specifically, the RTSP media server uses a doubling speed factor K=5, a doubling speed number N=3, and a speed factor... Calculate the transmission bitrate of the third GOP based on the bitrate of each GOP in the group information. b / s, 40ms transmission interval, number of transmissions 45 times, data volume sent each time =6396 bytes; transmission rate of the 4th GOP 1189831 b / s, number of transmissions: =45 times, with each data transmission amount being... 5949 bytes; transmission rate of the 5th GOP =1319342 b / s, number of transmissions: =45 times, each time the data size is B=(1187408*40) / (8*(1-5*0.02)*1000)=6596 bytes; the sending bitrate of other GOPs Number of times sent Size of data sent each time Byte. Wherein, the doubling-speed-transmission triggering condition in this application embodiment... The number of packets sent at double the speed (N) and the doubling coefficient (K) can be adjusted according to actual business needs. This ensures that when the bitrate fluctuation dispersion coefficient exceeds a threshold, the bitrate of the first N GOPs is automatically increased, while the bitrate of subsequent slices is reduced accordingly. This dynamic adjustment strategy guarantees the continuity and stability of playback.
[0073] In one embodiment, after transmitting media data to the terminal starting from the target screen group position, the method further includes: obtaining the number of retransmission packets and the total number of packets sent within a preset time period; determining the packet loss rate based on the number of retransmission packets and the total number of packets sent; and transmitting media data to the terminal according to an adaptive adjustment strategy if the packet loss rate is greater than a preset threshold.
[0074] Specifically, let's take the application scenario of IPTV (Internet Protocol Television) service as an example. After the RTSP media server transmits media data to the terminal starting from the target picture group position, the RTSP media server can preset the number of retransmission packets to be reported within a time period, such as 5 seconds. Total number of packets sent Calculate the packet loss rate: If the packet loss rate Or the amount of data sent by each GOP Then, the adaptive adjustment logic for sending data will be entered:
[0075] That is, the RTSP media server corrects the transmission interval. The number of GOPs sent is doubled. The amount of data sent each time is halved. This results in more even transmission and reduces packet loss. Consequently, the transmission strategy is dynamically adjusted based on the packet loss rate, further optimizing data transmission efficiency, reducing data loss, and ensuring smooth playback.
[0076] In one embodiment, when the packet loss rate is greater than a preset threshold, the step of transmitting media data to the terminal according to an adaptive adjustment strategy includes: adjusting the preset time interval to obtain an adjusted time interval; adjusting the amount of media data sent each time to obtain an adjusted data amount; adjusting the number of times media data is sent to obtain an adjusted number of times; and transmitting media data to the terminal based on the adjusted time interval, the adjusted number of times, and the adjusted data amount.
[0077] Specifically, when the packet loss rate exceeds a preset threshold, the RTSP media server can transmit media data to the terminal according to an adaptive adjustment strategy, that is, the RTSP media server adjusts the transmission interval. The number of GOPs sent is doubled. The amount of data sent each time is halved. This results in more even transmission and reduces packet loss. Consequently, the transmission strategy is dynamically adjusted based on the packet loss rate, further optimizing data transmission efficiency, reducing data loss, and ensuring smooth playback.
[0078] In one embodiment, this application also provides an application scenario in which the above-described media data transmission method is applied. Specifically, the media data transmission method is applied in this scenario as follows:
[0079] First, the on-demand content files are sliced using the IPTV slicing system to generate HLS on-demand resources with custom tags (including m3u8 index files and media segment files). Then, the IPTV slicing system injects these HLS on-demand resources into the IPTV content center. When a user requests a video, the set-top box terminal sends a playback request to the server via the RTSP protocol. The server calculates the GOP position (the playback time and location) based on the playback time carried in the request and dynamically adjusts the data transmission strategy according to the GOP bitrate and network conditions. For example, the server can send data evenly based on the GOP bitrate and use a timer to calculate the number of data packets sent and their size (i.e., the amount of data transmitted). Simultaneously, a fast transmission coefficient is added to reduce buffering, correcting the GOP transmission duration and adjusting the transmission bitrate and data volume. For instance, when encountering large bitrate fluctuations, a segmented, doubled fast transmission logic is used to accelerate data filling during the initial playback phase, followed by normal transmission at the subsequent rate. Furthermore, the data transmission strategy is dynamically adjusted based on the packet loss rate to ensure smooth data transmission, reduce packet loss and buffering, and ultimately improve the user's viewing experience for on-demand content.
[0080] Among them, RTSP (Real Time Streaming Protocol) is primarily used to manage the connection and control operations of streaming media, such as playback, pause, targeted playback, and stop. RTP (Real-Time Transport Protocol) is one of the standard protocols defined by the IETF, used to transmit audio and video media data over the Internet, supporting real-time transmission. RTCP (Real-Time Transport Control Protocol) is used in conjunction with RTP to monitor service quality and provide quality feedback. HLS on-demand resources: In IPTV services, the same content file needs to support multiple protocols such as RTSP and HLS. Therefore, most on-demand video resources are sliced and converted to the HLS protocol in the IPTV CDN system, hence the HLS on-demand resources mentioned here.
[0081] Currently, compared to the HLS transmission protocol, the RTSP protocol boasts powerful control functions, flexibility, and compatibility, making it widely used in IPTV (Internet Protocol Television) services. Set-top box users can use RTSP to play, pause, fast forward, rewind, position for playback, and stop video-on-demand, thus obtaining a viewing experience similar to traditional television. In RTSP-based video-on-demand services, the set-top box terminal sends playback control messages and receives RTP media data based on user playback operations; all data transmission is controlled by the RTSP media server.
[0082] In traditional methods, RTSP media servers typically send data continuously based on the average video bitrate. However, sending data at the average bitrate often leads to playback stuttering during the start-up phase or when there are significant fluctuations in the video bitrate, due to insufficient data filling or bitrate mismatch, thus affecting the user's viewing experience. If, in an attempt to prevent insufficient data, data is forcibly sent at N times the average video bitrate, it may result in the set-top box receiving more data than its buffer, causing data overflow and playback skipping, or network packet loss leading to audio-video desynchronization or playback stuttering.
[0083] Therefore, to address the playback issues caused by the aforementioned overflow or network packet loss, this application proposes a segmented adaptive RTSP media data transmission method and system based on GOP bitrate. The specific implementation steps are as follows (e.g.) Figure 4 (Flowchart shown)
[0084] 1) The IPTV slicing system downloads content files from the video-on-demand content source and slices them according to the agreed duration (10 seconds) to generate HLS video-on-demand resources. Then, it injects the m3u8 index file and slice files of the HLS video-on-demand resources into the IPTV content center. The HLS video-on-demand resource m3u8 index file contains a custom media segment tag: .
[0085] in, , .
[0086] Among them, P In+1 It is the offset position of the (n+1)th keyframe, P In It is the offset position of the nth keyframe, GOP n It is the length of the nth GOP, PCR In It is the PCR time of the nth keyframe, T n It is the PCR duration of the nth GOP, Rb n It is the bitrate of the nth GOP. n _Rb n : Records the length and bitrate information of each GOP in the slice in the form of an array.
[0087] An RTSP media server can obtain the bitrate of each GOP within a slice by parsing the media segment tags of each slice contained in the m3u8 index file, and calculate the bitrate fluctuation dispersion coefficient D based on the bitrate of each GOP. The calculation method for the bitrate fluctuation dispersion coefficient D is as follows:
[0088]
[0089]
[0090] .in, It is the average bitrate of the slice. is the standard deviation of the GOP bitrate of the slice, D is the slice bitrate fluctuation dispersion coefficient. The larger the dispersion coefficient, the greater the difference in bitrate between different GOPs. The smaller the dispersion coefficient, the more consistent the GOP bitrate. L is the offset position of the first audio frame.
[0091] 2) When a user makes a video-on-demand request, the set-top box initiates a playback request for the video-on-demand content through the RTSP protocol, and transmits the specific playback position (time offset) to the RTSP media server through a PLAY request (i.e., playback request).
[0092] 3) After receiving the player's request, the RTSP media server retrieves the corresponding m3u8 index file from the content center based on the requested URL, calculates the corresponding slice ID based on the playback position information (i.e., time offset), and retrieves the slice corresponding to the slice ID from the content center.
[0093] The slice ID in this application is calculated as follows: the slice duration information in the m3u8 index is accumulated. When the accumulated slice duration is greater than or equal to the playback position (i.e., time offset), the corresponding slice is the current playback slice.
[0094] 4) The RTSP media server parses the custom tag information of the TS slice, #EXT-X-CTYMEDIA-INFO, and the parsed information includes:
[0095]
[0096]
[0097]
[0098] Among them, t n The duration of the nth GOP, in seconds;
[0099] 5) The RTSP media server calculates the position of the playback position (i.e., time offset) in the GOP of the parsed TS slice based on the GOP playback duration information, and sends media data starting from the corresponding GOP.
[0100] The GOP position is calculated by accumulating the duration T of all slices preceding the current slice in the m3u8 index: T + t0 + t1 + ... + tt i If the playback position is greater than or equal to the playback time (e.g., NPT = 15), then the transmission starts from the i-th GOP, t i Let be the playback duration of the i-th GOP.
[0101] 6) Based on GOP bitrate Rb n Uniform transmission logic:
[0102] Set a timer to send the data, with the timer interval specified. ms, which is the interval between If data is sent once per millisecond, how many times does one GOP (Group of Pictures) need to send data? The size of data sent by each GOP The unit is Byte.
[0103] 7) To reduce insufficient data transmission due to sending and transmission time, a playback stuttering effect is introduced by adding a coefficient to the uniform transmission based on GOP bitrate. Speeding up transmission, i.e., adjusting the GOP transmission time to... Sending bit rate Number of times sent Size of data sent each time The unit is Byte.
[0104] 8) When the bitrate fluctuation dispersion coefficient D of the starting segment is large, that is, the GOP bitrate of the starting segment fluctuates greatly, especially the bitrate of the first GOP is much smaller than that of the subsequent GOPs, which can easily lead to insufficient data in the second GOP after the first GOP finishes playing, causing stuttering. A segmented doubling fast transmission logic based on GOP bitrate is proposed:
[0105] K: Doubling factor (2≤K≤10), N: Number of GOPs in Doubling The conditions for doubling the speed of delivery are met. At that time, the segmented doubling and rapid delivery logic is activated:
[0106] Start broadcasting N GOPs of bitrate Sending interval ms, GOP send duration corrected to Number of times sent The amount of data sent each time When bitrate fluctuations are large, the player buffer should be filled as quickly as possible during the start-up phase to reduce playback stuttering caused by bitrate fluctuations between different GOPs; the transmission bitrate of the remaining segments should be adjusted. Sending interval ms, GOP send duration corrected to Number of times sent The amount of data sent each time .
[0107] 9) Collect the number of retransmission packets reported by RTCP within 5 seconds. Total number of packets sent Calculate the packet loss rate: If packet loss rate Or the amount of data sent by each GOP Then, the adaptive adjustment logic for sending is entered:
[0108] Correct transmission interval The number of GOPs sent is doubled. The amount of data sent each time is halved. This makes the transmission more even and reduces packet loss.
[0109] In summary, based on network packet loss experiments, in IPTV CDN services, a packet loss rate of less than 3% will trigger the RTSP packet loss retransmission policy, and the server will promptly retransmit the lost data, generally preventing playback stuttering. However, a loss rate exceeding 5% poses a risk of exacerbating network congestion and worsening playback stuttering. High packet transmission frequency places a significant burden on server performance; therefore, it is recommended to double packet transmission when the network packet loss rate is greater than or equal to 5%.
[0110] Specific implementation examples are as follows:
[0111] 1. TS Video Basic Information: Based on the TS video basic information, the IPTV slicing system downloads the video content and then slices it to generate HLS on-demand resources.
[0112] Specifically, the length of GOP1 is 0x00085790-0, which is converted to decimal 546704-0=546704. The PCR duration T1 is 2s, and the bitrate Rb1=GOP1 / T1 *8=2186816 b / s. The length of GOP2 is 0x000BAAB4-0x00085790, which is converted to decimal 764596-546704=217892. The PCR duration T2 is 2s, and the bitrate Rb2=GOP1 / T1 *8=871568 b / s.
[0113] Each slice is defined as 10 seconds long, and the generated m3u8 index information (index file) is as follows:
[0114] #EXTM3U#EXT-X-VERSION:4
[0115] #EXT-X-TARGETDURATION:10.00
[0116] #EXT-X-MEDIA-SEQUENCE:0
[0117] #EXT-X-PLAYLIST-TYPE:VOD
[0118] #EXTINF:10.00,
[0119] #EXT-X-Tag:000, (Index Identifier) #EXT-X-CTYMEDIA-INFO:62.83,68808,546704_2186816,217892_871568,167884_671536,168260_673040,191760_767040, (Custom Slice Tag)
[0120] test_01_000.ts (slice identifier)
[0121] #EXTINF:10.00,
[0122] #EXT-X-Tag:001, (Index Identifier) #EXT-X-CTYMEDIA-INFO:23.53,87608,202100_808400,391228_1564912,287828_1151312,267712_1070848,296852_1187408, (Custom Slice Tag)
[0123] test_01_001.ts (slice identifier)
[0124] #EXTINF:10.00,
[0125] #EXT-X-Tag:002, (Index Identifier) #EXT-X-CTYMEDIA-INFO:43.59,81968,278428_1113712,506848_2027392,334828_1339312,603668_2414672,196460_785840, (Custom Slice Tag)
[0126] test_01_002.ts (slice identifier)
[0127] #EXTINF:10.00,
[0128] #EXT-X-Tag:003, (Index Identifier) #EXT-X-CTYMEDIA-INFO:9.63,110168,332196_1328783,260756_1043024,273164_1092656,276360_1105440,287264_1149056, (Custom Slice Tag)
[0129] test_01_003.ts (slice identifier)
[0130] #EXT-X-ENDLIST
[0131] 2. When a user requests video on demand, the set-top box terminal initiates a playback request via the RTSP protocol and sends the playback position (time offset) via a PLAY request (i.e., playback request).
[0132] 3. After receiving the player's request, the RTSP media server retrieves the corresponding m3u8 index file from the content center based on the requested URL, and then calculates the corresponding slice ID based on the playback position information. For example, if the input npt=15.000- indicates that playback starts at 15 seconds, the RTSP media server calculates based on the m3u8 index information that 15 seconds falls within the second slice, and downloads the second slice, test_01_001.ts, from the content center.
[0133] 4. The RTSP media server parses the #EXT-X-CTYMEDIA-INFO custom slice tag information of test_01_001.ts to obtain:
[0134]
[0135]
[0136] 5. The RTSP media server calculates the GOP position corresponding to the playback location based on the parsed TS segment GOP playback duration information. Since 10+2+2+2>15, it starts sending from the 3rd GOP. It skips redundant data in the TS segment during transmission, making the playback position more accurate.
[0137] 6. The RTSP media service sets the data transmission timer interval to 40ms, based on the GOP bitrate. The transmission bitrate of the 3rd GOP is Rb3=1151312 b / s, the GOP playback duration is t3=2s, the number of transmissions is c=2 / 40*1000=50 times, and the amount of data transmitted each time is B=(1151312*40) / (8*1000)=5756 bytes. Other slices are also transmitted according to their own GOP bitrate, with the number of transmissions and the amount of data transmitted each time calculated.
[0138] 7. Increase the transmission speed factor based on the GOP bitrate transmission rate. Calculated transmission bit rate b / s. 40ms transmission interval, number of transmissions. Each time, the amount of data sent is... Byte, other slices are also sent according to the bitrate. Number of times sent Size of data sent each time Bytes are sent.
[0139] Based on an average bitrate of 8Mbps and an average video duration of 1 hour for IPTV on-demand services, starting playback from the beginning, the cumulative reduction in transmission time during the entire playback process is: Each RTP packet carries 1472 bytes of data. The total number of packets sent for the entire video transmission is C = (3600 * 8 * 1000 * 1000) / (8 * 1472) = 2,445,000 packets. Assuming that the transmission time for one packet is 0.01ms, the total transmission time is 24 seconds. The maximum buffering time of the player is 72 - 24 = 48 seconds, corresponding to a data volume of 48MB, which will not trigger data overflow. The ∆ coefficient can be adjusted according to the actual business requirements.
[0140] 8. Assuming the trigger condition for doubling the speed of delivery. The number of double-speed transmissions N=3, the double-speed transmission coefficient K=5, and the discrete coefficient D corresponding to the current transmission slice is 23.8>20, triggering the double-speed transmission logic:
[0141] The transmission bitrate of the 3rd GOP b / s, 40ms transmission interval, number of transmissions Each time, the amount of data sent Byte;
[0142] The transmission bitrate of the 4th GOP b / s, number of transmissions Each time, the amount of data sent is [number]. Byte;
[0143] The transmission bitrate of the 5th GOP b / s, number of transmissions Each time, the amount of data sent is B = (1187408 * 40) / (8 * (1 - 5 * 0.02) * 1000) = 6596 bytes;
[0144] Sending bitrate of other GOPs Number of times sent Size of data sent each time Byte. Double the speed trigger condition The number of packets N and the doubling-speed-up coefficient K can be adjusted and set according to actual business needs.
[0145] 9. Assuming the current network bandwidth is 8Mbps, the average bitrate of the played video is 8Mbps, and the video bitrate fluctuates significantly, a doubling of transmission speed is triggered during the initial playback phase. What is the transmission bitrate at this time? Mbps, sending 1.11M data per second. Based on the current network bandwidth, an average of 1M data can be sent per second. Therefore, 0.11M of data may need to be retransmitted, resulting in a packet loss rate. Then, the bitrate adaptive adjustment logic is entered: the sending interval is halved, reducing the amount of data sent each time, which can reduce packet loss rate and reduce playback stuttering.
[0146] 10. Practical Data Display
[0147] In the current IPTV CDN service implemented in a certain province, the relevant RTSP segmented doubling speed control parameters are configured as follows: speed coefficient, Double the speed trigger conditions, Double the number of packets sent, N=3; Double the sending coefficient, K=6; Packet loss rate coefficient. Single shipment quantity coefficient .
[0148] Among them, such as Figure 7 The diagram shows the effect of optimizing the stuttering performance. Even using the segmented adaptive RTSP media transmission method based on GOP bitrate provided in this application, the overall stuttering performance optimization effect is shown in the diagram. Figure 7As shown. Playback quality rate: Calculated based on time blocks. It can be understood that as long as a user has a playback history, there is a playback time block within that 5 minutes. Poor quality time blocks are judged by two or more stutters within 5 minutes. A user's poor quality time blocks divided by the total playback time blocks in a day, exceeding 5%, are considered poor quality users. Playback quality rate = (Total users - Poor quality users) / Total users.
[0149] The beneficial effects of the technical solution provided in this application are as follows: 1. By customizing the tags in the m3u8 index file to record the length, bitrate, and bitrate fluctuation dispersion coefficient of each GOP in the media slice, the system can more accurately adjust the data transmission strategy in real time according to network conditions and bitrate fluctuations. Especially when the bitrate fluctuation is large, a segmented doubling fast transmission logic is adopted to speed up data filling in the start-up phase, and subsequent transmissions are sent at the normal rate, effectively reducing stuttering and improving user experience. 2. The technical solution provided in this application has significant advantages in reducing stuttering and packet loss. Based on the GOP bitrate and network conditions, the system adaptively adjusts the data transmission rate. When the bitrate fluctuation dispersion coefficient is detected to exceed the threshold, the transmission bitrate of the first N GOPs is automatically increased, and the bitrate of subsequent slices is reduced accordingly. This dynamic adjustment strategy ensures the continuity and stability of playback. At the same time, dynamically adjusting the transmission strategy according to the packet loss rate further optimizes data transmission efficiency, reduces data loss, and ensures smooth playback.
[0150] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0151] Based on the same inventive concept, this application also provides a media data transmission apparatus for implementing the media data transmission method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more media data transmission apparatus embodiments provided below can be found in the limitations of the media data transmission method described above, and will not be repeated here.
[0152] In one embodiment, such as Figure 8As shown, a media data transmission device is provided, comprising: an acquisition module 802, a determination module 804, and a transmission module 806, wherein:
[0153] The acquisition module 802 is used to acquire an index file corresponding to the on-demand content based on the identification information carried in the playback request when receiving a playback request for on-demand content sent by the terminal; the index file is used to index the media slices corresponding to the on-demand content.
[0154] The determining module 804 is used to determine the target media slice from the index file based on the playback time information carried in the playback request; and to determine the position of the target screen group corresponding to the playback time information in the target media slice based on the screen group information of the target media slice.
[0155] The transmission module 806 is used to transmit media data to the terminal starting from the position of the target screen group; the media data is used to play the on-demand content.
[0156] In one embodiment, the playback time information includes the playback time; the determining module is further configured to determine the slice identifier of the target media slice from the index file based on the playback time; the obtaining module is further configured to obtain the target media slice stored in the form of a file based on the slice identifier.
[0157] In one embodiment, the acquisition module is further configured to acquire the duration information of each media slice corresponding to the on-demand content from the index file; the device further includes: a summation module, configured to sum the duration information sequentially to obtain accumulated duration information; the determination module is further configured to determine, when the accumulated duration information is greater than or equal to the playback time, that the media slice corresponding to the last duration information in the accumulated duration information is the target media slice; the slice identifier of the media slice corresponding to the last duration information is the slice identifier of the target media slice.
[0158] In one embodiment, the apparatus further includes: a parsing module, configured to parse the slice tag information of the target media slice to obtain the picture group information of the target media slice; the picture group information includes the playback duration of each GOP; the determining module is further configured to determine the position of the target picture group in the target media slice based on the playback time information and the playback duration of each GOP contained in the target media slice.
[0159] In one embodiment, the playback time information includes the playback time; the acquisition module is further configured to acquire the duration information of each preceding slice before the target media slice from the index file; the device further includes: a summation module, configured to sum the duration information sequentially with the playback duration of each GOP contained in the target media slice to obtain a sum value; the determination module is further configured to determine the GOP corresponding to the last playback duration in the sum value as the target picture group position if the sum value is greater than or equal to the playback time.
[0160] In one embodiment, the transmission module is further configured to send media data to the terminal at preset time intervals, starting from the target frame group position and based on the bitrate of each GOP in the frame group information; wherein the amount of media data sent each time is determined based on the bitrate of each GOP in the frame group information and the preset time interval; or, starting from the target frame group position, sending media data to the terminal at preset time intervals, based on a fast transmission coefficient and the bitrate of each GOP in the frame group information; wherein the amount of media data sent each time is determined based on the bitrate of each GOP in the frame group information, the fast transmission coefficient, and the preset time interval.
[0161] In one embodiment, the picture group information includes the bitrate fluctuation coefficient of the target media slice; the transmission module is further configured to send media data to the terminal at preset time intervals based on the doubling fast transmission coefficient, the number of doubling fast transmissions, the fast transmission coefficient, and the bitrate of each GOP in the picture group information when the bitrate fluctuation coefficient meets the doubling fast transmission trigger condition; wherein, the amount of media data sent each time is determined based on the bitrate of each GOP in the picture group information, the doubling fast transmission coefficient, the fast transmission coefficient, and the preset time interval.
[0162] Each module in the aforementioned media data transmission device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0163] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores transmission data for media data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for transmitting media data.
[0164] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0165] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0166] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0167] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0168] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0169] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0170] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0171] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for transmitting media data, characterized in that, The method includes: When receiving a playback request for on-demand content sent by a receiving terminal, an index file corresponding to the on-demand content is obtained based on the identification information carried in the playback request; the index file is used to index the media slices corresponding to the on-demand content. Based on the playback time information carried in the playback request, the target media slice is determined from the index file; Based on the picture group information of the target media slice, the position of the target picture group corresponding to the playback time information is determined in the target media slice; Starting from the target screen group position, media data is transmitted to the terminal; the media data is used to play the on-demand content.
2. The method according to claim 1, characterized in that, The playback time information includes the playback time; The step of determining the target media slice from the index file based on the playback time information carried in the playback request includes: Based on the playback time, determine the slice identifier of the target media slice from the index file; Based on the slice identifier, the target media slice stored in file format is obtained.
3. The method according to claim 2, characterized in that, The step of determining the slice identifier of the target media slice from the index file based on the playback time includes: Obtain the duration information of each media slice corresponding to the on-demand content from the index file; The duration information is summed sequentially to obtain the accumulated duration information; If the accumulated duration information is greater than or equal to the playback time, the media slice corresponding to the last duration information in the accumulated duration information is determined as the target media slice; the slice identifier of the media slice corresponding to the last duration information is the slice identifier of the target media slice.
4. The method according to claim 1, characterized in that, The method further includes: Parse the slice tag information of the target media slice to obtain the frame group information of the target media slice; the frame group information includes the playback duration of each GOP; The step of determining the target frame group position corresponding to the playback time information within the target media slice, based on the frame group information of the target media slice, includes: Based on the playback time information and the playback duration of each GOP contained in the target media slice, the position of the target picture group in the target media slice is determined.
5. The method according to claim 4, characterized in that, The playback time information includes the playback time; Determining the position of the target scene group in the target media slice based on the playback time information and the playback duration of each GOP contained in the target media slice includes: Obtain the duration information of each preceding slice before the target media slice from the index file; The duration information is summed sequentially with the playback duration of each GOP contained in the target media slice to obtain the sum value; If the sum is greater than or equal to the playback time, the GOP corresponding to the last playback duration in the sum is determined as the target picture group position.
6. The method according to claim 1, characterized in that, The transmission of media data to the terminal, starting from the target screen group position, includes: Starting from the target frame group position, media data is sent to the terminal at preset time intervals based on the bitrate of each GOP in the frame group information; wherein, the amount of media data sent each time is determined based on the bitrate of each GOP in the frame group information and the preset time interval; or, Starting from the target frame group position, media data is sent to the terminal at preset time intervals based on the fast transmission coefficient and the bitrate of each GOP in the frame group information; wherein, the amount of media data sent each time is determined based on the bitrate of each GOP in the frame group information, the fast transmission coefficient, and the preset time interval.
7. The method according to claim 6, characterized in that, The image group information includes the bitrate fluctuation coefficient of the target media slice; After sending media data to the terminal at preset time intervals, starting from the target frame group position and based on the fast transmission coefficient and the bitrate of each GOP in the frame group information, the method further includes: When the bitrate fluctuation coefficient meets the doubling fast transmission trigger condition, media data is sent to the terminal at preset time intervals based on the doubling fast transmission coefficient, the number of doubling fast transmissions, the fast transmission coefficient, and the bitrate of each GOP in the picture group information. The amount of media data sent each time is determined based on the bitrate of each GOP in the picture group information, the doubling speed factor, the speed factor, and the preset time interval.
8. A media data transmission device, characterized in that, The device includes: The acquisition module is used to, upon receiving a playback request for on-demand content sent by a terminal, acquire an index file corresponding to the on-demand content based on the identification information carried in the playback request; the index file is used to index the media slices corresponding to the on-demand content. The determining module is used to determine the target media slice from the index file based on the playback time information carried in the playback request; and to determine the position of the target screen group corresponding to the playback time information in the target media slice based on the screen group information of the target media slice. The transmission module is used to transmit media data to the terminal starting from the target screen group position; the media data is used to play the on-demand content.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.