Raspbian: Camera: Porovnání verzí

Z Wiki Pavel
Skočit na navigaci Skočit na vyhledávání
(Založena nová stránka s textem „Here I'm documenting how to stream from the Raspberry Pi Camera board using VLC. Most of this is covered in the Raspberry Pi forums in this [http://www.ras…“)
 
 
Řádek 20: Řádek 20:
  
 
(Remembering to correctly set the IP address of your Raspberry Pi). Again this can be played back using VLC by opening a Network Stream of '''http://<IPofRaspberryPi>/streaming/stream.m3u8''' however HLS can consume all the CPU on the Raspberry Pi
 
(Remembering to correctly set the IP address of your Raspberry Pi). Again this can be played back using VLC by opening a Network Stream of '''http://<IPofRaspberryPi>/streaming/stream.m3u8''' however HLS can consume all the CPU on the Raspberry Pi
 +
 +
 +
[[Kategorie:Raspberry Pi2]]
 +
[[Kategorie:Raspbian]]

Aktuální verze z 19. 6. 2015, 16:07

Here I'm documenting how to stream from the Raspberry Pi Camera board using VLC. Most of this is covered in the Raspberry Pi forums in this thread.

The camera needs to be setup using the various instructions on the Raspberry Pi website and the only additional software package that needs to be installed is VLC which can be installed by doing sudo apt-get install vlc with further details about it on the VideoLan website.

The most reliable streaming method seems to be via RTSP and the command line to launch it is.

raspivid -o - -t 0 |cvlc -v stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

This causes the video from the camera to be streamed from port 8554 of your Raspberry Pi. This can then be viewed by launching VLC on your PC and open a 'Network Stream' with the address rtsp://<IPofRaspberryPi>:8554/

RTSP works well on a local network, but can be hard to expose through a router to allowing streaming over the internet. To over come this VLC can be configured to stream via HTTP, this seems to use a bit more CPU on the Raspberry Pi and can suffer from dropped frames however it only uses one port and can be easily port forwarded through most standard routers. The command for this configuration is

raspivid -o - -t 0 |cvlc -v stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8554}' :demux=h264

Once more this can be viewed on your PC by using VLC and opening a 'Network Stream' with the address http://<IPofRaspberryPi>:8554/

One final way of streaming the video is over HLS (HTTP Live Streaming). This, apparently, allows the video to be easily streamed to iOS devices. For this to work a web server needs to be installed on the Raspberry Pi. A popular choice is apache that can be installed using sudo apt-get install apache which will then serve the files stored in /var/www. To setup VLC to generate the HLS stream you can run

raspivid -o - -t 0 | cvlc -v -I "dummy" stream:///dev/stdin  :sout="#std{access=livehttp{seglen=10,delsegs=true,numsegs=5, index=/var/www/streaming/stream.m3u8, index-url=http://<IPofRaspberryPi>/streaming/stream-########.ts}, mux=ts{use-key-frames}, dst=/var/www/streaming/stream-########.ts}" :demux=h264

(Remembering to correctly set the IP address of your Raspberry Pi). Again this can be played back using VLC by opening a Network Stream of http://<IPofRaspberryPi>/streaming/stream.m3u8 however HLS can consume all the CPU on the Raspberry Pi