I created a screen recorder for iOS using FFmpeg. I concat the images into a video which is fine and the quality doesn't change much from the screenshots but when I use setpts to match the video to the audio, the quality drops a fair bit. How can I avoid this?

The command for concatenating the images

 "-f concat -i \(textFile) -c copy -b:v 20M -pattern_type sequence -r 25 concatVideo.mov"

The command to match video to audio length.

 "-i concatVideo.mov -vf setpts=\(audioDuration/videoDuration)*PTS -b:v 20M  -q:v 1 -qmin 1 -qmax 1 videoWithAdjustedLength.mov"

The command to combine the video with adjusted length and the audio file

 "-i videoWithAdjustedLength.mov -i audioInput.m4a -c:v copy -c:a aac -shortest finalOutput.mov"

I am using Mobile FFmpeg Cocoapod so I can use FFmpeg in XCode.

Thanks for your help

Your Answer

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

Browse other questions tagged or ask your own question.