Data slicing method and apparatus, electronic device, and storage medium

By recording and acquiring slice location information during the slice equipment upgrade process, seamless data flow connection is achieved, the impact of slice equipment upgrades and changes on playback effects is resolved, and the continuity of the slice process is ensured in live streaming or scenarios with high real-time requirements.

CN115988286BActive Publication Date: 2026-05-01DOUYIN VISION CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DOUYIN VISION CO LTD
Filing Date
2022-12-13
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

During the upgrade and change of slicing equipment, how can we achieve a seamless transition in the data slicing process to ensure that the playback effect is not affected?

Method used

The first slicing process records the slice position information, and when switching to the second slicing process, it obtains the current slice position information and uses the second slicing process to perform slicing, ensuring seamless connection of slice files.

Benefits of technology

Seamless switching of the slicing process was achieved, ensuring that upgrades and changes to the slicing equipment had no impact on the slicing process, and guaranteeing the real-time and continuous playback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115988286B_ABST
    Figure CN115988286B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of computer processing, in particular to a data slicing method and device, electronic equipment and storage medium, the method comprising slicing a data stream through a first slicing process and recording position information of the slicing; when switching from the first slicing process to a second slicing process, acquiring current slicing position information through the second slicing process; based on the current slicing position information, slicing the data stream through the second slicing process and recording the position of the slicing to determine a sliced file of the data stream. When switching from the first slicing process to the second slicing process, the current slicing position information is acquired, and the second slicing process is used to realize seamless connection slicing of the data stream, thereby realizing that the switching of the slicing process has no influence on the slicing process, and the slicing is not affected by the upgrade and change of the slicing equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Data slicing methods, apparatus, electronic devices and storage media Technical Field

[0001] This disclosure relates to the field of computer processing technology, and more specifically to data slicing methods, apparatus, electronic devices, and storage media. Background Technology

[0002] Because network transmission can affect the real-time performance of the data stream played on the terminal, the data stream is typically sliced ​​to mitigate the impact of streaming media size on playback. This slicing is performed by a slicing device; its main function is to divide the data stream into individual slice files according to specific requirements, which are then transmitted as slices.

[0003] However, data slicing devices often require periodic or ad-hoc upgrades and changes due to daily business needs. To ensure optimal playback quality on the terminal, these upgrades and changes must not affect the slicing process. Therefore, finding a suitable data slicing method for this scenario is a pressing issue that needs to be addressed. Summary of the Invention

[0004] In view of this, the present disclosure provides a data slicing method, apparatus, electronic device, and storage medium to solve the slicing problem in scenarios involving upgrades and changes to slicing equipment.

[0005] According to a first aspect, embodiments of this disclosure provide a data slicing method, including:

[0006] The data stream is sliced ​​using the first slicing process, and the position information of each slice is recorded.

[0007] When switching from the first slicing process to the second slicing process, the current slice position information is obtained through the second slicing process;

[0008] Based on the current slice position information, the data stream is sliced ​​by the second slicing process and the slice position is recorded to determine the slice file of the data stream.

[0009] According to the second aspect, this disclosure provides a data slicing apparatus, comprising:

[0010] The first slicing module is used to slice the data stream through the first slicing process and record the position information of the slices;

[0011] The acquisition module is used to obtain the current slice position information through the second slice process when switching from the first slice process to the second slice process.

[0012] The second slicing module is used to slice the data stream based on the current slice position information and record the slice position through the second slicing process to determine the slice file of the data stream.

[0013] According to a third aspect, this disclosure provides an electronic device, including: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the data slicing method described in the first aspect or any embodiment of the first aspect.

[0014] According to a fourth aspect, embodiments of this disclosure provide a computer-readable storage medium storing computer instructions for causing the computer to perform the data slicing method described in the first aspect or any embodiment of the first aspect.

[0015] The data slicing method provided in this embodiment records the slice position information during the process of slicing a data stream using a first slicing process. When the first slicing process switches to a second slicing process, the current slice position information can be obtained to achieve seamless slicing of the data stream using the second slicing process. This ensures that the switching of the slicing process has no impact on the slicing process and that the slicing is not affected by upgrades or changes to the slicing equipment. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure;

[0018] Figure 2 is a flowchart of a data slicing method according to an embodiment of the present disclosure;

[0019] Figure 3 is a schematic diagram of a slice according to an embodiment of the present disclosure;

