摄像头测试软件汇总
推薦一個零聲學院免費教程,個人覺得老師講得不錯,
分享給大家:[Linux,Nginx,ZeroMQ,MySQL,Redis,
fastdfs,MongoDB,ZK,流媒體,CDN,P2P,K8S,Docker,
TCP/IP,協(xié)程,DPDK等技術(shù)內(nèi)容,點擊立即學習:
https://ke.qq.com/course/4032547?flowToken=1042705
前言
? ? ? ? 本來是想用xawtv來測試攝像頭,結(jié)果不是很喜歡,然后,就想找一個喜歡的,然后就變成攝像頭軟件匯總了。
一 在ubuntu虛擬機中查看
攏共分三步
1.先 ls /dev/video*
ls /dev/video*2. 插入外置攝像頭
3.再 ls /dev/video*
多出來的那個videoXXX設(shè)備就是攝像頭了。
????????我使用的是一個外置的USB攝像頭,將USB攝像頭連接到虛擬機后,使用dmesg命令,會看到usb攝像頭被加載過程的信息。
[92462.307190] usb 3-2: new high-speed USB device number 5 using xhci_hcd [92462.726303] usb 3-2: New USB device found, idVendor=1e45, idProduct=3035 [92462.726306] usb 3-2: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [92462.726356] usb 3-2: Product: USB Camera [92462.726357] usb 3-2: Manufacturer: Generic [92462.726358] usb 3-2: SerialNumber: 0001 [92462.857710] media: Linux media interface: v0.10 [92462.994536] Linux video capture interface: v2.00 [92463.096302] usbcore: registered new interface driver snd-usb-audio [92463.177813] uvcvideo: Found UVC 1.00 device USB Camera (1e45:3035) [92463.185183] input: USB Camera: USB Camera as /devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb3/3-2/3-2:1.0/input/input6 [92463.185506] usbcore: registered new interface driver uvcvideo [92463.185507] USB Video Class driver (1.1.1) [92469.683588] usb 3-2: USB disconnect, device number 5 [92470.406837] usb 3-2: new high-speed USB device number 6 using xhci_hcd [92470.810353] usb 3-2: New USB device found, idVendor=1e45, idProduct=3035 [92470.810356] usb 3-2: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [92470.810357] usb 3-2: Product: USB Camera [92470.810358] usb 3-2: Manufacturer: Generic [92470.810359] usb 3-2: SerialNumber: 0001 [92470.823773] uvcvideo: Found UVC 1.00 device USB Camera (1e45:3035) [92470.833211] input: USB Camera: USB Camera as /devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb3/3-2/3-2:1.0/input/input7 [92478.499868] usb 3-2: USB disconnect, device number 6 [92479.215252] usb 3-2: new high-speed USB device number 7 using xhci_hcd [92479.614817] usb 3-2: New USB device found, idVendor=1e45, idProduct=3035 [92479.614819] usb 3-2: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [92479.614820] usb 3-2: Product: USB Camera [92479.614821] usb 3-2: Manufacturer: Generic [92479.614821] usb 3-2: SerialNumber: 0001 [92479.623908] uvcvideo: Found UVC 1.00 device USB Camera (1e45:3035) [92479.629663] input: USB Camera: USB Camera as /devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb3/3-2/3-2:1.0/input/input8 [92483.057036] usb 3-2: USB disconnect, device number 7 [92483.770509] usb 3-2: new high-speed USB device number 8 using xhci_hcd [92484.172011] usb 3-2: New USB device found, idVendor=1e45, idProduct=3035 [92484.172013] usb 3-2: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [92484.172015] usb 3-2: Product: USB Camera [92484.172016] usb 3-2: Manufacturer: Generic [92484.172017] usb 3-2: SerialNumber: 0001 [92484.181008] uvcvideo: Found UVC 1.00 device USB Camera (1e45:3035) [92484.189816] input: USB Camera: USB Camera as /devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb3/3-2/3-2:1.0/input/input9 [92484.551272] usb 3-2: USB disconnect, device number 8 [92485.262678] usb 3-2: new high-speed USB device number 9 using xhci_hcd [92485.660855] usb 3-2: New USB device found, idVendor=1e45, idProduct=3035 [92485.660857] usb 3-2: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [92485.660858] usb 3-2: Product: USB Camera [92485.660859] usb 3-2: Manufacturer: Generic [92485.660859] usb 3-2: SerialNumber: 0001 [92485.670919] uvcvideo: Found UVC 1.00 device USB Camera (1e45:3035) [92485.678017] input: USB Camera: USB Camera as /devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb3/3-2/3-2:1.0/input/input10查看設(shè)備名:
$ ls /dev/video* -ls 0 crw-rw----+ 1 root video 81, 0 9月 16 11:55 /dev/video0當前/dev目錄中多出了一個video0設(shè)備,主設(shè)備號是81,次設(shè)備號是0
二 xawtv測試
?點擊OK,郵件點擊視頻窗口,看到Options窗口。
(⊙o⊙)…好像我的需求中不需要窗口
看看幫助信息:
xawtv -h lkmao@ubuntu:~$ xawtv -h This is xawtv-3.103, running on Linux/x86_64 (4.15.0-142-generic)usage: xawtv [ options ] [ station ] options:-h -help print this text-v -debug n debug level n, n = [0..2]-remote assume remote display-n -noconf don't read the config file-m -nomouse startup with mouse pointer disabled-f -fullscreen startup in fullscreen mode-(no)dga enable/disable DGA extension-(no)vm enable/disable VidMode extension-(no)randr enable/disable Xrandr extension-(no)xv enable/disable Xvideo extension altogether-(no)xv-video enable/disable Xvideo extension (for video only,i.e. XvPutVideo() calls)-(no)xv-image enable/disable Xvideo extension (for image scalingonly, i.e. XvPutImage() calls)-(no)gl enable/disable OpenGL-(no)alsa enable/disable alsa streaming. Default: enabled-(no)alsa-cap manually specify an alsa capture interface-(no)alsa-pb manually specify an alsa playback interface-alsa-latency manually specify an alsa latency in ms. Default: 30-b -bpp n color depth of the display is n (n=24,32)-o -outfile file filename base for snapshots-c -device file use <file> as video4linux device-D -driver name use <name> as video4linux driver-C -dspdev file use <file> as audio (oss) device-vbidev file use <file> as vbi device-joydev file use <file> as joystick device-shift x shift display by x bytes-fb let fb (not X) set up v4l device-parallel n use n compression threads-bufcount n use n video buffers-hwscan print a list of available devices. station:this is one of the stations listed in $HOME/.xawtvCheck the manual page for a more detailed description.-- Gerd Knorr <kraxel@bytesex.org> lkmao@ubuntu:~$使用xawtv掃描系統(tǒng)中的視頻設(shè)備
xawtv -hwscan lkmao@ubuntu:~$ xawtv -hwscan This is xawtv-3.103, running on Linux/x86_64 (4.15.0-142-generic) looking for available devices Xlib: extension "XVideo" missing on display "localhost:10.0". /dev/video0: OK [ -device /dev/video0 ]type : libv4lname : USB Camera: USB Cameraflags: capturelkmao@ubuntu:~$三cheese軟件
cheese正常的翻譯是干酪、乳酪、芝士,拍照的時候翻譯成茄子或者七喜。這個好像默認是安裝的。沒有安裝的話,也很簡單。
sudo apt-get install cheese cheese看一下幫助信息:
lkmao@ubuntu:~$ cheese -h 用法:cheese [選項...]幫助選項:-h, --help 顯示幫助選項--help-all 顯示全部幫助選項--help-gapplication 顯示 GApplication 選項--help-gtk 顯示 GTK+ 選項應(yīng)用程序選項:-w, --wide 以寬屏模式啟動-d, --device=設(shè)備 用作攝像頭的設(shè)備-v, --version 輸出版本信息并退出-f, --fullscreen 以全屏模式啟動--display=顯示 要使用的 X 顯示lkmao@ubuntu:~$看一下就好了,再換一個
四 camorama測試
這個沒用過,得先安裝
sudo apt install camorama這個東西好像支持FTP遠程訪問
????????下面的嘗試不一定成功啊,試一下,將攝像頭連接到另一個虛擬機中,取名虛擬機2號,小名虛2。并保證該虛擬機安裝了ftp服務(wù)器。(⊙o⊙)…,沒安裝。那就安裝吧,過程在本文下面。
在虛1中運行camorama,然后配置FTP,這個時候虛1中已經(jīng)沒有攝像頭了,因為連接到虛2上了,打開會報錯,如下所示,所以要看看幫助信息
?先在虛1中連接筆記本電腦的攝像頭。保證camorama能打開
配置如下所示:
?點擊take picture,報錯。
?不知道怎么弄了,暫時先換一個軟件。?
ubuntu中使用guvcview
sudo apt install guvcview直接運行g(shù)uvcview即可?
mplayer
sudo apt install mencoder sudo apt install mplayer運行
$ mplayer mplayer: error while loading shared libraries: libfaad.so.2: cannot open shared object file: No such file or directory $這個沒安裝成功
$ sudo apt install mencoder Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies:mencoder : Depends: libfaad2 (>= 2.7) but it is not going to be installedmplayer : Depends: libfaad2 (>= 2.7) but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). $為了解決了這個問題,又單獨寫了一篇文章,這篇文章介紹了faad源碼下載與編譯安裝。安裝完以后mplayer就可以使用了。
https://lkmao.blog.csdn.net/article/details/126952445
五 在ubuntu中測試luvcview
安裝依賴包
sudo apt-get install debhelper sudo apt-get install libsdl1.2-dev sudo apt-get install libv4l-dev sudo apt-get install pkg-config下載的0.2.6版本的源碼,make會報錯,將其中的會報錯文件中的
#include <linux/videodev.h>
替換成#include <linux/videodev2.h>
只需要修改三個文件就行了,編譯好的源碼,在我的下載資源中有。地址:
https://download.csdn.net/download/yueni_zhao/86544123?spm=1001.2014.3001.5501
編譯完畢后生成luvcview可執(zhí)行文件
./luvcview如果找不到攝像頭會出書如下內(nèi)容:
$ ./luvcview luvcview 0.2.6SDL information:Video driver: x11A window manager is available Device information:Device path: /dev/video0 ERROR opening V4L interface: No such file or directory如果有攝像頭,輸出如下內(nèi)容:
$ ./luvcview luvcview 0.2.6SDL information:Video driver: x11A window manager is available Device information:Device path: /dev/video0 Stream settings:Frame format: MJPGFrame size: 640x480Frame rate: 30 fps?在虛擬機中安裝FTP服務(wù)器
打開 Ubuntu 的終端窗口,然后執(zhí)行如下命令來安裝 FTP 服務(wù): sudo apt-get install vsftpd lkmao@ubuntu:~$ sudo apt-get install vsftpd [sudo] password for lkmao: E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? lkmao@ubuntu:~$安裝器被鎖住了,這都是自動更新的鍋。將自動更新設(shè)置為never。然后重啟
重啟后,開始安裝,等待軟件安裝完成,完成以后使用 VI 命令打開/etc/vsftpd.conf,命令如下:
sudo vi /etc/vsftpd.conf打開 vsftpd.conf 文件以后找到如下兩行:
local_enable=YES write_enable=YES 確保上面兩行前面沒有“#”,有的話就取消掉,完成以后如圖 4.1.1 所示: 修改完 vsftpd.conf 以后保存退出,使用如下命令重啟 FTP 服務(wù): sudo /etc/init.d/vsftpd restart總結(jié)
????????
總結(jié)
- 上一篇: 天猫11.11:搜索引擎实时秒级更新(转
- 下一篇: 单链表的初始化,整表创建,单个元素插入,