Open iMovie on your Mac
Select the project you want to convert
Click the Share button
Choose File
Set the video quality, resolution, and compression settings
Click Next
Choose a save location
Click Save
Locate the exported file
If needed, rename the file extension to .mp4
If the export is not already MP4, use a video converter to convert the file to MP4
On iPhone or iPad, export the iMovie project to Files or Photos first
Use an MP4 converter app if the exported file is not in MP4 format
