- Portable & small
- Stream live video & audio
- Viewed in a browser
- Wireless
Using my PI seemed a logical solution = small. Attach a PowerGen external pack = Portable. I'm already making progress!
Streaming has been tougher, 4-5 days of tough. Seemed to settle immediately on VLC and started by using the Windows GUI to build out the command line options. I ended up with a network stream that VLC client could open.
vlc --qt-start-minimized dshow:// :dshow-vdev="QuickCam Orbit/Sphere AF" :dshow-adev="Microphone (2- Orbit/Sphere AF)" :dshow-size="640x480" :live-caching="300" --sout="#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:http{mux=ffmpeg{mux=flv},dst=:8888/}"Figured the next step was to reproduce this on Ubuntu before trying the Wheezy in case there was anything odd about the distro. Ubuntu build resulted in :
cvlc "v4l2://" --v4l2-width=420 --v4l2-height=320 --input-slave=alsa:// --sout '#transcode{vcodec=WMV2,vb=256,acodec=wma2}:standard{access=http,dst=8080/,mux=asf}'Adding the Mediabuntu repository allowed me to use h264 but the video was awful.
Getting this working involved a great deal of trial and error to find video and audio codecs that worked.
RaspberryPI
Expected to be able to use the same Ubuntu command. #fail
Again, a lot of trial and error resulted in.
cvlc 'v4l2:///dev/video0:chroma=mjpg' --v4l2-width=420 --v4l2-height=320 --input-slave=alsa://hw:1,0 --alsa-audio-channels=1 --volume=1024 --sout '#standard{access=http,mux=ogg,dst=:8888/stream.ogv}' --sout-http-mime=video/oggBig difference here is I stopped transcoding and switched to using the M-JPEG stream from the camera. as the CPU just wasn't up to transcoding, >90% CPU.
Initially the audio stream volume was very low. --volume=1024 helped but the actual fix was to use alsamix.
./alsamixer
- Change to Cam
- F4 change to capture
- Was set to 0 .. raised to 50
Getting this working in a browser is still a WIP. The camera outputs:
Video : MJPG
Audio : PCM S16 LE (ARAW)
From what I can tell theres no way to view a MJPG stream in a browser. Tried various things, including wrapping it all in a HTML5 <video></video> tag with some Apache proxy statements. Setting mime type (which I left on the working command above).
I have some h264 cameras coming so will see how that works out.
Some useful links that got me this far :
http://www.phillips321.co.uk/2012/11/05/raspberrypi-webcam-mjpg-stream-cctv/
https://www.adafruit.com/blog/2012/11/02/pieye-streaming-webcam-piday-raspberrypi-raspberry_pi/
https://forum.videolan.org/viewtopic.php?f=13&t=74077&start=0
http://stackoverflow.com/questions/7917905/how-to-use-vlc-live-streams-with-html5-video
No comments:
Post a Comment