Hello,
To explain my need, what works already:
- create a list of all the present recordable or playback audio devices on the machine ;
- display them ;
- select one of them ;
- choose playback or record ;
- record (the buffer contains ~ 2 s) ;
- play 2s.
The code works very well (tested on Linux only, Windows untested yet), and some links are provided there : [SDL_OpenAudioDevice] : can we open several recordable devices and select /change the used one? - #6 by ericb (search for audiodevice and audiomanager classes)
On the video side, using OpenCV, I can create any .mp4 or .mpv or .avi too (works well on both Linux and Windows).
As you probably already understood, the next main goal is to create a file containing the recorded audio from the selected sources.
Note : I already know how to mux both streams and create some .mp4 or .mkv after, not a problem.
First step (Current WIP, close to work)
- how to record continuesly the sound ? (investigating, I think iām close: use a circular buffer, e.g. a ring buffer )
Current status : I can record 2 seconds of audio, and hear the sound selecting default system + playback device. Works well, and I can record audio from one selected between several connected webcams (perfect for my need).
Second step : convert the recorded audio to .aac or .mp3
But Iām stuck there:
What is the format of the recorded audio in the buffer ? And how to āconvertā it into something ā.aacā or āmp3ā able ? Said differently : what does SDL2 callback record and how to convert it to .aac (low profile) or .mp3 ?
BTW, does a solution exist to directly create a file containing all the audio ? do SDL_rwops fit my needs ? (which one if so ? ) I think I have to copy the recorded sound (copied from some buffer) and create a file containing all the audio, but I have no precise plan yet.
FYI, some times ago, I implemented the audio directly recording using alsa (Linux only), NOT using SDL and giving a .wav at the end. It works very well, but this is not portable (the Windows version wonāt work) nor a good solution. Thatās the reason why I prefer use SDL who does the job under the hood.
Apologies for my poor wording (Iām not fluent with english), if Iām not precise, but any suggestion or track or even some links would be very appreciated
Thanks in advance !!