CN107770131B - Streaming media recording method based on nginx server - Google Patents
Streaming media recording method based on nginx server Download PDFInfo
- Publication number
- CN107770131B CN107770131B CN201610681762.1A CN201610681762A CN107770131B CN 107770131 B CN107770131 B CN 107770131B CN 201610681762 A CN201610681762 A CN 201610681762A CN 107770131 B CN107770131 B CN 107770131B
- Authority
- CN
- China
- Prior art keywords
- recording
- server
- name
- interface
- stop
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/1066—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/27—Server based end-user applications
- H04N21/274—Storing end-user multimedia data in response to end-user request, e.g. network recorder
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Multimedia (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Television Signal Processing For Recording (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a streaming media recording method based on a nginx server, which comprises the following steps: the live broadcast push flow client carries out push flow, and the push flow name is defined as the push flow name; requesting a starting interface for informing a server of starting recording in a terminal, and transmitting parameters such as the server, an application program, a name and the like; after receiving the starting request, the server starts traversing all current servers and matches the server item named as a memory, and the process is defined as server query; and after finding the memory item, the server starts to traverse all current applications and matches the application program item named as a recording program, and the process is defined as steps of application program query and the like. The invention can flexibly control the live broadcast recording and playback file function, save server resources and enhance the performance of the server.
Description
Technical Field
The invention relates to a streaming media recording method, in particular to a streaming media recording method based on an nginx server.
Background
According to the traditional Internet audio and video live broadcast recording technology, an automatic recording item is configured in a configuration file of an nginx server, the format of the recording file is configured, when a client carries out live broadcast stream pushing, the server automatically records when receiving live broadcast streams, and the live broadcast streams are stored as video files in a specified format.
In the traditional live recording technical scheme, the following disadvantages are provided: because the recording and playback file functions of live broadcasts generally need flexible control, some users need the playback function, and some users do not need the playback function, the traditional scheme records all live broadcasts, certainly wastes certain server resources, and influences certain server performance.
Disclosure of Invention
The invention aims to solve the technical problem of providing a streaming media recording method based on an nginx server, which can flexibly control the live broadcast file recording and playback function, save server resources and enhance the server performance.
The invention solves the technical problems through the following technical scheme: a method for recording streaming media based on a nginx server comprises the following steps:
the method comprises the following steps: the live broadcast push flow client carries out push flow, and the push flow name is defined as the push flow name;
step two: requesting a starting interface for informing a server to start recording in a terminal, and transmitting a server item, an application program item and a name item parameter into the terminal, wherein the server item in the parameters is defined as a memory, the application program item is defined as a recording program, the name item is defined as a recording name, and the starting interface is an http interface for indicating the start of recording;
step three: after receiving a starting request of a starting interface for informing the server of starting recording, the server starts traversing all current servers, and server items with names of memories are matched in all current servers, wherein the process is defined as the query of the server;
step four: after finding the memory, the server starts to traverse all current application programs, and matches application program items with names of recording programs in all the current application programs, wherein the process is defined as the query of the application programs;
step five: after finding out a recording program, the server starts to traverse all current live streams and judges whether the live streams with the recorded names exist in all the current live streams or not;
step six: when the recording name is equal to the push stream name of the live stream pushed in the first step, traversing the streaming media technology and session control corresponding to the push stream name, and recording;
step seven: if the recording name is not equal to the stream pushing name, namely when the live stream with the same name as the recording name cannot be found, the live stream is determined not to be published, recording cannot be carried out, but the recording name is stored, and when the live stream with the same name as the recording name is pushed, recording is carried out again;
step eight: when a user needs to stop recording, a terminal requests a stop interface for informing a server to stop recording, wherein the stop interface is an http interface for indicating to stop recording;
step nine: the principle of stopping the interface is the same as the principle of starting the interface in the steps two to seven.
Preferably, the http interface for instructing to start recording in the second step and the http interface for instructing to stop recording in the eighth step are invoked to help flexibly control a live broadcast recording file function.
Preferably, the stream names and the record names in the sixth step and the seventh step are compared, and the streams with unequal names are not recorded, so that the server resources are saved, and the performance of the server is enhanced.
Preferably, the streaming media recording method based on the nginx server solves the problem that whether the recording function is completely controlled by a user, the server provides the http interface which is used for instructing to start recording and the http interface which is used for instructing to stop recording, the http interface which is used for instructing to start recording has the function of informing the server to start recording, the http interface which is used for instructing to stop recording has the function of informing the server to stop recording, when the user needs to record, the http interface which is used for informing to record and instructing to start recording is called, and when the user needs to stop recording, the http interface which is used for instructing to stop recording is called.
The positive progress effects of the invention are as follows: the invention has the following advantages:
firstly, a http interface mode is used to enable the recording function to be more flexible;
secondly, the used http interface is not limited by a plug flow time sequence, the http interface can be requested after plug flow, or the http interface can be requested before plug flow, so that the server can record;
and thirdly, if the recording interface is requested in advance before stream pushing, the recording is carried out when the stream pushing is carried out, and data loss can be avoided.
Drawings
FIG. 1 is a flow chart of the present invention.
Detailed Description
The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that variations and modifications can be made by persons skilled in the art without departing from the spirit of the invention. All falling within the scope of the present invention.
As shown in fig. 1, the streaming media recording method based on nginx server of the present invention includes the following steps:
the method comprises the following steps: the live broadcast push stream client carries out push stream, and the push stream name is defined as a push stream name (publish _ name);
step two: requesting a Start interface (Start) for informing a Server of starting recording in a terminal, and transmitting the Start interface (Start) into parameters such as a Server (defined as a memory (record _ Server)), an application (App) (defined as a recording program (record _ App)), a Name (Name) (defined as a recording Name (record _ Name)), and the like, wherein the Start interface is an http interface for indicating the Start of recording;
step three: after receiving a Start request for notifying a Server of starting recording, the Server starts traversing all current servers (servers), and matches a Server (Server) item named as a memory (record _ Server) in all current application programs, wherein the process is defined as query (WalkServer) of the Server;
step four: after finding the memory (record _ server), the server starts to traverse all current applications, and matches an application program (app) item with the name of a record program (record _ app) in all current application programs, wherein the process is defined as query (WalkApp) of the application program;
step five: after finding out the recording program (record _ app), the server starts to traverse all current live streams and judges whether the live streams with the names of recording names (record _ names) exist in all the current live streams or not;
step six: when the recording name (record _ name) is equal to the push Stream name (publish _ name) of the live Stream pushed in the first step, traversing the streaming media technology (Stream) (defined as streaming media query) and Session control (Session) (defined as Session query) corresponding to the push Stream name, and recording;
step seven: if the recording name (record _ name) is not equal to the push stream name (publish _ name), namely when the live stream with the same name as the recording name (record _ name) cannot be found, the live stream is determined not to be published, recording cannot be carried out, but the recording name (record _ name) is stored, and when the live stream with the same name as the recording name (record _ name) is pushed, recording is carried out;
step eight: when a user needs to Stop recording, a Stop (Stop) interface which is used for requesting to inform a server to Stop recording in a terminal is used, and the Stop interface is an http interface for indicating the Stop of recording;
step nine: the principle of the Stop (Stop) interface is the same as that of the Start (Start) interface in steps two to seven.
And calling an http interface for indicating to start recording in the step two and an http interface for indicating to stop recording in the step eight to help flexibly control the live broadcast recording file function.
Comparing the stream pushing name and the recording name in the sixth step and the seventh step, and not recording the streams with unequal names, thereby saving server resources and enhancing the performance of the server.
The streaming media recording method based on the nginx server solves the problem that whether the recording function is completely controlled by a user, the server provides an http interface for instructing the user to start recording and an http interface for instructing the user to stop recording, the http interface for instructing the user to start recording has the function of informing the server to start recording, the http interface for instructing the user to stop recording has the function of informing the server to stop recording, when the user needs to record, the http interface for informing the user of instructing the user to start recording is called, and when the user needs to stop recording, the http interface for instructing the user to stop recording is called.
In conclusion, the invention can flexibly control the live broadcast recording and playback file function, save server resources and enhance server performance.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention.
Claims (1)
1. A method for recording streaming media based on a nginx server is characterized in that a http interface mode is used to enable the recording function to be more flexible; the used http interface is not limited by a plug flow time sequence, the http interface can be requested after plug flow, or the http interface can be requested before plug flow, so that the server can record; if the recording interface is requested in advance before stream pushing, recording can be carried out when stream pushing is carried out, and data loss can be avoided; the live broadcast recording and playback file function is flexibly controlled, server resources are saved, and the performance of the server is enhanced; the streaming media recording method based on the nginx server comprises the following steps:
the method comprises the following steps: the live broadcast push flow client carries out push flow, and the push flow name is defined as the push flow name;
step two: requesting a starting interface for informing a server to start recording in a terminal, and transmitting a server item, an application program item and a name item parameter into the terminal, wherein the server item in the parameters is defined as a memory, the application program item is defined as a recording program, the name item is defined as a recording name, and the starting interface is an http interface for indicating the start of recording;
step three: after receiving the request of the starting interface for informing the server to start recording, the server starts traversing all current servers, and server items with names of memories are matched in all current servers, wherein the process is defined as server query;
step four: after finding the memory, the server starts to traverse all current application programs, and application program items with the names of recording programs are matched in all the current application programs, wherein the process is defined as the query of the application programs;
step five: after finding out a recording program, the server starts to traverse all current live streams and judges whether the live streams with the names of recording exist in all the current live streams or not;
step six: when the recording name is equal to the stream pushing name of the live stream pushed in the first step, traversing the streaming media technology and session control corresponding to the stream pushing name, and recording;
step seven: if the recording name is not equal to the stream pushing name, namely when the live stream with the same name as the recording name cannot be found, the live stream is determined not to be published, recording cannot be carried out, but the recording name is stored, and when the live stream with the same name as the recording name is pushed, recording is carried out again;
step eight: when a user needs to stop recording, a terminal requests a stop interface for informing a server to stop recording, wherein the stop interface is an http interface for indicating to stop recording;
step nine: the principle of the stopping interface is the same as that of the starting interface in the second step to the seventh step;
the http interface which indicates to start recording in the step two and the http interface which indicates to stop recording in the step eight call a recording file function which is beneficial to flexibly controlling live broadcasting;
comparing the stream pushing name and the recording name in the sixth step and the seventh step, and not recording the streams with unequal names, thereby saving server resources and enhancing the performance of the server;
the streaming media recording method based on the nginx server solves the problem that whether the recording function is completely controlled by a user, the server provides two http interfaces which are called by the user and used for indicating to start recording and an http interface which is used for indicating to stop recording, the http interface which indicates to start recording has the function of informing the server to start recording, the http interface which indicates to stop recording has the function of informing the server to stop recording, when the user needs to record, the http interface which informs the user of recording to start recording is called, and when the user needs to stop recording, the http interface which indicates to stop recording is called.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610681762.1A CN107770131B (en) | 2016-08-17 | 2016-08-17 | Streaming media recording method based on nginx server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610681762.1A CN107770131B (en) | 2016-08-17 | 2016-08-17 | Streaming media recording method based on nginx server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107770131A CN107770131A (en) | 2018-03-06 |
CN107770131B true CN107770131B (en) | 2021-06-29 |
Family
ID=61261327
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610681762.1A Active CN107770131B (en) | 2016-08-17 | 2016-08-17 | Streaming media recording method based on nginx server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107770131B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111756681A (en) * | 2019-03-29 | 2020-10-09 | 北京金山云网络技术有限公司 | Streaming media cascade scheduling method and device, electronic equipment and storage medium |
CN115941983A (en) * | 2021-08-09 | 2023-04-07 | 广州市千钧网络科技有限公司 | Live playback video generation method and device, storage medium and electronic equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102340494A (en) * | 2010-07-28 | 2012-02-01 | 中国科学院沈阳计算技术研究所有限公司 | Manageable P2P (Peer-to-Peer) streaming media live broadcasting system based on IMS (IP Multimedia Subsystem) in NGN (Next Generation Network) and realization method thereof |
CN102413369A (en) * | 2011-11-14 | 2012-04-11 | 深圳市同洲电子股份有限公司 | On-demand method and on-demand system of digital television time-shifting programs |
CN103561285A (en) * | 2013-10-11 | 2014-02-05 | 深圳市同洲电子股份有限公司 | Program broadcasting method and network plug-flow server |
CN103607655A (en) * | 2013-11-15 | 2014-02-26 | 乐视网信息技术(北京)股份有限公司 | A playback method for live programs and an electronic device |
CN104683884A (en) * | 2015-02-09 | 2015-06-03 | 网宿科技股份有限公司 | Live method and system for stream medium |
CN105721811A (en) * | 2015-05-15 | 2016-06-29 | 乐视云计算有限公司 | Live video recording method and system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8412772B1 (en) * | 2011-09-21 | 2013-04-02 | Color Labs, Inc. | Content sharing via social networking |
-
2016
- 2016-08-17 CN CN201610681762.1A patent/CN107770131B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102340494A (en) * | 2010-07-28 | 2012-02-01 | 中国科学院沈阳计算技术研究所有限公司 | Manageable P2P (Peer-to-Peer) streaming media live broadcasting system based on IMS (IP Multimedia Subsystem) in NGN (Next Generation Network) and realization method thereof |
CN102413369A (en) * | 2011-11-14 | 2012-04-11 | 深圳市同洲电子股份有限公司 | On-demand method and on-demand system of digital television time-shifting programs |
CN103561285A (en) * | 2013-10-11 | 2014-02-05 | 深圳市同洲电子股份有限公司 | Program broadcasting method and network plug-flow server |
CN103607655A (en) * | 2013-11-15 | 2014-02-26 | 乐视网信息技术(北京)股份有限公司 | A playback method for live programs and an electronic device |
CN104683884A (en) * | 2015-02-09 | 2015-06-03 | 网宿科技股份有限公司 | Live method and system for stream medium |
CN105721811A (en) * | 2015-05-15 | 2016-06-29 | 乐视云计算有限公司 | Live video recording method and system |
Non-Patent Citations (1)
Title |
---|
《低成本Flash Media Server视频直播架构方案》;张戈;《信息安全与技术》;20121130;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN107770131A (en) | 2018-03-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11350139B2 (en) | Video live broadcast method and apparatus | |
US9609371B2 (en) | Online video playing method and video playing server | |
CN107483627B (en) | File distribution method, file download method, distribution server, client and system | |
JP4813001B2 (en) | Media resynchronization during streaming | |
US7574514B2 (en) | Systems and methods for identifying original streams of media content | |
US10015222B2 (en) | Systems and methods for selective retrieval of adaptive bitrate streaming media | |
US20160323647A1 (en) | Video sharing method and system in smart tv | |
CA2840106A1 (en) | Offline download method, multimedia file download method and system thereof | |
CN106301865B (en) | Data processing method and device applied to service providing device | |
US9055268B2 (en) | Multi-tier recorder to enable seek-back unique copy recording | |
WO2015050651A1 (en) | Downloading media objects | |
KR20110101051A (en) | Method and apparatus for generating bookmark information | |
CN107770624B (en) | Method and device for playing multimedia file in live broadcast process and storage medium | |
US11889163B2 (en) | Receiving device, receiving method, transmitting device, and transmitting method | |
TW202002662A (en) | Methods and apparatus for updating media presentation data | |
CN110198494B (en) | Video playing method, device, equipment and storage medium | |
CN110620828A (en) | File pushing method, system, device, electronic equipment and medium | |
CN107770131B (en) | Streaming media recording method based on nginx server | |
CN106331089A (en) | Video play control method and system | |
CN111064980A (en) | Cloud-based audio and video playing control method and system | |
US8359627B2 (en) | Method and apparatus for realizing PVR using home network device | |
CN103747326A (en) | Continuous playing method and device for multimedia file | |
US8055779B1 (en) | System and method using data keyframes | |
WO2018019167A1 (en) | Set top box-based live sharing method and system | |
US10498787B2 (en) | Communication apparatus, communication method, and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |