I'm trying to make SDR scanner to broadcast signal to web.
RTL_FM -> FFMPEG -> Icecast2.
But in pauses streaming terminates and as I understood, there are no options to keep it alive with Ffmpeg functions. So I decided to add empty input and mix it with RTL-signal to keep it online:
rtl_fm -f 104M -f 102.8 -f ... -M fm -s 180s -r 44.1k | ffmpeg -f lavfi -i anullsrc=r=44.1k:cl=mono -f s16le -ar 44.1k -ac 1 -i pipe:0 -filter_complex amix=inputs=2:duration=longest -acodec libmp3lame -b:a 92k -ar 44.1k -content_type audio/mpeg icecast://source:pass@localhost:8000/audio.mp3
Aaand it doesn't work! There is no broadcast while RTL signal is offline. Why? Same result if I use anoisesrc instead of anullsrc.
This works as expected:
ffmpeg -f lavfi -i anullsrc=r=44.1k:cl=mono -acodec libvorbis -b:a 92k -ar 44.1k -content_type audio/ogg icecast://source:pass@localhost:8000/vorbis.ogg
apart from the fact that CPU load is 100%.
What's wrong? Maybe there is more suitable solution to keep stream alive? ubuntu-18.04.4