Compile nginx with RTMP support on Raspbian

Here’s a bash script. Put this into a new file, ~/install-nginx-rtmp.sh:

 #!/bin/bash
sudo apt-get update
sudo apt-get install nginx -y
sudo apt-get remove nginx -y
sudo apt-get clean nginx -y
sudo apt-get install -y curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev
mkdir nginx-build
cd nginx-build
wget http://nginx.org/download/nginx-1.7.5.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
tar -zxvf nginx-1.7.5.tar.gz
unzip master.zip
cd nginx-1.7.5
./configure --prefix=/var/www --sbin-path=/usr/sbin/nginx  --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_ssl_module --without-http_proxy_module --add-module=/home/pi/nginx-build/nginx-rtmp-module-master

make
sudo make install
echo "made it to the end"

execute it like this:

sh install.sh

Notice it install nginx from the package manager, and then removes it. This will leave some useful files behind for running nginx as a service.

This script is made of commands I learned from these posts, which explain what’s going on line-by-line.

Remotely viewing Raspberry Pi Cams

If you’ve mounted where your Raspberry Pi and camera in a place where you can’t plug in a screen and keyboard, you’ll want an easy way to see how its photos look. Try using a mobile app instead of manually transferring photos to another machine where you can view them.

Still photos on an Android device

RaspiCam Remote Android app logs into your Pi via SSH, runs raspistill, and sends the output to your Android device. You can use the GUI to preview some filters, or set command line arguments. I haven’t tried the video features yet.

There are some other apps for Android as well like Pi Sight and Raspberry PiCam.

Still photos with an iOS device

Consider BerryCam. I haven’t tried it, but it looks like RaspiCam Remote.

Fixing incorrect Raspberry Pi Cam auto exposure

Are your pictures coming out too bright or dark under reasonable lighting conditions? Check your timeout value (the -t parameters in raspistill -t 100 -o cam.jpg.

I took a bunch of pictures using raspistill -t 100 and didn’t understand why they were coming out over exposed on an average, sunny day. I tried different metering, exposure, and exposure compensation modes, but none of them consistently improved the image. I didn’t realize what was happening until I tried raspivid and watched the camera adjust itself for the first few seconds within turning on.

Under normal usage, raspistill turns on the camera and prepares it to take a picture. After 100ms, it hasn’t had enough time to adjust the exposure. I find it needs at least a 1000ms to get it close, and about 2000ms to settle the correct value. Increasing the timeout to 2000ms solved the issue for me. Delaying taking the photo by 2000ms was not an issue in my use case.

If you can’t wait for the timeout, look into Signal Mode, which would let you turn the camera on early, and then trigger taking a picture with another command. The time between those two commands maybe enough for the camera to adjust its exposure.