Как транслировать аудио и захватывать одновременно

471
Aaron

Я хотел бы сохранить mp3, который транслируется в локальный файл для архивных целей.

Я использую следующую строку в моем скрипте bash для потоковой передачи звука с аудиоустройства USB на мой сервер Icecast.

/usr/bin/sox -t ossdsp -s -r 44100 -c 2 /dev/dsp1 -t raw - | \ /usr/bin/lame -r -a -m mono -b 24 --cbr --resample 22500 --lowpass 4 - - 2> /tmp/status.lame | \ /usr/bin/ezstream -qvc ezstream-config.xml 

Это работает на Raspberrypi под управлением Rasbpian.

0

1 ответ на вопрос

2
Xen2050

So sox pipes to lame which pipes to ezstream? How about add in a tee somewhere to save a copy? I'm not super-familiar with the tools you're using, but tee can "read from standard input and write to standard output and files" so it could copy one of the pipes to a file.

Something like this might work, tee between lame & ezstream:

/usr/bin/sox -t ossdsp -s -r 44100 -c 2 /dev/dsp1 -t raw - | \ /usr/bin/lame -r -a -m mono -b 24 --cbr --resample 22500 --lowpass 4 - - 2> /tmp/status.lame \ | tee outputfile-lame | \ /usr/bin/ezstream -qvc ezstream-config.xml