前言

最近自己在研究有关于直播平台源码流媒体播放的技术,网上资料甚少。出于开源精神以及在查阅资料得到各位大佬的帮助,故将自己的心得写下记录,便于分享以及日后维护。

在此极力感谢并推荐雷神(雷霄骅)

个人博客:https://blog.csdn.net/leixiaohua1020

系统组成

一个完整的直播平台源码流媒体系统大致需要三个部分组成:编码器、流服务器和播放器。

编码器通过对内容来源(如MP3文件或者麦克风输入)进行编码,并将编码过的内容发送到直播平台源码流服务器;直播平台源码流服务器再将它们发布到Internet,这样直播平台源码客户端的播放器只要连接到流服务器就可以进行在线播放了。

而本次搭建过程是基于RTMP协议完成。

RTMP协议简介

播放一个RTMP协议的流媒体需要经过以下几个步骤:握手,建立连接,建立流,播放。

RTMP连接都是以握手作为开始的。

1:建立连接阶段用于建立客户端与服务器之间的“网络连接”;

2:建立流阶段用于建立客户端与服务器之间的“网络流”;

3:播放阶段用于传输视音频数据。

Red5 概述

Red5 是一个采用 Java 开发开源的 Flash 流媒体服务器。免费开源使软件更加容易扩展,下载后你可以对源代码进行修改;更加经济,比起 FMS 高昂的费用,Red5 能为一般的应用节约大笔费用;同时服务器端的 Java 面向对象语言比起 FMS 服务器端的 ActionScript2 语言更加成熟。鉴于 Red5 的种种优势,推出不久便被广大用户所接受。

Red 5 支持:

把音频(MP3)和视频(FLV, F4V, MP4, 3GP)转换成播放流;

1、录制客户端播放流, 把摄像头,麦克风等传入的音频视频录制保存到服务器;

2、共享对象;

3、现场直播流发布;

4、远程调用;

5、协议:RTMP, RTMPT, RTMPS, and RTMPE。

Red5 服务器搭建

JDK自行安装_本文不做演示

可参考:https://jingyan.baidu.com/article/6dad5075d1dc40a123e36ea3.html

下载Red5:(本人使用版本:1.0.10)

官网:http://red5.org/

GitHub:https://github.com/Red5/red5-server/releases

下载后解压到自己的固定文件夹,如图:

可以选择在conf/red5.properties文件下修改IP和端口号

