Media stream slicing method, apparatus, storage medium, and electronic device

By slicing the media stream only when a pull request is received, the problem of resource waste during media stream slicing in the prior art is solved, and more efficient memory and disk utilization is achieved.

CN116264627BActive Publication Date: 2025-11-28BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111539015.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-15
Publication Date
2025-11-28
Estimated Expiration
2041-12-15

AI Technical Summary

Technical Problem

In existing technologies, media streams begin slicing immediately upon arrival at the source station, resulting in a waste of machine memory and disk resources.

Method used

When a push request is received, the media stream is stored on the server, and when a pull request is received, it is sliced, slice files are generated, and returned to the client.

Benefits of technology

It effectively reduces the usage of machine memory and disk, and solves the problem of resource waste during media stream slicing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116264627B_ABST
    Figure CN116264627B_ABST
Patent Text Reader

Abstract

The application discloses a media stream slicing method and device, a storage medium and an electronic device. The method comprises the following steps: acquiring a media stream in the case that a push request of pushing the media stream is received; storing the media stream in a server; slicing the media stream to obtain a slice file in the case that a pull request of pulling the media stream is received; and returning the slice file to a client sending the pull request. The application solves the technical problem of wasting machine memory and disk resources when the media stream is sliced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computer, in particular to a media stream slicing method, device, storage medium and electronic equipment. BACKGROUND

[0002] In prior art, in the process of live broadcast, when the live broadcast source station receives the push stream from the anchor end, the media stream is usually sliced as soon as the push stream is received, and the slice file is obtained, then when the client pulls the video stream from the source station for watching, the slice file is pulled from the source station, and the client can watch the media stream.

[0003] However, in the above method, the media stream is sliced as soon as it reaches the source station, which wastes machine memory and disk resources. SUMMARY

[0004] Embodiments of the present application provide a media stream slicing method, device, storage medium and electronic equipment to at least solve the technical problem of wasting machine memory and disk resources when slicing the media stream.

[0005] According to an aspect of an embodiment of the present application, a media stream slicing method is provided, comprising: in the case of receiving a push request for pushing a media stream, acquiring the media stream; storing the media stream in a server; in the case of receiving a pull request for pulling the media stream, slicing the media stream to obtain a slice file; returning the slice file to a client sending the pull request.

[0006] According to another aspect of an embodiment of the present application, a media stream slicing device is provided, comprising: a first acquisition module configured to acquire a media stream in the case of receiving a push request for pushing the media stream; a storage module configured to store the media stream in a server; a processing module configured to slice the media stream to obtain a slice file in the case of receiving a pull request for pulling the media stream; and a sending module configured to return the slice file to a client sending the pull request.

[0007] As an optional example, the processing module comprises: an acquisition unit configured to acquire a slicing parameter, wherein the slicing parameter is used to determine the time length of each slice file when the media stream is sliced; and a processing unit configured to slice the media stream according to the slicing parameter to obtain a plurality of slice files with the same time length.

[0008] As an optional example, the processing module comprises: a detection unit configured to detect the number of slice files in the process of slicing the media stream; a determination unit configured to determine that a new slice file is generated in the case that the number of slice files changes; and an output unit configured to output the new slice file.

[0009] As an optional example, the detection unit comprises a processing sub-unit, which is configured to start timing when the first slice starts, and restart timing when the number of slice files is detected to change, and detect the number of slice files when the timing duration reaches the file duration of a slice file, and continue timing when the number of slice files does not change, and detect the number of slice files every predetermined duration until the timing duration reaches the target duration or the number of slice files is detected to change.

[0010] As an optional example, the device further comprises a timing module configured to start timing when the media stream is sliced in response to receiving a pull request for pulling the media stream, and a control module configured to stop slicing the media stream when the timing duration reaches a predetermined duration.

[0011] As an optional example, the timing module is further configured to restart timing when the pull request is received again when the timing duration does not reach the predetermined duration.

