ffmpeg和ffserver配置使用
环境:ffmpeg 1.1 Centos 6.4 vlc 1.1.5 mp3lame 3.99.5 xvidcore 1.3.2
1. ffserver点播本地文件
ffserver.conf配置:
<Stream jbf.flv>
File "/tmp/jbf.flv"
Format rtp
#ACL allow *.*.*.*
</Stream>
本地文件存储在/tmp/jbf.flv,使用vlc 1.1.5播放器
2. ffmpeg流化到ffserver
ffserver.conf配置:
#这个是配置缓存文件的
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 1000M
ACL allow localhost 10.122.2.126
</Feed>
#这个是配置输出流的
<Stream test_h.avi>
Feed feed1.ffm
Format rtp
#
BitExact
DctFastint
IdctSimple
VideoFrameRate 25
VideoSize 352x288
VideoBitRate 200
VideoGopSize 30
VideoCodec libxvid
NoAudio
#AudioBitRate 40
#AudioChannels 2
#AudioSampleRate 22050
#AudioCodec libmp3lame
#
PreRoll 0
StartSendOnKey
#MaxTime 100
</Stream>
本地文件存储在/tmp/jlr.asf
ffmpeg命令行:./ffmpeg -i /tmp/jlr.asf http://localhost:8090/feed1.ffm
上面配置了NoAudio,则使用vlc播放时正常的,只是没有音频,将NoAudio关闭,放开下面的配置
AudioBitRate 40
AudioChannels 2
AudioSampleRate 22050
AudioCodec libmp3lame
用vlc就不能播放了,但是监视网络,rtsp及rtp(音视频都有)的流都在传输,就是vlc不出画面
ffmpeg输出错误行:Non-monotonous DTS in output stream 0:0; previous: 115846440, current: 115844580; changing to 115846441. This may result in incorrect timestamps in the output file.
问题原因还没找到。。。
3. mp3lame xvid
由于开源协议问题,ffmpeg中没有包含lame和xvid,所以直接编译ffmpeg后,默认是不支持mp3lame及xvid编码器的,我们可以下载这两个开源软件,安装之,然后在ffmpeg的configure时配置一下:
./configure --prefix=/usr/local/ffmpeg --enable-libmp3lame --enable-libxvid --enable-gpl
这样ffmpeg就支持了mp3和xvid编码了;