CN112887750A - 一种基于rtmp的低时延直播方法 - Google Patents

一种基于rtmp的低时延直播方法 Download PDF

Info

Publication number
CN112887750A
CN112887750A CN202110152993.4A CN202110152993A CN112887750A CN 112887750 A CN112887750 A CN 112887750A CN 202110152993 A CN202110152993 A CN 202110152993A CN 112887750 A CN112887750 A CN 112887750A
Authority
CN
China
Prior art keywords
module
data
rtmp
client
live broadcast
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
CN202110152993.4A
Other languages
English (en)
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.)
Chengdu Guoyi Electronic Technology Co ltd
Original Assignee
Chengdu Guoyi Electronic 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 Chengdu Guoyi Electronic Technology Co ltd filed Critical Chengdu Guoyi Electronic Technology Co ltd
Priority to CN202110152993.4A priority Critical patent/CN112887750A/zh
Publication of CN112887750A publication Critical patent/CN112887750A/zh
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/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • H04N21/23106Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion involving caching operations
    • 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/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234309Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4 or from Quicktime to Realvideo
    • 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/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • 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/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • H04N21/440218Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本发明公开了一种基于RTMP的低时延直播方法,涉及计算机互联网的音视频直播领域,包括如下步骤:步骤1:视频编码模块将摄像头采集图像进行字符叠加后的图像按H264标准进行压缩编码发送至视频推流模块;步骤2:视频推流模块将完成压缩编码后的数据进行封包并发送至Nginx服务模块;步骤3:Nginx服务模块对接收的数据进行拆包还原图像数据,转存到本地缓存;步骤4:客户端拉流模块向Nginx服务模块发送链接请求和数据传输请求,获取图像数据并将图像数据传输给客户端解码模块;步骤5:客户端解码模块对接收到的数据进行解码播放。本发明的有益效果:可以实现流媒体传输的准实时播放,从视频采集到客户端播放整体时延1~2秒。

Description

一种基于RTMP的低时延直播方法
技术领域
本发明涉及计算机互联网的音视频直播领域,具体的,涉及一种基于RTMP的直播时延优化方法。
背景技术
网络直播技术的核心是视频传输。从图像采集到用户终端,需要经过采集、编码、推流、分发、拉流、解码等一系列数据传输处理,才能将图像显示到用户终端,而由于这些环节的传输和处理,必然会产生延时。若延时太大,人与人交互起来就很困难。
目前常用处理技术方法为:(1)降低GOP间隔。编码器将原始图像编码为三种类型帧,也就是I帧、B帧、P帧。I帧指的是关键帧,保留完整的图像信息;B帧指的是双向内插帧,需要参考前后帧来还原此帧的图像信息;P帧指的是前向预测帧,需要参考前一帧图像来还原此帧图像信息。GOP指视频编码中两个I帧的间隔。由于播放端解码器需要关键帧才能解码,缩短GOP间隔可以降低延迟,但是这种方法会导致图像编码压缩率变低,降低图像质量。(2)减小数据缓存。由于RTMP是基于TCP的一种应用层网络协议,在网络条件差的时候,为保证传输可靠性,会将失败的包缓存起来,等待网络条件好的时候一并发出,这样就存在累积延迟的问题。减小数据缓存可以有效缓解延迟累加的问题,但由于缓存太小,数据丢失后播放端容易出现卡顿的现象。
申请号为“2017104377335”的专利公开了“一种降低网络直播延时的方法”,其降低延时所采用的方法就是根据延时跳帧播放,采用这种方法虽然可以有效降低延时时间,提高直播的实时性和交互体验,但是会降低图像质量。
发明内容
本发明的目的在于,针对上述问题,提出一种基于RTMP的直播时延优化方法。
一种基于RTMP的直播时延优化方法,包括如下步骤:
步骤1:视频编码模块将摄像头采集图像进行字符叠加后的图像按H264标准进行压缩编码发送至视频推流模块;
步骤2:视频推流模块将完成压缩编码后的数据进行封包并发送至Nginx服务模块;
步骤3:Nginx服务模块对接收的数据进行拆包还原图像数据,转存到本地缓存;
步骤4:客户端拉流模块向Nginx服务模块发送链接请求和数据传输请求,获取图像数据并将图像数据传输给客户端解码模块;
步骤5:客户端解码模块对接收到的数据进行解码播放。
优选的,所述步骤1中压缩编码默认GOP长度开始编码。
优选的,所述步骤2中对压缩编码后的数据进行RTMP协议封装。
所述步骤4具体包括如下步骤:
步骤41:Nginx服务模块判断服务端缓冲区余量,若服务端缓冲区余量较低则执行步骤42;若缓冲区余量高,则执行步骤43;
步骤42:当服务端缓冲区余量较低时,提高视频推流模块访问Nginx服务模块的拉流频率,降低客户端拉流模块的播放速度,将本地缓冲区数据降速播放;
步骤43:当服务端缓冲区余量较高时,提高客户端拉流模块播放速度,将本地缓冲区数据提速播放,降低视频推流模块访问Nginx服务模块的拉流频率。
本发明的有益效果:可以实现流媒体传输的准实时播放,从视频采集到客户端播放整体时延1~2秒;相比原来单一的缩短GOP长度和减少缓存大小,本发明能根据当前网络环境实时调整GOP和缓存大小减少时延,并通过调整播放速率消除累积时延,达到降低摄像头采集与客户端直播间时延的效果。
附图说明
图1为本发明的流程图。
图2为本发明的拉流模块工作流程图。
具体实施方式
下面结合附图对本发明作进一步说明。
如图1所示,一种基于RTMP的直播时延优化方法,包括如下步骤:
步骤1:视频编码模块将摄像头采集图像进行字符叠加后的图像按H264标准进行压缩编码发送至视频推流模块;
步骤2:视频推流模块将完成压缩编码后的数据进行封包并发送至Nginx服务模块;
步骤3:Nginx服务模块对接收的数据进行拆包还原图像数据,转存到本地缓存;
步骤4:客户端拉流模块向Nginx服务模块发送链接请求和数据传输请求,获取图像数据并将图像数据传输给客户端解码模块;
步骤5:客户端解码模块对接收到的数据进行解码播放。
需要说明的是,所述步骤1中压缩编码默认GOP长度开始编码。
需要说明的是,所述步骤2中对压缩编码后的数据进行RTMP协议封装。
如图2所示,客户端拉流模块的工作流程为:Nginx服务模块判断服务端缓冲区余量,若服务端缓冲区余量较低则提高视频推流模块访问Nginx服务模块的拉流频率,降低客户端拉流模块的播放速度,将本地缓冲区数据降速播放;当服务端缓冲区余量较高时,提高客户端拉流模块播放速度,将本地缓冲区数据提速播放,降低视频推流模块访问Nginx服务模块的拉流频率。

