学ffmpeg之际想看看推流,折腾了一天彻底是配置的缘由,现记录一下供之后查找。html
推流还有个live555,想了解能够去搜索下,固然方案不止这些。ide
http://www.ffmpeg.org/ffserver.htmlspa
# 注释以#开头
Port 8090 BindAddress 0.0.0.0 MaxHTTPConnections 2000 MaxClients 1000 MaxBandwidth 1000000 CustomLog - <Feed video.ffm> File /tmp/video.ffm FileMaxSize 1024M ACL allow 127.0.0.1 </Feed> <Feed sound.ffm> File /tmp/sound.ffm FileMaxSize 100M ACL allow 127.0.0.1 </Feed> <Stream live.flv> Format flv Feed video.ffm VideoCodec libx264 VideoFrameRate 24 VideoBitRate 5120 VideoSize 1920x1080 AVOptionVideo crf 23 AVOptionVideo preset medium AVOptionVideo flags +global_header AudioCodec aac Strict -2 AudioBitRate 320 AudioChannels 2 AudioSampleRate 44100 AVOptionAudio flags +global_header </Stream> <Stream live.flac> Feed sound.ffm Title "Music Live" AudioBitRate 320 AudioChannels 2 AudioSampleRate 44100 NoVideo </Stream> <Stream stat.html> Format status ACL allow localhost ACL allow 192.168.0.0 192.168.255.255 </Stream> <Redirect index.html> URL http://www.ffmpeg.org/ </Redirect>
将上述代码保存成文本文件,例如:ffserver.confcode
经过 ffserver -f ffserver.conf 启动ffserverorm
使用 ffmpeg -i xx.mp4 http://ip:port/video.ffm 将xx.mp4转码到ffserver的视音频(sound.ffm转码到单独音频)视频
播放 http://ip:port/live.flv 播放音视频(live.flac播放音频)server