zoukankan      html  css  js  c++  java
  • 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路径要是绝对的

  • 相关阅读:
    TCP/IP学习-链路层
    Linux下搭建Wordpress环境
    DiskMgr的限制项
    Win10系统Start Menu上的图标莫名消失
    powershell
    第一个页面的文本域中输入的值怎么在第二个页面中显示
    php 文本框里面显示数据库调出来的资料
    php代码
    php表单提交方法汇总
    php将SQL查询结果赋值给变量
  • 原文地址:https://www.cnblogs.com/lanqie/p/7667450.html
Copyright © 2011-2022 走看看