1

Im using tricks from following link and able to record audio into file Record a program's output with PulseAudio

I have been tweaking commands and trying to stream bytes to a UDP server. This is what i have got so far which does not work

parec -d sink_name.monitor | ffmpeg -re -ac 1 -f s16le -ar 16000  -i - - | ffmpeg -re -i - -f mpegts udp://localhost:20001
  1. First command provides the audio stream
  2. This command is partially used to store stream in .mp3 file refer-ffmpeg -ac 1 -f s16le -ar 44100 -i - test.mp3
  3. This should redirect stream to UDP - from ffmpeg -ac 1 -f s16le -ar 44100 -i - test.mp3

I could use some help here. Thanks in advance!

2
  • Why pipe from ffmpeg to ffmpeg instead of just using ffmpeg?
    – llogan
    Mar 15, 2021 at 18:14
  • 3rd command is not accepting input from 1st, says invalid input. Currently i ended up using 2 different commands. 1st to save stream to file. 2nd from file to UDP
    – NotABot
    Mar 16, 2021 at 5:20

1 Answer 1

0

After tweaking around the existing command I figured it out-

parec --format=s16le -d sink_name.monitor | lame -r -a --quiet -b 18 -B 18 - | ffmpeg -re -i - -f s16le udp://localhost:20001

All three commands explained below -

  1. First command accesses the audio from sound cards and streams to 2nd command in s16le PCM format
  2. Second, lame changes bit rate to 18 kbps
  3. Third, ffmpeg streams live to udp server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .