2

Is it possible to create an "infinite" WAV file, that can be appended?

I want to continously record audio and write it into a WAV file, but I can't overwrite the file to save it as new. The reason is that I want to use ist as basis of streaming with FFmpeg, which gets the visual part by an image pipe.

I program in Python and want to do something like

audio_file = wave.open("myfile.wav")
audio_file.setlength(9999999)
audio_file.append(chunksof_audio)

1 Answers1

0

Saving to files almost certainly has to be the wrong way to stream recorded data to FFmpeg. I think you need to create a buffer area in memory that receives the recorded data. Then open an IO stream that can directly feed to an FFmpeg streaming input, and poll data from this buffer area.

The buffer should be a FIFO ring structure of some sort that can flex in size and allows both streams to operate at the same time. IDK how easily Python lets you build data structures like this or how it deals with concurrent operations though. This is what I would do using Java.

Phil Freihofner
  • 7,645
  • 1
  • 20
  • 41