![]() |
◆ | Webカメラの認識確認 |
Webカメラは認識されているか確認 | |
[root@centos]# dmesg | less 途中省略 [ 1.157653] usb 3-5: new high-speed USB device number 2 using xhci_hcd [ 1.194974] usb 3-5: New USB device found, idVendor=058f, idProduct=3831 [ 1.194976] usb 3-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 1.194978] usb 3-5: Product: USB 2.0 PC Camera [ 1.194979] usb 3-5: Manufacturer: Alcor Micro, Corp. 途中省略 |
|
上記のように USB Camera が USB 2.0準拠の5番目のポートに接続されている | |
◆ | EPELリポジトリとNux Dextopリポジトリ追加 |
yum 用リポジトリの追加 を参照の事 | |
◆ | ffmpeg のインストール |
無効になっているEPELリポジトリとNux Dextopリポジトリを有効にしてインストール | |
[root@centos]# yum -y --enablerepo=epel --enablerepo=nux-dextop install ffmpeg ffmpeg-devel |
|
◆ | motion のインストール |
無効になっているEPELリポジトリとNux Dextopリポジトリを有効にしてインストール | |
[root@centos]# yum -y --enablerepo=epel --enablerepo=nux-dextop install motion |
|
◆ | motion の設定 |
[root@centos]# vi /usr/local/etc/motion.conf 途中略 ############################################################ # Daemon ############################################################ # Start in daemon (background) mode and release terminal (default: off) daemon on <--- on になっている事を確認(デーモンで起動) 途中略 ########################################################### # Capture device options ########################################################### 途中略 # The video input to be used (default: -1) # Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras input -1 <--- -1 になっている事を確認(USBカメラを使用) # The video norm to use (only for video capture and TV tuner cards) # Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL) norm 0 <--- 変更 日本製(日本向け)のカメラはNTSC方式を採用している ↓ ※変更しなくても映る場合があるが天地左右がおかしくなる 可能性がある norm 1 途中略 # Image width (pixels). Valid range: Camera dependent, default: 352 width 320 <--- 画像の横サイズを変更したい場合は任意に変更 # Image height (pixels). Valid range: Camera dependent, default: 288 height 240 <--- 画像の横サイズを変更したい場合は任意に変更 # Maximum number of frames to be captured per second. # Valid range: 2-100. Default: 100 (almost no limit). framerate 2 <--- 変更 1秒間に撮影するコマ数(2~100 数が多い方が滑らかの映像になる) ↓ framerate 100 途中略 ############################################################ # Live Stream Server ############################################################ # The mini-http server listens to this port for requests (default: 0 = disabled) stream_port 8081 <--- ポートを変更したい場合は書き換える ↓ stream_port **** # Quality of the jpeg (in percent) images produced (default: 50) stream_quality 50 <--- 変更 ライブ画像の画質(1~100 数が多い方が高画質になる) ↓ stream_quality 100 # Output frames at 1 fps when no motion is detected and increase to the # rate given by webcam_maxrate when motion is detected (default: off) stream_motion off # Maximum framerate for webcam streams (default: 1) stream_maxrate 1 <--- 変更 ライブ画像のフレームセット ↓ stream_maxrate 30 # Restrict webcam connections to localhost only (default: on) stream_localhost on <--- 変更 ローカルホスト以外もライブ映像を配信 ↓ stream_localhost off 以下略 |
|
◆ | motion 起動ディレクトリの作成 |
[root@centos]# mkdir -p /var/run/motion |
|
◆ | motion 起動 |
[root@centos]# /usr/local/bin/motion |
|
◆ | motion 終了 |
[root@centos]# /usr/bin/killall motion |
|
◆ | 再起動時の自動起動ファイルの作成 |
|
|
ファイルが出来上がったらデーモンのリロード | |
|
|
◆ | 自動起動設定 |
|
|
自動起動設定の確認 | |
|
|
◆ | ブラウザ確認 |
インターネットブラウザを起動して http://<ホスト名 or ドメイン名 or サーバーのIPアドレス>:8081/ にアクセスしてライブ映像が見れる事を確認 注意:IEでは見られません 確認した限りではEdge・ Firefox・Safari では見れました
以前はJavaを使いIE見られるようにする設定等を記載していま したが最近(2018年)の新しいブラウザではセキュリティーのためJavaの使用を制限しているブラウザが多くなりましたのでEdge・Firefox・Safari等で見る事をお勧めします。
また、Javaの設定は閲覧側でしなくてはならなくセキュリティー等の関係で非常に難しく閲覧者の負担となるためEdge・Firefox・Safari等のブラウザで見ることをお勧めした方が親切ではないでしょうか?
Windows10 の標準ブラウザEdgeで見る事ができるので今後は問題ないと思います。 |
|
◆ | motionの自動起動 |
私の環境ではシステムの再起動時に『motion の起動スクリプト』を自動的に読み込んでくれるので特に設定の必要はなかった?? | |
この辺は疑問が残る所だけれど・・・・・その内、詳しい人が解決してくれると言う事にしよう(笑) | |
◆ | サンプル映像 |
サンプル映像は ここ をクリックして下さい 。現在の私の部屋の時計が見れます。 | |