Video file production method based on SRS, background server and system

文档序号:956382 发布日期:2020-10-30 浏览:5次 中文

阅读说明:本技术 一种基于srs的视频文件生产方法、后台服务器和系统 (Video file production method based on SRS, background server and system ) 是由 朱正辉 张常华 赵定金 于 2020-07-21 设计创作,主要内容包括:本发明公开了一种基于SRS的视频文件生产方法、后台服务器和系统,包括以下步骤:S1:获取直播视频流,并由SRS自动按预设顺序生成ts视频文件和第二索引文件,同时根据需要录制视频的起始时间和结束时间对ts文件进行编号;S2:通过预先录入的录制文件分析脚本遍历ts视频文件,再动态获取ts视频文件的文件特征信息,组装生成第一索引文件;S3:将步骤S2循环到的ts视频文件和生成的第一索引文件均复制到指定目录中。在本发明中,通过由ts视频文件的文件特征信息组装生成第一索引文件对ts视频文件进行播放,以使得ts视频文件无需再通过转码成其他格式或者进行额外的合并,即可适于终端进行播放,避免耗费大量时间去将ts视频文件进行合成或者转码。(The invention discloses a video file production method based on SRS, a background server and a system, comprising the following steps: s1: acquiring a live video stream, automatically generating a ts video file and a second index file according to a preset sequence by the SRS, and numbering the ts file according to the starting time and the ending time of the video to be recorded; s2: traversing the ts video file through a recording file analysis script which is input in advance, then dynamically acquiring file characteristic information of the ts video file, and assembling to generate a first index file; s3: the ts video file to which the loop of step S2 is looped and the generated first index file are both copied into the specified directory. In the invention, the ts video file is played by generating the first index file by assembling the file characteristic information of the ts video file, so that the ts video file can be played by a terminal without transcoding into other formats or extra merging, and the ts video file is prevented from being synthesized or transcoded by consuming a large amount of time.)

1. A video file production method based on SRS is characterized by comprising the following steps:

s1: acquiring a live video stream, generating a ts video file according to a preset sequence, and numbering the ts file according to the start time and the end time of a video to be recorded;

s2: traversing the ts video file through a recording file analysis script which is input in advance, then dynamically acquiring file characteristic information of the ts video file, and assembling to generate a first index file;

s3: the ts video file and the first index file are both copied to the specified directory.

2. The SRS-based video file production method according to claim 1, wherein the step S1 is implemented by the steps of:

s11: acquiring a live video stream, generating a plurality of ts video files according to the live video stream in a preset sequence by configuring an SRS (sounding reference signal) distribution mode, numbering the ts files according to the start time and the end time of a video to be recorded, and storing the ts files in a storage;

S12: generating a second index file and storing the second index file to a storage;

s13: and playing the ts video file according to the preset sequence through the second index file.

3. The SRS-based video file production method according to claim 2, wherein: the preset sequence is a time sequence for playing the live video stream signal pictures.

4. The SRS-based video file production method according to claim 2, wherein: the SRS distribution mode is an HLS distribution mode.

5. The SRS-based video file production method according to claim 1, wherein the step S2 is implemented by the steps of:

s21: analyzing a SHELL script traversal ts video file through a recording file which is recorded in advance;

s22: and dynamically acquiring file characteristic information of the ts video file through an FFprobe command, and dynamically assembling the ts video file into a first index file.

6. The SRS-based video file production method according to claim 1, wherein: the file characteristic information comprises the name, the number and the playing time length of the ts video file.

7. A video file production background server based on SRS is characterized in that: comprises a storage and a processor;

a memory for storing program instructions;

A processor for executing the program instructions to perform the SRS-based video file production method according to any one of claims 1 to 6.

8. A video file production system based on SRS, characterized in that: comprising the SRS-based video file production backend server, the live device and the playback device according to claim 7, wherein the live device and the playback device are connected to the SRS-based video file production backend server.

Technical Field

The invention relates to the technical field of video processing, in particular to a video file production method based on SRS, a background server and a system.

Background

Srs (simple RTMP server) is a very excellent open source streaming media server software, which can be used in various scenes such as live broadcast/recorded broadcast/video customer service, and its location is an operation-level internet live broadcast server cluster.