[0012] As an optional example, the device further comprises a second acquisition module configured to acquire an occupied space value of memory during slicing the media stream, and an adjustment module configured to adjust the value of the predetermined duration when the occupied space value increases.

[0013] According to another aspect of the embodiments of the present application, a storage medium is provided, and the storage medium stores a computer program, and the computer program is executed by a processor to perform the media stream slicing method.

[0014] According to another aspect of the embodiments of the present application, an electronic device is provided, and the electronic device comprises a memory and a processor, the memory stores a computer program, and the processor is configured to perform the media stream slicing method by using the computer program.

[0015] In the embodiment of the present application, the method comprises the following steps: obtaining the media stream when receiving a push request of pushing the media stream; storing the media stream in a server; slicing the media stream to obtain slice files when receiving a pull request of pulling the media stream; and returning the slice files to a client sending the pull request. In the method, when live streaming, the media stream is stored first, and then the media stream is sliced to obtain the slice files when receiving the pull request of the media stream, and the slice files are returned to the client. Therefore, the occupation of the internal memory and the disk is reduced, and the technical problem of wasting the machine internal memory and the disk resources when slicing the media stream is solved. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:

[0017] Figure 1 is a flow chart of an optional media stream slicing method according to an embodiment of the present application;

[0018] Figure 2 is a data flow chart of an optional media stream slicing method according to an embodiment of the present application;

[0019] Figure 3 is a slice detection chart of an optional media stream slicing method according to an embodiment of the present application;

[0020] Figure 4 is a slice detection structure chart of an optional media stream slicing method according to an embodiment of the present application;

[0021] Figure 5 is a client request slicing chart of an optional media stream slicing method according to an embodiment of the present application;

[0022] Figure 6 is a client continuous stream pulling chart of an optional media stream slicing method according to an embodiment of the present application;

[0023] Figure 7 is a structure chart of an optional media stream slicing device according to an embodiment of the present application;

[0024] Figure 8 is a chart of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0025] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application in order to make the technical personnel in the technical field better understand the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by the ordinary technical personnel in the technical field without creative labor should belong to the protection scope of the present application.

[0026] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in other than the order illustrated or described herein. In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0027] According to a first aspect of the embodiments of the present application, a media stream slicing method is provided, which can be applied in the process of slicing a live media stream, as shown in the following. Figure 1 The method comprises the following steps.

[0028] S102, in the case of receiving a push request for pushing a media stream, acquiring the media stream;

[0029] S104, storing the media stream in a server;

[0030] S106, in the case of receiving a pull request for pulling the media stream, slicing the media stream to obtain a slice file;

[0031] S108, returning the slice file to a client sending the pull request.

[0032] Optionally, the above-mentioned method can be applied in the process of slicing a live media stream. The live media stream can be a video stream, an audio stream or an audio-video stream. The above-mentioned method can be deployed in a server, which can be a live platform server or a live source station server. The live media stream can be uploaded to the server for downloading, buffering and the like by a client. For example, as shown in the following, Figure 2 Figure 2 In the above-mentioned method, the anchor end 202 can upload the media stream to the server 204, the client can pull the media stream from the server, and after pulling the media stream, the media stream can be played in the interface 206 of the client.

[0033] ​Optionally, in this embodiment, when there is a media stream to be uploaded to the server, the host end can send a push request to the server, and the server can obtain the media stream pushed by the push request after receiving the push request. After obtaining the media stream, the media stream can be saved in the server, and no slicing processing is performed temporarily. When the media stream is stored in the server, the client sends a request to the server to pull the media stream, and the server starts the slicing action of the media stream again, slices the media stream into slice files, and returns the slice files to the client for playing the media stream.

[0034] Through this embodiment, when the media stream is obtained during live streaming, the media stream can be stored first, and then when a pull request for the media stream is received, slicing of the media stream is started to obtain slice files, and the slice files are returned to the client. This method can effectively reduce the occupation of internal memory and disk, and solves the technical problem of wasting machine memory and disk resources when slicing the media stream.

