Question

I want to make a program which takes video and audio and merges them. Video type or audio type is not important for me. How can I make this? Does any library exist for this? I know there are many programs about this topic but I want to learn how to implement such a program.

Was it helpful?

Solution

The technical term for what you are trying to do is 'multiplexing', and commonly referred to as 'muxing'.

FFmpeg is a multiplatform command line tool that does this, and arguable the industry standard. Many projects wrap FFmpeg into libraries and GUIs.

FFmpeg is also open source, so you can download the code and see how they have done it. That siad, it is very big and complex.

If you are interested in the actual mechanics of muxing separate audio and video files together into a destination file, then you will need to learn much about container formats and Codecs.

OTHER TIPS

Look at some sort of FFMPEG wrapper in C#.

An easy way to multiplex audio and video on linux is to use gstreamer. Here's a A/V pipeline that you can create using gst-launch on a shell prompt.

filesrc location=file1.vid ! queue ! mux. filesrc location=file2.aud ! queue ! mux. avimux name=mux ! filesink location=output.avi

Replace file1.vid with the name of your encoded video file and file2.aud with the name of your encoded audio file. output.avi is the container file that you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top