I've been using ffmpeg for the occasional video conversion for quite some time, and recently discovered that H.264 (libx264) videos generated by ffmpeg aren't working in iMovie or QuickTime (nor will they play or show a preview in Finder with the quick view feature).

If I generate videos using OS X applications which internally use ffmpeg (e.g. MP4tools or Adapter) the videos work fine, but not when I try to use ffmpeg directly, e.g. to convert a video:

# ffmpeg -i input.avi output.mp4

or to combine some images into a video:

# ffmpeg -f image2 -pattern_type sequence image-%04d.png output.mp4

iMovie just imports the video as black/blank, quick preview just shows the file info, (but no video preview), and Quicktime tells me it cannot play it:

document could not be opened

What's going on?!

2 Answers 2


In short, you (often) need to include the argument -pix_fmt yuv420p when using ffmpeg to generate H.264 content for Apple software/devices, and a bunch of other decoders that don't handle yuv444p.

# ffmpeg -i input.avi -pix_fmt yuv420p output.mp4

This is not mentioned in the output when using the defaults, but can be found in their Encode/H.264 guide.

It turns out that ffmpeg have chosen a default pixel format of yuv444p for libx264 encoding (under some circumstances), which is not compatible with Apple's software/hardware H.264 decoders (and perhaps not very widely compatible in general?). Unfortunately this seems unlikely to change, and there's no warning about it, so just something you have to know if using ffmpeg to make H.264 files.

As far as I can tell, if converting a video that's already using yuv420p it'll maintain that, but if converting from something a bit more exotic (e.g. images or a GIF or whatever) the pixel format must be specified for general Apple compatibility.

  • 2
    Does not help in current version of iMovie (Yosemite). Any other ideas? Commented Mar 16, 2015 at 21:16
  • 1
    Can you post the output of ffprobe -select_streams v -show_streams output.mp4? Commented Mar 17, 2015 at 0:06
  • 1
    +1, even yuv420p videos are not playing in High Sierra as well.
    – xxx
    Commented Nov 12, 2018 at 4:58
  • Not just Apple, but also Windows media player sometimes can't play the output if you don't specify that option. And if you try playing it with other players, it would be a comeple gray screen with artifacts showing on video.
    – Shayan
    Commented Dec 1, 2019 at 13:28
  • 2
    Just wanted to add this worked for me in 2020, with Catalina 10.15.5 and ffmpeg 4.3. Thanks!
    – David Lord
    Commented Jun 28, 2020 at 10:59

In addition to yuv420p, some discoveries on codecs in 2021 (Catalina 10.15.7 and Monterey 12.0.1, imovie 10.3 and 10.2.5, ffmpeg 4.4).

Not all *264 codecs are the same. The -c:v libx264 codec cannot be consistently imported. Instead, use -c:v h264_videotoolbox.

This is true across "Apple silicon" (aka ARM) and Intel CPUs.

Neither libx265 nor hevc_videotoolbox can be imported consistently, if at all.

(edit, days later, I had a video that wouldn't import with -c:v hd264_videotoolbox. It did work with -c:v copy -c:a copy, so one more thing to try)

  • Well the last line, c:v copy means it didn't create a new video, just copied everything as it was from some other source. Commented Sep 14, 2022 at 10:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .