iMovie Fail: Very slow importing, iMovie'11 and h264
iMovie sometimes takes a really really long time to import a relatively small clip encoded in âh264â. For example, a 50 second clip can take up to 10 minutes to import, while a similar clip of the same duration with an âmpeg4â encoding would take only seconds. If you are going to import a medium size movie, you are ultimately out of luck. For a 20 minute clip, iMovie can take up to 6 hours.
After a little experimentation, the source of the problem materialized itself on my computer screen like a dew drop on a lotus leaf. âh264â is a interframe codec. It can use information from other frames to encode a certain frame. This potentially decreases the size of encoded of video while maintaining the quality. However, iMovieâ11 cannot edit a file encoded in an interframe encoding: in order to edit a frame, there should be no inter dependency across other frames. iMovie should be able to manipulate a frame independent of others in a clip. Hence, iMovie reencodes the movie in "iCod" (a Quicktime format), and this takes a really long time while requiring a great deal of free drive space.
There is a neat solution to all this mess. You can re-encode your video in âh264â with exactly the same settings but by only turning off inter frame lookups. This process will create a video with visually no quality degradation and very little increase in the size. And, iMovie will be able to import your movie quickly.
âffmpegâ command line tool enables you to use âh264â with no inter frame lookups. You need to use â-preset ultrafastâ to accomplish this. In my example,
I have always been baffled by how badly iMovie is designed for errors. There is no explicit communication of what is happening and no course of action is ever offered should you run into a problem. Design world has known it better since 1980s than the Apple iMovie engineers know in 2010s.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
â Live Streamingâ Interactive Chatâ Private Showsâ HD Qualityâ Free Actions
Free to watch ⢠No registration required ⢠HD streaming
iMovie Fail: "This clip cannot be optimized. Error -50"
iMovie sometimes simply cannot implement âfast forwardâ or âslow motionâ on movie clips. This happens when you have a project in which you want to edit part of a movie to play at higher speeds such as 2x, 4x, etc (or at lower speeds for that matter). iMovie will tell you that it will need to optimize the clip before you can fast forward it, and then it will fail with a cryptic message: âThis clip cannot be optimized. Error: -50â
It turns out that the problem is unambiguous, you just donât have enough space on your drive for the optimization. If you have multiple drives, this would be the drive on which you created the âEventâ when importing your clip.
Evidently, the remedy is simple, just create more space on your drive. But, what if you cannot do that? There is an alternative, you can decrease the size of your clip by reducing the âbitrateâ using a command line tool called âffmpegâ. Of course, you will have to do this before importing your movie to iMovie.
Here are the steps:
1. Failed to import with optimization on iMovie on âImport MoviesâŚâ
The movie I had was 1.65 Gigs, and I had 3.5 Gigs empty on my hard drive. For iMovie, this was just not enough for optimizing the video. It would fail without any error messages.Â
Since this failed, I unchecked the "Optimize video" and imported the movie without any optimization.
2. Failed to optimize the clip when trying to âFast Forwardâ
When I tried to âfast forwardâ the clip, iMovie said that âthe clip must be converted before its speed can be adjustedâ. When I okâed that, it started âoptimizingâ, only to fail with the ever famous cryptic message: âThis clip cannot be optimized. Error: -50â
3. What to do next?
I could not delete more files, so I decided to lower the bitrate of my video to decrease the size. âffmpegâ can do this easily.
4. Install ffmpeg using MacPorts
I decided to use MacPorts to install âffmpegâ. After Googleâing and installing the macports pkg, I opened "Terminal" and typed âsudo port install ffmpegâ. Voila, I had ffmpeg on my computer. You can use Command + Space to open the search bar on the top right, and type "Terminal" to find Terminal on your Mac.
5. The command line
First you have to change to the directory that the movie resides in. For my case, it is in "~/Document". I typed "cd ~/Documents". Then, I wanted to check what the movie is encoded in. I typed âffmpeg -i MOVIE_FILENAMEâ. This will tell you the encoding, and the bitrate. My file was encoded in h264 with 8147k bitrate. I decided to halve the bitrate to 4000k. So I typed:
â-b:v 4000kâ sets the output bitrate 4000k, while â-c:v h264â sets the encoder for video to be h264.
Since my movie's audio was encoded in AAC, ffmpeg asked me to add "-strict -2" to the command line. I did that.
When I first tried to use "-c:v h264", iMovie's optimization on ffmpeg's output would take forever and the optimized file would be many times larger than the original, which beats my purpose. After a bit tinkering, I found out that you need to disable h264's interframe reference by adding the setting to "-preset superfast"
6. Success!
The output file was only 800 Megs with not so much of a difference in quality, at least for my purposes. And iMovie successfully optimized the new video.
It comes as a surprise how horrific iMovie is designed for errors. On one hand iMovie is an immensely user-friendly tool for quick editing your movies. But on the other hand, it does not go much further in error handling than the long-gone DOS operating system with its own version of cryptic error messages. From a design perspective this is one of the no-noâs in Donald Normanâs monumental âDesign of Everyday Thingsâ. In his book, Norman gives a simple recipe for âhow to do things wrongâ and I believe iMovie engineers followed these instructions really well, especially the fourth bullet point:
âUse idiosyncratic language or abbreviations. Use uninformative error messagesâ(1)
Once you finish editing your movie, I strongly recommend to add Normanâs book to your reading list. It is quick and very informative.
Links:
(1) Donald Norman, âDesign of Everyday Thingsâ (2002), page 179