由于ffserver不稳定性问题,FFmpeg最终下线了ffserver,并推荐了其他集成方案。但是对于日常非正式产品的使用,可以继续使用ffserver,需要指定安装版本(3.4.6之前的版本) 。
一、安装
安装yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
./configure
make && sudo make install
- 安装ffmpeg&ffserver
wget https://ffmpeg.org/releases/ffmpeg-3.4.6.tar.gz
tar zxvf ffmpeg-3.4.6.tar.gz
cd ffmpeg-3.4.6/
#./configure --prefix=/usr/local --enable-shared --enable-static
configuration: --prefix=/usr/local/ffmpeg --enable-version3 --enable-postproc --enable-libvorbis --enable-libvpx
make && sudo make install
- 修改ld.so.conf和etc/profile
sudo vi /etc/ld.so.conf
添加/usr/local/ffmpeg
//usr/local/ffmpeg 目录是我ffmpeg安装目录,根据你的安装目录改吧
配置/etc
export PATH="/usr/local/ffmpeg/bin:$PATH"
然后保存并运行source /etc/profile
安装完毕后验证是否成功:
ffmpeg -version
ffserver -version
二、推流
运行:ffserver -f ffserver.conf
推流:ffmpeg -i lilll1.webm http://X.X.X.X:port/feed1.ffm
拉流: http://10.0.13.120:9989/test.webm
可以在VLC配置上使用或者直接在游览器上运行
配置ffmpeg.conf
HTTPPort 9989
RTSPPort 9980
HTTPBindAddress 0.0.0.0
MaxClients 1000
MaxBandwidth 900000
CustomLog -
<Feed feed1.ffm>
File ./feed1.ffm
FileMaxSize 4000M
ACL allow 0.0.0.0 0.0.255.255
</Feed>
<Stream test1.webm>
Feed feed1.ffm
Format webm
VideoCodec libvpx
VideoFrameRate 10
VideoBitRate 300
VideoSize 480x320
NoAudio
PreRoll
StartSendOnKey
#AVPresetVideo default
#AVPresetVideo baseline
AVOptionVideo flags +global_header
AVOptionVideo cpu-used 0
AVOptionVideo qmin 10
AVOptionVideo qmax 42
AVOptionVideo quality good
AVOptionAudio flags +global_header
</Stream>
参考文章: