安装ffmpeg:

下载FFmpeg和libx264的包
ffmpeg-2.4.1.tar.bz2  last_x264.tar.bz2
libx264需要yasm,所以先安装yasm

  1. apt-get install yasm

然后安装libx264

  1. aptitude install libx264-dev

也可以手动安装libx264(原先libx264在ubuntu的软件源里是没有的只能手动安装,现在有了就可以不用手动安装了)
解压缩libx264

  1. tar -xjvf last_x264.tar.bz2

安装libx264

  1. ./configure --enable-shared --enable-pic
  2. make
  3. make install

然后安装ffmpeg,ffmpeg有许多依赖包,需要一个一个先安装
1. libfaac

  1. aptitude install libfaac-dev

2. libmp3lame

  1. aptitude install libmp3lame-dev

3. libtheora

  1. aptitude install libtheora-dev

4. libvorbis

  1. aptitude install libvorbis-dev

5. libxvid

  1. aptitude install libxvidcore-dev

6. libxext

  1. aptitude install libxext-dev

7. libxfixes

  1. aptitude install libxfixes-dev

依赖包安装完后,安装ffmpeg
先解压缩ffmpeg

  1. tar -xjvf ffmpeg-2.4.1.tar.bz2

然后编译安装

  1. ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
  1. make
  2. make install

nginx+nginx-rtmp-module+ffmpeg搭建流媒体服务器:

Nginx本身是一个非常出色的HTTP服务器,FFMPEG是非常好的音视频解决方案.这两个东西通过一个nginx的模块nginx-rtmp-module,组合在一起即可以搭建一个功能相对比较完善的流媒体服务器.

这个流媒体服务器可以支持RTMP和HLS(Live Http Stream)

从安装开始

Nginx的安装参照我之前的这个: http://blog.csdn.net/redstarofsleep/article/details/45092127

不同的是在configure的时候需要增加nginx-rtmp-module的支持,下载好nginx-rtmp-module后解压,然后nginx安装时增加这个模块(--add-module),其它都是一样的.

  1. ./configure --prefix=/usr/local/nginx --with-pcre=/home/user/pcre/pcre-8.32--with-zlib=/home/user/zlib/zlib-1.2.8--with-openssl=/home/user/openssl/openssl-1.0.1i  --add-module=/home/user/nginx-rtmp-module

FFMPEG的安装参照上一篇: http://blog.csdn.net/redstarofsleep/article/details/45092145

nginx配合ffmpeg做流媒体服务器的原理是:nginx通过rtmp模块提供rtmp服务, ffmpeg推送一个rtmp流到nginx, 然后客户端通过访问nginx来收看实时视频流. HLS也是差不多的原理,只是最终客户端是通过HTTP协议来访问的,但是ffmpeg推送流仍然是rtmp的.

安装完成后,打开Nginx的配置文件nginx.conf进行配置

首先在里面加入rtmp的配置

  1. rtmp {
  2. server {
  3. listen 1935;
  4. application myapp {
  5. live on;
  6. }
  7. application hls {
  8. live on;
  9. hls on;
  10. hls_path /tmp/hls;
  11. }
  12. }
  13. }

然后,针对hls,还需要在http里面增加一个location配置

  1. location /hls {
  2. types {
  3. application/vnd.apple.mpegurl m3u8;
  4. video/mp2t ts;
  5. }
  6. root /tmp;
  7. add_header Cache-Control no-cache;
  8. }

这是一个最简单,最基础的配置, rtmp监听1935端口,如果是hls的话用hls on开启hls,并且为hls设置一个临时文件目录hls_path /tmp/hls; 其它更高级的配置可以参看nginx-rtmp-module的readme,里面有比较详细的介绍其它的配置,并且它还提供了一个通过JWPlayer在网页上播放的例子.

保存完配置文件后,启动nginx,通过netstat -ltn命令可以看到增加了一个1935端口的监听.8080是nginx默认的http监听端口.

[java] view plaincopy

  1. # netstat -ltn
  2. Active Internet connections (only servers)
  3. Proto Recv-Q Send-Q Local Address           Foreign Address         State
  4. tcp        00127.0.1.1:530.0.0.0:*               LISTEN
  5. tcp        000.0.0.0:220.0.0.0:*               LISTEN
  6. tcp        00127.0.0.1:6310.0.0.0:*               LISTEN
  7. tcp        000.0.0.0:19350.0.0.0:*               LISTEN
  8. tcp        000.0.0.0:80800.0.0.0:*               LISTEN
  9. tcp6       00:::22:::*                    LISTEN
  10. tcp6       00::1:631:::*                    LISTEN

