参考: https://github.com/ossrs/srs/wiki/v2_CN_SampleFFMPEGgit clone https://github.com/ossrs/srscd srs/trunk./configuremakemake 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:
# 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]; } }#保存直播为flvdvr { # 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
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路径要是绝对的