Linux ffserver 实例
来源:互联网 发布:c数据库编程实战经典 编辑:程序博客网 时间:2024/06/06 08:56
1) 安装编译就不说了 用的ffmpeg 2.8版本。
How to use ffserver
2) Ffserver config example (baseon ffmpeg-2.8)
# This is a test configuration file. Youcan invoke it with
# ../ffserver -f ffserver.conf
# when in the tests directory and once thevsynth1 subdirectory
# has been populated. Then point yourbrowser at http://whatever:9999/teststat.html
# and you can look at the streams
#
#
# Port on which the server is listening.You must select a different
# port from your standard http web serverif it is running on the same
# computer.
#HTTPPort 9999
HTTPPort 8090
RTSPPort 9990
# Address on which the server is bound.Only useful if you have
# several network interfaces.
HTTPBindAddress 0.0.0.0
#HTTPBindAddress 127.0.0.1
# Number of simultaneous requests that canbe handled. Since FFServer
# is very fast, this limit is determinedmainly by your Internet
# connection speed.
MaxClients 1000
MaxBandwidth 100000
# Access Log file (uses standard Apache logfile format)
# '-' is the standard output
CustomLog -
##################################################################
# Definition of the live feeds. Each livefeed contains one video
# and/or audio sequence coming from anffmpeg encoder or another
# ffserver. This sequence may be encodedsimultaneously with several
# codecs at several resolutions.
<Feed feed1.ffm>
# You must use 'ffmpeg' to send a live feedto ffserver. In this
# example, you can type:
#
# ffmpeg http://localhost:8090/feed1.ffm
# ffserver can also do time shifting. Itmeans that it can stream any
# previously recorded live stream. Therequest should contain:
#"http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
# a path where the feed is stored on disk.You also specify the
# maximum size of the feed (100M byteshere). Default:
# File=/tmp/feed_name.ffm FileMaxSize=5M
File/home/melody/Downloads/ffmpeg-2.8/tests/feed1.ffm
FileMaxSize 100M
# Fire up ffmpeg pointing at this stream
##Launch ./ffmpeg -v 0 -y -f image2 -itests/vsynth1/%02d.pgm
ACL allow localhost
</Feed>
##################################################################
# Now you can define each stream which willbe generated from the
# original audio and video stream. Eachformat has a filename (here
# 'test128.mpg'). FFServer will send thisstream when answering a
# request containing this filename.
<Stream test_h.avi>
Feed feed1.ffm
Format avi
#
BitExact
DctFastint
IdctSimple
VideoFrameRate 10
VideoSize 352x288
VideoBitRate 100
VideoGopSize 30
NoAudio
PreRoll 10
StartSendOnKey
MaxTime 100
</Stream>
<Stream test.swf>
Feed feed1.ffm
#
BitExact
DctFastint
IdctSimple
Qscale 10
VideoFrameRate 10
VideoSize 352x288
VideoBitRate 100
VideoGopSize 30
NoAudio
PreRoll 10
StartSendOnKey
MaxTime 100
</Stream>
<Stream test_l.asf>
Feed feed1.ffm
Format asf
#
BitExact
DctFastint
IdctSimple
Qscale 10
VideoFrameRate 2
VideoSize 320x240
VideoBitRate 40
VideoGopSize 20
NoAudio
PreRoll 20
StartSendOnKey
MaxTime 100
AVOptionVideo flags +global_header
Metadata title "Test data stream"
</Stream>
<Stream test_h.rm>
Feed feed1.ffm
Format rm
BitExact
DctFastint
IdctSimple
Qscale 10
VideoBitRate 100
VideoFrameRate 10
VideoGopSize 30
VideoSize 320x240
NoAudio
PreRoll 10
StartSendOnKey
MaxTime 100
</Stream>
<Stream mp4.mjpg>
File"/mnt/share/Tvideos/Kaleidoscope_mp4-mpeg4+mp3.mp4"
Format rtp
</Stream>
<Stream my.rm>
File"/mnt/share/Tvideos/Kaleidoscope_mp4-mpeg4+mp3.mp4"
Format rtp
</Stream>
<Stream outAV.flv>
File"/home/melody/ffmpeg_test/outAV.flv"
Format flv
</Stream>
##################################################################
# Special stream : server status
<Stream teststat.html>
Format status
</Stream>
2) 测试流程
a) 启动fferver
ffserver -f ./ffserver-example.conf
此时你可以在浏览器中输入http://localhost:8090/teststat.html来 ffserver status.
格式: [ http://ffserver-ip:8090/ffserver-status.html]ffserver-ip 换成ffserver ip,ffserver-status 换成在ffsever 配置文件中的ffserver status page name.
b) 播放已经存在的文件以配置文件为例,用RSTP传输。
格式:ffplay rtsp://ffserver-ip: RTSPPort /file-name
ffplay rtsp://localhost:9990/mp4.mjpg
c) 播放已经存在的文件以配置文件为例,用HTTP传输。
格式:ffplay http://ffserver-ip: HTTPPPort /file-name
ffplay http://192.168.1.60:8090/outAV.flv
有的件格式用HTTP不能正常播放,有待研究。
(二) 播放流
Feed the fee1.ffm
ffmpeg -i /home/melody/ffmpeg_test/outAV.flv http://localhost:8090/feed1.ffm
也可以在ffserver 的配置文件中用launch 来启动这个命令。
播放测试:
ffplay http://192.168.1.60:8090/test_h.rm
=============================================================================
参考资料:
ffmpeg+ffserver搭建流媒体服务器
- Linux ffserver 实例
- FFServer
- ffserver 拆解
- ffserver 拆解
- ffserver配置
- ffserver 拆解
- ffserver.conf
- ffserver + hls
- ffmpeg+ffserver
- ffserver与x264
- FFServer源码分析
- ffserver源码分析
- FFServer源码分析
- FFServer源码分析
- FFServer源码分析
- ffserver的配置
- ffmpeg和ffserver
- ffserver用法小结
- Java学习感受
- Hive基础学习文档和入门教程
- 关于achartengine的使用一些小经验(转)
- Android编译系统详解(一)
- linux poll机制
- Linux ffserver 实例
- JAVA配置系统环境
- 为什么手机充电时会感觉麻麻的,有问题吗?
- 关于H5+App的开发注意事项
- AlertDialog.Builder对话框类的用法
- 第二章:对象、消息、运行期
- windows安装phpunit
- Moneky之命令参数
- Android[初级] android开发学习之(一)HelloWrold