Philipp's Computing Blog

Success is about speed and efficiency

Using the Raspberry Pi Camera Board on Arch Linux ARM

Update 2014-01-14: There is now a completely Python-based camera-interface for you to work with: picamera

Preparations

Add /opt/vc/bin to your $PATH:

# To add /opt/vc/bin temporarily to your $PATH:
PATH=$PATH:/opt/vc/bin

and set up your /boot/config.txt to contain the following:

gpu_mem=128
start_file=start_x.elf
fixup_file=fixup_x.dat
# optionally:
disable_camera_led=1

Source: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=44539

Usage

# Capture an image in jpeg format:
raspistill -o image.jpg
# Capture a 5s video in h264 format:
raspivid -o video.h264
# Capture a 10s video:
MOVIE=video.h264
raspivid -o $MOVIE -t 10000
# Wrap the bare h264 stream in an MP4 container:
ffmpeg -r 30 -i $MOVIE -vcodec copy $(basename -s .h264 $MOVIE).mp4
# https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
# 4x Timelapse with doubled framerate (plus every other frame dropped):
ffmpeg -i $(basename -s .h264 $MOVIE).mp4 -r 60 -filter:v "setpts=0.25*PTS" -an $(basename -s .h264 $MOVIE)_60.mp4
# Capture a 10s video in demo mode:
raspivid -o video.h264 -t 10000 -d
# To see a list of possible options for running raspivid or raspistill, you can run:
raspivid | less
raspistill | less
# Use the arrow keys to scroll and type q to exit.

# Using `raspivid` for continuous capturing
# http://goo.gl/K4YhfF
raspivid -fps 5 -w 640 -h 480 -sg 600000 -t 0 -qp 30 -o /pfad/zur/ext/hdd/test%03d.h264

Video-Streaming

See the section "How to stream video from the Raspberry Pi camera over a network" on the original blog post on the camera board and maybe sometime later for embedding on a web page in an answer to that post.

Resources