[0035] As an optional example, the slicing of the media stream to obtain slice files when the pull request for pulling the media stream is received includes:

[0036] Obtaining slicing parameters, wherein the slicing parameters are used to determine the time length of each slice file when the media stream is sliced;

[0037] Slicing the media stream according to the slicing parameters to obtain multiple slice files with the same time length.

[0038] Optionally, in this embodiment, when the media stream is sliced, the media stream can be sliced according to fixed slicing parameters. The slicing parameters are parameters used to control the time length of the slice file obtained by slicing the media stream. For example, if the slicing parameter is 5 (seconds), the media stream is sliced into a slice file every 5 seconds. The slicing can also be performed according to the demand of the client or according to the network load to determine the real-time slicing parameter. If the network load is large and the network stability is not good, the slicing parameter can be reduced. If the network load is small and the stability is good, the slicing parameter can be increased.

[0039] As an optional example, the slicing of the media stream to obtain slice files when the pull request for pulling the media stream is received includes:

[0040] Detecting the number of slice files during the slicing of the media stream;

[0041] Determining that a new slice file is generated when the number of slice files changes;

[0042] Outputting the new slice file.

[0043] Optionally, in the process of slicing the media stream, the number of slice files can be detected. The number of slice files can be initially zero, because no slice file has been generated. As the slicing proceeds, the number of slice files becomes 1, which indicates that a new slice file has been generated. Alternatively, the number of slice files changes from 5 to 6, from 8 to 9, etc., all of which are considered as a change in the number of slice files, and a new slice file is generated. The new slice file is outputted.

[0044] As an optional example, the above method of detecting the number of slice files in the process of slicing the media stream includes:

[0045] Timing is started at the beginning of the first slice, and restarted when a change in the number of slice files is detected;

[0046] The number of slice files is detected once when the timing duration reaches the file duration of one slice file;

[0047] When the number of slice files does not change, the timing continues, and the number of slice files is detected every predetermined duration until the timing duration reaches the target duration or a change in the number of slice files is detected.

[0048] Optionally, in the process of detecting the number of slice files, timing is started at the beginning of the first slice, and the number of slice files is detected once when the timing duration reaches the duration of one slice. If the number of slice files does not change, it indicates that the first slice has not generated the first slice file. In this case, the number of slice files is detected every predetermined duration, such as 500 milliseconds. If a change in the number of slice files is detected, the timing is restarted. Alternatively, if the timing duration reaches the target duration, and no change in the number of slice files is detected, the timing is restarted. The target duration can be twice the duration of a slice file plus an adjustment parameter, which can be N seconds, where N is a positive integer. For example, as shown in Figure 3 Figure 3 In the example, slice file 1 is normally sliced, and is detected at 10 seconds. Slice file 1 is then sent to the client. After restarting the timing, slice file 2 is not completed after 10 seconds, and is not detected after another 4*500 milliseconds (every 500 milliseconds). Slice file 2 is then sent to the client after being completed, and the timing is restarted. Slice file 3 is not sent to the client after 10*2 seconds plus N seconds, and the timing is restarted. In the next timing period, slice file 3 is completed, and is sent to the client. N is a positive number.

[0049] As an optional example, the above method further includes:

[0050] ​In the case of receiving a pull request for pulling the media stream, start timing when the media stream is sliced;

[0051] In the case of the timing duration reaching a predetermined duration, stop slicing the media stream.

[0052] Optionally, in the embodiment, when receiving a pull request, start timing when the media stream is sliced. The purpose of the timing is to check whether the pull request is continuously requesting slice files. When receiving a pull request, start timing. If the predetermined duration is 2 minutes, continue slicing and return slice files to the client within 2 minutes. If the timing duration exceeds 2 minutes, stop slicing and interrupt responding to the pull request. The purpose of the method is to interrupt slicing if the pull request is no longer continuously requesting media stream slice files after a certain duration, so as to save memory and disk occupation.

