Merge audio/video when audio duration is less than video duration

880 views Asked by At

I'm only merging a single audio/video file. The problem is that, my video file is of 40 seconds & audio file is of 28 seconds. So for remaining 12 (40 - 28) seconds – I want to repeat audio for the remaining part from 0 second. How do I that? Is there a direct way to do this?

P.S. I'm using AVComposition for this. And code from here.

1

There are 1 answers

1
Ashwin P On BEST ANSWER

First calculate the time of both video and audio which i guess you were able to do it. if audio is lesser that video crop the audio using the code mentioned in the How to trim audio file in iPhone?. Do follow the same and then merge the audio files Combine two audio files into one in objective c and then do what you want.