DEV Community

David Gavilan for Metail

Posted on

Scaling videos with ffmpeg for App Previews

The problem

When you upload video previews for your iOS app, they have to be in a specific resolution, usually matching the native resolution of the device. Check: App Preview Resolutions

However, your video editor may not support those resolutions natively. When the iPhoneX was released, iMovie didn't support it and iPhoneX captures were exported as 750x1334 videos, instead of the native 886:1920 of the capture. Supposedly, iMovie has support for App Previews, but the support for latest devices sometimes lag behind.

Workaround with ffmpeg

You can use ffmpeg to crop and resize videos. I usually do it in 2 steps, because these command line tools can get really convoluted if you try to do it all in one go. Here's what you have to do for the iPhoneX example above:

ffmpeg -i iPhoneX-iMovie.mp4 -filter:v "crop=616:1334:68:0" -c:a copy cropped.mp4
ffmpeg -i cropped.mp4 -vf scale=886:1920 -c:a copy iPhoneX-final.mp4

Done. Now your iPhoneX video is ready for the App Store.

Top comments (0)