[0053] As an optional example, the above method further comprises:

[0054] In the case of the timing duration not reaching the predetermined duration, restart timing when receiving a pull request again.

[0055] Optionally, in the embodiment, in the case of the above timing duration being within 2 minutes, if a pull request is received again, such as receiving a pull request again at 1 minute and 10 seconds, restart timing. Interrupt slicing again in the case of not receiving a pull request for 2 minutes.

[0056] As an optional example, the above method further comprises:

[0057] Obtain the occupation space value of memory in the process of slicing the media stream;

[0058] In the case of the occupation space value increasing, adjust the value of the predetermined duration.

[0059] Optionally, in the embodiment, when slicing a media stream, detect the size of the occupation space value of memory. If the value is continuously increasing, the predetermined duration can be adjusted, such as adjusting 2 minutes to 1 minute or adjusting to 3 minutes, so as to reduce the occupation space value of memory as much as possible, and learn the optimal predetermined duration.

[0060] Let's illustrate this with an example. For instance, receiving a Real-Time Messaging Protocol (RTMP) push stream, the server stores the pushed media stream. When a pull request is received from an HTTP-based Adaptive Bitrate Streaming (HLS) pull stream, the server begins slicing the media stream and returns the sliced ​​files to the client. Here, HTTP stands for HyperText Transfer Protocol.

[0061] During the slicing process described above, you can check whether the slicing was successful and whether you obtained the sliced ​​file. Combined with... Figure 4 Here's an explanation. After triggering a slice during streaming, it's necessary to check if the slice is ready. The initial check can be performed after the slice begins, at the duration of the first TS slice (slice file). Subsequent checks are performed every 500ms until twice the TS slice duration plus 3 seconds is detected. During this process, if the slice is confirmed to be successful, the slice file is retrieved, and data is sent to the client. The purpose of checking twice the TS slice duration plus 3 seconds is to ensure successful slicing, as the slice needs to wait for keyframes.

[0062] Furthermore, a predetermined duration can be set to constrain the request when the client requests to retrieve the slice file. For example... Figure 5 and Figure 6 As shown. The first time a stream is pulled, it triggers a slice and sets the slice state for 2 minutes, which is configurable. If the 2 minutes are exceeded, the streaming stops. For subsequent streams, i.e., when streaming is pulled again during the slicing process, the slice state is extended by 2 minutes, the timer is reset for 2 minutes, and slicing stops when the 2 minutes are reached.

[0063] This embodiment effectively reduces machine memory usage. Tests showed that when the server received 10,000 data streams while HLS pulled 5,000, 25% of machine memory was saved.

[0064] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0065] According to another aspect of the embodiments of this application, a media stream slicing device is also provided, such as... Figure 7 As shown, it includes:

[0066] The first obtaining module 702 is configured to obtain the media stream in a case where a push request for pushing the media stream is received.

[0067] The storage module 704 is configured to store the media stream in a server.

[0068] The processing module 706 is configured to slice the media stream to obtain slice files in a case where a pull request for pulling the media stream is received.

[0069] The sending module 708 is configured to return the slice files to a client sending the pull request.

[0070] Optionally, the apparatus can be applied in a process of slicing a live media stream. The live media stream can be a video stream, an audio stream or an audio-video stream. The apparatus can be deployed in a server, which can be a live platform server or a live source station server. The live media stream can be uploaded to the server for downloading, buffering and the like by a client. For example, as shown in FIG. 2, a host terminal 202 can upload a media stream to a server 204, a client can pull the media stream from the server, and the pulled media stream can be played in an interface 206 of the client. Figure 2 Figure 2

[0071] Optionally, in the embodiment, when a media stream is to be uploaded to the server, the host terminal can send a push request to the server, and the server can obtain the media stream pushed by the push request after receiving the push request. After obtaining the media stream, the server can store the media stream without slicing the media stream temporarily. When the media stream is stored in the server, the client sends a request for pulling the media stream to the server, and the server starts to slice the media stream to obtain slice files, and returns the slice files to the client for playing the media stream.

