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

参考:

    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:

# 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

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路径要是绝对的

posted @ 2017-10-14 15:08  懒企鹅  阅读(10618)  评论(0编辑  收藏  举报