2

I have two audio/video files that I would like to merge using picture in picture and the audio from both videos.

The following command worked to create the picture in picture. It also had the audio from the local.webm. However, it did not have the audio from the remote.webm.

 ffmpeg -i local.webm -i remote.webm -filter_complex "[1]scale=iw/4:ih/4 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10" -ar 44100 -vcodec h264 -acodec aac -strict experimental outstream.mp4
4

Add the amerge filter:

ffmpeg -i local.webm -i remote.webm -filter_complex "[1]scale=iw/4:ih/4 [pip]; [0][pip] overlay=main_w-overlay_w-10:main_h-overlay_h-10[v];[0:a][1:a]amerge[a]" -map "[v]" -map "[a]" -ac 2 -ar 44100 -vcodec libx264 -acodec aac outstream.mp4
  • I added -ac 2 to make a stereo output. Otherwise if both inputs are stereo amerge would make a 4 channel output.

  • I removed -strict experimental because it is not needed to use the encoder aac unless your ffmpeg is outdated.

1
  • @LockNeckbeard Thank you very much. Your answer worked perfectly for me. I was using avconv vs ffmpeg (my ubuntu release didn't support it officially). So I used a PPA to install ffmpeg instead and used your amerge command and it worked flawlessly. I now have both videos. I have both audio. I have the picture in a picture. Its working great! Thanks! – Daryl Sep 16 '16 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.