Hardware Reference
In-Depth Information
3. For MPlayer, you need to tag on an MJPG file extension to the stream, using
the following command:
$ mplayer -demuxer lavf "http://[IP address]:8080/?action=stream&s
tream.mjpg"
4. (Optional) You can add live audio monitoring from the webcam by opening
up a
Terminal
and typing in the command line you learned in the
Listening
in on conversations from a distance
section of
Chapter 2
,
Audio Antics
:
$ ssh pi@[IP address] sox -t alsa plughw:1 -t sox - | sox -q -t
sox - -d
Recording the video stream
The best way to save a video clip from the stream is to record it with VLC, and
save it into an AVI file container. With this method, we get to keep the MJPEG
compression while retaining the frame rate information.
Unfortunately, you won't be able to record the webcam video with
sound. There's no way to automatically synchronize audio with the
MJPEG stream. The only way to produce a video file with sound would
be to grab video and audio streams separately and edit them together
manually in a video editing application such as VirtualDub.
Recording in Windows
We're going to launch VLC from the command line to record our video:
1.
Open up a command prompt window from the Start menu by clicking
on the shortcut or by typing in
cmd
in the
Run/Search
field. Then type in
the following command to start recording the video stream to a file called
myvideo.avi
, located on the desktop:
C:\> "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" http://[IP
address]:8080/?action=stream --sout="#standard{mux=avi,dst=%UserPr
ofile%\Desktop\myvideo.avi,access=file}"
As we've mentioned before, if your particular Windows version doesn't have
a
C:\Program Files (x86)
folder, just erase the
(x86)
part from the path
on the command line.
2.
It may seem like nothing much is happening, but there should now be a
growing
myvideo.avi
recording on your desktop. To confirm that VLC
is indeed recording, we can select
Media Information
from the
Tools
drop-down menu and then select the
Statistics
tab. To stop the recording,
simply close VLC.