OpenCV record both Webcam and Audio

10,031

To start, check:

I don't think PortAudio is able to deal with video files, so don't expect to inject the captured audio directly into the video file created by OpenCV.

However, if you are allowed to use something else, I would certainly take a look at FFmpeg since it can accomplish both tasks, on the cmd-line. Of course, you can also use the ffmpeg's API to write an application to do that. And if you still need to throw OpenCV in the middle of this, in this answer I showed how to convert an FFmpeg frame to an OpenCV Mat.

Share:
10,031
ALexF
Author by

ALexF

i am C/C++ developer, i am from viet nam, i interesting C++ embedded linux

Updated on June 04, 2022

Comments

  • ALexF
    ALexF almost 2 years

    I want use OpenCV and Portaudio to record video and then inject audio tracks into the Video file. Resources on this are extremely scarce, could anyone please offer some guidance?