[0020] Figure 4 is a flowchart of a data slicing method according to an embodiment of the present disclosure;

[0021] Figure 5 is a schematic diagram of data slicing according to an embodiment of the present invention;

[0022] Figure 6 is a flowchart of a data slicing method according to an embodiment of the present disclosure;

[0023] Figure 7 is a flowchart of a data slicing method according to an embodiment of the present disclosure;

[0024] Figure 8 is a structural block diagram of a data slicing apparatus according to an embodiment of the present disclosure;

[0025] Figure 9 is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0027] In live streaming or scenarios with high real-time requirements, the playback end demands high real-time video quality. Therefore, after pulling the stream, the data stream is typically sliced, and smaller slice files are transmitted over the network to reduce network latency. This slicing of the data stream is done through slicing devices, or it can also be understood as slicing on the server; in the following text, we will refer to it uniformly as slicing devices.

[0028] However, as mentioned above, the slicing equipment may need to be upgraded or modified periodically during operation. Given the real-time requirements of the playback end for screen switching, these upgrades must not affect the slicing process. Therefore, it is essential to ensure that upgrades to the slicing equipment do not impact the overall slicing process.

[0029] For example, Figure 1 illustrates a slicing diagram in a live streaming scenario. The streaming tool pushes the data stream to the source server via a streaming protocol. The slicing device first pulls the data stream from the source server and then slices it. The player pulls the sliced ​​files from the slicing device via a streaming protocol, assembles them, and plays them. As the live content generation or streaming end, the RTMP protocol is generally used to push the stream to the cloud. As the live content consumption end, common streaming protocols include HTTP-FLV, HLS, and RTMP. Among these, HLS is the most commonly used streaming protocol. Since the streaming uses the RTMP protocol and the streaming uses the HLS protocol, this involves the conversion from RTMP to HLS, a task typically performed by the slicing device. Specifically, in the application scenario shown in Figure 1, the main task of the slicing device is to convert the RTMP live data stream into individual TS / FMP4 slice files according to certain requirements (e.g., slicing starts at keyframe positions and slicing at fixed time intervals), while simultaneously updating the m3u8 file. The m3u8 file records descriptive information about the sliced ​​files, facilitating the receiving end to assemble and play the sliced ​​files based on this m3u8 file. The m3u8 file can also be called a slice description file. As described above, the process of slicing a data stream is not limited to dividing a large data stream into multiple smaller files; it also includes the conversion between different protocols. Of course, whether or not protocol conversion is necessary depends on the actual application scenario of the slicing. If both the push and pull streams use the same protocol, then protocol conversion is unnecessary.

[0030] It should be noted that the slice file obtained after the slicing device slices the data stream is not limited to the TS / FMP4 format. Correspondingly, the slice description file is not limited to the m3u8 file and can also use other files, depending on the streaming protocol used. No restrictions are made here.

[0031] During the upgrade of slicing equipment, the old slicing process usually exits and the new slicing process starts to serve. How to maintain a seamless connection of data slicing during the exit of the old slicing process and the start of the new slicing process is the problem that this disclosure aims to solve.

[0032] According to an embodiment of this disclosure, a data slicing method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0033] This embodiment provides a data slicing method that can be used in electronic devices, such as servers and slicing devices. Figure 2 is a flowchart of the data slicing method according to an embodiment of this disclosure. As shown in Figure 2, the process includes the following steps:

[0034] S11, the data stream is sliced ​​through the first slicing process and the position information of the slices is recorded.

[0035] The first slicing process is the process currently processing the slicing task, and the data stream is the data that needs to be sliced. The first slicing process slices the data stream according to the slice position and slice interval. The slice position is related to the keyframes in the data stream or is user-defined, and the slice interval is set according to actual needs, without any limitations here. In the slicing process of this embodiment, it is also necessary to record the slice position information, that is, where the slicing of the data stream begins.

[0036] Recording slice location information facilitates seamless slice transitions when switching between two slice processes. Slicing a data stream is a continuous process, resulting in multiple slice operations. Slice location information can be recorded at each slice execution, or it can be initiated only when an upgrade or change requirement for the device used for slicing is detected. The specific timing for recording slice location information is set according to actual needs and is not limited here.

[0037] The location information of a slice can be represented by the identifier of a data frame in the data stream, by the timestamp of a data frame in the data stream, or by other methods. For example, as shown in Figure 1, the data stream is represented by a sequence of streaming media frames, including data frame 1, data frame 2, ..., data frame 8, where 1, 2, ..., 8 are the identifiers of each data frame. If the first slicing process slices from data frame 1, data frame 4, and data frame 7, the slice locations to be recorded for these three slices are: data frame 1, data frame 4, and data frame 7; or, the slice locations to be recorded for these three slices are: the timestamp of data frame 1, the timestamp of data frame 4, and the timestamp of data frame 7. The timestamp of a data frame is a timestamp carried on the data frame, such as a decoding timestamp.

[0038] As shown in Figure 1, the first slicing process slices the data stream to obtain the first slice file formed by data frames 1-3, the second slice file formed by data frames 4-6, and the slice of data frames 7-8 currently being processed.

[0039] S12, when switching from the first slicing process to the second slicing process, obtain the current slice position information through the second slicing process.

[0040] After the equipment used for slicing is upgraded or changed, the equipment needs to continue slicing based on the upgraded environment. At this time, a new slicing process is started to replace the work of the first slicing process. In this embodiment, the newly started slicing process is referred to as the second slicing process. When switching from the first slicing process to the second slicing process, a handover of slicing processing is required. At this time, the second slicing process needs to know the current slicing position information of the first slicing process in order to achieve a seamless transition.

[0041] As described in S11 above, the first slicing process records the slice position information during the slicing process. Based on this, the second slicing process can obtain the current slice position of the first slicing process. The current slice position refers to the slice position in the data stream, and more specifically, it refers to the starting slice frame in the data stream. For example, as shown in Figure 3, if the first slicing process is currently processing the slice of data frames 7-8 in the data stream, then the current slice position information represents the position information of data frame 7, including but not limited to the identifier of data frame 7 or the timestamp of data frame 7.

[0042] S13, based on the current slice position information, the data stream is sliced ​​through the second slicing process and the slice position is recorded to determine the slice file of the data stream.

[0043] After obtaining the current slice position information, the second slicing process continues to slice the data stream based on this information, thus achieving seamless integration between the first and second slicing processes. During the slicing process, the second process also needs to record the slice position to facilitate subsequent handover and ensure that upgrades to the slicing equipment do not affect the slicing process.

[0044] Regardless of whether it's the first or second slicing process, each process yields a corresponding slice file after slicing. As shown in Figure 3, the first slicing process slices the data stream to obtain a first slice file formed by data frames 1-3, and a second slice file formed by data frames 4-6. While the first slicing process is processing slices starting from data frame 7, it receives a message requiring a process switch, meaning it needs to switch from the first slicing process to the second slicing process to continue slicing. At this time, the second slicing process obtains the current slice position information, i.e., the position information of data frame 7, from the first slicing process. Based on this, the second slicing process continues slicing from data frame 7, obtaining a third slice file formed by data frames 7-9, a fourth slice file formed by data frames a-c, and a fifth slice file formed by data frames d-f. Of course, Figure 1 only outputs a data stream composed of a limited number of data frames, but this does not limit the number of data frames included in the data stream in this embodiment.

[0045] The data slicing method provided in this embodiment records the position information of the slices during the process of slicing the data stream using the first slicing process. When the first slicing process switches to the second slicing process, the current slice position information can be obtained to achieve seamless slicing of the data stream using the second slicing process. This ensures that the switching of the slicing process has no impact on the slicing process and that the slicing is not affected by upgrades or changes to the slicing equipment.

[0046] This embodiment provides a data slicing method that can be used in electronic devices, such as servers and slicing devices. Figure 4 is a flowchart of the data slicing method according to an embodiment of this disclosure. As shown in Figure 4, the process includes the following steps:

[0047] S21, the data stream is sliced ​​through the first slicing process and the position information of the slices is recorded.

[0048] Specifically, S21 includes:

[0049] S211, the first data in the data stream is pulled by the first slicing process and sliced, and the start timestamp of each slice in the first data is recorded.

[0050] The starting timestamp is the timestamp of the starting slice frame in the first data.

[0051] To easily distinguish the data streams sliced ​​by the first slicing process and the second slicing process, the data processed by the first slicing process is referred to as the first data, and the data processed by the second slicing process is referred to as the second data. Of course, the first data and the second data may contain the same data frames, and both the first data and the second data belong to data streams.