[0072] According to the embodiment, when a media stream is obtained during live streaming, the media stream can be stored first, and then the media stream is sliced to obtain slice files when a pull request for the media stream is received, and the slice files are returned to the client. The method can effectively reduce the occupation of internal memory and disk, and solve the technical problem of wasting machine internal memory and disk resources when the media stream is sliced.

[0073] As an optional example, the processing module includes:

[0074] The obtaining unit is configured to obtain slice parameters, wherein the slice parameters are used to determine the time length of each slice file when the media stream is sliced.

[0075] ​​The processing unit is configured to slice the media stream according to a slice parameter to obtain a plurality of slice files with the same time length.

[0076] Optionally, in the embodiment, when the media stream is sliced, the media stream can be sliced according to a fixed slice parameter. The slice parameter is a parameter for controlling the time length of the slice file obtained when the media stream is sliced. For example, if the slice parameter is 5 (seconds), the media stream is sliced into a slice file every 5 seconds. When slicing, the real-time slice parameter can also be determined according to the demand of the client or according to the network load. If the network load is large and the network stability is not good, the slice parameter can be reduced. If the network load is small and the stability is good, the slice parameter can be increased.

[0077] As an optional example, the processing module includes:

[0078] The detection unit is configured to detect the number of slice files during the slicing of the media stream.

[0079] The determination unit is configured to determine that a new slice file is generated when the number of slice files changes.

[0080] The output unit is configured to output the new slice file.

[0081] Optionally, in the embodiment, the number of slice files can be detected during the slicing of the media stream. The initial value of the number of slice files can be zero because no slice file has been obtained by slicing. As the slicing proceeds, the number of slice files becomes 1, and it is determined that a new slice file is generated. Alternatively, the number of slice files changes from 5 to 6, from 8 to 9, etc., which are all regarded as a change in the number and generation of a new slice file. The new slice file is outputted.

[0082] As an optional example, the detection unit includes:

[0083] The processing sub-unit is configured to start timing when the first slicing starts, restart timing when the change in the number of slice files is detected, detect the number of slice files when the timing length reaches the file length of a slice file, continue timing when the number of slice files does not change, and detect the number of slice files every predetermined length of time until the timing length reaches the target length or the change in the number of slice files is detected.

[0084] Optionally, in the embodiment, when detecting whether the number of slice files changes, the timing can be started when the first slice is performed, and the number of slice files is detected once the timing duration reaches the duration of a slice. If the number of slice files does not change, it indicates that the first slice has not obtained the first slice file, and at this time, the number of slice files is detected every predetermined duration, such as 500 milliseconds. If it is detected that the number of slice files changes, the timing is restarted, or if the timing duration reaches the target duration, and the number of slice files is still not detected to change, the timing is restarted. The target duration can be twice the duration of the slice file plus an adjustment parameter, and the adjustment parameter can be N seconds, where N is a positive integer. For example, as shown in Figure 3 Figure 3 In the embodiment, the slice file 1 is normally sliced, and is detected in 10 seconds, and then the slice file 1 is sent to the client. After the timing is restarted, after 10 seconds, the slice file 2 is not completed, and after another 4*500 milliseconds (the number of detections is 1 every 500 milliseconds), the slicing is completed, and then the slice file 2 is sent to the client and the timing is restarted. The slice file 3 is not completed after 10*2 seconds and N seconds, and then the slice file 3 is not sent to the client and the timing is restarted. In the next timing period, the slice file 3 is completed, and the slice file 3 is sent to the client. N is a positive number.

[0085] As an optional example, the above apparatus further includes:

[0086] The timing module is configured to start timing when the media stream is sliced in response to the pull request.

[0087] The control module is configured to stop slicing the media stream when the timing duration reaches the predetermined duration.

