1

I have three live audio feeds which I want to rebroadcast as one combined audio stream. I would like to listen to all three of these live audio feeds at once, but my home connection is limited by data per month so I'd rather only stream from one source. Which is why I want to instead use one feed from my off-site server.

Is it possible to use something like ffmpeg to achieve this, or would it be more complicated than that?

I can get the live audio feed in many formats. The ones supported they support streaming to are Windows Media Player, Real Player, iTunes, Winamp, Web Player, and a Java Web Player, so getting a supported feed type will not be an issue.

Here is an example of two of the feeds:

  • http://audio2.radioreference.com/342138428
  • http://audio7.radioreference.com/333108723

I would like to make these into one feed, so say I'd tune to http://example.com/radiostream and I'd have a stream. The feed is in an MPEG format right now, and outputting it back in the exact same codec is totally fine.

  • "I would like to listen to all three of these live audio feeds at once". I'm not sure I understand. Do you want selectable channels (3) in one feed? – Rajib Jan 28 '15 at 4:13
  • @Rajib nope, just one stream with the three merged basically. I want them just all straight mixed together. I do not need the ability to select a channel. – ComputerLocus Jan 28 '15 at 4:15
  • 1
    You can mix the three audio channels in ffmpeg using amix filter. What is the input (feed) format? And could you also specify an out put format such as mp3 etc. – Rajib Jan 28 '15 at 4:18
  • @Rajib it is an MPEG based stream, you can use this stream as an example: audio2.radioreference.com/342138428 . – ComputerLocus Jan 28 '15 at 4:23
  • Can you give me one more stream as well so I can test. The above stream records fine BTW. – Rajib Jan 28 '15 at 6:23
2

Mixing the two channels is trivial. Here is a test that mixes the two channels and records a file for 500 seconds, using the amix filter:

ffmpeg -i http://audio2.radioreference.com/342138428 -i http://audio7.radioreference.com/333108723 -filter_complex amix=inputs=2 -t 500 a.mp3

This is simpler than the amerge filter, which is also dependent on channel layout (Left, Right, Centre etc). So while this worked too, it panned the channels pretty much:

ffmpeg -i http://audio2.radioreference.com/342138428 -i http://audio7.radioreference.com/333108723 -filter_complex amerge=inputs=2 -t 500 a.mp3

Streaming:

ffmpeg can stream in two ways.

  1. Directly
  2. To another server, such as say icecast

See this guide for more details.

Using icecast, with password for source as "hackme" (the default), and port 8000 (default) as one of the ports, fire up using:

icecast -c /usr/local/etc/icecast.xml

Of course yours would be :

icecast -c /path/to/your/icecast.xml

Then use the amerge to feed to icecast:

ffmpeg -i http://audio2.radioreference.com/342138428 -i http://audio7.radioreference.com/333108723 -filter_complex amerge=inputs=2 -f mp3 icecast://source:hackme@localhost:8000/radio

Open VLC and connect to stream- http://192.168.1.128:8000/radio (That's my designated ip, you can use localhost:8000/radio).

You can hear the 2 streams. With amerge (rather than amix) the 2 streams will be panned left-right and its easy to distinguish.

For mixing 3 streams use the amix filter:

ffmpeg -i http://audio2.radioreference.com/342138428 -i http://audio7.radioreference.com/333108723 -i <third stream> -filter_complex amix=inputs=3 -f mp3 icecast://source:hackme@localhost:8000/radio
  • I'll have three streams though. So mixing it with left and right won't totally work. – ComputerLocus Jan 30 '15 at 21:25

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.