[0052] The first slicing process first needs to fetch the first data and slice it. The length of the first data fetched each time is determined according to the actual scenario requirements. After fetching the first data, the first slicing process slices the first data and records the start timestamp of each slice. As mentioned above, the start timestamp is the timestamp of the first slice frame in the first data, and the start slice frame is the first data frame at the time of each slice. For example, as shown in Figure 3, data frame 1 is the start slice frame of the first slice, and data frame 4 is the start slice frame of the second slice. The timestamp of the start slice frame can be obtained from the start slice frame. For example, the timestamp is used as additional information of the data frame and assembled with the data to form a data frame.

[0053] S212, determine the start timestamp of each slice as the slice location information, and write the start timestamp into the slice description file.

[0054] In this embodiment, the start timestamp of each slice represents the slice's position information. The recorded start timestamp is written to a slice description file, which can also be understood as a playlist or media playlist. The playback order of the slice files can be determined through this slice description file. The start timestamp is stored as extended information in the slice description file to obtain the slice description file.

[0055] For example, taking a streaming protocol using RTMP for push and HLS for pull as an example, the slice description file is an m3u8 file. The extended tag name in the m3u8 file is EXT-X-FP-LAST-ORI-PKT-DTS, used to record the start timestamp. Specifically, EXT-X-FP-LAST-ORI-PKT-DTS means the timestamp of the RTMP packet when the slice begins. Its function is to ensure that when the first slice process switches to the second slice process, the slice can start according to the slice position of the first slice process, avoiding inconsistent slice positions.

[0056] In some implementations, the above-described process of slicing the data stream by pulling the first data from the first slicing process includes:

[0057] (1) Record the target timestamp of the starting slice frame in the slice file obtained after each slice, and the target timestamp is used for the alignment of slice timestamps.

[0058] (2) Write the target timestamp into the slice description file.

[0059] During the first slicing process, in addition to recording the start timestamp, it also needs to record the target timestamp of the starting slice frame in the slice file. Specifically, the slice file is the file encapsulated after slicing. The target timestamp of the starting slice frame in this slice file is different from the start timestamp mentioned above. The start timestamp mentioned above is the timestamp of the original data frame before slicing, which follows the encapsulation protocol of the original data frame. The target timestamp, however, is the timestamp of the starting slice frame after slicing. As mentioned above, slicing also involves protocol conversion; correspondingly, the timestamp of the starting slice frame after slicing needs to conform to the requirements of the current encapsulation protocol. For example, before slicing, encapsulation was based on the RTMP protocol, while after slicing, encapsulation is based on the HLS protocol. These two different protocols correspond to different timestamp encapsulation requirements. Therefore, after switching slicing processes, a timestamp mapping relationship is also needed to ensure the continuity of the target timestamps in the slice file obtained after slicing. Based on this, it is necessary to record the target timestamp of the starting slice frame in the slice file for slice timestamp alignment.

[0060] Similarly, the recorded target timestamps are written to the slice description file, which can be stored as extended information of the slice description file to obtain the slice description file.

[0061] Continuing with the example above, assuming RTMP is used for pushing the stream and HLS for pulling it, the segment description file is an m3u8 file. The extended tag name in the m3u8 file is EXT-X-FP-LAST-SEG-PKT-DTS, used to record the target timestamp. Specifically, EXT-X-FP-LAST-SEG-PKT-DTS represents the timestamp of the first converted streaming media packet of the TS / MP4 file at the start of slicing, i.e., the target timestamp of the starting segment frame in the segment file. Its function is to obtain the target timestamp of the starting segment frame after slicing when switching from the first slicing process to the second slicing process, for segment timestamp alignment.

[0062] The mapping relationship between the timestamp of the data frame and the target timestamp can be obtained, so that the timestamp of the slices can be aligned when the second slicing process is used for slicing.

[0063] In some implementations, the above-described process of slicing the data stream by pulling the first data from the first slicing process further includes:

[0064] (1) Record the identifier of the slice file obtained after each slice.

[0065] (2) Write the identifier into the slice description file.

[0066] The segment file identifier is used to indicate the playback order of the segment files. The segment file number is written into the segment description file to ensure the continuity of the segment file numbers after the segment process switches, thereby ensuring the continuity of the playback order. The segment can be represented by numbers, characters, or other methods; there are no restrictions on this.

[0067] Similarly, the recorded identifiers are written into the slice description file, which can be stored as extended information of the slice description file to obtain the slice description file.

