树莓派 3B 发现不了摄像头 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
thomaswang
V2EX    问与答

树莓派 3B 发现不了摄像头

  •  
  •   thomaswang 2017-08-20 11:46:40 +08:00 9598 次点击
    这是一个创建于 2987 天前的主题,其中的信息可能已经有所发展或是发生改变。

    系统是用 noobs 装的,raspi-config, 找不到 enabled camera 选项,也就开启不了摄像头 摄像头是 camera module v2 8MP, 也找不到 /dev/video0, 摄像头上面的灯也不亮 是没有发现摄像头的原因吗

    13 条回复    2017-08-20 15:58:45 +08:00
    thomaswang
        1
    thomaswang  
    OP
       2017-08-20 11:47:47 +08:00
    reboot 过 n 次
    thomaswang
        2
    thomaswang  
    OP
       2017-08-20 11:48:51 +08:00
    interfaces 里面的 Camera SSH 这种东西都选了 Enabled
    panda1001
        3
    panda1001  
       2017-08-20 11:53:07 +08:00 via Android
    出这问题的估计就是官方摄像头
    panda1001
        4
    panda1001  
       2017-08-20 11:57:59 +08:00
    默认开机不自动加载原生摄像头驱动,解决就是手动或自动加载
    sudo modprobe bcm2835-v4l2
    参考:
    https://raspberrypi.stackexchange.com/questions/10480/raspi-camera-board-and-motion/26386
    https://github.com/ccrisan/motioneye/issues/489
    ju5t4fun
        5
    ju5t4fun  
       2017-08-20 12:50:30 +08:00
    有没有可能插反了
    yangxuan8282
        6
    yangxuan8282  
       2017-08-20 13:02:41 +08:00   1
    输入这个看看是什么结果:

    ```
    vcgencmd get_camera
    ```
    thomaswang
        7
    thomaswang  
    OP
       2017-08-20 13:09:29 +08:00
    @ju5t4fun 哈哈,这个没有的
    thomaswang
        8
    thomaswang  
    OP
       2017-08-20 13:10:42 +08:00
    @yangxuan8282 supported=1 detected=1
    yangxuan8282
        9
    yangxuan8282  
       2017-08-20 13:13:37 +08:00   1
    @thomaswang 那就是已经检测到了啊,拍张照试试:

    ```
    raspistill -o foobar.jpg
    ```
    thomaswang
        10
    thomaswang  
    OP
       2017-08-20 13:38:29 +08:00
    -rw-r--r-- 1 root root 3838561 Aug 19 03:35 foobar.jpg 应该是拍到东西了
    yangxuan8282
        11
    yangxuan8282  
       2017-08-20 14:24:35 +08:00   1
    @thomaswang 那就是没什么问题了,记得摄像头模块的灯不是常亮的,拍照时候才亮,拍的照片你可以用 samba/sftp/z modem 传到电脑上看看,或者手机上装个应用来控制并查看拍的照片,google play/app store 上搜一下就有
    thomaswang
        12
    thomaswang  
    OP
       2017-08-20 14:59:22 +08:00
    @yangxuan8282 我把拍到的图片 scp 到我的 mac,看到图片了
    我想做些和视频相关的,比如: 树莓派录制一段视频,客户端实时看到这个摄像头的画面,我该怎么下手,ffmpeg,gstreamer。。。
    yangxuan8282
        13
    yangxuan8282  
       2017-08-20 15:58:45 +08:00   1
    @thomaswang
    这类网上教程很多,最简单的可以参照这篇博客:
    https://blog.alexellis.io/live-stream-with-docker/
    用 docker 来实现,文中是将摄像头的内容推到 youtube,你也可以推到自己的服务器上
    我试过用 raspivid + ffmpeg 推到 b 站和推到本地的 rtmp 服务器上,这样用 vlc 或其它播放器都能实时观看摄像头拍的画面,另外 homebridge 还有一个插件可以实现利用 homekit 在 ios 的 `家庭` 应用里观看

    其实很简单,安装好软件之后基本一行命令基本搞定:

    ```
    raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv $RTMP_SERVER_HERE
    ```

    可能这样出来的图像是倒的,可以去掉上面参数里的 `-vf` `-hf`,其它的可以视自己的带宽调节一下分辨率之类的,我当时是参照的这篇博客:

    https://maxogden.com/hd-live-streaming-cats.html

    直接看第 4 部分就行

    自己建立 rtmp 服务器的话软件应该也不少的,我当时是用的这个项目: https://github.com/iizukanao/node-rtsp-rtmp-server

    另外 raspbian/debian 上现在应该可以直接通过 apt 来安装 ffmpeg 了,不需要自己编译, 想添加更多特性的话需要自己编译,比如启用 mmal,可以大概参考下我之前的这篇博客:

    https://www.zybuluo.com/yangxuan/note/374932#7-ffmpeg
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3869 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 05:29 PVG 13:29 LAX 22:29 JFK 01:29
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86