2

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?

Herman Schaaf
  • 46,821
  • 21
  • 100
  • 139
ALexF
  • 171
  • 1
  • 2
  • 11

1 Answers1

3

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.

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • yeah, i used portaudio, but if use ffmpeg to inject audio into video,i cant use CMD, use FFMPEG API very hard, what is the solution simple ?? – ALexF Dec 25 '11 at 14:19
  • What is the main objective? Isn't record audio/video simultaneously and store it on a video file? Install FFMPEG on your system and do it using the cmd-line. That's the easiest way. – karlphillip Dec 25 '11 at 14:43
  • yeah, but i must write 1 program for sales and of course cant use CMD :D – ALexF Dec 25 '11 at 15:42
  • In that case, FFmpeg is not that complex. ;) – karlphillip Dec 25 '11 at 19:34
  • Is a shame that FFmpeg seems to be the best solution around for recording video/audio, yet its a pain (impossible?) to get it in cmd to record video and pipe a live stream to a program to view the output. – Brad Moore Nov 19 '15 at 09:57
  • Nowadays you can use **gstreamer** to achieve the same thing. `gst-launch` is a command-line application to assist on these types of tasks. – karlphillip Nov 19 '15 at 11:17