[0068] Continuing with the example above, assuming RTMP is used for pushing streams and HLS for pulling streams, the slice description file is an m3u8 file. The extended tag name in the m3u8 file is EXT-X-FP-SequenceStr, used to record identifiers. Optionally, a slice file can be divided into multiple sub-slices to further reduce latency. Correspondingly, it is necessary to record the identifiers of each sub-slice within the same slice file. Therefore, in EXT-X-FP-SequenceStr, the seq number represents the slice file identifier, and the partialSeqNumber represents the sub-slice number within that slice file.

[0069] Identifying the segment files facilitates their assembly during playback on the playback device, ensuring the correct order between them.

[0070] As shown in Figure 5, the push stream uses the RTMP protocol, the pull stream uses the HLS protocol, and the slice description file is an m3u8 file. The output of the slicing process includes slice files and slice description files. Specifically, slicing is performed first, and the position information of the slice is recorded in EXT-X-FP-LAST-ORI-PKT-DTS in the slice description file; then, the segmented data stream frame sequence is encapsulated into a TS file to obtain the slice file. At this time, the target timestamp of the starting slice frame in the slice file is recorded in EXT-X-FP-LAST-SEG-PKT-DTS in the slice description file; then, the identifier of the slice file is recorded in EXT-X-FP-SequenceStr in the slice description file, and the slice description file m3u8 is updated, thus completing one slice processing step.

[0071] S22, when switching from the first slicing process to the second slicing process, obtain the current slice position information through the second slicing process.

[0072] For details, please refer to S12 of the embodiment shown in Figure 2, which will not be repeated here.

[0073] S23, based on the current slice position information, the data stream is sliced ​​through the second slicing process and the slice position is recorded to determine the slice file of the data stream.

[0074] For details, please refer to S13 of the embodiment shown in Figure 2, which will not be repeated here.

[0075] The data slicing method provided in this embodiment is such that the first data corresponds to the first slicing process. The first data is first retrieved using the first slicing process, and then the first data is sliced ​​and the start timestamp of the slice is recorded. Since the timestamps of each data frame in the first data are fixed, using the start timestamp as the position information of the slice can ensure the accuracy of the slice position information.

[0076] This embodiment provides a data slicing method that can be used in electronic devices, such as servers and slicing devices. Figure 6 is a flowchart of the data slicing method according to an embodiment of this disclosure. As shown in Figure 6, the process includes the following steps:

[0077] S31, the data stream is sliced ​​through the first slicing process and the position information of the slices is recorded.

[0078] For details, please refer to S21 of the embodiment shown in Figure 4, which will not be repeated here.

[0079] S32, when switching from the first slicing process to the second slicing process, obtain the current slice position information through the second slicing process.

[0080] For details, please refer to S22 of the embodiment shown in Figure 4, which will not be repeated here.

[0081] S33, based on the current slice position information, the data stream is sliced ​​through the second slicing process and the slice position is recorded to determine the slice file of the data stream.

[0082] Specifically, S33 includes:

[0083] S331, determine the second data to be sliced ​​in the data stream based on the current slice position information.

[0084] The first data frame of the second data can be the data frame pointed to by the current slice position, or it can be a few data frames backward from the data frame pointed to by the current slice position. For example, as shown in Figure 3, the data frame pointed to by the current slice position is data frame 7. The first data frame of the second data can be data frame 7, or it can be a few data frames backward from data frame 7, that is, data frame 4 can be used as the first data frame of the second data.

[0085] After determining the first data frame of the second data, the length of the second data is determined according to actual needs, and the second data to be sliced ​​can be determined in the data stream.

[0086] S332, retrieves the second data through the second slicing process.

[0087] The second slicing process uses the first data frame and length of the second data to pull the second data from the data stream and continue slicing processing.

[0088] S333: Based on the current slice position information, the second slice process slices the second data and records the slice position to determine the slice file of the data stream.

[0089] Since the current slice position information indicates the position where the first slice process is currently processing slices, and the slice processing has not yet been completed, the second slice process needs to continue the slice processing from that position. For example, as shown in Figure 3, the first slice process is currently processing the slice task starting from data frame 7, and has not yet completed it; the second slice process continues the slice task starting from data frame 7.

[0090] Similarly, when the second slicing process slices the second data, it also needs to record the slice position. The process is similar to that of the first slicing process and will not be repeated here. The difference between the second and first slicing processes is that the second slicing process needs to consider the slice connection with the first slicing process, while other specific slicing methods are similar to those of the first slicing process.

[0091] In some implementations, S333 includes:

