I have an ongoing (hobby) project to use RPi's for bird monitoring and research studies. I started this project last fall and was able to get an RPi3 with PiCam camera module to stream video (via wifi) to a security camera client (iSpy). This set-up worked very well as we could use iSpy to monitor the inside of a birdhouse and also automatically capture video (motion detection) to the PC hard drive. We were able to monitor (record) a chickadee mated pair produce eggs and fledge 5 young birds. COOL!
I spent a lot of time trying to figure out the best video streamer to use. I was a total "noob" then, and only slightly over that level now. Lol. I was proud though that I got where I am today without posting a question here - but now I am stumped trying to figure out how to add audio (using a USB mic).
I settled on setting up a UV4L Server and this works very well for the wifi video stream:
I recently purchased a VA Links USB Microphone and the RPi recognizes it (hw:1,0) .
Code: Select all
sudo uv4l -nopreview --auto-video_nr --driver raspicam --encoding mjpeg --width 640 --height 480 --framerate 3 --bitrate 100000 --server-option '--port=9090' --server-option '--max-queued-connections=30' --server-option $
Now my major confusion is how to get the RP1 to stream the audio from the mike. The iSpy software has settings for an external networked mike, and FFMPEG is one of the options and I think likely the best choice (i can set a url in the microphone settings).
When I set up UV4l for video it was straightforward about the settings for video server (and I believe it uses FFMPEG underneath), but I don't see any options for an Audio Server. I have read posts suggesting WebRTC but my impression is that it is used for streaming to browsers. I want to use iSpy for listening and recording the audio from inside the birdhouse. So I THINK I need to configure FFMPEG for audio.
I have been testing FFMPEG commands and admit the "output" section confuses me. This is one I tried:
Note that 192.168.1.58 is the IP of the RPi3.
Code: Select all
sudo ffmpeg -ar 44100 -ac 1 -acodec pcm_s16le -f alsa -thread_queue_size 2048 -i hw:1,0 -thread_qu eue_size 2048 -r 10 -i http://192.168.1.58:9090/stream/
This is the result from command line:
It seemed to like everything except the output to the IP and file. My understanding is that the second "-i" is identifying the Output.sudo ffmpeg -ar 44100 -ac 1 -acodec pcm_s16le -f alsa -thread_queue_size 2048 -i hw:1,0 -thread_qu eue_size 2048 -r 10 -i http://192.168.1.58:9090/stream/
ffmpeg version 3.2.10-1~deb9u1+rpt1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1) 20170516
configuration: --prefix=/usr --extra-version='1~deb9u1+rpt1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnuea bihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdi o --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libg me --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse -- enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable -libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx2 65 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl - -enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable -libx264 --enable-shared
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, alsa, from 'hw:1,0':
Duration: N/A, start: 1531085010.899271, bitrate: 705 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
[http @ 0x231a440] HTTP error 404 Not Found
http://192.168.1.58:9090/stream/: Server returned 404 Not Found
So my questions:
1. Am I thinking correctly that FFMPEG is the best choice for adding an audio stream?
a. If FFMPEG can work, what am I missing in setting the Output?
b. Is there a better way than FFMPEG? I really don't want to scrap the UV4l Server as it works very well.