1.下载Windows版本的ffmpeg和Linux版本的ffserver
https://ffbinaries.com/downloads
下载ffmpeg 3.4 binaries版本
2.Linux下配置并启动ffserver
live.conf:
ACL allow 127.0.0.1 10.211.55.4(允许局域网推流到IP地址,不加的话只能Linux本机推流)
HTTPPort 8090
HTTPBindAddress 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 10.211.55.4
</Feed>
# if you want to use mpegts format instead of flv
# then change "live.flv" to "live.ts"
# and also change "Format flv" to "Format mpegts"
<Stream live.ts>
Format mpegts
Feed feed1.ffm
VideoCodec libx264
VideoFrameRate 24
VideoBitRate 512
VideoSize 854x480
AVOptionVideo crf 23
AVOptionVideo preset medium
# for more info on crf/preset options, type: x264 --help
AVOptionVideo flags +global_header
AudioCodec aac
Strict -2
AudioBitRate 128
AudioChannels 2
AudioSampleRate 48000
AVOptionAudio flags +global_header
</Stream>
##################################################################
# Special streams
##################################################################
<Stream stat.html>
Format status
# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255 0.0.0.0
</Stream>
# Redirect index.html to the appropriate site
<Redirect index.html>
URL http://www.ffmpeg.org/
</Redirect>
##################################################################
启动:
./ffserver -f live.conf
推流地址:http://10.211.55.4:8090/feed1.ffm
播流地址:http://10.211.55.4:8090/live.ts
3.Windows下启动ffmpeg推流
推流指定的视频文件流
ffmpeg -i test.mp4 http://10.211.55.4:8090/feed1.ffm
Windows下推流桌面录屏流(若为Linux,则将gdigrab替换为x11grab)
audio=""(替换为实际的录音设备名称)
ffmpeg -f gdigrab -s 320x240 -r 25 -i desktop -f dshow -i audio="Microphone (Parallels Audio Controller)" -r 5 -vcodec libx264 -preset:v ultrafast -tune:v zerolatency -acodec libmp3lame http://10.211.55.4:8090/feed1.ffm
4.效果预览