Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

combining separate audio and video files into one file C++

I am working on a C++ project with openCV. It is a simple web cam application with basic features like capturing pictures and videos. I have already been able to save video (w/o audio). Since openCV doesnot support audio processing, I was wondering if there is any way I can record audio separately in a different file and later combine those together to get one video file. While searching on the internet, I did hear something about using ffmpeg with openCV. But I just cant figure out how to do it exactly.....

Can you guys help me? I would be very grateful... Thankyou!

P.S. I have used openCV and QT (for GUI)

like image 962
Aashish Shrestha Avatar asked Jul 18 '11 17:07

Aashish Shrestha


People also ask

How can I merge audio and video for free?

Clideo. Clideo is another easy-to-use audio and video merger. It instantly combines your videos, photos and music into one integrated video, even videos and photos online. The supported media formats are MP4, AVI, MPG, VOB, WMV, MOV and more.


2 Answers

As you said, opencv doesn't by itself deal with audio. However once you get a separate audio and video file, you can combine them using a technique called muxing. There are many many ways to do this. I use VirtualDub for most of my muxing needs, although it is windows only (not sure if that's a problem). I know ffmpeg is also capable of muxing (via the command line interface), I can't recall what the command is. There's also mplayer and a multitude of other programs out there to do this.

like image 52
Chris Eberle Avatar answered Sep 21 '22 14:09

Chris Eberle


as far as i know openCV is good for video/image processing. To support audio processing, you can use other libraries e.g. PortAudio or C-sound.

like image 38
A. K. Avatar answered Sep 23 '22 14:09

A. K.