本文的主要内容:演示如何利用命令行采集摄像头的视频数据。
Windows
dshow支持的设备
ffmpeg -f dshow -list_devices true -i dummy
输出结果大致如下所示。
DirectShow video devices (some may be both video and audio devices)
"Integrated Camera"
DirectShow audio devices
"麦克风阵列 (Realtek(R) Audio)"
Integrated Camera是我笔记本上自带的摄像头,等会我们就是通过这个摄像头采集视频数据。
dshow支持的参数
ffmpeg -h demuxer=dshow
输出结果大致如下所示。
dshow indev AVOptions:
-video_size <image_size> set video size given a string such as 640x480 or hd720.
-pixel_format <pix_fmt> set video pixel format (default none)
-framerate <string> set video frame rate
-list_devices <boolean> list available devices (default false)
-list_options <boolean> list available options for specified device (default false)
- -video_size:分辨率
- -pixel_format:像素格式
- -framerate:帧率(每秒采集多少帧画面)
- -list_devices:true表示列出dshow支持的所有设备
- -list_options:true表示列出特定设备支持的所有参数
摄像头支持的参数
ffmpeg -f dshow -list_options true -i video="Integrated Camera"
输出结果大致如下所示。
DirectShow video device options (from video devices)
Pin "捕获" (alternative pin name "捕获")
vcodec=mjpeg min s=1280x720 fps=30 max s=1280x720 fps=30
vcodec=mjpeg min s=320x180 fps=30 max s=320x180 fps=30
vco