转:http://www.raspberry-projects.com/pi/pi-hardware/raspberry-pi-camera/streaming-video-using-vlc-player
Installing VLC Player
sudo apt-get install vlc
Streaming The Camera Video Using RTSP
Enter the following command to start the streaming:
raspivid -o - -t 0 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264
raspivid is used to capture the video
"-o -" causes the output to be written to stdout
"-t 0" sets the timeout to disabled
"-n" stops the video being previewed (remove if you want to see the video on the HDMI output)
cvlc is the console vlc player
"-vvv" and its argument specifies where to get the stream from
"-sout" and its argument specifies where to output it to
边录制视频边输出视频流
pi@raspberrypi ~ $ raspivid -rot 180 -o - -t 0 -n | cvlc -vvv stream:///dev/stdin --sout '#duplicate{dst=standard{access=file,mux=avi,dst=/home/pi/test.avi}, dst=rtp{dst=192.168.1.112,name=stream,sdp=rtsp://192.168.1.112:10086/stream}}' :demux=h264
客户端播放
yanisyu@yanisyu-Aspire-E1-571G:~$ vlc rtsp://192.168.1.112:10086/stream
Options
Specifying the camera resolution
raspivid -o - -t 0 -n -w 600 -h 400 -fps 12 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264
-w
Width available range: 64 to 1920
-h
Height available range: 64 to 1080
-fps
Frames per second: 2 to 30 (may change in the future)
Viewing The RTSP Stream Over The Network
You need a player which supports RTSP, for instance VLC, Quicktime, etc. Open a network stream using
rtsp://###.###.###.###:8554/
where ###.###.###.### is the IP address of the RPi.