然后用ffmpeg推流到nginx:

第一个是推到了上面配置的myapp上:

[java] view plaincopy

  1. ffmpeg -re -i"D:\download\film\aqgy\02.mp4"-vcodec libx264 -vprofile baseline -acodec aac
  2. -ar 44100-strict -2-ac1-f flv -s 1280x720 -q10rtmp://server:1935/
  3. myapp/test1

第二个推送到hls上:

[java] view plaincopy

  1. ffmpeg -re -i"D:\download\film\aqgy\02.mp4"-vcodec libx264 -vprofile baseline -acodec aac
  2. -ar 44100-strict -2-ac1-f flv -s 1280x720 -q10rtmp://ip:1935/
  3. hls/test2

现在我们的流媒体服务器有两个实时流了,一个是rtmp的,另一个是hls的,用流媒体播放器播放一下,流媒体播放器可以用vlc也可以用ffmpeg带的ffplay.手机也是可以播放的.

上面这两个流的地址分别是:

第一个就是推送的地址: rtmp://serverIp:1935/myapp/test1

第二个是HTTP地址: http://serverIp:8080/hls/test2.m3u8

最后贴上一段对于HLS这个比较特殊的流媒体协议的解释:

(这段解释来自: http://www.cnblogs.com/haibindev/archive/2013/01/30/2880764.html)

  HTTP Live Streaming(HLS)是苹果公司(Apple Inc.)实现的基于HTTP的流媒体传输协议,可实现流媒体的直播和点播,相对于常见的流媒体直播协议,例如RTMP协议、RTSP协议、MMS协议等,HLS直播最大的不同在于,直播客户端获取到的,并不是一个完整的数据流。HLS协议在服务器端将直播数据流存储为连续的、很短时长的媒体文件(MPEG-TS格式),而客户端则不断的下载并播放这些小文件,因为服务器端总是会将最新的直播数据生成新的小文件,这样客户端只要不停的按顺序播放从服务器获取到的文件,就实现了直播。由此可见,基本上可以认为,HLS是以点播的技术方式来实现直播。由于数据通过HTTP协议传输,所以完全不用考虑防火墙或者代理的问题,而且分段文件的时长很短,客户端可以很快的选择和切换码率,以适应不同带宽条件下的播放。不过HLS的这种技术特点,决定了它的延迟一般总是会高于普通的流媒体直播协议。

用开源nginx-rtmp-module搭建flash直播环境:

1、将nginx和nginx-rtmp-module的源码包解压
PS:nginx-rtmp-module网址
https://github.com/arut/nginx-rtmp-module

2、进入nginx的源代码目录,编译
./configure --add-module=<path-to-nginx-rtmp-module> --without-http_rewrite_module
make
make install

3、写一个测试配置文件
#user  nobody;
worker_processes  1;

error_log  logs/error.log debug;
#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 4096;

application myapp {
            live on;
        }
    }
}

http {
    server {
        listen      8080;

location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

location /stat.xsl {
            root /home/arut-nginx-rtmp-module-e5d61f2/;
        }

location / {
            root /home/arut-nginx-rtmp-module-e5d61f2/test/rtmp-publisher;
        }
    }
}

4、启动nginx
/usr/local/nginx/sbin/nginx -c /home/arut-nginx-rtmp-module-e5d61f2/test/nginx.conf

5、用ffmpeg产生一个模拟直播源,向rtmp服务器推送
ffmpeg -re -i ~/2012.flv -f flv rtmp://192.168.11.75/myapp/test1
注意,源文件必须是H.264+AAC编码的。192.168.11.75是运行nginx的服务器IP

6、访问http://192.168.11.75:8080/stat,可以看到统计情况

7、网页播放测试,用nginx-rtmp-module自带的一个例子修改,在test/rtmp-publisher目录下

player.html

<!DOCTYPE html>
<html>
<head>
    <title>RTMP Player</title>
    <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">
        var flashVars = {
            streamer: 'rtmp://192.168.11.75/myapp',
            file:'test1'
        };
        swfobject.embedSWF("RtmpPlayer.swf", "rtmp-publisher", "500", "400", "9.0.0",

null, flashVars);
    </script>
