Difference between revisions of "Video"

From HiveTool
Jump to: navigation, search
(Install ffmpeg)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
  
Most cameras will stream "raw video" but special media players will be required to view it unless it is first encoded to a format like mpeg, h.264 and wrapped in a container like avi, swf, mp4.
+
Most cameras will stream "raw video" but special media players will be required to view it unless it is first encoded to a format like mpeg, h.264 and wrapped in a container like avi, swf, mp4. Encoding the video can consume considerable processing power. Underpowered machines are limited to low frame rates (5 fps) and resolutions (320x240) resulting in slow, jerky video.  The Pi's core has encoder hardware but enabling it requires payment of a licensing fee.
  
Some cameras have hardware encoders built into the camera and in addition to raw video, can also stream encoded video. The Logitech HD920 has mpeg and h.264 encoders.
+
Some cameras have hardware encoders built into the camera and in addition to raw video, can also stream encoded video. The Logitech HD920 has mpeg and h.264 encoders.  If the camera will stream encoded video, all the computer has to do is copy the stream from the USB connector to the internet connection.
  
 
==Display camera modes==
 
==Display camera modes==
 +
 +
Video4Linux can be used to find out what formats the camera supports and to control the camera.
  
 
To install Video4Linux on the Pi:
 
To install Video4Linux on the Pi:
Line 12: Line 14:
 
To display the video formats the camera supports:
 
To display the video formats the camera supports:
 
  v4l2-ctl --list-formats
 
  v4l2-ctl --list-formats
 +
 +
If the camera is fixed, auto focus can be turned off and the camera focused manually.
  
 
To turn auto focus off and manually set the focus:
 
To turn auto focus off and manually set the focus:
Line 20: Line 24:
 
==Install ffmpeg==
 
==Install ffmpeg==
  
1. Install h.294 library libx264  
+
Ffmpeg is one program to encode or copy video and/or audio streams.
 +
1. Install h.264 library libx264 if h.264 encoding will be used.
 
  git clone git://git.videolan.org/x264.git
 
  git clone git://git.videolan.org/x264.git
 
  cd x264
 
  cd x264
Line 39: Line 44:
 
1. Disable the assembler when compiling on the Pi[http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=53936]:<br>
 
1. Disable the assembler when compiling on the Pi[http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=53936]:<br>
 
  ./configure --disable-asm --enable-shared
 
  ./configure --disable-asm --enable-shared
2. Disable on the Pi
+
2. Disable mmx on the Pi
 
  ./configure --enable-shared --enable-gpl  --enable-libx264  --enable-libfreetype --disable-mmx
 
  ./configure --enable-shared --enable-gpl  --enable-libx264  --enable-libfreetype --disable-mmx
  

Revision as of 17:56, 2 May 2014

Introduction

Most cameras will stream "raw video" but special media players will be required to view it unless it is first encoded to a format like mpeg, h.264 and wrapped in a container like avi, swf, mp4. Encoding the video can consume considerable processing power. Underpowered machines are limited to low frame rates (5 fps) and resolutions (320x240) resulting in slow, jerky video. The Pi's core has encoder hardware but enabling it requires payment of a licensing fee.

Some cameras have hardware encoders built into the camera and in addition to raw video, can also stream encoded video. The Logitech HD920 has mpeg and h.264 encoders. If the camera will stream encoded video, all the computer has to do is copy the stream from the USB connector to the internet connection.

Display camera modes

Video4Linux can be used to find out what formats the camera supports and to control the camera.

To install Video4Linux on the Pi:

apt-get install v4l-utils v4l-conf

To display the video formats the camera supports:

v4l2-ctl --list-formats

If the camera is fixed, auto focus can be turned off and the camera focused manually.

To turn auto focus off and manually set the focus:

/usr/bin/v4l2-ctl --verbose --set-ctrl=focus_auto=0
/usr/bin/v4l2-ctl -d 0 -c focus_absolute=25


Install ffmpeg

Ffmpeg is one program to encode or copy video and/or audio streams. 1. Install h.264 library libx264 if h.264 encoding will be used.

git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-static --enable-shared *See Note 1 below.
make
make install
ldconfig

2. Install ffmpeg

git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-gpl --enable-libx264  --enable-libfreetype *See Note 2
make
make install
ldconfig

NOTES:
1. Disable the assembler when compiling on the Pi[1]:

./configure --disable-asm --enable-shared

2. Disable mmx on the Pi

./configure --enable-shared --enable-gpl  --enable-libx264   --enable-libfreetype --disable-mmx

Configure ffserver

ffmpeg