Leo’s Tech Blog
Published in

Leo’s Tech Blog

Convert MPG videos to MP4 (to edit them in iMovie)

Posted by Leo Soto on July 19th, 2012.

I just filmed a couple of clips to edit them later in iMovie. Surprisingly, the MPG files generated by my (consumer, low end) camera were not importable in iMovie.

Armed with ffmpeg $ brew install ffmpeg if you don't have it already installed) and bash, it wasn't that difficult to solve the problem, once I figured out the particular incantation that ffmpeg required. Therefore, to hopefully save someone else time if he/she has the same need, here it is:

for x in *.MPG; do ffmpeg -i $x -strict experimental -f mp4 \ -vcodec libx264 -acodec aac \ -ab 160000 -ac 2 -preset slow \ -crf 22 ${x/.MPG/.mp4}; done

And voila, all the *.MPG files in the current directory will be converted to *.mp4 files, importable in iMovie.

Originally published at techblog.leosoto.com on July 19, 2012.




A personal blog on tech stuff. Includes older entries that used to live on techblog.leosoto.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Leo Soto

Leo Soto

CEO at ContinuumHQ.com, MITI.cl founder. Passionate software developer & MBA

More from Medium

Introducing Space Gas Station

Manual for Wagering on the 42nd Brilliant Raspberry Grants

IMD3901B — Simone Cormier — Milestone 7

Developing your Vue micro-frontend (part 1)