1. First, download the FFmpeg source code, compile
First./configure--disable yasm--prefix=/usr/local/ffmpeg
Then make and make install
2. Modifying environment variables
Modify/etc/profile file, and then add
Export path= "/usr/local/ffmpeg/bin: $PATH"
3. Do a conf file, start Ffserver
Port 8090 #绑定端口号BindAddress 0.0.0.0 #绑定ipMaxHTTPConnections #最大HTTP连接数MaxClients Maximum number of client connections MaxBandWidth #最大带宽CustomLog- #日志文件, "-" for direct printing Nodaemon #默认全局参数 <feed feed1.ffm> # Feed: each input (webcam) build a feed file/tmp/feed1.ffm #Feed缓存文件 filemaxsize 20M #缓存文件最大值 ACL allow 127.0.0.1 #允许写入Feed的ip </feed><stream test.flv> #Stream: transcoding of each broadcast (converted video stream) Setup Item format FLV #视频流格式 Feed feed1.ffm #视频流的种子来源 videoframerate #视频帧频 videobitrate Video bit rate videosize 160x80 #视频帧大小 avoptionvideo flags +global_header noaudio</stream>
Note that this is noaudio, there is no audio, because it is the camera, no audio.
4. Insert the camera and connect it to the virtual machine, and use the DMESG command to see:
......
Linux Video Capture interface:v2.00
Uvcvideo:found UVC 1.00 Device USB2.0 Camera (1e4e:0110)
input:usb2.0 Camera AS/DEVICES/PCI0000:00/0000:00:11.0/0000:02:03.0/USB1/1-1/1-1:1.0/INPUT/INPUT5
Usbcore:registered New Interface Driver Uvcvideo
USB Video Class Driver (v1.0.0)
5. Use the FFmpeg command to feed ffserver a stream:
Ffmpeg-f v4l2-i/dev/video0 HTTP://127.0.0.1:8090/FEED1.FFM
6. Finally, with VLC or media player, you can play http://virtual machine ip:8090/test.flv.
Yes, remember to turn off iptables.
The problem now is that the delay is very large.
Consider the next step with RTSP protocol.
Ffmpeg+ffserver for Camera Live