注:この記事では、リモート監視がクラウドサーバーがパブリックIPは、SSHリバースプロキシた持っている必要があり、パブリックネットワークの一部です。
運動を達成するために、ネットワーク内のビデオ監視によって第1、
- レディ
- その後、プラグカメラ、および入力して
ls /dev/video*
特定したカメラかどうかを確認するためのコマンドを
- その後、プラグカメラ、および入力して
- 運動のインストール
- モーションLinuxはオープンソースであり、ラズベリーはで使用されて来
sudo apt-get install motion
、インストールが簡単にインストールするため。
- モーションLinuxはオープンソースであり、ラズベリーはで使用されて来
- 修正モーション設定
- 一般的な構成と意味
# Start in daemon (background) mode and release terminal (default: off) # 在后台运行。设置为off将在前台运行 daemon on # Videodevice to be used for capturing (default /dev/video0) # for FreeBSD default is /dev/bktr0 # 视频设备,刚才ls /dev/video*看到的 videodevice /dev/video0 # Image width (pixels). Valid range: Camera dependent, default: 352 # 图像宽 width 320 # Image height (pixels). Valid range: Camera dependent, default: 288 # 图像高 height 240 # The setting for keep-alive of network socket, should improve performance on compatible net cameras. # off: The historical implementation using HTTP/1.0, closing the socket after each http request. # force: Use HTTP/1.0 requests with keep alive header to reuse the same connection. # on: Use HTTP/1.1 requests that support keep alive as default. # Default: off # 开启KeepAlive功能 netcam_keepalive on # Output 'normal' pictures when motion is detected (default: on) # Valid values: on, off, first, best, center # When set to 'first', only the first picture of an event is saved. # Picture with most motion of an event is saved when set to 'best'. # Picture with motion nearest center of picture is saved when set to 'center'. # Can be used as preview shot for the corresponding movie. # 禁用自动拍照保存的功能 output_pictures off # Use ffmpeg to encode movies in realtime (default: off) # 禁用自动拍摄视频保存的功能 ffmpeg_output_movies off # The mini-http server listens to this port for requests (default: 0 = disabled) # 视频监听的端口,默认8081 stream_port 1001 # Quality of the jpeg (in percent) images produced (default: 50) # 图像质量 stream_quality 50 # Output frames at 1 fps when no motion is detected and increase to the # rate given by stream_maxrate when motion is detected (default: off) stream_motion on # Maximum framerate for stream streams (default: 1) # 帧数8,需要先把上面的选项改成on stream_maxrate 8 # Set the authentication method (default: 0) # 0 = disabled # 1 = Basic authentication # 2 = MD5 digest (the safer authentication) # 改成1,增加授权验证,访问需要输入密码 stream_auth_method 1 # Authentication for the stream. Syntax username:password # Default: not defined (Disabled) # 设置用户名username和密码password stream_authentication username:password # Restrict stream connections to localhost only (default: on) # 改成off允许外网访问视频 stream_localhost off # TCP/IP port for the http server to listen on (default: 0 = disabled) # WEB控制台监听的端口,默认8080 webcontrol_port 1000 # 改成off允许外网访问web控制台 webcontrol_localhost off
- 変更する必要があり
daemon on
ます:webcontrol_localhost off
、。デフォルトの設定では、その後、独自のパラメータを調整し、重要なカトンを有することができます。最後に、効果は非常に滑らかであることができます。 - 使用する
sudo motion
モーションを有効にするには、コマンドを - 使用して、
sudo killall -TERM motion
モーションをオフにすることができます
- テスト
sudo motion
ブラウザに入力した後、ip:你设定的端口号(默认8081)
リアルタイム監視を表示します。以下のような:192.168.137.30:8081。- 注:この時点でのみ、内部ネットワークへのアクセス。
第二に、sshのリバースプロキシラズベリーパイを経由して監視し、パブリックネットワーク遠隔ビデオを達成するために
- ラズベリーは来ます
ssh -CqTfnN -R 0.0.0.0:12345:localhost:8081 ubuntu@yourserver
(Test.serverクラウドサーバーは、ドメイン名またはIPです)- yourserverは、この通信ポートとPIを使用することができた後、この接続は、パイのポート8081へのローカルポート12345をyourserver確立されています。
- サーバー上の
ssh -fCNL "*:12345:localhost:12346" ubuntu@yourserver
- データは、ポート12345にラズベリーPiは、「プロキシ」の効果を達成するために、ポート8081に接続し、その後12345のポートを転送する場合12346ポートがデータを受信したときに12346のリッスンは、ポート、他のクライアントの要求を構築します。ブラウザは、リアルタイム監視、パブリックネットワークを有効にする、クラウドサーバポート12346、同等のアクセスポート8081ラズベリーパイにアクセスした場合。
- sshのリバースプロキシを使用するこの方法はまた、公衆ネットワークリモートコントロールラズベリーパイを達成することができます。
- テスト
- ラズベリーパイオープン運動した後、ブラウザに入力された
服务器ip:服务器设置的监听端口(本例为12346)
モーション・ビデオを見るために。 - 注:速度制限のために、ビデオはカトン月。この時点で、運動構成を変更サイズ、等フレームレート、画質を、排除することができるカトンを減らします。
- ラズベリーパイオープン運動した後、ブラウザに入力された