audio – how to transform live RTMP video to live mp3 Icecast stream – Stack Overflow

Source: audio – how to transform live RTMP video to live mp3 Icecast stream – Stack Overflow

I have RTMP live stream with video and audio. I can get ogg audio live stream from RTMP and translate it to Icecast2 and get it on my site using JPlayer. Now i use such command:

/usr/local/bin/ffmpeg -re -i rtmp://192.168.22.12/live/live1 \
-vn -acodec libvorbis -b:a 48k -f ogg - | oggfwd -p -d "" \
-g "" -u "" localhost 8000 somepass live2

Then I stream my live audio using Icecast2, but it is in OGG format, so mobile devices don’t play it (Android device has a time lagging near 30 sec before they start playing, iOS devices don’t want to play it).

How can I transcode it to mp3 before sending to Icecast2?

If you are using a (very) recent version you just could use ffmpeg for this. To test if your ffmpeg is capable to stream to Icecast, do the following:

ffmpeg -protocols -v 0 | grep icecast

If this returns “icecast”, hooray, you can just do the following:

ffmpeg -re -i rtmp://192.168.22.12/live/live1 -vn \
       -codec:a libmp3lame -b:a 64k -f mp3 \
       -content_type audio/mpeg \
       icecast://source:pass@example.com:8000/mountpoint.mp3

Replace source with a specific username, if you have configured any, else leave it as source. The other things should be obvious.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.