CN110753234A - Real-time conversion method for converting national standard PS stream into RTMP live stream - Google Patents

Real-time conversion method for converting national standard PS stream into RTMP live stream Download PDF

Info

Publication number
CN110753234A
CN110753234A CN201910941106.4A CN201910941106A CN110753234A CN 110753234 A CN110753234 A CN 110753234A CN 201910941106 A CN201910941106 A CN 201910941106A CN 110753234 A CN110753234 A CN 110753234A
Authority
CN
China
Prior art keywords
packet
stream
rtmp
rtp
video
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.)
Pending
Application number
CN201910941106.4A
Other languages
Chinese (zh)
Inventor
毕凯强
万森
刘子龙
陈小奇
刘琼
张敬锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ANHUI YUNSEN INTERNET OF THINGS TECHNOLOGY Co Ltd
Original Assignee
ANHUI YUNSEN INTERNET OF THINGS TECHNOLOGY Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by ANHUI YUNSEN INTERNET OF THINGS TECHNOLOGY Co Ltd filed Critical ANHUI YUNSEN INTERNET OF THINGS TECHNOLOGY Co Ltd
Priority to CN201910941106.4A priority Critical patent/CN110753234A/en
Publication of CN110753234A publication Critical patent/CN110753234A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/21Server components or server architectures
    • H04N21/218Source of audio or video content, e.g. local disk arrays
    • H04N21/2187Live feed
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4782Web browsing, e.g. WebTV
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols
    • H04N21/6437Real-time Transport Protocol [RTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/858Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot
    • H04N21/8586Linking data to content, e.g. by linking an URL to a video object, by creating a hotspot by using a URL

Abstract

The invention discloses a real-time conversion method for converting national standard PS stream into RTMP live stream, belonging to the technical field of video and comprising the following steps: s1, receiving RTP data packet of PS stream from stream receiving port, searching first RTP packet of PS packet head, then putting RTP packet of PS packet into PS packet buffer, checking whether RTP packet Sequence is continuous, if not, buffer is cleared; s2, analyzing the RTP packet in the PS packet buffer, continuously receiving the RTP packet and putting the RTP packet into the PS packet buffer at the same time until a complete PS packet is received, analyzing the video data of the load in the complete PS packet and putting the video data into the video H.264 buffer; s3, the H.264 data disassembled from the PS packet is disassembled into frames, and each whole H.264 frame is put into a frame buffer; and S4, packaging the complete H.264 frame into the RTMP, and then pushing the RTMP to the RTMP streaming media server through the URL. The method and the device solve the problem that the browser cannot directly play the video stream in the public safety field and needs to use plug-ins.

Description

Real-time conversion method for converting national standard PS stream into RTMP live stream
Technical Field
The invention belongs to the technical field of videos, and particularly relates to a real-time conversion method for converting national standard PS (packet switched) stream into RTMP (real time Messaging protocol) live stream.
Background
The PS Stream is called a Program Stream (Program Stream), and a plurality of components of a Program are organized according to their correlation systems and added to the Stream after the relationship description of each component. A PS stream is a kind of package container for multiplexing digital audio, video, etc., and is a stream in which one or more PES streams having a common time reference are combined into one integral stream, mainly for program storage. The packet length is not fixed and is long, once the synchronization information is lost, the receiver cannot determine the synchronization position of the next packet, so that the loss of synchronization is caused, and the serious information loss is caused.
RTMP is a Real Time Messaging Protocol. The protocol is based on TCP and is a protocol family, comprising various variants of RTMP basic protocol and RTMPT/RTMPS/RTMPE. RTMP is a network protocol designed for real-time data communication, and is mainly used for audio-video and data communication between a Flash/AIR platform and a streaming media/interaction server supporting the RTMP protocol.
In the field of internet live broadcast, protocols such as RTMP and HLS adopted by a mainstream live broadcast protocol can be used for directly watching videos on a webpage without any plug-in, so that the method is very convenient. In the public security field of today, the device cascade is mainly performed through GB/T-28181, and the media stream in GB/T-28181 is a PS stream of RTP payload, and the payload video format in the PS stream is H.264. Because the WEB browser cannot directly support the on-demand of the PS stream, the user needs to install a plug-in to play the PS stream, the plug-in needs to be adapted to various browsers and various operating systems, the plug-in compatibility is poor, and the user experience is also poor. Moreover, the browser company needs to develop corresponding plug-ins, extra development workload is needed, and manpower and material resources are wasted. Therefore, a system for converting national standard PS stream into RTMP stream is needed, and the video in the public security field is converted into the internet live broadcast field.
Disclosure of Invention
Aiming at the defects of the prior art, the invention aims to provide a real-time conversion method for converting national standard PS (packet switched) stream into RTMP (real time Messaging protocol) live stream, and solves the problem that a browser cannot directly play video stream in the public security field and needs to use a plug-in.
The purpose of the invention can be realized by the following technical scheme:
a real-time conversion method for converting national standard PS stream to RTMP live stream includes the following steps:
s1: firstly, receiving RTP data packets loaded with PS streams from a stream receiving port, searching a first RTP packet loaded with a PS packet header, then putting the RTP packet loaded with the PS packet into a PS packet cache, checking whether the Sequence of the RTP packet is continuous or not, and if not, emptying the cache;
s2: analyzing the RTP packet in the PS packet cache, continuously receiving the RTP packet and putting the RTP packet into the PS packet cache until a complete PS packet is received, analyzing the video data loaded in the complete PS packet and putting the video data into a video H.264 cache;
s3: the H.264 data disassembled from the PS packet is subjected to frame disassembling, and each complete H.264 frame is placed into a frame buffer;
s4: packaging the complete H.264 frame into an RTMP, and then pushing the stream to an RTMP streaming media server through a URL (uniform resource locator);
as a preferred technical solution, the h.264 frame includes SPS, PPS, and key frame.
As a preferred technical scheme, a WEB browser or a VLC player pulls a stream to an RTMP streaming media server through a URL for video on demand.
The invention has the beneficial effects that:
1. the technical scheme provides a real-time conversion method for converting national standard PS stream into RTMP live stream, and the technical scheme enables a user to directly use a WEB browser VLC player to watch videos in the public safety field without installing corresponding browser plug-ins, so that the user experience is good, and the method is convenient and fast.
2. The technical scheme provides a real-time conversion method for converting national standard PS stream into RTMP live stream, the method has high conversion efficiency, all conversion processes of the technical scheme are completed on a server, a terminal for receiving the RTMP stream, such as a WEB browser or a VLC player, does not need the conversion process any more, the conversion calculation amount of the terminal for receiving the RTMP stream is reduced, and the energy consumption is reduced.
Drawings
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a flow inversion flow diagram of the present invention;
FIG. 2 is a flow timing diagram of the present invention;
FIG. 3 is a schematic diagram of a conversion system architecture;
FIG. 4 is a schematic diagram of a conversion system module assembly.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1-2, a method for converting a national standard PS stream to an RTMP live stream in real time includes the following steps:
s1: receiving RTP data packets loaded with PS streams from a stream receiving port, searching a first RTP packet loaded with a PS packet header, then putting the RTP packet loaded with the PS packet into a PS packet cache, checking whether the Sequence of the RTP packet is continuous or not, and if not, emptying the cache; the buffer emptying makes the process of the PS packet parsed in step S2 correct, and reduces the error probability of the PS packet parsing.
S2: analyzing the RTP packet in the PS packet cache, continuously receiving the RTP packet and putting the RTP packet into the PS packet cache until a complete PS packet is received, analyzing the video data loaded in the complete PS packet and putting the video data into a video H.264 cache;
s3: the H.264 data disassembled from the PS packet is subjected to frame disassembling, and each complete H.264 frame is placed into a frame buffer; because a PS packet may carry multiple frames of h.264, h.264 data removed from the PS packet needs to be removed from the frame, the h.264 data is removed by searching the start header of the h.264 (start header bit 0x00000001 or 0x000001 of h.264 transmitted by a network), and the data between two start headers is a complete h.264 frame;
s4: and packaging the complete H.264 frame into the RTMP, and then pushing the RTMP to the RTMP streaming media server through the URL.
Wherein the h.264 frames include SPS, PPS, key frames.
By the real-time conversion method for converting the national standard PS stream into the RTMP live stream, the WEB browser or the VLC player pulls the stream to the RTMP streaming media server through the URL for video on demand.
The Sequence of each RTP packet is automatically added with one, and the Sequence is used for detecting the packet loss condition by a receiving end.
As shown in fig. 3, the conversion system structure constructed by applying the real-time conversion method from the national standard PS stream to the RTMP live stream includes a stream conversion and an RTMP server, the camera generates PS packets to form PS streams to be uploaded to the stream conversion, the stream conversion uses the real-time conversion method from the national standard PS streams to the RTMP live stream to convert the PS streams to the RTMP streams and push the streams to the RTMP server, and the terminals such as the WEB browser and the VLC player pull the streams to the RTMP streaming media server through the URL to perform video on demand.
As shown in fig. 4, the module component of the conversion system constructed by applying the real-time conversion method from the national standard PS stream to the RTMP live stream includes a PS stream receiving module, a PS packet cache module of RTP load, a PS packet cache module, a media stream cache module, and an h.264 split and packed RTMP stream pushing module;
the PS flow receiving module is responsible for receiving RTP data packets of the load PS flow of the flow receiving port;
the PS packet buffer module of RTP load is responsible for analyzing RTP data packets of PS stream, first finding out the first RTP packet carrying PS packet head, then putting the RTP packet carrying PS packet into PS packet buffer, and checking whether the Sequence of RTP packet is continuous, if not, buffer is cleared;
the PS packet cache module is responsible for analyzing the RTP packet in the PS packet cache, continuously receives the RTP packet and puts the RTP packet into the PS packet cache at the same time until a complete PS packet is received, analyzes the video data loaded in the complete PS packet and puts the video data into a video H.264 cache;
the media stream cache module is responsible for frame splitting of the H.264 data split from the PS packet and putting each split complete H.264 frame into a frame cache;
the H.264 splitting and packaging RTMP stream pushing module is responsible for packaging complete H.264 frames into RTMP and then pushing the stream to the RTMP stream media server through the URL;
the invention provides a real-time conversion method for converting national standard PS stream into RTMP live stream, which has high conversion efficiency, and the technical scheme ensures that a user can directly use a WEB browser VLC player to watch the video in the public safety field without installing a corresponding browser plug-in, thereby having good user experience, convenience and rapidness.
In the description herein, references to the description of "one embodiment," "an example," "a specific example" or the like are intended to mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The foregoing shows and describes the general principles, essential features, and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are described in the specification and illustrated only to illustrate the principle of the present invention, but that various changes and modifications may be made therein without departing from the spirit and scope of the present invention, which fall within the scope of the invention as claimed.

Claims (3)

1. A real-time conversion method for converting national standard PS stream to RTMP live stream is characterized by comprising the following steps:
s1: receiving RTP data packets loaded with PS streams from a stream receiving port, searching a first RTP packet loaded with a PS packet header, then putting the RTP packet loaded with the PS packet into a PS packet cache, checking whether S sequence of the RTP packet is continuous or not, and if not, emptying the cache;
s2: analyzing the RTP packet in the PS packet cache, continuously receiving the RTP packet and putting the RTP packet into the PS packet cache until a complete PS packet is received, analyzing the video data loaded in the complete PS packet and putting the video data into a video H.264 cache;
s3: the H.264 data disassembled from the PS packet is subjected to frame disassembling, and each complete H.264 frame is placed into a frame buffer;
s4: and packaging the complete H.264 frame into the RTMP, and then pushing the RTMP to the RTMP streaming media server through the URL.
2. The method as claimed in claim 1, wherein the h.264 frames include SPS, PPS, and key frames.
3. The method for converting national standard PS stream to RTMP live stream according to claim 1, wherein WEB browser or VLC player pulls stream to RTMP streaming media server through URL for video on demand.
CN201910941106.4A 2019-09-30 2019-09-30 Real-time conversion method for converting national standard PS stream into RTMP live stream Pending CN110753234A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910941106.4A CN110753234A (en) 2019-09-30 2019-09-30 Real-time conversion method for converting national standard PS stream into RTMP live stream

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910941106.4A CN110753234A (en) 2019-09-30 2019-09-30 Real-time conversion method for converting national standard PS stream into RTMP live stream

Publications (1)

Publication Number Publication Date
CN110753234A true CN110753234A (en) 2020-02-04

Family

ID=69277583

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910941106.4A Pending CN110753234A (en) 2019-09-30 2019-09-30 Real-time conversion method for converting national standard PS stream into RTMP live stream

Country Status (1)

Country Link
CN (1) CN110753234A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111954014A (en) * 2020-08-13 2020-11-17 北京金山云网络技术有限公司 Live broadcast stream pushing method and device, storage medium and equipment
CN112601114A (en) * 2020-12-14 2021-04-02 杭州当虹科技股份有限公司 GB28181 on-demand stream pulling implementation method based on hook callback

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002199386A (en) * 2000-12-27 2002-07-12 Takara Co Ltd Remote image visualization system
CN104639900A (en) * 2015-02-03 2015-05-20 广西智询信息科技有限公司 RTMP-to-M3U8 video slicing system and method
CN104639903A (en) * 2015-02-03 2015-05-20 广西智询信息科技有限公司 Code scanning direct broadcasting wireless video monitoring system of mobile terminal
CN108337527A (en) * 2017-12-18 2018-07-27 武汉烽火众智智慧之星科技有限公司 A kind of access gateway and a kind of cut-in method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002199386A (en) * 2000-12-27 2002-07-12 Takara Co Ltd Remote image visualization system
CN104639900A (en) * 2015-02-03 2015-05-20 广西智询信息科技有限公司 RTMP-to-M3U8 video slicing system and method
CN104639903A (en) * 2015-02-03 2015-05-20 广西智询信息科技有限公司 Code scanning direct broadcasting wireless video monitoring system of mobile terminal
CN108337527A (en) * 2017-12-18 2018-07-27 武汉烽火众智智慧之星科技有限公司 A kind of access gateway and a kind of cut-in method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111954014A (en) * 2020-08-13 2020-11-17 北京金山云网络技术有限公司 Live broadcast stream pushing method and device, storage medium and equipment
CN111954014B (en) * 2020-08-13 2022-01-28 北京金山云网络技术有限公司 Live broadcast stream pushing method and device, storage medium and equipment
CN112601114A (en) * 2020-12-14 2021-04-02 杭州当虹科技股份有限公司 GB28181 on-demand stream pulling implementation method based on hook callback
CN112601114B (en) * 2020-12-14 2023-03-21 杭州当虹科技股份有限公司 GB28181 on-demand stream pulling realization method based on hook callback

Similar Documents

Publication Publication Date Title
US11196786B2 (en) Interface apparatus and method for transmitting and receiving media data
US20160337424A1 (en) Transferring media data using a websocket subprotocol
CN108881927A (en) A kind of video data synthetic method and device
CN108494792A (en) A kind of flash player plays the converting system and its working method of hls video flowings
US20140369222A1 (en) Method for estimating network jitter in apparatus for transmitting coded media data
CN105049931B (en) The method and system that the video of format non-supporting in mobile terminal is converted
WO2015152599A2 (en) Signaling and operation of an mmtp de-capsulation buffer
CN110166433B (en) Method and system for acquiring video data
CN110753234A (en) Real-time conversion method for converting national standard PS stream into RTMP live stream
CN108632679B (en) A kind of method that multi-medium data transmits and a kind of view networked terminals
CN110602522A (en) Multi-path real-time live webRTC stream synthesis method
CN110113564B (en) Data acquisition method and video networking system
CN104469538B (en) RTP video streaming data packet recombination methods towards picture image quality compared with small loss
CN110753259B (en) Video data processing method and device, electronic equipment and computer readable medium
CN110086773B (en) Audio and video data processing method and system
Andriescu et al. AmbiStream: a middleware for multimedia streaming on heterogeneous mobile devices
US8296444B2 (en) Medium resource reservation method, service package information obtaining method and apparatus
WO2016090916A1 (en) Code stream transmission method and device
US20090265478A1 (en) Method and apparatus for data stream analysis and decoding apparatus
CN110460790A (en) A kind of abstracting method and device of video frame
CN108390794B (en) Method and system for calculating packet loss rate of streaming media data
CN102131116B (en) Digital television electronic program guide (EPG) data receiving and resolution method
CN108200481B (en) RTP-PS stream processing method, device, equipment and storage medium
KR100925507B1 (en) Contents streaming system and contents streaming method
CN110719495A (en) Video data processing method and system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200204

RJ01 Rejection of invention patent application after publication