Currently, there are two methods for generating a recording file in a system (non-CDN deployment) that provides both live broadcast service and on-demand playback service in the market. Firstly, when a live broadcast device without a recording function (such as a camera and a third-party live broadcast stream) is docked, a live broadcast server is required to record an MP4 file at first, then the MP4 file is compatible with the broadcast of a mobile terminal, and the MP4 file is required to be transcoded into other formats suitable for the broadcast of the mobile terminal, such as M3U8, so that complete on-demand service can be provided; and secondly, butt-jointing live broadcast equipment with a recording function (company own live broadcast equipment or a universal third-party live broadcast product), butt-jointing through a TCP (transmission control protocol), controlling the live broadcast equipment to record, pause and stop to generate a recorded file, after the live broadcast is finished, the live broadcast equipment returns the recorded file to an appointed directory of a live broadcast server through an FTP (file transfer protocol) protocol and a pre-established FTP (file transfer protocol) service, then the live broadcast server scans the appointed directory again, and the recorded file is matched with, associated with or even updated in a database with live broadcast information. After recording the file, in order to be compatible with the mobile terminal playing, transcoding to another format suitable for the mobile terminal playing, for example, M3U8, is also required to provide the complete on-demand service. No matter which way produces the recording file, this process is all very complicated, not only make mistakes easily, but also waste time and energy, in addition live broadcast time is longer, the recording file that comes out follow-up is bigger, later transcoding time is longer, and because soft coding is long-consuming, so this process is consuming time very long, also can not release for a long time to the occupation of system resource simultaneously, and final result is that the video on demand service provides can seriously delay and lag, and user experience is relatively poor.

Disclosure of Invention

In order to overcome the disadvantages of the prior art, it is an object of the present invention to provide a method for producing a video file based on SRS, which can solve the problem that the provision of a video on demand service may be severely delayed and delayed.

The invention also aims to provide a video file production background server based on the SRS, which can solve the problems of serious delay and lag in the provision of the video-on-demand service.

It is a further object of the present invention to provide a video file production system based on SRS which can solve the problem that the provision of the video on demand service may be severely delayed and delayed.

In order to achieve one of the above purposes, the technical scheme adopted by the invention is as follows:

a video file production method based on SRS includes the following steps:

s1: acquiring a live video stream, generating a ts video file according to a preset sequence, and numbering the ts file according to the start time and the end time of a video to be recorded;

s2: traversing the ts video file through a recording file analysis script which is input in advance, then dynamically acquiring file characteristic information of the ts video file, and assembling to generate a first index file;

s3: the ts video file and the first index file are both copied to the specified directory.

Preferably, the step S1 is implemented by the following steps:

s11: acquiring a live video stream, generating a plurality of ts video files according to the live video stream in a preset sequence by configuring an SRS (sounding reference signal) distribution mode, numbering the ts files according to the start time and the end time of a video to be recorded, and storing the ts files in a storage;

s12: generating a second index file and storing the second index file to a storage;

s13: and playing the ts video file according to the preset sequence through the second index file.

Preferably, the preset sequence is a time sequence of playing live video stream signal pictures.

Preferably, the SRS distribution method is an HLS distribution method.

Preferably, the step S2 is implemented by the following steps:

s21: analyzing a SHELL script traversal ts video file through a recording file which is recorded in advance;

s22: and dynamically acquiring file characteristic information of the ts video file through an FFprobe command, and dynamically assembling the ts video file into a first index file.

Preferably, the file characteristic information includes a name, a number and a play time of the ts video file.

In order to achieve the second purpose, the technical scheme adopted by the invention is as follows:

a video file production background server based on SRS comprises a storage and a processor;

A memory for storing program instructions;

and the processor is used for operating the program instructions to execute the video file production method based on the SRS.

In order to achieve the third purpose, the technical scheme adopted by the invention is as follows:

a video file production system based on SRS comprises the video file production background server based on SRS, live broadcast equipment and playing equipment, wherein the live broadcast equipment and the playing equipment are connected with the video file production background server based on SRS.

Compared with the prior art, the invention has the beneficial effects that: the method comprises the steps of generating a ts video file and a dynamic second index file from a live video stream through an HLS distribution function of an SRS, playing the ts video file by utilizing the dynamic second index file, keeping the current live broadcast at a low delay and playing compatibility of terminal equipment, reducing the influence of the current live broadcast, dynamically assembling a first index file by adopting file characteristic information, storing the first index file and the ts video file into a directory which can be accessed by an HTTP server, enabling a user to directly access a stream media address of a point broadcast, normally playing the stream media address by loading a player, and providing video on demand service for the user as soon as possible without any coding or transcoding operation in the playing process.

Drawings

Fig. 1 is a flowchart of a video file production method based on SRS according to the present invention.

Detailed Description

The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.

In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.

In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.

The invention will be further described with reference to the accompanying drawings and the detailed description below:

in the invention, the live broadcast equipment can be equipment without a recording function (without limiting butt joint equipment), a TCP (transmission control protocol) is not required to be customized to control the live broadcast equipment, an FTP (file transfer protocol) system is not required to be built, the deployment of a recorded file scanning service is avoided, the playing equipment can be equipment such as a computer and a mobile phone which can log in an HTTP server, and the specified directory is a directory which can be accessed by the HTTP server.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种音视频传输方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类