javaaudiovideoadditionxuggler

How to merge audio and video in Java


We have created an application that records web camera streams using Xuggler, but video and audio are separated.

We need to merge, not concatenate, these two files.

How can this be done in Java?


Solution

  • If you have audio and video file then you can merge them to a single audio video file using FFmpeg:

    1. Download FFmpeg: http://ffmpeg.zeranoe.com/builds/
    2. Extract downloaded file to specific folder, say c:\ffmpeffolder
    3. Using cmd move to specific folder c:\ffmpeffolder\bin
    4. Run following command: $ ffmpeg -i audioInput.mp3 -i videoInput.avi -acodec copy -vcodec copy outputFile.avi This is it. outputFile.avi will be the resulting file.