[0092] (1) Obtain a slice description file, the slice description file including a start timestamp for representing the current slice position information.

[0093] (2) Determine the second starting slice frame corresponding to the starting timestamp in the second data.

[0094] (3) Based on the second starting slice frame, the second data is sliced ​​through the second slicing process and the slice position is recorded in order to update the slice description file and determine the slice file of the data stream.

[0095] For specific details regarding the slice description file, please refer to the description of the corresponding content in the embodiment shown in Figure 4, which will not be repeated here.

[0096] The timestamps of the data frames in the second data are matched with the starting timestamps corresponding to the current slice position information to determine the second starting slice frame corresponding to the starting timestamp, for example, data frame 7 shown in Figure 3. After determining the second starting slice frame, the second data frame is sliced ​​starting from the second starting slice frame, and the slice position is recorded during the slicing process. The recorded slice position is written to the slice description file to update the slice description file.

[0097] When switching to the second slicing process, the starting timestamp representing the current slice position information is used to continue slicing, achieving seamless connection of slices for the data stream.

[0098] In some implementations, the slice description file includes the target timestamp of the first frame in the slice file obtained after each slice. Based on this, step (3) of S333 above includes:

[0099] 3.1) Obtain the latest target timestamp from the slice description file.

[0100] 3.2) Based on the current slice position, the second data is sliced ​​through the second slicing process, and the slicing results are mapped based on the latest target timestamp to update the slice description file and determine the slice file.

[0101] The slice description file also includes a target timestamp. When switching to the second slicing process to encapsulate the divided data frames, the latest target timestamp needs to be used to ensure the alignment of the slice timestamps. Referring to Figure 3, the slicing result is the division of the data stream into groups of data; that is, data frames 1-3 are the slice results, and the slice file is the file after encapsulating the slice results using the corresponding protocol. When encapsulating the slice results using the corresponding protocol, the latest target timestamp needs to be used for processing.

[0102] Similar to the slicing process of the first slicing process, after obtaining the slice file, the second slicing process may also need to record the target timestamp of the starting slice frame in the slice file into the slice description file in order to update the slice description file.

[0103] By using the latest target timestamp in the slice description file, the target timestamp of the slice file obtained after the second data slice is determined, thus achieving slice timestamp alignment.

[0104] In some implementations, the slice description file also includes an identifier for the slice file obtained after each slice. Based on this, step (3) of S333 above includes:

[0105] 3.1) Obtain the latest identifier from the slice description file.

[0106] 3.2) Mark the slice file corresponding to the second data based on the latest identifier to update the slice description file and determine the slice file.

[0107] As mentioned above, the identifier is used to indicate the playback order of the segment files. If the latest identifier is N, then after the second segment process obtains the first segment file, it determines its identifier to N+1 and records it in the segment description file. That is, the segment file corresponding to the second data is marked using the latest identifier.

[0108] By using the latest identifier in the slice description file, the identifier of the next slice file can be obtained, ensuring the continuity of slice file identifiers.

[0109] The data slicing method provided in this embodiment requires using the current slice position information to determine where to slice from when slicing using the second slicing process. Based on this, the second data corresponding to the current slice position is retrieved, thereby ensuring the continuity of slicing and reducing duplicate slicing.

[0110] As a specific application example of this disclosure, in a live streaming application scenario, the RTMP protocol is used for pushing the stream, the HLS protocol is used for pulling the stream, the slice description file is an m3u8 file, the old process is the first slice process, and the new process is the second slice process. The specific slice processing procedure is shown in Figure 7, including:

[0111] ① The old process continuously slices and updates the m3u8 file. Specifically, after the old process retrieves the RTMP stream from the source server, it iterates through each frame, finds the position that meets the slicing conditions, and begins slicing, that is, it starts merging frames to generate a TS / FMP4 file. The file path of the generated TS / FMP4 file is updated in the m3u8 file according to the HLS protocol specification. At the same time, an extended tag is written to the m3u8 file to record the slicing process information of the current RTMP stream and TS / FMP4 file. For details on the extended tag, please refer to the above description, which will not be repeated here.

[0112] ②Start a new process.

[0113] ③Start the source pull and slicing tasks.

[0114] ④ Create a slice task from the previous m3u8 information.

[0115] ⑤ Notify the old process to stop slicing.

[0116] This embodiment also provides a data slicing device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0117] This embodiment provides a data slicing device, as shown in Figure 8, including:

