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

  • 相关阅读:
    求1+2+3+...+n
    孩子们的游戏(圆圈中最后剩下的数) 约瑟夫环
    扑克牌顺子
    翻转单词顺序列
    左旋转字符串
    和为S的两个数字
    和为S的连续正数序列
    CocoaPods 更新
    UITextView 动态高度计算(iOS7版)
    Mac 把图片反色
  • 原文地址:https://www.cnblogs.com/lanqie/p/7667450.html
Copyright © 2011-2022 走看看