[0088] Optionally, in the embodiment, when a pull request is received, the timing is started when the media stream is sliced, and the purpose of the timing is to check whether the pull request is continuously requesting slice files. When the pull request is received, the timing is started, and if the predetermined duration is 2 minutes, the slicing is continuously performed within 2 minutes, and the slice file is returned to the client. If the timing duration exceeds 2 minutes, the slicing is stopped, and the response to the pull request is interrupted. The purpose of the method is to interrupt the slicing if the pull request does not continuously request the slice file of the media stream after a certain duration, so as to save the occupation of the memory and the disk.

[0089] As an optional example, the timing module is further configured to:

[0090] In the case where the timing duration does not reach the predetermined duration, the timing is restarted when the pull request is received again.

[0091] ​Optionally, in the embodiment, in the case that the time length is less than 2 minutes, if the pull request is received again, such as the pull request is received again at 1 minute and 10 seconds, the time is restarted, and in the case that the time is restarted for 2 minutes without receiving the pull request, the slice is interrupted.

[0092] As an optional example, the apparatus further comprises:

[0093] The second obtaining module is configured to obtain an occupied space value of the memory in the process of slicing the media stream.

[0094] The adjusting module is configured to adjust the value of the predetermined time length in the case that the occupied space value increases.

[0095] Optionally, in the embodiment, when the media stream is sliced, the size of the occupied space value of the memory is detected, if the value is always increasing, the predetermined time length can be adjusted, such as adjusting 2 minutes to 1 minute or adjusting to 3 minutes, etc., so as to reduce the occupied space value of the memory as much as possible, and to learn the optimal predetermined time length.

[0096] Other examples of the embodiment can refer to the above examples, and will not be described here.

[0097] Figure 8 is a structural block diagram of an optional electronic device according to the embodiment of the application, as shown in Figure 8 The processor 802, the communication interface 804 and the memory 806 complete the communication with each other through the communication bus 808, wherein,

[0098] The memory 806 is configured to store the computer program.

[0099] The processor 802 is configured to execute the computer program stored in the memory 806, and implement the following steps:

[0100] In the case that the push request of pushing the media stream is received, the media stream is obtained.

[0101] The media stream is stored in the server.

[0102] In the case that the pull request of pulling the media stream is received, the media stream is sliced to obtain the slice file.

[0103] The slice file is returned to the client sending the pull request.

[0104] Optionally, in the embodiment, the communication bus described above can be a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For the convenience of representation, Figure 8 only one bus or one type of bus is represented by a thick line, but it does not mean that there is only one bus or one type of bus. The communication interface is used for communication between the electronic device described above and other devices.

[0105] The memory can include a RAM, and can also include a non-volatile memory, for example, at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0106] As an example, the memory 806 described above can include, but is not limited to, the first acquisition module 702, the storage module 704, the processing module 706, and the sending module 708 in the processing device described above. In addition, other module units in the processing device described above can also be included, but are not limited to, which will not be described in detail in this example.

[0107] The processor described above can be a general-purpose processor, which can include, but is not limited to, a CPU (Central Processing Unit), an NP (Network Processor), and the like; and can also be a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0108] Optionally, the specific examples in the embodiment can refer to the examples described in the above-described embodiments, which will not be described in detail in this embodiment.

[0109] Those of ordinary skill in the art can understand that, Figure 8 The structure shown is only a schematic, and the device for implementing the processing method described above can be a terminal device, which can be a smart phone (such as an Android phone, an iOS phone, and the like), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like.Figure 8 It does not cause limitation to the structure of the electronic device. For example, the electronic device can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figures, or have a different configuration from that shown in the figures. Figure 8 Figure 8 The electronic device can further include more or less components (such as a network interface, a display device, etc.) than those shown in the figures, or have a different configuration from that shown in the figures.

[0110] Those skilled in the art can understand that all or part of the steps of various methods in the above embodiments can be completed by a program instructing the hardware of the terminal device, and the program can be stored in a computer readable storage medium, which can include a flash disk, a ROM, a RAM, a magnetic disk, an optical disk, etc.

