【问题标题】:Http Media Streaming ServerHttp媒体流服务器
【发布时间】:2013-12-20 13:35:42
【问题描述】:

我已经使用 RED5 媒体服务器 (RTMP) 开发了视频流应用程序。而不是 RTMP 需要通过 HTTP 流式传输实时视频。

任何开源的 HTTP 媒体服务器??

是否有同时支持 RTMP 和 HTTP 的开源服务器?

提前致谢。

【问题讨论】:

  • 不管怎样,我已经在 Node.js 中编写了一个简单的服务器,它使用 FFmpeg 动态重新编码视频以进行常规 HTTP 流传输。它工作得很好,并且是

标签: html video-streaming audio-streaming http-live-streaming http-streaming


【解决方案1】:

首先,HTTP 和 RTMP 是不同的协议。您不会在 HTTP 内提供 RTMP。 (尽管您可以为隧道解决方案执行此操作)。

存在几种进行 HTTP 流式传输的方法。如 HLS、DASH、平滑和渐进式下载。如果您需要向 iOS(iPad、iPhone、Apple TV)提供流媒体服务,则需要使用 HLS。

正如arcyqwerty所说。任何 HTTP 服务器都能够提供 HTTP 流。但您需要在投放前准备好媒体文件和清单文件。

以下是一些对于阅读 HLS(HTTP Live Streaming)非常重要的链接:

开源服务器呢?我知道这些:

或者您也可以像我一样使用 GStreamer 进行分段并制作清单。最后,我只使用 Nginx 来为他们服务。

希望对你有所帮助。

【讨论】:

    【解决方案2】:

    任何可以提供文件的 HTTP 服务器(apache、nginx、IIS 等)都可以通过 HTTP“流式传输”媒体。 因此,如果您愿意,您可以为 RTMP 保留 RED5,并设置一个 HTTP 服务器来提供相同的文件。

    您可能需要查看Media streaming basics - HTTP vs RTMP 以了解有关协议的信息

    如果您需要单一产品的解决方案,将 nginx-rtmp 模块添加到 nginx 可能是您正在寻找的东西

    https://github.com/arut/nginx-rtmp-module

    【讨论】:

    • RED5 是闪存媒体服务器。 ipad 设备不支持 flash。
    • arcyqwerty@: 有没有开源的 http 媒体服务器可用?如何通过http流式传输rtmp?有样品吗?
    • 嗯,您提到了 RED5 作为您当前的解决方案,所以我认为它符合您的要求。我希望 ipad 有一些支持 RTMP 或 HTTP 流的媒体播放器。
    • 如果 RED5 不能满足您的需求,也许可以将 obsproject.com/index 作为 RTMP 服务器。 Nginx 默认支持 HTTP(作为 web 服务器),我提到的模块应该添加 RTMP 支持
    【解决方案3】:

    我使用它并且它工作正常。 (Ubuntu 12.04 TLS 服务器)

    一步一步:

    sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
    wget http://nginx.org/download/nginx-1.6.0.tar.gz
    wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
    tar -zxvf nginx-1.6.0.tar.gz
    unzip master.zip
    cd nginx-1.6.0
    
    ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master --with-http_flv_module --with-http_mp4_module
    make
    sudo make install
    
    sudo /usr/local/nginx/sbin/nginx -s stop
    sudo /usr/local/nginx/sbin/nginx
    

    NGINX 配置: (/usr/local/nginx/conf/nginx.conf)

    #user  nobody;
    worker_processes  1;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    #pid        logs/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    rtmp {
        server {
        listen 1935;
        chunk_size 4000;
        # video on demand for flv files
        application vod {
            play /var/flvs;
        }
    
        # video on demand for mp4 files
            application vod2 {
            play /var/mp4s;
            }
        }
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        gzip  on;
    
        server {
            listen       80;
            server_name  192.168.52.16;
            #charset koi8-r;
            #access_log  logs/host.access.log  main;
    
            # This URL provides RTMP statistics in XML
            location /stat {
                rtmp_stat all;
                rtmp_stat_stylesheet stat.xsl;
            }
    
            location /stat.xsl {
                # XML stylesheet to view RTMP stats.
                # Copy stat.xsl wherever you want
                # and put the full directory path here
                root /var/www/;
            }
    
        location /hls {
            # Serve HLS fragments
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            alias /tmp/app;
            expires -1;
        }
    
    #   location /hds {
    #       f4f;    # Use the HDS handler to manage requests
    #           # serve content from the following location
    #       alias /var/www/video;
    #   }
    
        location /video {
            mp4;
            flv;
            mp4_buffer_size     4M;
            mp4_max_buffer_size 10M;
        }
    
        location / {
            root   html;
            index  index.html index.htm;
        }
    
        error_page  404              /404.html;
    
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
    
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
    
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
        }
    }
    

    保存配置文件并:

    sudo /usr/local/nginx/sbin/nginx -s stop
    sudo /usr/local/nginx/sbin/nginx
    

    接下来... 创建两个目录:

    mkdir /var/flvs
    mkdir /var/mp4s
    

    您需要将 mp4 文件复制到 mp4s 目录。例如:sample.mp4

    最后

    sudo /usr/local/nginx/sbin/nginx -s stop
    sudo /usr/local/nginx/sbin/nginx
    

    试试:

    rtmp://your_server_ip/vod2/sample.mp4
    

    (建议:您使用 VLC 媒体播放器)

    或html代码

    <html>
    <head>
        <title>RTMP Video</title>
        <!-- flowplayer javascript component -->
        <script src="http://releases.flowplayer.org/js/flowplayer-3.2.12.min.js"></script>
    </head>
    
    <body>
    <div id="player" style="width:644px;height:480;margin:0 auto;text-align:center">
        <img src="images/background.jpg" height="480" width="644" /></div>
    <script>
    
    $f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.16.swf", {
        clip: {
            url: 'sample.mp4',
            scaling: 'fit',
            provider: 'hddn'
        },
    
        plugins: {
            hddn: {
                url: "swf/flowplayer.rtmp-3.2.13.swf",
    
                // netConnectionUrl defines where the streams are found
                netConnectionUrl: 'rtmp://your_server_ip:1935/vod2/'
    
            }
        },
        canvas: {
            backgroundGradient: 'none'
        }
    });
    </script>
    </body>
    </html>
    

    【讨论】:

      猜你喜欢
      • 2020-05-16
      • 2014-09-11
      • 1970-01-01
      • 2012-11-30
      • 2020-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多