Streaming Video

From SingletonMillerWiki
Revision as of 10:04, 28 March 2015 by Martin (Talk | contribs) (Created page with " Category:RaspberryPi Category:Projects == Introduction == The objective of this How To is install setup and stream high resolution, high frame rate video from your R...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Introduction

The objective of this How To is install setup and stream high resolution, high frame rate video from your Raspberry Pi (with a Camera module) over a network. Based on [1].

Equipment

  • Raspberry Pi
  • Raspberry Pi camera module

Initial Setup

It is assumed that your Raspberry Pi is running Raspian and that the camera module is connected correctly. Familiarity with the command line prompt is of benefit as most of the work here is via the command line. If you're using the desktop, open a Terminal from the desktop menu or use a remote connection via SSH Enable SSH#Connect_via_SSH_on_a_Local_network

To test the camera is working take a picture from the camera.

$ cd ~
$ raspistill -o test_image.jpg

To check the picture use the file browser the picture should be in your home folder (~) [2].

If its not working, try the following,

$ sudo apt-get update
$ sudo apt-get upgrade

check the camera is enabled

$ sudo raspi-config

Reboot to bring your pi back up in a known good state and hopefully a retest of the picture capture will work.

$ sudo reboot

Streaming

Install vlc

$ sudo apt-get install vlc

Enable he v4l module

sudo modprobe bcm2835-v4l2

VLC command

Use the command line version of vlc to directly stream the camera output to a port.

cvlc v4l2:///dev/video0 --v4l2-width 640 --v4l2-height 480 --v4l2-chroma h264 --sout '#standard{access=http,mux=ts,dst=0.0.0.0:8085}' &

Change the --v4l2-width and --v4l2-height to adjust the screen resolution. I've tested up to 1900 x 1080. Change 8085 to adjust the port to broadcast on.

Monitor the Stream

Check that this is working by monitoring the stream on anther PC (is best). We need to know the IP address of your Pi on your network and the port (from above):

$ ifconfig | grep 'inet addr:'

should give something like

    inet addr:192.168.0.31  Bcast:192.168.0.255  Mask:255.255.255.0
    inet addr:127.0.0.1  Mask:255.0.0.0

Point your Firefox browser to the address http://192.168.0.31:8085 to see the live feed. Alternatively use the same address in the VLC GUI under a 'Open Network Stream'.

Stream Capture

It is possible to capture the stream on any computer than can see the stream. If your router is correctly configured the stream can be viewed by any computer on the internet.
Use VLC to record the stream (use the figures below as a guide)

  1. Enter the network stream address
  2. Select the Convert Save button
  3. Create a Raw Capture Profile using the
  4. Select the Raw profile and select the file save location.

TO DO LIST

  1. Add scripts for running the code from a script
  2. How to set up a router to forward a stream port
  3. How to get your internet IP address for external viewing (no-ip)

References

  1. ICS Insight Blog>The Raspberry Pi Camera Module
  2. How to take a photo with your Raspberry Pi