[0118] The first slicing module 41 is used to slice the data stream through the first slicing process and record the position information of the slices.

[0119] The acquisition module 42 is used to acquire the current slice position information through the second slice process when switching from the first slice process to the second slice process;

[0120] The second slicing module 43 is used to slice the data stream and record the slice positions based on the current slice position information through the second slicing process, so as to determine the slice file of the data stream.

[0121] In some implementations, the first slicing module 41 includes:

[0122] The first slicing unit is used to pull the first data in the data stream through the first slicing process and slice it, and record the start timestamp of each slice in the first data, wherein the start timestamp is the timestamp of the first slice frame in the first data.

[0123] The first writing unit is used to determine the start timestamp of each slice as the position information of the slice, and write the start timestamp into the slice description file.

[0124] In some implementations, the first slicing unit further includes:

[0125] The first recording subunit is used to record the target timestamp of the starting slice frame in the slice file obtained after each slice, and the target timestamp is used for the alignment of slice timestamps;

[0126] The first writing subunit is used to write the target timestamp into the slice description file.

[0127] In some implementations, the first slicing unit further includes:

[0128] The second recording subunit is used to record the identifier of the slice file obtained after each slice.

[0129] The second writing subunit is used to write the identifier into the slice description file.

[0130] In some implementations, the second slicing module 43 includes:

[0131] The first determining unit is used to determine the second data to be sliced ​​in the data stream based on the current slice position information;

[0132] A pull unit is used to pull the second data through the second slicing process;

[0133] The second slicing unit is used to slice the second data based on the current slice position information and record the slice position through the second slicing process.

[0134] In some implementations, the second slicing unit includes:

[0135] The first acquisition subunit is used to acquire a slice description file, the slice description file including a start timestamp for representing the current slice position information;

[0136] The first determining subunit is used to determine the second starting slice frame corresponding to the starting timestamp in the second data;

[0137] The third recording subunit is used to slice the second data based on the second starting slice frame through the second slicing process and record the slice position in order to update the slice description file and determine the slice file of the data stream.

[0138] In some implementations, the slice description file includes the target timestamp of the first frame in the slice file obtained after each slice, and the second slice unit includes:

[0139] The second acquisition subunit is used to acquire the latest target timestamp in the slice description file;

[0140] The mapping subunit is used to slice the second data based on the current slice position through the second slicing process, and to map the slicing results based on the latest target timestamp, so as to update the slice description file and determine the slice file.

[0141] In some implementations, the slice description file further includes an identifier for the slice file obtained after each slice, and the second slice unit further includes:

[0142] The third acquisition subunit is used to acquire the latest identifier in the slice description file;

[0143] The numbering subunit is used to mark the slice file corresponding to the second data based on the latest identifier, so as to update the slice description file.

[0144] In this embodiment, the data slicing device is presented in the form of a functional unit. Here, a unit refers to an ASIC circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0145] Further functional descriptions of the above modules are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0146] This disclosure also provides an electronic device having the data slicing device shown in FIG8 above.

[0147] Please refer to Figure 9, which is a schematic diagram of the structure of an electronic device provided in an optional embodiment of this disclosure. As shown in Figure 9, the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, a memory 54, and at least one communication bus 52. The communication bus 52 is used to realize communication between these components. The communication interface 53 may include a display screen or a keyboard; optionally, the communication interface 53 may also include a standard wired interface or a wireless interface. The memory 54 may be a high-speed RAM (Random Access Memory) or a non-volatile memory, such as at least one disk storage device. Optionally, the memory 54 may also be at least one storage device located remotely from the aforementioned processor 51. The processor 51 may be combined with the apparatus described in Figure 8, the memory 54 stores application programs, and the processor 51 calls the program code stored in the memory 54 to execute any of the above-described method steps.

[0148] The communication bus 52 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus 52 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in Figure 9, but this does not indicate that there is only one bus or one type of bus.

[0149] The memory 54 may include volatile memory, such as random-access memory (RAM); the memory may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 54 may also include a combination of the above types of memory.

[0150] The processor 51 can be a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP.

[0151] The processor 51 may further include a hardware chip. This hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0152] Optionally, memory 54 is also used to store program instructions. Processor 51 can invoke program instructions to implement the data slicing method as shown in any embodiment of this application.

[0153] This disclosure also provides a non-transitory computer storage medium storing computer-executable instructions that can execute the data slicing method in any of the above method embodiments. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.