Claims (5)

1.一种基于RTMP的直播时延优化方法,其特征在于,包括如下步骤:
步骤1:视频编码模块将摄像头采集图像进行字符叠加后的图像按H264标准进行压缩编码发送至视频推流模块;
步骤2:视频推流模块将完成压缩编码后的数据进行封包并发送至Nginx服务模块;
步骤3:Nginx服务模块对接收的数据进行拆包还原图像数据,转存到本地缓存;
步骤4:客户端拉流模块向Nginx服务模块发送链接请求和数据传输请求,获取图像数据并将图像数据传输给客户端解码模块。
2.如权利要求1所述一种基于RTMP的直播时延优化方法,其特征在于,所述步骤1中压缩编码默认GOP长度开始编码。
3.如权利要求1所述一种基于RTMP的直播时延优化方法,其特征在于,所述步骤2中对压缩编码后的数据进行RTMP协议封装。
4.如权利要求1所述一种基于RTMP的直播时延优化方法,其特征在于,所述步骤4具体包括如下步骤:
步骤41:Nginx服务模块判断服务端缓冲区余量,若服务端缓冲区余量较低则执行步骤42;若缓冲区余量高,则执行步骤43;
步骤42:当服务端缓冲区余量较低时,提高视频推流模块访问Nginx服务模块的拉流频率,降低客户端拉流模块的播放速度,将本地缓冲区数据降速播放;
步骤43:当服务端缓冲区余量较高时,提高客户端拉流模块播放速度,将本地缓冲区数据提速播放,降低视频推流模块访问Nginx服务模块的拉流频率。
5.如权利要求1所述一种基于RTMP的直播时延优化方法,其特征在于,还包括步骤5:客户端解码模块对接收到的数据进行解码播放。
CN202110152993.4A 2021-02-04 2021-02-04 一种基于rtmp的低时延直播方法 Pending CN112887750A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110152993.4A CN112887750A (zh) 2021-02-04 2021-02-04 一种基于rtmp的低时延直播方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110152993.4A CN112887750A (zh) 2021-02-04 2021-02-04 一种基于rtmp的低时延直播方法

Publications (1)

Publication Number Publication Date
CN112887750A true CN112887750A (zh) 2021-06-01

Family

ID=76057151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110152993.4A Pending CN112887750A (zh) 2021-02-04 2021-02-04 一种基于rtmp的低时延直播方法

