Got a couple of Raspberry PI that (amongst other duties) I'd like to stream video and audio from.
Turns out the video streaming is super easy. With a clean Raspbian installation:
$ sudo apt-get dist-upgrade
$ sudo apt-get install vlc
$ sudo rpi-update
$ sudo reboot
$ sudo modprobe bcm2835-v4l2
$ cvlc v4l2:///dev/video0 --v4l2-width 1280 --v4l2-height 720 --v4l2-chroma h264 --sout '#rtp{sdp=rtsp://:8554/}'
(note: cvlc == /usr/bin/vlc -I "dummy" "$@")
Optionally use v4ls-ctl to control various camera settings (rotation, exposure, ...
This will create a RTSP server listening on port 8554, for any number of clients to connect to (i.e. via rtsp://
10.1.10.29:8554/). CPU usage is low, ~5% with one client, ~10% with two clients.
$ lsusb
...
Bus 001 Device 004: ID 0d8c:0008 C-Media Electronics, Inc.
Basic audio record/play works:
$ alsamixer // set recording volume
$ arecord -D plughw:1,0 -f S16_LE test.wav
$ aplay -D plughw:1,0 test.wav
Note the options to select the ALSA device and format (S16_LE seems to be the only format this dongle supports).
I can also use cvlc to stream the audio only:
$ cvlc alsa://hw:1,0 --sout '#rtp{sdp=rtsp://:8555}'
Ideally I'd like to add the audio to the video stream that gets served by vlc. (using :input-slave):
$ cvlc v4l2:///dev/video0 --v4l2-width 320 --v4l2-height 256 --v4l2-chroma :h264 :input-slave=alsa://hw:1,0 --sout '#rtp{sdp=rtsp://:8554/}'
However that complains:
[0x17c7118] stream_out_rtp stream out error: cannot add this stream (unsupported codec: I420)
[0x17cd778] main decoder error: cannot create packetizer output (I420)
So I suspect I need some transcoding options here. Questions:
* does the PI have enough CPU to combine these two streams into a single container?
* anyone familiar enough with VLC to know the magic incantation to do this?
Worse case is that I have to stream the video and audio separately, and combine them at the destination. But I'd like to avoid that if possible.
Thanks!