Posts: 2
Joined: Sun Dec 17, 2017 8:31 pm

Adding Audio to UV4L Video Stream

Sun Jul 08, 2018 10:55 pm

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:

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 $
I recently purchased a VA Links USB Microphone and the RPi recognizes it (hw:1,0) .

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:

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
Note that is the IP of the RPi3.

This is the result from command line:
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
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 Server returned 404 Not Found
It seemed to like everything except the output to the IP and file. My understanding is that the second "-i" is identifying the Output.

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.


Posts: 2
Joined: Sun Dec 17, 2017 8:31 pm

Re: Adding Audio to UV4L Video Stream

Tue Jul 10, 2018 11:39 am

Did I post this in the wrong forum? Any advice appreciated.

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 17 guests