Apologies for the loooong delay before answering you, but I was not able to answer you seriously before (new job, no more spare time.
Thanks a lot for reading my code and try to help me, I really appreciate ! And you are right, the way I record data seems to be not very serious, and needs more work. When I’ll have more timte (starting next week) I’ll have a deeper look, and I’ll try to improve my code. Of course, any feedback is welcome.
FYI, I did not continue in that direction, and I’m doing something completely different : currently, I’m able to select any (between several) existing and recordable audio source and any images sources e.g. webcam or a video and create an .mp4 from that. I didn’t commit the code yet, because I need to clean it up a bit, e.g. choose between static callbacks included in a class (C++ style) or C style with static callbacks (more easy to use but no nice in the middle of C++ source code).
Short answer, what works;
- collect audio from the webcam micro : ok
- collect video : conversion from from ffmpeg into cv::Mat is ok and works as expected.
- mux both into a final .mp4 : looks ok
What does not work is audio : the .mp4 (or .mkv ou .avi) is valid including quality and synchronization, but the audio is broken (sort of shopped sound, in sync with video, but not the original sound. Probably a type issus with some pointer and very probably I’m wrong with userdata use in my callback. Can need some time … no idea how long this issue will take to be solved.
Last : I’ll very probably commit everythin in a new branch soon (in max 2 weeks I mean).
Further information here : Convert SDL2 audio into ffmpeg AVFrame (recording from webcam + muxing)
Thanks again for your support