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

  • 相关阅读:
    SpringMVC学习笔记----
    各种语言学习
    七步精通Python机器学习 转
    开源GIS有用
    sql 语句
    调试windows服务最简单的方法之一
    sqlserver2008 win7下安装 windows installer错误
    高德地图AmapSDKDemo运行
    google mapsDemo示例运行
    android开发环境搭建遇到的问题
  • 原文地址:https://www.cnblogs.com/lanqie/p/7667450.html
Copyright © 2011-2022 走看看