使用ffserver实现转发实时流媒体(摄像头捕获)

来源:互联网 发布:sql怎么清除数据 编辑:程序博客网 时间:2024/04/29 04:03

本系统为ubuntu 10.04LTS

说明1:本实验在本机成功测试通过;

说明2:本实验仅仅测试了视频流,未测试音频流。


1、配置ffserver.conf

-----------------------------ffserver.conf----------------------------start

Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
NoDaemon


<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 200K
ACL allow 127.0.0.1
</Feed>

<Stream test1.mpg>
Feed feed1.ffm
Format mpeg
VideoBitRate 64
VideoBufferSize 40
VideoFrameRate 3
VideoSize 352x240
VideoGopSize 12
NoAudio
</Stream>


<Stream stat.html>
Format status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</Stream>
-----------------------------ffserver.conf----------------------------end


2、启动ffserver

命令: ffserver -f doc/ffserver.conf


3、检查服务器状态

在web浏览器中输入地址:http://localhost:8090/stat.html

若能看到 ffserver Status 说明成功启动,通过内容可以看到在ffserver.conf配置的流信息等内容,对整个过程的成功进行有帮助


4、捕获输入流,采集到临时文件feed1.ffm

命令:ffmpeg -f video4linux2 -framerate 30 -i /dev/video0 http://localhost:8090/feed1.ffm


5、请求ffserver播放视频流

命令:ffplay http://cher-ubuntu:8090/test1.mpg


使用ffmpeg捕获USB外部摄像头视频流

本系统为ubuntu 10.04 LTS

// 捕获存入文件后播放

1、捕获:ffmpeg -f video4linux2 -s 320*300 -i /dev/video0 test.asf

2、播放:ffplay test.asf

// 捕获后实时播放

1、ffplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
0 0
原创粉丝点击