how to record/stream multiple audio output from a single input?

2

1

This is the command I am currently using to stream live audio under the Raspbian distro:

ffmpeg -f alsa -ac 1 -i hw:1 -ar 44100 -f flv rtmp://10.255.11.53/

The functionality I am looking for is called the "Tee" command, which I will use to record the stream as an mp3 file while it is streaming live.

Is there any hope of getting this functionality from the Raspbian repository? Or is there an different command which does the same thing?

hinekyle

Posted 2013-03-15T13:28:53.770

Reputation: 290

Should I wait for the Raspbian repository to update to the latest version of Libav (which might or might not have the "Tee" command) or reformat my RaspberryPi to run on the Arch distro which has FFmpeg in its repository? – hinekyle – 2013-03-15T13:53:37.443

1

libav pretends that FFmpeg does not exist, and therefore does not merge many features FFmpeg develops including the tee-psuedo muxer. So you'll either have to compile ffmpeg, or as you mentioned, use a (better) distro like Arch Linux ARM.

– llogan – 2013-03-15T19:02:21.823

this was and still is very confusing because even though I am on Raspbian which only supports Libav I can still run FFmpeg commands. For a while I thought I was using FFmpeg until I did more research, ignorance is bliss! – hinekyle – 2013-03-15T19:16:52.810

1

Yes, it is an unfortunate situation has confused thousands of users and using the name "ffmpeg" is misleading. See Who can tell me the difference and relation between ffmpeg, libav, and avconv? and The FFmpeg/Libav situation for more details.

– llogan – 2013-03-15T19:23:05.167

Answers

2

Unless putting this all in a single command is absolutely vital, I would say that changing the entire OS to a less stable one for this one purpose is probably overkill. I would just use one of the alternative commands on the page you linked to in the question:

ffmpeg -f alsa -ac 1 -i hw:1 -ar 44100 -c:a libmp3lame -f mpegts - | \
ffmpeg -f mpegts -i - -c copy output.mp3 -c copy -f flv rtmp://10.255.11.53/

Even on a Raspberry Pi, I doubt that the minor extra overhead of the extra ffmpeg process will be too much - especially since -c copy takes a tiny amount of processing.

Depending on how old your ffmpeg is, you may have to use -acodec copy instead of -c copy.

Also, you can get an up-to-date static build of ffmpeg from here; I know that Raspbian is based off of Debian, so maybe the Debian repos listed there could be handy?

evilsoup

Posted 2013-03-15T13:28:53.770

Reputation: 10 085

1I disagree with the statement that Arch Linux ARM is less stable. Have you used it? – llogan – 2013-03-15T19:03:39.483

1This solution worked for me with only a minor alteration: ffmpeg -f alsa -ac 1 -i hw:1 -ar 44100 -f \ mp3 - | ffmpeg -f mp3 -i - -acodec copy output.mp3 -acodec copy -f flv rtmp://10.255.11.53/ – hinekyle – 2013-03-15T19:19:27.757