The FFMPEG video acquisition function is very powerful. It can not only collect video capture card or USB camera images, but also screen recording. It also supports transmitting videos to RTSP-enabled streaming media servers in RTP mode, supports live applications.
- FFmpeg Video Acquisition in Linux
On Linux, FFMPEG provides excellent support for v4l2 video devices, such:
. /FFMPEG-T 10-F video4linux2-s 176*144-R 8-I/dev/video0-vcodec h263-F RTP: // 192.168.1.105: 5060>/tmp/FFMPEG. SDP
The preceding command indicates that the video is collected for 10 seconds, and the video4linux2 video device is collected. The qcif (176*144) video is collected at 8 frames per second, and the video device is/dev/video0, the video encoding is h263 and the output format is RTP. The IP address and port are defined later, and the SDP file corresponding to the code stream is redirected to/tmp/FFMPEG. in SDP, you can upload the SDP file to the Streaming Media Server for live broadcasting.
. /FFMPEG-T 10-F video4linux2-s 176*144-R 10-vpre libx264-hq.ffpreset-I/dev/video0-vcodec libx264-F RTP: // 192.168.1.105: 6060>/tmp/x264.sdp
This command is similar to the preceding one, but the video is encoded as h264. Because FFMPEG uses the external library x264 to support h264 encoding, more parameters are required for h264 video collection. You must specify-Vpre libx264-hq.ffpreset.
- FFmpeg Video Acquisition in Windows
There is very little information about FFMPEG video collection in windows, but FFMPEG supports video collection in windows. FFmpeg supports video collection on Windows video for Windows (VFW) devices. However, VFW devices are outdated and are being replaced by WDM video devices, but FFMPEG has no plans to support WDM, however, it seems that there are tools for converting WDM into VFW, so FFMPEG can still be used for video collection in windows. The command is as follows:
./FFMPEG-T 10-F vfwcap-I 0-R 8-F MP4 cap.mp4
The specific description is as follows: we collect for 10 seconds. The collection device is a vfwcap type device and 0th vfwcap collection devices (if the system has multiple VFW video collection devices, you can use-I num to select), 8 frames per second, the output mode is file, and the format is MP4.