Country Status (1)

Country Link
CN (1) CN112887750A (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115529298A (zh) * 2022-11-30 2022-12-27 湖南快乐阳光互动娱乐传媒有限公司 一种密集视音频传输***、方法和装置

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009045683A1 (en) * 2007-09-28 2009-04-09 Athanasios Leontaris Video compression and tranmission techniques
CN101466034A (zh) * 2008-12-25 2009-06-24 华为技术有限公司 发送、播放流媒体数据的方法和装置及流媒体点播***
CN102378065A (zh) * 2011-10-19 2012-03-14 江西省南城县网信电子有限公司 基于mpeg-4的流媒体服务器端配置缓冲区的方法及***
CN105657443A (zh) * 2015-12-30 2016-06-08 深圳市云宙多媒体技术有限公司 一种直播时移播放方法和***
CN107205160A (zh) * 2017-06-27 2017-09-26 青岛海信电器股份有限公司 一种针对服务器下发的视频的播放方法及装置
CN107743252A (zh) * 2017-11-01 2018-02-27 创盛视联数码科技(北京)有限公司 一种降低直播延迟的方法
US10547915B1 (en) * 2019-07-19 2020-01-28 Look At Me, Inc. System and method for optimizing playlist information for ultra low latency live streaming

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009045683A1 (en) * 2007-09-28 2009-04-09 Athanasios Leontaris Video compression and tranmission techniques
CN101466034A (zh) * 2008-12-25 2009-06-24 华为技术有限公司 发送、播放流媒体数据的方法和装置及流媒体点播***
CN102378065A (zh) * 2011-10-19 2012-03-14 江西省南城县网信电子有限公司 基于mpeg-4的流媒体服务器端配置缓冲区的方法及***
CN105657443A (zh) * 2015-12-30 2016-06-08 深圳市云宙多媒体技术有限公司 一种直播时移播放方法和***
CN107205160A (zh) * 2017-06-27 2017-09-26 青岛海信电器股份有限公司 一种针对服务器下发的视频的播放方法及装置
CN107743252A (zh) * 2017-11-01 2018-02-27 创盛视联数码科技(北京)有限公司 一种降低直播延迟的方法
US10547915B1 (en) * 2019-07-19 2020-01-28 Look At Me, Inc. System and method for optimizing playlist information for ultra low latency live streaming

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115529298A (zh) * 2022-11-30 2022-12-27 湖南快乐阳光互动娱乐传媒有限公司 一种密集视音频传输***、方法和装置
CN115529298B (zh) * 2022-11-30 2023-10-13 湖南快乐阳光互动娱乐传媒有限公司 一种密集视音频传输***、方法和装置

Similar Documents

Publication Publication Date Title
US8472520B2 (en) Systems and methods for transmitting and receiving data streams with feedback information over a lossy network
US9866605B2 (en) Streaming manifest quality control
US8355437B2 (en) Video error resilience
US8355452B2 (en) Selective frame dropping for initial buffer delay reduction
KR101737325B1 (ko) 멀티미디어 시스템에서 멀티미디어 서비스의 경험 품질 감소를 줄이는 방법 및 장치
US8875208B1 (en) High quality multimedia transmission from a mobile device for live and on-demand viewing
CN104394426B (zh) 流媒体倍速播放方法和装置
US10944973B2 (en) Estimation of video quality of experience on media servers
KR20200109359A (ko) 비디오 스트리밍
CN101917613A (zh) 一种流媒体采集编码服务***
AU2007236534B2 (en) Method, system and software product for streaming content
CN107743252A (zh) 一种降低直播延迟的方法
JP2011512767A (ja) ビデオ・ストリーミング
KR20050097738A (ko) 비디오 스트림을 재생하는 클라이언트 및 재생 방법
CN113382278B (zh) 视频推送方法、装置、电子设备和可读存储介质
CN112887750A (zh) 一种基于rtmp的低时延直播方法
CA2716084C (en) Apparatus for and a method of providing content data
US20030112366A1 (en) Apparatus and methods for improving video quality delivered to a display device
US20140321556A1 (en) Reducing amount of data in video encoding
WO2011029369A1 (zh) 一种视频编解码方法、***及视频监控***
CN101860471B (zh) 一种媒体流切换方法、装置和***
CN105306970B (zh) 一种流媒体直播发送速度的控制方法及装置
CN114339316A (zh) 一种基于视频直播的视频流编码处理方法
Psannis et al. QoS for wireless interactive multimedia streaming
CN111405298A (zh) 一种基于KCP协议的Android端到端直播方法

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: 20210601

RJ01 Rejection of invention patent application after publication