我有一个 hama usb 网络摄像头,可以使用 fswebcam 命令正常捕获单帧,但是当我尝试使用 ffmpeg 捕获视频时出现错误:
sudo ffmpeg -f video4linux2 -i /dev/video0 myvid.mpg
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 16 2012 19:54:21 with gcc 4.6.3
configuration:
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
[video4linux2,v4l2 @ 0x11f0440] Buffer len [0] = 12288 != 19200
/dev/video0: Operation not permitted
命令 usb-devices 给出:
T: Bus=01 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0c45 ProdID=6142 Rev=01.01
S: Product=USB camera
C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=sonixj
并且 v4l2-ctl 给出:
v4l2-ctl --all
Driver Info (not using libv4l2):
Driver name : sonixj
Card type : USB camera
Bus info : usb-bcm2708_usb-1.3
Driver version: 3.2.27
Capabilities : 0x05000001
Video Capture
Read/Write
Streaming
Format Video Capture:
Width/Height : 640/480
Pixel Format : 'JPEG'
Field : None
Bytes per Line: 640
Size Image : 230990
Colorspace : JPEG (JFIF/ITU601)
JPEG compression:
Quality: 90
Markers: 0x00000018
Define Huffman Tables
Define Quantization Tables
Video input : 0 (sonixj: ok)
Streaming Parameters Video Capture:
Frames per second: invalid (0/0)
Read buffers : 2