</head>
<body>
    <div id="rtmp-publisher">
        <p>Flash not installed</p>
    </div>
</body>
</html>

访问http://192.168.11.75:8080/player.html,可以播放。用三星P7500安卓平台也可以播放,就是

播放大视频会很卡

nginx-rtmp-module还有许多其他特性,例如支持FLV/MP4的点播、HLS直播、多worker工作模式、push and pull工作模式等,以后慢慢挖掘

Nginx-RTMP功能调研:

1.RTMP协议介绍...2

2.RTMP server.3

2.1当前的流媒体server.3

2.2Wowza功能...3

3.Nginx-based RTMP server.5

3.1  Nginx rtmp 功能点...5

3.2编译nginx rtmp模块...6

3.3配置以及功能介绍...6

3.4用nginx-rtmp-module搭建直播环境...8

3.5Nginx rtmp对于HLS支持...13

协议介绍

RTMP(Real Time Messaging Protocol)实时消息传送协议是Adobe Systems公司为Flash播放器和服务器之间音频、视频和数据传输开发的私有协议。

它有三种变种:

1)工作在TCP之上的明文协议,使用端口1935

2)RTMPT封装HTTP请求之中,可穿越防火墙

3)RTMPS类似RTMPT,但使用的是HTTPS连接;

RTMP协议就像一个用来装数据包的容器,这些数据可以是AMF格式的数据,也可以是FLV中的视/音频数据。一个单一的连接可以通过不同的通道传输多路网络流。这些通道中的包都是按照固定大小的包传输的。

1RTMP交互图

更多协议的细节可以参见《rtmp specification 1.0

2. RTMP server

2.1当前的流媒体server

现在主要有两种rtmp server,商业的和开源的。商业的比开源的支持的功能多,个人根据需要选择吧

商业的有FMS Wowza

开源RTMP server

1.  red5 java  有名

2.  crtmpserver c++ 支持多种rtmp协议,移动设备以及IPTV相关网络协议 http://www.rtmpd.com/ Erlyvideo erlong 有开源和商业版本 https//github.com/erlyvideo/erlyvideo h

3.  aXeVideo haXe 一个实验性的,轻量级的服务器 http://code.google.com/p/haxevideo/

4. FluorineFx .Net To be defined http://www/fluorinefx.com

5. nginx-rtmp c nginx模块 支持rtmp和HLS https://github.com/arut/nginx-rtmp-module

2.2 Wowza功能

FMS是Adobe公司的产品,license非常昂贵。下面就wowza这个商业软件讲下流媒体Server,不仅仅是RTMP Server,在达到生产环境所需要的功能。wowza最突出的特定是多终端适应性,这个在如今多媒体融合的网络环境下有很强的实用意义。究其原理并无深入研究。国内尚为视讯是其代理公司。

Wowza Media Server是一款高性能、多线程的流媒体服务器软件。专为多种终端设备提供音视频内容播放服务,支持iOSwindowsAndroidBlackMerry等系统的终端设备,以HTTPRTSP/ RTPRTMP传输协议的流播放,还支持利用机顶盒进行播放的IPTV

通过对Wowza Media Server的深度定制开发,尚为网络视听管理系统实现了对网络音视频内容的采集、编码、编辑、转码、审核、播出与监控等完整的生命周期管理,突出了以下能力:

1)自动化内容收录

  对网络视频的录制,采用服务器端录制模式,满足从28Kbps10Mbps码流范围的H.264编码流的自动化定时收录。

2)快速在线编辑

云计算架构设计,服务器端处理。所有编辑任务都处在云端,对编辑机无要求,任务处理快捷简单。

  对视频的处理包括切条、合并、去除广告、添加logo等操作。

  支持同一素材多格式文件的一次性编辑处理,提高工作效率。

3)云式转码

  采用云转码技术开发的音视频文件转码、实时流转码,实现了不同格式、码率、分辨率、帧数等参数的自由转换,满足不同终端的播放需求。

4)多终端发布支持

  结合Wowza Media Server支持多协议多终端的特性,尚为网络视听系统一个平台即可支持多终端设备的视频访问,无论用任何设备都可访问所需的视频内容。

  在对多终端内容统一管理的基础之上,还可实现了多终端视频的断点续播功能。用户的播放在一个终端上播放暂停后,用户的信息、节目信息以及断点信息立刻传送给其它终端,实现了不同终端间的断点续播。

