一、编译SRS 
https://github.com/winlinvip/simple-rtmp-server 
目前有1.0-release、2.0、3.0等版本 
2.0官方文档地址:https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_Home

1.如果是新系统,先安装git

  1. CentOSyum -y install git
  • 1

2.源码下载:

  1. git clone https://code.csdn.net/winlinvip/srs-csdn.git
  • 1

3.git操作

a.改变SRS分支

  1. 切换到1.0分支
  2. git pull && git checkout 1.0release
  3. 切换到2.0分支
  4. git pull && git checkout 2.0release
  • 1
  • 2
  • 3
  • 4

我把源码下载到了/mnt目录,然后我们cd /mnt

b.查看当前分支

  1. cd /mnt/srs-csdn;git branch
  • 1

c.改变到2.0分支

  1. git pull && git checkout 2.0release
  • 1

4.编译安装

  1. cd /mnt/srs-csdn/trunk
  • 1

./configure -h #查看编译时的帮助,里面有一些指定的参数是情况加减,官方文档

开始编译:

  1. ./configure --prefix=/usr/local/srs --with-ssl --with-hls --with-hds --with-dvr --with-nginx --with-http-callback --with-http-server --with-stream-caster --with-http-api --with-ffmpeg --with-transcode --with-ingest --with-stat --with-librtmp --with-research --with-utest --with-gperf --with-gprof
  2. make;make install
  • 1
  • 2
  • 3

第三方应用启动:

  1. sudo ./objs/nginx/sbin/nginx --- 启动nginx for hls
  2. ./objs/ffmpeg/bin/ffmpeg ---ffmpeg
  3. python ./research/api-server/server.py 8085 ---to start the api-server
  • 1
  • 2
  • 3

SRS启动

  1. cd /mnt/srs-csdn/trunk
  2. ./objs/srs -c conf/srs.conf
  3. ps -ef | grep srs
  4. ./srs -v
  • 1
  • 2
  • 3
  • 4

到此为止,SRS已编译安装完成!

二、配置RTMP 
1.RTMP URL解释:

  1. rtmp://HOST:PORT/app/stream_name
  2. rtmp: 协议头
  3. HOST:注意的IP地址或域名
  4. app: 应用名称
  5. stream_name:流名称
  • 1
  • 2
  • 3
  • 4
  • 5

2.SRS中RTMP配置信息 
文件目录:/mnt/srs-csdn/trunk/conf/rtmp.conf 
配置内容:

  1. listen 1935;
  2. pid ./objs/srs.pid;
  3. chunk_size 60000;
  4. ff_log_dir ./objs;
  5. srs_log_tank file;
  6. #配置日志答应到文件,需要和srs_log_level配合使用
  7. srs_log_level trace;
  8. #制定配置文件的级别,默认级别是trace
  9. srs_log_file ./objs/srs.log;
  10. #制定日志文件的位置。
  11. max_connections 1000;
  12. #最大连接数
  13. daemon on;
  14. #以daemon的方式启动,如果要启动在console,那么需要配置daemon off;并且,需要配置srs_log_tank console;
  15. utc_time off;
  16. #是否使用utc时间。如果该值为off则使用本地时间,如果开始使用utc时间。
  17. vhost __defaultVhost__ {
  18. #默认的vhost,在没有指明vhost的情况,默认使用这个vhost。
  19. }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

3.ffmpeg推流 VLC播放 
ffmpeg可执行程序目录:/mnt/srs-csdn/trunk/objs/ffmpeg/bin/ffmpeg

推流:

  1. cd /mnt/srs-csdn/trunk/objs/ffmpeg/bin
  2. ./ffmpeg -i "abc.avi" -vcodec libx264 -vprofile baseline -level 30 -g 60 -vb 800k -strict experimental -acodec aac -ab 96000 -ar 48000 -ac 2 -f flv rtmp://192.168.1.62:1935/live/zb
  • 1
  • 2

VLC取流:

  1. rtmp://192.168.1.62:1935/live/zb
  • 1


SRS服务器搭建,ffmpeg 本地推流,srs从本地拉流

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
参考:
 
    https://github.com/ossrs/srs/wiki/v2_CN_SampleFFMPEG
 
git clone https://github.com/ossrs/srs
cd srs/trunk
./configure
make
make install
 
./objs/srs -c conf/myconf.conf
 
其中: ./configure --with-ffmpeg && make
如果编译失败就去掉--with-ffmpeg,自己安装ffmpeg
本地推流: ffmpeg -re -i /root/Videos/aaa.mp4 -c copy -f flv rtmp://192.168.2.125:1935/live/aaa

配置文件myconf.conf:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# the config for srs use ffmpeg to transcode
# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleFFMPEG
# @see full.conf for detail config.
 
listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;
vhost __defaultVhost__ {
    transcode {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
        engine ff {
            enabled         on;
            vfilter {
            }
            vcodec          libx264;
            vthreads        4;
            vprofile        main;
            vpreset         medium;
            vparams {
            }
            acodec          libfdk_aac;
            aparams {
            }
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
    }
 
#保存直播为flv
dvr {
        # https://github.com/ossrs/srs/wiki/v2_CN_DVR
         
        enabled         on;
        dvr_path        ./objs/nginx/html/[app]/[stream].[timestamp].flv;
        dvr_plan        session;
        dvr_duration    30;
        dvr_wait_keyframe       on;
        time_jitter             full;
 
   }
 
}

srs从本地拉流:

my.ingest.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;
vhost __defaultVhost__ {
    ingest livestream {
        enabled      on;
        input {
            type    file;
            url     /root/Videos/zzzz.mp4;
        }
        ffmpeg      /usr/local/bin/ffmpeg;
        engine {
            enabled         off;
            output          rtmp://127.0.0.1:1935/live/livestream;
            #rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
        }
    }
}

关键是ffmpeg路径要是绝对的

SRS流媒体服务器搭建+ffmpeg推流VLC取流观看的更多相关文章

  1. 流媒体服务器搭建 ffmpeg + nginx

    第一部分: mkdir ~/working 切换到~/working目录下 cd ~/working 获取nginx源码: wget http://nginx.org/download/nginx-1 ...

  2. Android视频直播:流媒体服务器搭建

    一.前言 实时视频直播是这两年非常火的技术形态,已经渗透到教育.在线互娱等各种业务场景中.但要搭建一套实时视频直播系统,并非易事,下面针对直播系统的的搭建做一下说明: 1.1 通常的直播系统的技术模型 ...

  3. nginx-rtmp流媒体服务器搭建【转】

    nginx-rtmp https://github.com/pengqiuyuan/nginx-rtmp nginx-rtmp 流媒体服务器的搭建(采集桌面,手机直播) 在线Demo,直播自己的pc机 ...

  4. 为SRS流媒体服务器添加HLS加密功能(附源码)

    为SRS流媒体服务器添加HLS加密功能(附源码) 之前测试使用过nginx的HLS加密功能,会使用到一个叫做nginx-rtmp-module的插件,但此插件很久不更新了,网上搜索到一个中国制造的叫做 ...

  5. rtmp与hls流媒体服务器搭建:ubuntu下Nginx搭建初探与rtmp-module的添加

    关键词:Nignx(http服务器):rtmp,hls(流媒体服务) 前言:感谢开源,感谢战斗民族.现在在做流媒体服务的一些工作,流媒体服务器搭建的网上教程多入牛毛,但是细细查看,发现很多同志贴上来的 ...

  6. 利用Nginx搭建RTMP视频直播,点播服务器,ffmpeg推流,回看

        一.环境和工具 ubuntu 14.04 desktop 不用server的原因是一部分的演示用到了linux视频播放和直播软件,自己还要装桌面,麻烦. 不建议使用 最新的16TLS,我一开始 ...

  7. 流媒体服务器搭建 red5

    简介 1. 流媒体指以流方式在网络中传送音频.视频和多媒体文件的媒体形式.相对于下载后观看的网络播放形式而言,流媒体的典型特征是把连续的音频和视频信息压缩后放到网络服务器上,用户边下载边观看,而不必等 ...

  8. windows server 2012 流媒体服务器搭建(直播与点播)

    IIS Live Smooth Streaming(实时平滑流式处理)是微软下一代流媒体解决方案.该技术是在IIS web中集成媒体传输平台IIS media services,实现利用标准 HTTP ...

  9. SRS服务器搭建,ffmpeg 本地推流,srs从本地拉流

    参考: https://github.com/ossrs/srs/wiki/v2_CN_SampleFFMPEG git clone https://github.com/ossrs/srs cd s ...

随机推荐

  1. Rasterization 学习笔记

    ======================Barycentric interpolation====================================== <1>2d/3d ...

  2. Unity3D动态生成多边形

    来自https://blog.csdn.net/qq_14903317/article/details/69668521 自由绘制多边形   https://blog.csdn.net/lei_710 ...

  3. hostapd修改beacon帧和probe response帧

    在AP模式下,热点会不断定期地发送Beacon帧来宣告自己存在,告知设备可以加入网络: Probe Response帧是用于应答Probe Request帧,Probe Request帧是移动工作站用 ...

  4. 阿里云rds mysql数据库数据恢复到ecs中

    背景:aliyun上的rds数据库快满了,于是删除了某个备份的表后面大boss说是有用的表,需要恢复回来,阿里云有7天内的物理全量备份(通过percona-xtrabackup备份的)第一时间应该延长 ...

  5. maven项目导入war包

    导入war包,使用war包中的类和静态资源(css,js,包含jsp等) A项目是被导入的war工程,B项目是需要A项目的一个工程. 在<build>中 <resources> ...

  6. Linux系统的命令别名功能(转)

    在管理和维护Linux系统的过程中,将会使用到大量命令,有一些很长的命令或用法经常被用到,重复而频繁地输入某个很长命令或用法是不可取的.这时可以使用命令别名功能将这个过程简单化. 1.系统定义的别名通 ...

  7. 2)实现github自动登陆获取信息

    # -*- coding:utf-8 -*- # __author__ = 'lixiang' # 实现github自动登陆和获取数据 import requests from bs4 import ...

  8. Confluence 6 使用 JConsole 监控本地 Confluence

    如果你遇到了一些特定的问题,或者你仅仅是希望在一个很短的时间内监控你 Confluence 的运行,你可以使用本地监控.本地监控将会对你的服务器性能产生影响,所以我们并不推荐你使用本地监控来长时间的监 ...

  9. Confluence 6 升级自定义的站点和空间应用你的自定义布局

    当你升级你的 Confluence 到其他一个主要的 Confluence 发行版本的时候,你需要手动应用你修改过的任何全局或者空间级别的布局.除非有特殊的声明,针对一些非主要的 Confluence ...

  10. 学习Spring Boot:(一)入门

    微服务 现在微服务越来越火了,Spring Boot热度蹭蹭直升,自学下. 微服务其实是服务化思路的一种最佳实践方向,遵循SOA(面向服务的架构)的思路,各个企业在服务化治理上面的道路已经走得很远了, ...