Streaming media on-demand system
By introducing the live streaming module and recording module into the streaming media on-demand system, real-time recording and transmission of video clip information solves the problem of switching between on-demand mode and live broadcast mode, and enables users to watch live broadcasts and historical highlights in real-time in the on-demand state. functions to improve user experience.
Patent Information
- Application Number
- CN202410686842.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-08-27
AI Technical Summary
The existing streaming media on-demand system cannot freely switch between on-demand mode and live broadcast mode. Users cannot freely switch historical highlights while watching live broadcasts, which is inconvenient to use.
A streaming media on-demand system is designed, which records real-time video through the live streaming module and recording module of the streaming media server, and transmits the video clip information to the on-demand module. It supports the RTSP protocol, realizes the association between the on-demand module and the live broadcast module, and allows users to Watch live broadcasts in real time on demand, and control jumps through signaling to watch historical highlights.
It enables real-time viewing of live broadcasts in on-demand mode. Users can view the latest media streams anytime and anywhere, and jump to watch historical highlights through signaling control, which improves user experience.
Smart Images

Figure CN118555418A
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of streaming media, and in particular relates to a streaming media on-demand system. Background Art
[0002] Currently, streaming media-based on-demand services use streaming media servers as the medium. Clients access files stored on disks through streaming media services, which control the file transmission rate and progress, thus achieving a scenario of accessing historical audio and video streams.
[0003] For the on-demand mode, the clients currently on the market all directly use the mode of single-segment on-demand. To watch a certain time period, click on the time period (start time, end time) to play on demand. After the playback, the user needs to operate whether to watch the next episode, or the user can click to choose whether to watch the live broadcast. For the live broadcast mode, it is impossible to watch historical videos in the live broadcast state, and you can only see what you get in real time. The on-demand mode and live broadcast mode cannot be switched freely.
[0004] Currently, in the APP applications on the market, users need to click to select and switch between points and live broadcasts, or there is a jump process after watching; there is no function to freely switch between historical and real-time images in a playback window; there is no function to freely switch between historical highlights while watching live broadcasts, which causes many inconveniences for users. Summary of the invention
[0005] In view of the above problems, the present invention provides a streaming media on-demand system, which uses streaming media service as a medium. In the on-demand state, the streaming media service starts live streaming and real-time recording, and transmits new video clip information to the on-demand module to achieve a "click-to-direct" conversion that is close to the live broadcast state, and supports jumping to watch historical highlights.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0007] A streaming media on-demand system, comprising a client and a streaming media server, wherein the client is provided with a playback logic control module, and the streaming media server comprises a live streaming module, a video recording module, a video recording callback module and a streaming on-demand module; the playback logic control module supports the RTSP protocol;
[0008] The playback logic control module is used to receive the client's operation and generate a corresponding RTSP streaming request;
[0009] The live streaming module is used to pull real-time data. The obtained data source is pulled by the client to watch the real-time stream. On the other hand, the data is sent to the recording module and stored in real time as file segments for use by the on-demand module.
[0010] The video recording control module is used to receive the real-time stream, store it into multiple MP4 files, and notify the client and the on-demand module of the update status of the files through the callback module;
[0011] The video call back module is used to call back the real-time generated information of each video clip to the client and the on-demand module in a timely manner;
[0012] The on-demand module is used to receive the RTSP stream pulling request from the client, read the video clip corresponding to the live source, and output the media stream to the client for viewing at real clock intervals.
[0013] In a possible implementation, the video recording control module is used to receive the real-time stream, store it into multiple MP4 files, and notify the client and the on-demand module of the update of the files through the callback module, specifically including:
[0014] The application layer controls the streaming media server, starts pulling live broadcasts, turns on the recording function of the live stream, and presets the duration of a recording segment; the application layer is a master control program that integrates the streaming media server and responds to client requests;
[0015] The real-time stream is parsed and transferred to the video module. The video module uses whether a key frame is encountered and whether the length of the video segment reaches the preset segment length as the end mark of the file segment;
[0016] Each file segment is encapsulated into a post-indexed MP4 file and stored in the disk space, recording information including the start time, end time, time period, storage location and file size of the file segment.
[0017] In a possible implementation manner, the video call back module is used to call back the real-time generated information of each video segment to the client and the on-demand module in a timely manner, specifically including:
[0018] The callback module registers the video callback function after the program starts;
[0019] When the recording module starts recording for the first time, and after each separate file segment is generated, a callback is triggered to inform the client of the complete information of the recording file, including the start time, end time, storage location of the segment duration, and the corresponding live source;
[0020] If a user requests this media source on demand during recording, and there is corresponding information record in the on-demand-live source information dictionary, the newly generated file segment information will be passed to the corresponding instance of the on-demand module and recorded in real time in the on-demand running program.
[0021] In a possible implementation manner, the on-demand-live source information dictionary records the on-demand stream id and the live stream id together, thereby associating the real-time live broadcast module with the on-demand module.
[0022] In a possible implementation manner, the RTSP stream pull request carries parameters including a start time StartTime and an end time EndTime, and carries live source information parameters.
[0023] The present invention has the following beneficial effects: when multimedia audio and video are watched in on-demand mode, when a user operates a client player and clicks to watch, on the one hand, the streaming media server will pull the stream in real time and record the video, inform the on-demand module of the real-time recording information, update the on-demand content time period, and the on-demand module will update the length of the video clip in time after outputting a frame of data, so as to achieve the purpose of continuously playing the latest media stream; the on-demand process can also control the jump history through signaling, so that the highlights can be watched at any time. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 The schematic diagram of the streaming media on-demand system according to the embodiment of the present invention is shown in FIG. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] Reference Figure 1, shown is a principle block diagram of a streaming media on-demand system according to an embodiment of the present invention, comprising a client and a streaming media server, wherein the client is provided with a playback logic control module, and the streaming media server comprises a live streaming module, a recording module, a recording callback module and a video on-demand module; the playback logic control module refers to a client interface for users to watch videos, which can be a PC or a client on a mobile device, as long as it supports the RTSP protocol; the user controls the viewing time period (the parameter part of the URL attached to the RTSP request), jumps (RTSP signaling Range parameter), pauses and other operations (RTSP Pause signaling) through the client; the user can watch the highlights that have occurred at any time, or the multimedia audio and video data at a time point close to the real-time live broadcast time point. The playback logic control module is used to receive customer operations and generate corresponding RTSP streaming requests; the live streaming module is used to pull real-time data. The obtained data source is pulled by the client to watch the real-time stream on the one hand, and the data is sent to the recording module and stored in real time as file segments for use by the on-demand module on the other hand; the recording control module is used to receive real-time streams and store them in multiple MP4 files, and the callback module notifies the client and the on-demand module of file updates; the recording callback module is used to promptly call back the real-time generated information of each recording segment to the client and the on-demand module; the on-demand module is used to receive the client's RTSP streaming request, read the recording segment corresponding to the live source, and output the media stream for the client to watch at real clock intervals.
[0027] In a streaming media on-demand system according to another embodiment of the present invention, the video recording control module is used to receive the real-time stream, store it into multiple MP4 files, and the callback module notifies the client and the on-demand module of the update of the files, which specifically includes:
[0028] The application layer controls the streaming media server, starts pulling live broadcasts, turns on the recording function of the live stream, and presets the duration of a recording segment; the application layer is a master control program that integrates the streaming media server and responds to client requests;
[0029] The real-time stream is parsed and transferred to the video module. The video module uses whether a key frame is encountered and whether the length of the video segment reaches the preset segment length as the end mark of the file segment;
[0030] Each file segment is encapsulated into a post-indexed MP4 file and stored in the disk space, recording information including the start time, end time, time period, storage location and file size of the file segment.
[0031] In a streaming media on-demand system according to another embodiment of the present invention, the video call back module is used to call back the real-time generated information of each video clip to the client and the on-demand module in a timely manner, and specifically includes:
[0032] The callback module registers the video callback function after the program starts;
[0033] When the recording module starts recording for the first time, and after each separate file segment is generated, a callback is triggered to inform the client of the complete information of the recording file, including the start time, end time, storage location of the segment duration, and the corresponding live source;
[0034] If a user requests this media source on demand during recording, and there is a corresponding information record in the on-demand-live source information dictionary, the newly generated file segment information will be passed to the corresponding instance of the on-demand module and recorded in real time in the on-demand running program, so that the client user can know the media viewing progress in time, and the on-demand module can obtain the file information of the approximate live broadcast time in time.
[0035] Specifically, the on-demand-live source information dictionary records the on-demand stream id and the live stream id together, so that the real-time live module is associated with the on-demand module. The "on-demand-live source" information dictionary is used to associate the real-time live module with the on-demand module. In general, on-demand and live broadcast are two unrelated modules, and what is seen on-demand is a past video clip. However, in this example, in order to share the video clip information generated in real time by the live module with the on-demand module (the on-demand module can always get the latest video clip during on-demand viewing), a data dictionary records the on-demand stream id (a parameter required for on-demand operation) and the live stream id (a required parameter for generating a live stream) together. In this way, after generating the video clip, the video callback module knows which on-demand instance to send the clip information to (there may be many people on-demand for the same video clip, so there will be multiple on-demand instances, and not every on-demand user needs to watch future videos, so this dictionary is needed to record specific information).
[0036] In a streaming media on-demand system according to another embodiment of the present invention, the RTSP streaming request carries parameters including the start time StartTime and the end time EndTime, and carries the live source information parameters. For example: the current time is 14:00, the live broadcast starts at 13:00 and ends at 16:00, and the latest delay will not exceed 24:00 on the same day), then the on-demand URL (RTSP request) carries the parameters StartTime=14:00, EndTime=24:00; and carries the live source information parameters, so as to be recorded in the "on-demand-live source" dictionary, so that the live streaming video can be updated to the on-demand module in real time. The RTSP request can be controlled by signaling to jump to the specified time, as well as Pause and Scale speed, so as to facilitate the client user to watch the time period of interest. The length of the video clip should not be too long to ensure that the clips that are close to the live broadcast can be updated to the on-demand module and the client in time, so that customers can watch the current latest status of the video without switching between "historical playback" and "real-time live broadcast", and can also switch back to the wonderful review at any time.
[0037] Because a video clip can only be played after a complete file is generated for this clip, the length of the video clip should not be set too long. Otherwise, when the user jumps to a time period that is close to real time, the picture he sees will be greatly delayed compared with the actual real-time stream. This delay is affected by the length of the video clip. Of course, live broadcasts generally have frequent screen switching, so the GOP will not be too large, which is just right for setting a smaller MP4 video clip length to ensure a certain degree of real-time performance.
[0038] Through the above-set streaming media on-demand system, when there is a live program and the user does not have high requirements for real-time performance:
[0039] The application layer (the master control program that controls the streaming media server and responds to the on-demand request from the client) is controlled by the user, pulls the live stream, generates a live stream id, which is subsequently used to detect the "on-demand-live source" dictionary and start the real-time stream recording module for recording. The preset interval of the recording segment should be as short as ten seconds, not too long; usually the generation of a recording segment is determined by two factors, one is the preset duration of a single recording segment, and the other is encountering a video key frame. When the stored segment duration is greater than or equal to this preset duration and encounters a key frame, the recording of the next segment is started, and the time information and file information of the segment are recorded and stored on disk);
[0040] On the one hand, the video clips generated in real time will be stored in the hard disk recorder (disk storage) so that users can watch them at any time. When they are recorded in the disk, the start time StartTime, end time EndTime, duration duration, and storage location path of each file will be recorded at the same time; on the other hand, if a user requests a video on demand, the file information will be transmitted to the video on demand module and the client through the video callback module;
[0041] When users search for live content, the application layer feeds back media information (live source ID), recording progress (EndTime-StartTime), and storage location of recorded clips to the client, allowing users to watch recorded clips on demand by clicking;
[0042] The user clicks on the interface to watch multimedia, and the client's underlying program uses the RTSP protocol to play the video clips in the streaming media service on demand. The on-demand address contains the start time StartTime of the viewing, the end time EndTime [future time, the time when the live broadcast has ended], the location of the on-demand file, the live stream id, the on-demand id and other information. It should be noted here that the on-demand id is unique to avoid mixing the viewing progress of multiple users. The multimedia clips located on the server disk are pulled. The streaming media service reads the file fragments on the disk as an intermediary and sends each frame of audio and video to the client according to the real clock interval.
[0043] On-demand address example:
[0044] rtsp: / / 127.0.0.1:554 / record / playback_1? path= / test / data / 20240101&startTime=20240101130000&endTime=20240102000000&SrcId=camera_strream_1
[0045] On-demand id = playback_1 Single-person control, different for each user;
[0046] path sets the storage path of the video (the one fed back to the client by the streaming service);
[0047] Internally, the video clips stored on the disk are searched sequentially to search and collect the files in the on-demand time period;
[0048] Set the video source id (SrcId) to notify the VOD module in time after the video clips of the live stream are generated.
[0049] As the recording and on-demand video are continuously being processed, each time a video is generated, the recording callback module will notify the on-demand video module and the client, so that the client can update the on-demand video time progress in the interface, and the on-demand video module can read the latest video clip content. The recording callback module will detect the "on-demand-live source" dictionary, which stores <on-demand id, live source id>;
[0050] The client user can drag the progress bar to the time period of interest (past time). The client's underlying program will first send a Pause signaling (RTSP protocol signaling) to the streaming service to pause the streaming media and send data to the client. Then, the dragged time point will be sent to the streaming service through the Range field of the Play signaling. The streaming service will first find the file segment at this time point, parse the MP4 file, and jump to the key frame near this time point (the stss in the MP4 records the video key frame information. The MP4 file is parsed and the key frame closest to the corresponding time point is read to ensure that the client displays the picture in time) to read the data and transmit it to the client.
[0051] Since the end time of the user's on-demand video is in the future, as long as the live broadcast does not end, there will be a continuous stream of video clips generated and notified to each client, and the user can continuously switch between the videos of the historical and latest time periods;
[0052] The client program should pay attention to controlling the progress bar, updating the latest viewing duration EndTime-StartTime, and reserve a delay to ensure playback continuity. For example, the latest segment is 2024 / 01 / 01 / 13-59-00 to 2024 / 01 / 01 / 13-59-30, and the next latest segment is 2024 / 01 / 01 / 13-58-30 to 2024 / 01 / 01 / 13-59-00, then the client update progress is best to be EndTime=2024 / 01 / 01 / 13- 59-00 (the end time of the client progress bar); if the user interface is updated with the latest time immediately, it is possible that the user will directly drag to 2024 / 01 / 01 / 13-59-30 seconds, and after watching for one second, the new video clip has not been generated yet (the next latest clip is 2024 / 01 / 01 / 13-59-30 to 2024 / 01 / 01 / 14-00-00, which will not be generated until 14 o'clock), so it is impossible to watch it in time; therefore, the client and server programs must cooperate to set a delay strategy for a certain period of time.
[0053] Through the above-set streaming media on-demand system, multimedia audio and video can be watched in on-demand mode. When the user operates the client player and clicks to watch, the streaming media server will pull the stream in real time and record the video, inform the on-demand module of the real-time recording information, and update the on-demand content time period. After the on-demand module outputs a frame of data, it will update the length of the recording segment in time to achieve the purpose of continuously playing the latest media stream; the on-demand process can also control the jump history through signaling, so that the highlights can be watched at any time.
[0054] It should be understood that the exemplary embodiments described herein are illustrative rather than restrictive. Although one or more embodiments of the present invention have been described in conjunction with the accompanying drawings, it should be understood by those skilled in the art that various changes in form and detail may be made without departing from the spirit and scope of the present invention as defined by the appended claims.
Claims
1. A streaming media on-demand system, characterized in that: It includes a client and a streaming media server, wherein the client is provided with a playback logic control module, and the streaming media server includes a live streaming module, a video recording module, a video recording callback module and a video-on-demand module; The playback logic control module supports the RTSP protocol; The playback logic control module is used to receive the client's operation and generate a corresponding RTSP streaming request; The live streaming module is used to pull real-time data. The obtained data source is pulled by the client to watch the real-time stream. On the other hand, the data is sent to the recording module and stored in real time as file segments for use by the on-demand module. The video recording control module is used to receive the real-time stream, store it into multiple MP4 files, and notify the client and the on-demand module of the update of the files through the callback module; The video call back module is used to call back the real-time generated information of each video clip to the client and the on-demand module in a timely manner; The on-demand module is used to receive the RTSP stream pulling request from the client, read the video clip corresponding to the live source, and output the media stream to the client for viewing at real clock intervals.
2. The streaming media on-demand system according to claim 1, characterized in that: The video recording control module is used to receive the real-time stream, store it into multiple MP4 files, and notify the client and the on-demand module of the file update status through the callback module, specifically including: The application layer controls the streaming media server, starts pulling live broadcasts, turns on the recording function of the live stream, and presets the duration of a recording segment; the application layer is a master control program that integrates the streaming media server and responds to client requests; The real-time stream is parsed and transferred to the video module. The video module uses whether a key frame is encountered and whether the length of the video segment reaches the preset segment length as the end mark of the file segment; Each file segment is encapsulated into a post-indexed MP4 file and stored in the disk space, recording information including the start time, end time, time period, storage location and file size of the file segment.
3. The streaming media on-demand system according to claim 1, characterized in that: The video call back module is used to call back the real-time generated information of each video clip to the client and the on-demand module in a timely manner, and specifically includes: The callback module registers the video callback function after the program starts; When the recording module starts recording for the first time, and after each separate file segment is generated, a callback is triggered to inform the client of the complete information of the recording file, including the start time, end time, storage location of the segment duration, and the corresponding live source; If a user requests this media source on demand during recording, and there is corresponding information record in the on-demand-live source information dictionary, the newly generated file segment information will be passed to the corresponding instance of the on-demand module and recorded in real time in the on-demand running program.
4. The streaming media on-demand system according to claim 3, characterized in that: The on-demand-live source information dictionary records the on-demand stream ID and the live stream ID together, thereby associating the real-time live broadcast module with the on-demand module.
5. The streaming media on-demand system according to claim 1, characterized in that: The RTSP stream pull request carries parameters including a start time StartTime and an end time EndTime, and carries live source information parameters.