5)稳定的安全保障

  全LINUX架构,保障系统的安全性。

  自动支持负载均衡部署,可满足大并发用户的数据响应处理。

扩展性好,可随需增减流媒体服务器来变更系统承载的并发用户数。

除此之外,个人认为完善的DRM版权管理对于视频直播分发是非常重要的功能,服务器状态实时监控是对运营的高效稳定也有非常最要的功能。

3. Nginx-basedRTMP server

3.1  Nginx rtmp 功能点

1.   支持音视频直播

2.   支持flv/mp4视频格式,输入可以是文件或者HTTP流

3.   支持两种流的分发模式 pushand pull

4.   可以将直播流录制成flv文件

5.   H264/AAC编码

6.   支持在线转码 Onlinetranscoding with FFmpeg

7.   支持HLS (HTTP LiveStreaming)需要 libavformat (>= 8. 53.31.100) from ffmpeg (ffmpeg.org)

8.   HTTPcallbacks (publish/play/record/update etc)

9.   支持外部程序(exec)

10.  HTTPcontrol module for recording audio/video and dropping clients

11.  先进内存控制技术,可以在使用少量内存的情况下完成流畅的直播功能。

12 . 可以和以下协同工作。FMS server(Wirecast, FMS, Wowza,)Player(JWPlayer, FlowPlayer, StrobeMediaPlayback,)外部程序(ffmpeg,avconv,rtmpdump,flvstreamer )

13. Statistics in XML/XSL in machine- & human- readable form

14.  支持跨平台 Linux/FreeBSD/MacOS

项目地址

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

nginx-rtmp-module Directives

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

总的来说Nginx-RTMP是个比较轻量的项目,可以满足直播的采集,编码和分发工作,该项目丰富的完善了nginx对视频的支持,特别的nginx-rtmp实现了对HLS的支持。

3.2 编译nginx rtmp模块

编译安装,和其他nginx模块一样

./configure--add-module=/path/to/nginx-rtmp-module

对于HLS的支持,需要额外的一个模块 .

./configure--add-module=/path/to/nginx-rtmp-module--add-module=/path/to/nginx-rtmp-module/hls

3.3 配置以及功能介绍

RTMP 直播的一般格式是rtmp://youdomain.com/app/name,其中app的名字对于application的名字,

1.      下列是直播的配置,app是live。

application live {
 
    live on;
}

2.    配置支持访问控制,你可以指定允许发布的IP以及允许收看的IP:

