Linux下成功安裝網路攝影機 :-)

來源:互聯網
上載者:User

    一直 醞釀了很久,資料軟體也找得差不多了,動手開始做事情拉.
    首先要下載的是網路攝影機驅動程式,推薦使用spca5xx webcam drivers,可以到網站FreeWorld libland http://mxhaard.free.fr/download.html (這個網站雖然簡陋,但是相當有水準,推薦!)上下載最新版本的驅動程式,我使用的是spca5xx-20060101.tar.gz,順便說一下,在載入spca5xx驅動時,必需閱讀README,主要看兩處:1.該版本的spca5xx是否支援現版本的linux核心,比如說spca5xx-20060101.tar.gz就不支援2.4.22的核心,我的核心是2.6.11-1.1369_FC4-i686; 2.版本的spca5xx是否支援網路攝影機晶片,可以lsusb一下
root@localhost ~]# lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 002: ID 0ac8:301b Z-Star Microelectronics Corp. Sansun SN-510 WebCam [hv713d]
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
我的網路攝影機晶片是由中微星電子公司生產的(我試過實驗室多個網路攝影機,結果都是一樣的,可見低端網路攝影機晶片市場大部分被中微星所佔),再查看一下spca5xx的README,通過ID號0ac8:301b,可以發現該驅動支援Z-Star的晶片.
    然後重新編譯核心,make menuconfig ->Multimedia devices ->Video For Linux,選擇載入V4L模組.
    接下來解壓縮編譯spca5xx-20060101.tar.gz,指令tar zxvf spca5xx-20060101.tar.gz,然後 make,make install,一般是README裡面說明支援的核心都是能編譯通過的.檢查spca5xx是否載入,執行lsmod
    spca5xx               673040  0
    videodev                9537  1 spca5xx
 在/proc/devices裡面也可以找到dev裝置,一般裝置號為83.

    網路攝影機驅動程式模組載入完成了,現在要找幾個videoGrabber軟體,編譯安裝他們也是一件相當令人頭疼的事情.推薦兩款:spcaview-20051212.tar.gz & xawtv-3.94.tar.tar
    先看xawtv-3.94.tar.tar,解壓縮 tar zxvf xawtv-3.94.tar.tar,首先閱讀一下README(這是個好習慣),大概瞭解安裝步驟,./configure->make->make install,問題出現了:-( 在make這一步出錯了:
root@localhost xawtv-3.91]# make
CC console/fbtv.o
In file included from console/fbtv.c:31:
./libng/grab-ng.h:28:1: warning: "bool" redefined
In file included from /usr/include/curses.h:143,
from console/fbtv.c:24:
/usr/lib/gcc/i386-redhat-linux/4.0.1/include/stdbool.h:36:1: warning: this is the location of the previous definition
console/fbtv.c:190: 錯誤:對 ‘snapbase’ 的靜態聲明出現在非靜態聲明之後
./common/commands.h:53: 錯誤:‘snapbase’ 的上一個聲明在此
console/fbtv.c: 在函數 ‘text_out’ 中:
console/fbtv.c:329: 警告:傳遞參數 4 (屬於 ‘fs_puts’) 給指標時目標與指標有/無符 號不一致
console/fbtv.c: 在函數 ‘text_width’ 中:
console/fbtv.c:335: 警告:傳遞參數 2 (屬於 ‘fs_textwidth’) 給指標時目標與指標有/無符號不一致
console/fbtv.c: 在函數 ‘main’ 中:
console/fbtv.c:801: 警告:對指標賦值時目標與指標有/無符號不一致
make: *** [console/fbtv.o] 錯誤 1

鬱悶,百思不得其解,索性開啟看裡面的原始碼,在console/fbtv.c的190行定義了static char *snapbase,在fbtv.c裡include了commands.h,該標頭檔也定義了snapbase,extern char *snapbase;
修改fbtv.c,把static char *snapbase改為char  *snapbase,再make, Done and then ->make install,Done!!!!!
直接運行xawtv即可看到視頻,但是效果好像捕食很好,色彩偏灰,不甚理想.

而spcaview就好多了,而且編譯安裝一路綠燈,以下摘至README:
BASIC INSTALLATION:
-------------------
These are generic installation instructions.
You need sdl installed with the headers http://www.libsdl.org for spcaview
to compile all type:
make
to install in /usr/local/bin as root:
make install
to clean the last compile work:
make clean
to compile and install as root only spcaserv (No dependance)
make install_spcaserv
to compile and install only spcacat  (No dependance)
make install_spcacat
編譯安裝成功,簡單運行spcaview,
[root@localhost ~]# spcaview
 Spcaview version: 1.1.5 date: 12:12:2005 (C) mxhaard@magic.fr
Initializing SDL.
SDL initialized.
bpp 3 format 15
Using video device /dev/video0.
Initializing v4l.
**************** PROBING CAMERA *********************
Camera found: Z-star Vimicro zc0301p
Bridge found: ZC301-2
Bridge find ZC301-2 number 13
StreamId: JPEG Camera
quality 1 autoexpo 1 Timeframe 0
Bridge find ZC301-2 number 13
Available Resolutions width 640  heigth 480 native
Available Resolutions width 352  heigth 288 decoded
Available Resolutions width 320  heigth 240 native *
Available Resolutions width 176  heigth 144 decoded
*****************************************************
 grabbing method default MMAP asked
VIDIOCGMBUF size 2457616  frames 2  offets[0]=0 offsets[1]=1228808
VIDIOCGPICT
brightnes=32768 hue=0 color=0 contrast=32768 whiteness=0
depth=12 palette=15
VIDIOCSPICT
brightness=32768 hue=0 color=0 contrast=32768 whiteness=0
depth=24 palette=15
                

heihei,嚼著口香糖擺個pose

開啟看了一下spcaview的源碼,發現還有很多好玩的功能,現在學到的只是初步的東西,嘿嘿,相當值得研究研究,網上搜到一些資料,在我的收藏裡面有Spcaview的HOWTO,這兩天好好研究研究,今天先到這裡,洗個澡去...........................

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.