2

I use Qt & OpenCV to record video and QAudioInput to record audio into wav format. I want to combine them into one video file. How can I accomplish this? I have researched so much but I can't seem to find a command to accomplish this.

I use both Windows and Mac.

ic3b3rg
  • 14,629
  • 4
  • 30
  • 53
ALexF
  • 171
  • 1
  • 2
  • 11

1 Answers1

0

FYI, this operation seems to be accomplished through the cmd-line in this thread. This approach may turn into an easy hack since you can call this command using system().

But if you still want to do it programatically, I suggest you take a look at Dranger's FFmpeg tutorials. It provides 8 interesting tutorials that shows how to do simple stuff, from taking snapshots of a video to more complex stuffs like writing a simple video player with audio/video sync.

These tutorials teach how to work independently with audio and video streams, which is what you need to do: read the audio stream from the WAV file and then insert it as the audio stream of a video file.

Maybe not directly related to what you are aim for, but this answer demonstrates how to use FFmpeg to retrieve the audio stream of one file and play it with SDL, while simultaneously using OpenCV to retrieve video frames and display them in a SDL window.

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • yeah, i understanded, i combined successfull, i use Commanline: ffmpeg.exe -i 1.wav -i 1.avi -acodec copy -vcodec copy output.avi but it have 1 issue is: after combined, when i play video then audio & video not sync, example: sounds occurring before the video show, how to sync audio & video record ??? – ALexF Jan 05 '12 at 15:54