[0154] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the method embodiments are basically similar to the device and system embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the device and system embodiments.

[0155] It is understood that in the specific embodiments of this disclosure, the collection of data streams is involved. When the above embodiments of this disclosure are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0156] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A data slicing method, characterized in that, include: The data stream is sliced ​​and the slice location information is recorded through the first slicing process; the data stream is a media stream. When switching from the first slicing process to the second slicing process, the current slice position information is obtained through the second slicing process. The current slice position information is used to characterize the starting slice frame of the current slice. Based on the current slice position information, the data stream is sliced ​​by the second slicing process, and the slice positions are recorded to determine the slice file of the data stream. The step of slicing the data stream by the first slicing process and recording the slice positions includes: retrieving first data from the data stream by the first slicing process and slicing it, and recording the start timestamp of each slice in the first data, where the start timestamp is the timestamp of the first slice frame in the first data, and the start timestamp corresponds to the data encapsulation protocol before the slice; determining the start timestamp of each slice as the slice position information and writing the start timestamp into the slice description file; recording the target timestamp of the starting slice frame in the slice file obtained after each slice, where the target timestamp is used for slice timestamp alignment, and the target timestamp corresponds to the data encapsulation protocol after the slice; and writing the target timestamp into the slice description file.

2. The method according to claim 1, characterized in that, The step of slicing the data stream through the first slicing process further includes: recording the identifier of the slice file obtained after each slice; and writing the identifier into the slice description file.

3. The method according to claim 1, characterized in that, The step of determining the slice file of the data stream by slicing the data stream and recording the slice positions based on the current slice position information through the second slicing process includes: determining the second data to be sliced ​​in the data stream based on the current slice position information; retrieving the second data through the second slicing process; and slicing the second data by the second slicing process and recording the slice positions based on the current slice position information to determine the slice file of the data stream.

4. The method according to claim 3, characterized in that, The step of determining the slice file of the data stream by slicing the second data and recording the slice positions based on the current slice position information through the second slicing process includes: obtaining a slice description file, the slice description file including a start timestamp for representing the current slice position information; determining a second start slice frame corresponding to the start timestamp in the second data; and slicing the second data and recording the slice positions based on the second start slice frame through the second slicing process to update the slice description file.

5. The method according to claim 4, characterized in that, The slice description file includes the target timestamp of the first frame in the slice file obtained after each slice. The step of slicing the second data through the second slicing process based on the current slice position information includes: obtaining the latest target timestamp in the slice description file; slicing the second data through the second slicing process based on the current slice position; and mapping the slicing results based on the latest target timestamp to update the slice description file.

6. The method according to claim 4, characterized in that, The slice description file also includes the identifier of the slice file obtained after each slice. The step of slicing the second data through the second slicing process based on the current slice position information further includes: obtaining the latest identifier in the slice description file; marking the slice file corresponding to the second data based on the latest identifier, so as to update the slice description file and determine the slice file.

7. A data slicing device, characterized in that, include: The first slicing module is used to slice the data stream through the first slicing process and record the position information of the slices, wherein the data stream is a media stream; The acquisition module is used to acquire the current slice position information through the second slice process when switching from the first slice process to the second slice process. The current slice position information is used to characterize the timestamp of the starting slice frame of the current slice. The second slicing module is used to slice the data stream based on the current slice position information using the second slicing process and record the slice positions to determine the slice file of the data stream; wherein, the first slicing module includes: a first slicing unit, used to pull first data from the data stream through the first slicing process for slicing, and record the start timestamp of each slice in the first data, the start timestamp being the timestamp of the first slice frame in the first data, the start timestamp corresponding to the data encapsulation protocol before slicing; a first writing unit, used to determine the start timestamp of each slice as the slice position information, and write the start timestamp into a slice description file; the first slicing unit includes: a first recording subunit, used to record the target timestamp of the start slice frame in the slice file obtained after each slice, the target timestamp being used for slice timestamp alignment, the target timestamp corresponding to the data encapsulation protocol after slicing; a first writing subunit, used to write the target timestamp into the slice description file.

8. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the data slicing method of any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the data slicing method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Streaming media file slicing method, device and system

    CN105871806A

  • Live video stream playback processing method and device, and computing equipment

    CN111447455A

  • Uninterrupted service upgrading method and system

    CN112596771A

  • RTMP connection migration method, apparatus and device, and readable storage medium

    CN114827096A