Support #728
Updated by Daniel Curtis almost 9 years ago
This is a guide on how I created a video stream using a webcam attached to a Raspberry Pi Model B running Arch Linux.
h2. Prepare the Environment
* Make sure the system is up to date:
<pre>
sudo pacman -Syu
</pre>
h2. Install Motion
* Install motion:
<pre>
sudo pacman -S motion
</pre>
* Edit the motion config file:
<pre>
nano /etc/motion/motion.conf
</pre>
#* And modify the following parameters:
<pre>
daemon on
v4l2_palette 2
width 1280
height 720
webcam_localhost off
control_localhost off
</pre>
* Test start the motion server to check that everything is running properly:
<pre>
sudo motion -n -c /etc/motion/motion.conf
</pre>
#* @Ctrl+C@ to quit the server when done testing.
* Start and enable the server at boot:
<pre>
sudo systemctl enable motion
sudo systemctl start motion
</pre>
* Open a web browser and go to http://motion.example.com:8081 to view the video stream.
#* Open a web browser and go to http://motion.example.com:8080 to view configuration information.
h2. Install Nginx
* Install Nginx
<pre>
pkg install nginx
</pre>
* Start and enable nginx at boot:
<pre>
echo 'nginx_enable="YES"' >> /etc/rc.conf
service nginx start
</pre>
* Create a configuration directory to make managing individual server blocks easier
<pre>
mkdir /usr/local/etc/nginx/conf.d
</pre>
* Edit the main nginx config file:
<pre>
vi /usr/local/etc/nginx/nginx.conf
</pre>
#* And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
<pre>
worker_processes 1;
error_log /var/log/nginx-error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# Load config files from the /etc/nginx/conf.d directory
include /usr/local/etc/nginx/conf.d/*.conf;
}
</pre>
* Add a *deluge site server block*:
<pre>
vi /usr/local/etc/nginx/conf.d/camera.example.com.conf
</pre>
#* Add the following:
<pre>
server {
listen 80 default_server;
server_name camera.example.com;
access_log /var/log/camera.example.com.log;
location / {
proxy_pass http://localhost:8081/;
}
}
</pre>
h2. Resources
* http://pimylifeup.com/raspberry-pi-webcam-server/
* https://www.linux.com/learn/tutorials/780055-how-to-operate-linux-spycams-with-motion