# Socket policypolicy.host=0.0.0.0policy.port=843# HTTPhttp.host=192.168.1.115 //可在此修改HTTP  IP地址http.port=5080https.port=5443http.URIEncoding=UTF-8http.max_headers_size=8192http.max_keep_alive_requests=-1http.max_threads=20http.acceptor_thread_count=10http.processor_cache=20# RTMPrtmp.host=192.168.1.115 //可在此修改IP地址rtmp.port=1935rtmp.io_threads=8rtmp.send_buffer_size=65536rtmp.receive_buffer_size=65536rtmp.ping_interval=1000rtmp.max_inactivity=60000rtmp.max_handshake_time=5000rtmp.tcp_nodelay=truertmp.tcp_keepalive=falsertmp.default_server_bandwidth=10000000rtmp.default_client_bandwidth=10000000rtmp.client_bandwidth_limit_type=2rtmp.bandwidth_detection=falsertmp.encoder_base_tolerance=5000rtmp.encoder_drop_live_future=false# traffic optimization hinting. to disable set traffic class set to -1# low delay + high throughput == 24 (0x18)rtmp.traffic_class=-1# requested maximum length of the queue of incoming connectionsrtmp.backlog=32# the interval (seconds) between each throughput calculationrtmp.thoughput_calc_interval=15# enable use of the default mina acceptorrtmp.default_acceptor=true# socket i/o pool sizes used when default acceptor is disabledrtmp.initial_pool_size=0rtmp.max_pool_size=2rtmp.max_processor_pool_size=8rtmp.executor_keepalive_time=60000mina.logfilter.enable=false# scheduler configs (per application)rtmp.scheduler.pool_size=8rtmp.deadlockguard.sheduler.pool_size=8# message executor configs (per application) - adjust these as needed if you get tasks rejectedrtmp.executor.core_pool_size=4rtmp.executor.max_pool_size=32rtmp.executor.queue_capacity=64# drop audio packets when queue is almost full, to disable this, set to 0rtmp.executor.queue_size_to_drop_audio_packets=60# maximum amount of time allotted to process a single rtmp message / packet in milliseconds, set it as 0 to disable timeoutrtmp.max_handling_time=2000# connection tweaks - dont modify unless you know what you're doingrtmp.channel.initial.capacity=3rtmp.channel.concurrency.level=1rtmp.stream.initial.capacity=1rtmp.stream.concurrency.level=1rtmp.pending.calls.initial.capacity=3rtmp.pending.calls.concurrency.level=1rtmp.reserved.streams.initial.capacity=1rtmp.reserved.streams.concurrency.level=1# maximum packet size allowed in bytesrtmp.max_packet_size=3145728# RTMPSrtmps.host=0.0.0.0rtmps.port=8443rtmps.ping_interval=5000rtmps.max_inactivity=60000rtmps.max_keep_alive_requests=-1rtmps.max_threads=8rtmps.acceptor_thread_count=2rtmps.processor_cache=20# RTMPS Key and Trust store parametersrtmps.keystorepass=passwordrtmps.keystorefile=conf/keystore.jksrtmps.truststorepass=passwordrtmps.truststorefile=conf/truststore.jks# RTMPTrtmpt.host=0.0.0.0rtmpt.port=8088rtmpt.ping_interval=5000rtmpt.max_inactivity=60000rtmpt.max_handshake_time=5000rtmpt.max_keep_alive_requests=-1rtmpt.max_threads=8rtmpt.acceptor_thread_count=2rtmpt.processor_cache=20rtmpt.encoder_base_tolerance=5000rtmpt.encoder_drop_live_future=true# better setting for streaming mediartmpt.target_reponse_size=32768# best setting for small messages or shared objects#rtmpt.target_reponse_size=8192# max incoming messages to process at a time. the most that FP appears to send is 166rtmpt.max_in_msg_process=166# max time in millis that we will wait when offering data to the in or out queuertmpt.max_queue_offer_time=125# max offer attemptsrtmpt.max_queue_offer_attempts=4# Debug proxy (needs to be activated in red5-core.xml)proxy.source_host=127.0.0.1proxy.source_port=1936proxy.destination_host=127.0.0.1proxy.destination_port=1935# JMXjmx.rmi.host=localhostjmx.rmi.port=9999jmx.rmi.sport=9998jmx.rmi.port.remoteobjects=jmx.keystorepass=passwordjmx.mina.monitor.enable=falsejmx.mina.poll.interval=1000# Whether to always create the registry in-process, not attempting to# locate an existing registry at the specified port. Set to "true" in order# to avoid the overhead of locating an existing registry when you always intend# to create a new registry in any case.jmx.registry.create=true# Whether or not the MBeanServerFactoryBean should attempt to locate a running# MBeanServer before creating onejmx.reuse.existing.server=true# Whether to register the MBeanServer with the MBeanServerFactory, making it# available through MBeanServerFactory.findMBeanServer()jmx.register.factory=true# Whether any threads started for the JMXConnectorServer should be started as daemon threadsjmx.daemon=true# Whether the JMXConnectorServer should be started in a separate threadjmx.threaded=true# Server properties# max events to send in a single updateso.max.events.per.update=64so.scheduler.pool_size=4keyframe.cache.entry.max=500war.deploy.server.check.interval=600000fileconsumer.delayed.write=truefileconsumer.queue.size=120fileconsumer.wait.for.keyframe=truesubscriberstream.buffer.check.interval=5000subscriberstream.underrun.trigger=100subscriberstream.max.pending.frames=10subscriberstream.max.sequential.frames=10broadcaststream.auto.record=false

启动red5.bat

出现上图后在浏览器输入:http://IP:port/

如:http://192.168.1.115:5080/

即代表启动成功!

声明:本文由云豹科技转发,如有侵权请联系作者删除

