首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Http媒体流服务器

Http媒体流服务器
EN

Stack Overflow用户
提问于 2013-12-04 14:59:48
回答 3查看 33.1K关注 0票数 8

我已经用RED5媒体服务器(RTMP)开发了视频流应用程序。而不是RTMP需要通过HTTP直播视频。

是否有开源的HTTP媒体服务器??

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

提前谢谢。

EN

回答 3

Stack Overflow用户

发布于 2013-12-05 09:09:20

HTTP和RTMP基本上是不同的协议。您将不会在HTTP中提供RTMP。(尽管您可以为隧道解决方案执行此操作)。

有几种方法可以实现HTTP流。例如HLS、DASH、平滑和渐进式下载。如果你需要服务流到iOS (iPad,iPhone,苹果电视),你将需要使用HLS。

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

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

  • http://features.encoding.com/http-live-streaming-hls/

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

http://www.flumotion.net/

  • Flumotion

  • Gstreamer服务器流:http://cgit.freedesktop.org/gstreamer/gst-streaming-server/

  • Nginx HLS模块:http://nginx.org/en/docs/http/ngx_http_hls_module.html (仅限Nginx Plus)

或者您可以像我一样,使用GStreamer进行细分和显示。最后,我只使用Nginx来为他们服务。

我希望我对你有一点帮助。

票数 11
EN

Stack Overflow用户

发布于 2013-12-04 15:07:18

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

您可能希望在Media streaming basics - HTTP vs RTMP中查找有关协议的信息

如果您需要一个单一产品的解决方案,那么将nginx-rtmp模块添加到nginx中可能就是您想要的

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

票数 2
EN

Stack Overflow用户

发布于 2014-05-22 15:01:31

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

分步执行:

代码语言:javascript
复制
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//nginx/conf/nginx.conf)

代码语言:javascript
复制
#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;
    #}
    }
}

保存配置文件并执行以下操作:

代码语言:javascript
复制
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx

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

代码语言:javascript
复制
mkdir /var/flvs
mkdir /var/mp4s

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

最终

代码语言:javascript
复制
sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx

尝试:

代码语言:javascript
复制
rtmp://your_server_ip/vod2/sample.mp4

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

或html代码

代码语言:javascript
复制
<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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20369046

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档