1

I have been able to use FFmpeg with OpenAI Whisper to transcribe an audio file to text.

What I would like to do is, instead of using a pre-recorded file, stream an RTMP feed into FFmpeg in order to transcribe in real-time.

1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Commented Apr 14, 2023 at 0:02

1 Answer 1

0

I've had success with this shell script, which requires you to have ffmpeg, inotifywait and whisper installed:

ffmpeg -i STREAM_URL -f segment -segment_time 30 -strftime 1 %s.mp4 -v verbose 2>&1 |
  grep -Po --line-buffered "Opening '\K\d+" |
  xargs -I _ bash -c 'echo; date -d @_; inotifywait -qqe CLOSE _.mp4; whisper --model medium.en _.mp4'

The ffmpeg command saves 30-second segments to the current directory in mp4 format, named by Unix timestamp. Its output is then filtered for the debug messages that are printed when it opens a segment file for writing. The command will print the time when each segment file is opened, wait for ffmpeg to close it, and then call whisper.

You must log in to answer this question.

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