直播平台源码的搭建,离不开流媒体视频服务相关推荐

  1. 直播平台源码中的推拉流是什么

    关于直播平台源码中的推流和拉流,最常用的就是RTMP和RTSP协议了 推流,指的是把采集阶段封包好的内容传输到服务器的过程,推流是直播端需要完成的步骤.拉流是指服务器已有直播内容,用指定地址进行拉取的 ...

  2. 直播平台源码中直播系统捕获音视频的步骤

    如何开发一套完整的直播平台源码,首先需要采集主播的视频和音频功能,然后传入流媒体服务器.本篇主要讲解如何采集主播的视频和音频功能,当前可以切换前置后置摄像头和焦点光标,直播APP拥有独立的美颜SDK, ...

  3. 直播平台开发时iOS 开发内购功能,直播平台源码搭建

    1.首先登录苹果账号,在直播平台源码搭建完成好后,进入后台管理中心添加商品,选择功能----App内购买项目------添加商品类型.商品的ID.以及说明信息. 2.在直播平台源码搭建后台创建沙盒测试 ...

  4. 搭建直播平台源码用到的云技术到底是什么

    现在在搭建直播平台源码时经常会听到云技术这个词,云技术到底是什么?很多第一次听到的人都会有这个困扰,简单说,云技术就是将局域网或广域网内的硬件.软件和网络等一系列资源统一整合起来,通过托管对数据的计算 ...

  5. 直播平台源码搭建教程盘点直播技术中的编解码、直播协议、网络传输与简单实现

    直播平台源码搭建教程盘点直播技术中的编解码.直播协议.网络传输与简单实现 Live CheatSheet | 直播技术理论基础与实践概论 音视频直播的基本流程都是采集 → 编码推流 → 网络分发 → ...

  6. 优质的教育直播平台源码是如何进行在线教育系统搭建的

    一般教育培训机构转型线上都是找优质的教育直播平台源码进行在线教育系统搭建的.如何在价格不一的源码市场中,选择优质的教育直播平台源码呢?优质的直播平台源码是如何进行在线教育系统搭建的呢?我们来了解一下. ...

  7. 搭建直播平台的基础,实现直播平台源码的架构

    服务端流媒体服务器搭建 选择的流媒体服务器linux+nginx+rtmp_module https://github.com/arut/nginx-rtmp-module 1.需要下载的其他包 2. ...

  8. 搭建直播平台源码,从何入手

    搭建直播平台源码需要多少人手: 产品组,包括产品经理.UI等,负责市场调研.竞品研究和效果图制作等工作 OC工程师,负责使用OC语言进行IOS端软件开发工作 JAVA工程师,负责使用JAVA进行安卓端 ...

  9. 在找直播平台源码搭建教程?先看看这些吧

    很多人都在找直播平台源码教程,但其实连一些基础知识都不知道,因此小编特地编辑了这份跟直播平台源码搭建相关知识,以供大家进行学习. 1.服务器的选择: 服务器是搭建直播平台唯一需要购买的硬件设备,通常会 ...

最新文章

  1. FireDAC 下的 Sqlite [4] - 创建数据库
  2. pchar,pwidechar,pansichar作为返回参数时内存访问错误
  3. 将tif文件转化为png文件 Python3
  4. 基于ssm的水果商城系统项目总结
  5. JS,JQ 格式化小数位数
  6. PHY以太网自动协商原理
  7. WPF ComboBox下拉绑定Treeview 功能的实现
  8. ANOI 2009 【同类分布】
  9. Julia: Join与字符串Array
  10. 《Adobe Fireworks CS5中文版经典教程》——1.2 工具面板
  11. 波特率和比特率之间的关系
  12. NEO主要技术社区成员大曝光
  13. correl函数相关系数大小意义_教你利用Correl函数返回相关系数并确定属性关系
  14. GeoTools解析shape文件中文乱码
  15. 苹果手机科学计算机怎样调用,iOS上的表达式科学计算器Calculator i++使用说明
  16. 办公小技巧,批量修改文件名,手把手教你
  17. 14、微信小程序——上传、预览、长按删除图片
  18. 关于学习的一些网站(自用)
  19. 实现求出100~200之间的全部素数,每行输出8个数,每个数宽度为5列。 输入格式:无 输出格式:“%5d“ “\n“
  20. 互动作业组的计算机在哪,互动作业和作业互动组区别介绍 看起来有很相似

热门文章

  1. phpcmsv9mysql扩展_PHPCMS v9 教程:全站搜索
  2. 给计算机专业学生的几条建议
  3. js 判断平面几何图形是否重叠
  4. java 从字符串中提取数字
  5. mysql MDL锁如何解决_理解MySQL的MDL元数据锁
  6. GridSearch Kfold cross validation
  7. 带搜索功能的GridView控件
  8. “等一下,我碰!”——常见的2D碰撞检测
  9. 如何批量生成IATA条码
  10. 【2019年04月22日】A股最便宜的股票