[0111] According to another aspect of the embodiments of the present application, a computer readable storage medium is also provided, which stores a computer program. When the computer program is run by a processor, the steps of the above media stream slicing method are executed.

[0112] Optionally, in the present embodiment, those skilled in the art can understand that all or part of the steps of various methods in the above embodiments can be completed by a program instructing the hardware of the terminal device, and the program can be stored in a computer readable storage medium, which can include a flash disk, a ROM, a RAM, a magnetic disk, an optical disk, etc.

[0113] The serial numbers of the above embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.

[0114] The integrated units in the above embodiments, if realized in the form of software function units and sold or used as independent products, can be stored in the above computer readable storage medium. Based on such understanding, the technical solutions of the present application or all or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing one or more computer devices (which can be personal computers, servers or network devices, etc.) to execute all or part of the steps of the various embodiment methods of the present application.

[0115] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0116] ​In several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other manners. Of course, the unit embodiments described above are merely schematic, and for example, the division of the units is only a logical function division, and there can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, and can be in electrical, mechanical or other forms.

[0117] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.

[0118] In addition, each functional unit in the various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.

[0119] The above descriptions are merely preferred embodiments of the present application, and it should be pointed out that for those skilled in the art, some improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements should also be considered as the protection scope of the present application.

Claims

1. A media stream slicing method, characterized in that, include: Upon receiving a push request for a media stream, the media stream is acquired; The media stream is stored on a server; Upon receiving a pull request for the media stream, the media stream is sliced ​​to obtain slice files; The sliced ​​file is returned to the client that sent the pull request; The method further includes: upon receiving a pull request to pull the media stream, constraining the pull request by a predetermined duration, starting a timer when the first pull triggers a slice, stopping the pull when the timer exceeds the predetermined duration, and restarting the timer when the pull is performed again during the slice process; The method further includes: obtaining the memory space occupied during the slicing of the media stream; and adjusting the value of the predetermined duration if the memory space occupied increases.

2. The method according to claim 1, characterized in that, Upon receiving a request to retrieve the media stream, the step of slicing the media stream to obtain sliced ​​files includes: Obtain the slicing parameters, wherein the slicing parameters are used to determine the duration of each slice file when slicing the media stream; The media stream is sliced ​​according to the slicing parameters to obtain multiple slice files with the same duration.

3. The method according to claim 1, characterized in that, Upon receiving a request to retrieve the media stream, the step of slicing the media stream to obtain sliced ​​files includes: During the process of slicing the media stream, the number of sliced ​​files is detected; If the number of slice files changes, it is determined that a new slice file has been generated; Output the new slice file.

4. The method according to claim 3, characterized in that, The process of slicing the media stream, including detecting the number of sliced ​​files, includes: Timing begins at the start of the first slice and restarts when a change in the number of slice files is detected. If the timing duration reaches the length of a slice file, the number of slice files is detected once; If the number of slice files remains unchanged, the timing continues, and the number of slice files is checked every predetermined time interval until the timing reaches the target time interval or a change in the number of slice files is detected.

5. A media stream slicing device, characterized in that, include: The first acquisition module is used to acquire the media stream upon receiving a push request for the media stream; A storage module is used to store the media stream in a server; The processing module is used to slice the media stream to obtain slice files when a pull request for the media stream is received; The sending module is used to return the sliced ​​file to the client that sent the pull request; This also includes: upon receiving a pull request to pull the media stream, constraining the pull request by a predetermined duration, starting a timer when the first pull triggers a slice, stopping the pull when the timer exceeds the predetermined duration, and restarting the timer when the pull is performed again during the slice process; This also includes: obtaining the memory space occupied during the slicing of the media stream; and adjusting the value of the predetermined duration if the occupied space value increases.

6. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to perform the method described in any one of claims 1 to 4.

7. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 4 through the computer program.

Citation Information

Patent Citations

  • Media stream real-time delivery method and server

    CN111193684A