application live {
 
    live on;
 
    allow publish 127.0.0.1;
    deny publish all;
    allow play all;

3.支持Multi-worker streaming工作方式,需要指令rtmp_auto_push on支持,这样nginx有多个worker的情况下,可以将流分发到多个进程进行处理,充分利用服务器资源。

rtmp_auto_push on;
 
rtmp {
 
    server {
 
        listen 1935;
 
        chunk_size 4000;
 
        # TV mode: one publisher, many subscribers
        application mytv {
            live on;
        }
    }
}

4. 流转码的功能,下面的例子使用了exec这种使用外部程序ffmpeg的功能.  Ffmpeg是一个强大的媒体处理工具,几乎可以做任意有关video/audio的处理。更多ffmpeg与RTMP流媒体连接用法可以参考以下链接。

http://www.chinavideo.org/viewthread.php?tid=15423

# Transcoding (ffmpeg needed)
application big {
            live on;
            # Multiple exec lines can be specified.
            exec /usr/bin/ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 32x32 -f flv rtmp://localhost:1935/small/${name};
}
application small {
            live on;
            # Video with reduced resolution comes here from ffmpeg
}
 

5.Push和pull模式,用在多个server协助的情况下,输出流可以push,输入流可以pull。

 
        application mypush {
            live on;
 
            # Every stream published here
            # is automatically pushed to 
            # these two machines
            push rtmp1.example.com;
            push rtmp2.example.com:1934;
        }
 
        application mypull {
            live on;
 
            # Pull all streams from remote machine
            # and play locally
            pull rtmp://rtmp3.example.com pageUrl=www.example.com/index.html;
        }
 

3.4 用nginx-rtmp-module搭建直播环境

1.      需要准备视频源,这个可以使用ffmpeg模拟,或者通过FMS采集。使用ffmpeg比较方便,例如ffmpeg -re -i /root/test123.flv -f flv rtmp://192.168.100.135/myapp/test,这样一条命令就可以发布一个直播源。

2.      配置nginx-rtmp,完成相关功能配置,可以参考以上描述。

3.      搭建客户端测试环境,本文测试播放器使用的是jwplayer

https://github.com/arut/nginx-rtmp-module项目里面test目录下有相关的播放器设置和配置文件。

配置文件

[html] view plaincopy

  1. worker_processes  1;
  2. error_log  logs/error.log debug;
  3. #error_log  logs/error.log  notice;
  4. #error_log  logs/error.log  info;
  5. #pid        logs/nginx.pid;
  6. events {
  7. worker_connections  1024;
  8. }
  9. rtmp {
  10. server {
  11. listen 1935;
  12. chunk_size 128;
  13. publish_time_fix off;
  14. application myapp {
  15. live on;
  16. record keyframes;
  17. record_path /tmp;
  18. record_max_size 128K;
  19. record_interval 30s;
  20. record_suffix .flv;
  21. on_publish http://localhost:8080/publish;
  22. on_play http://localhost:8080/play;
  23. on_record_done http://localhost:8080/record_done;
  24. }
  25. application myapp2 {
  26. live on;
  27. }
  28. #        application mypull {
  29. #            live on;
  30. #            pull myapp mystream localhost;
  31. #        }
  32. #        application mypush {
  33. #            live on;
  34. #            push myapp mystream localhost;
  35. #            push myapp2 mystream localhost;
  36. #        }
  37. }
  38. }
  39. http {
  40. server {
  41. listen      8080;
  42. location /publish {
  43. return 201;
  44. }
  45. location /play {
  46. return 202;
  47. }
  48. location /record_done {
  49. return 203;
  50. }
  51. location /stat {
  52. rtmp_stat all;
  53. rtmp_stat_stylesheet stat.xsl;
  54. }
  55. location /stat.xsl {
  56. root /home/rarutyunyan/nginx-rtmp-module/;
  57. }
  58. location /rtmp-publisher {
  59. root /home/rarutyunyan/nginx-rtmp-module/test;
  60. }
  61. location / {
  62. root /home/rarutyunyan/nginx-rtmp-module/test/www;
  63. }
  64. }
  65. }

测试用例:

/home/rarutyunyan/nginx-rtmp-module/test/rtmp-publisher

/home/rarutyunyan/nginx-rtmp-module/test/www

测试URL:

http://192.168.100.135:8080/index.html

http://192.168.100.135:8080/rtmp-publisher/player.html

效果:

支持的配置指令有很多,没有一一研究。参见:

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

max_streams

syntax: max_streams value
context: rtmp, server

Setsmaximum number of RTMP streams. Data streams are multiplexed into a single datastream. Different channels are used for sending commands, audio, video etc.Default value is 32 which is usually ok for many cases.

exec

Syntax: exec command arg*
Context: rtmp, server, application

Specifiesexternal command with arguments to be executed on every stream published. Whenpublishing stops the process is terminated. Full path to binary should bespecified as the first argument. There are no assumptions about what thisprocess should do. However this feature is useful with ffmpeg for streamtranscoding. FFmpeg is supposed to connect to nginx-rtmp as a client and outputtranscoded stream back to nginx-rtmp as publisher. Substitutions of form$var/${var} can be used within command line:

·        $name - stream name

·        $app - application name

·        $addr - client address

·        $flashver - client flashversion

·        $swfurl - client swf url

·        $tcurl - client tc url

·        $pageurl - client page url

Thefollowing ffmpeg call transcodes incoming stream to HLS-ready stream(H264/AAC). FFmpeg should be compiled with libx264 & libfaac support forthis example to work.

3.5 Nginx rtmp对于HLS支持

HTTP Live Streaming(缩写是 HLS)是一个由苹果公司提出的基于HTTP的流媒体网络传输协议。是苹果公司QuickTime X和iPhone软件系统的一部分。它的工作原理是把整个流分成一个个小的基于HTTP的文件来下载,每次只下载一些。当媒体流正在播放时,客户端可以选择从许多不同的备用源中以不同的速率下载同样的资源,允许流媒体会话适应不同的数据速率。在开始一个流媒体会话时,客户端会下载一个包含元数据的extended M3U (m3u8) playlist文件,用于寻找可用的媒体流。

HLS只请求基本的HTTP报文,与实时传输协议(RTP)不同,HLS可以穿过任何允许HTTP数据通过的防火墙或者代理服务器。它也很容易使用内容分发网络来传输媒体流。

此协议详细内容请参考apple官方网站:https://developer.apple.com/resources/http-streaming/

搭建HLS server方式有以下三种:

1.      利用apple SDK,

2.      利用adobe 的fms,4.5版本支持hls,可以参考,

http://www.adobe.com/products/flash-media-streaming/features._sl_id-contentfilter_sl_featuredisplaytypes_sl_new.html

利用其他商业软件也可以比如wowza。

3.    一种是利用opensouce.Nginx-rtmp。

下面主要是Nginx-RTMP对HLS直播的支持。

HTTP Live Streaming(HLS)is an HTTP-based media streaming communications protocol implemented by AppleInc.
If you are interested in any of the following:

·Streaming audio or video toiPhone, iPod touch, iPad, or Apple TV

·Streaming live events withoutspecial server software

·Sending video on demand withencryption and authentication

图5 HLS(HTTP Live Streaming)

使用nginx-rtmp完成hls支持,需要额外的segmenter支持,该工具可以将文件分割成 ts小文件并且产生m3u8列表。项目地址:https://github.com/johnf/m3u8-segmenter。

下载编译只需要编译m3u8-segmenter.c即可,需要libc2.5以上支持。l

流化可以支持以下两种。第一种尚未找到具体方法,下面的实例是采用第二种基于文件的。

Stream Segmenter

Stream Segmenter reads live broadcast from network(normally udpprotocol) and publish HTTP Live Streaming into the internet. It reads theTransport Stream from the network and divides it into a series of small mediafiles of equal duration. Even though each segment is in a separate file, videofiles are made from a continuous stream which can be reconstructed seamlessly.

The segmenter also creates an index file containing references tothe individual media files. Each time the segmenter completes a new media file,the index file is updated. The index is used to track the availability andlocation of the media files.
Media segments are saved as .ts files (MPEG-2 transport stream files). Indexfiles are saved as .M3U8 playlists.

File Segmenter

File Segmenter allows you to use a library of existing audio andvideo files for sending video on demand via HTTP Live Streaming. The FileSegmenter performs the same tasks as the Stream Segmenter, but it takes filesas input instead of streams.

Our File Segmenter supportsMP4,TS, MOV, FLV and some otherfile formats. If you already have a media file encoded using supportedcodecs(H.264 + AAC or H.264 + MP3), you needn't to re-encode it, otherwise, youneed to re-encode the video or audio. The File Segmenter has two work mode:re-encode and no-re-encode.

1.      使用ffmpeg + segmenter:首先转化成ts文件,然后分割

ffmpeg -loglevel quiet  -i cctv1.ts -f mpegts - | segmenter -i - -d 10 -p /tmp/app/big_buck_bunny -m/tmp/app/big_buck.m3u8 -u http://inodes.org/hls/

2.       高版本的ffmpeg可以直接转化

参考链接:http://1.richitec.sinaapp.com/?p=64

ffmpeg -i test456.mp4 -f  segment -segment_time 10  -segment_format mpegts -segment_listlist_file.m3u8 -codec copy -bsf:v h264_mp4toannexb -map 0 output_file-%d.ts

HLS相关配置如下

[html] view plaincopy

  1. application hls {
  2. hls on;
  3. hls_path /tmp/app;
  4. hls_fragment 10s;
  5. }
  6. location /hls {
  7. # Serve HLS fragments
  8. alias /tmp/app;
  9. }


使用vlc测试。

测试成功。

nginx+ffmpeg搭建流媒体服务器相关推荐

  1. Nginx+ffmpeg 搭建流媒体服务器(四):H5直播演练

    H5直播演练 播放器选型 video.js hls.js flv.js 播放器选型 video.js 链接: GitHub https://unpkg.com/video.js/dist/video- ...

  2. 音视频开发(8)---nginx+nginx-rtmp-module+ffmpeg搭建流媒体服务器

    nginx+nginx-rtmp-module+ffmpeg搭建流媒体服务器 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/redstarofsle ...

  3. ffmpeg libx264_nginx+ffmpeg搭建流媒体服务器(直播流)

    这里实现了简单nginx+ffmpeg 推本地mp4视频文件的功能,以后将会继续更新 环境 系统环境:CentOS release 6.7 (Final) 需求 利用nginx和ffmpeg搭建流媒体 ...

  4. Linux---nginx+ffmpeg搭建流媒体服务器

    这里实现了简单nginx+ffmpeg 推本地mp4视频文件的功能,以后将会继续更新 环境 系统环境:CentOS release 6.7 (Final) 需求 利用nginx和ffmpeg搭建流媒体 ...

  5. srs服务器播放文件,使用SRS+ffmpeg搭建流媒体服务器播放m3u8格式视频

    1.简介 srs是一个简单的流媒体开源直播软件,ffmpeg是完整的跨平台解决方案,用于记录,转换和流传输音频和视频. 2.相关 官网下载页面:点击我到达 在线演示播放页面:点击我到达 Git页面:点 ...

  6. nginx+nginx-rtmp-module+ffmpeg搭建流媒体服务器

    Nginx本身是一个非常出色的HTTP服务器,FFMPEG是非常好的音视频解决方案.这两个东西通过一个nginx的模块nginx-rtmp-module,组合在一起即可以搭建一个功能相对比较完善的流媒 ...

  7. 使用EasyDarwin + ffmpeg 搭建流媒体服务器,实现多台智能电视同步播放宣传视频

    近期单位用户提出需求,需要在单位内部的9台安卓智能电视(小米电视)上同步播放用户提供的宣传视频,希望能够做到所有电视音视频同步播放(电视均位于食堂内部,使用内置扬声器,各电视间音频延迟不同会导致混响) ...

  8. Nginx+jwPlay搭建流媒体服务器,记忆播放

    1.具体的流媒体服务器的搭建参考博客: http://blog.chinaunix.net/uid-20639775-id-154556.html 具体可能编译的时候有个地方报错 /root/ngin ...

  9. obs nginx-rtmp-module搭建流媒体服务器实现直播 ding

    欢迎大家来此浏览,希望大家一块在此学习,共同交流进步. 接下来我就简单跟大家介绍一下利用nginx来搭建流媒体服务器. 我选择的是腾讯云服务器 1.下载nginx-rtmp-module: nginx ...

最新文章

  1. uva 101 The Blocks Problem
  2. wpf学习笔记---初识xaml标签语言
  3. Base64 加密算法原理
  4. Vue — 第七天(vue-cli-案例)
  5. 关于本博客数据仓库方面的原创文章汇总
  6. sql不写parametertype_Mapper接口中方法的输入参数类型要和Mapper.xml中定义的每个sql的parameterType的类型相同...
  7. 从零开始搭建轻量级JavaWeb框架
  8. 有多少程序员干到35岁,那么其他人去干什么了?
  9. 【鱼眼镜头2】[鱼眼畸变模型]:评估了五个模型:radial,division,FOV,多项式(如双三次]和rational模型。【需要修改】
  10. css横排文字光影效果_css3模糊发光文字动画特效
  11. java成员变量默认是_在Java语言中,String类型的成员变量的默认初始值是( )
  12. Option3X 5G 全网部署(基于 IUV_5G 软件)
  13. 【算法设计与分析】C++回溯法求全排列
  14. Halo2学习笔记——背景资料之Elliptic curves(5)
  15. 超级右键 iRightMouse --Mac强大的右键菜单设置工具
  16. 【树莓派开发】使用树莓派在Linux环境下编写C语言代码
  17. Elasticsearch 中文IK分词器
  18. C++ 函数的声明和定义
  19. 基于全志A33开发板linux系统移植学习记录(Boot0)
  20. 安卓手机如何投屏? Scrcpy完美解决

热门文章

  1. 伦敦金走势实时与前瞻
  2. ultraedit反编译c语言,UltraEdit怎么反编译
  3. 从业五年java的感受 十
  4. SMT丨工艺特点及详细生产工艺流程
  5. Flash CS3的ActionScript3入门
  6. sinr的值在多少到多少之间
  7. 【机器学习概率统计】02 事件的关系:深入理解独立性
  8. 如何降低直通车推广的费用花销?影响因素有哪些?
  9. 干货!什么是游戏外挂,外挂的种类及实现原理
  10. IE 访问服务器页面调试显示挂起,数据提交一直在挂起状态(IE显示请求挂起)...