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?
Asked
Active
Viewed 1.1k times
2
-
1Sure, what have you tried so far? What difficulties did you encounter that you need help with? Were there parts of the documentation that you read and weren't clear enough? – Darin Dimitrov Dec 25 '11 at 13:34
-
i use Qt on Windows and macos, it is C++ – ALexF Dec 25 '11 at 13:48
-
i used cvCreateVideoWriter_FFMPEG and but it cant record audio :(, hepl me ! – ALexF Dec 25 '11 at 13:56
1 Answers
3
To start, check:
PortAudio Wiki, which has a great tutorial on how to capture audio.
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
-
-
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