Instagram doesn't let me upload MOV files, so I convert them to MP4 first. For the conversion, I use ffmpeg:

ffmpeg -i <input_file> <output_file>

I ensure the input file has a .mov extension and the output file has a .mp4 extension. And that's it!

(Okay, you got me. Setting the file extension isn't strictly necessary, but it's good enough for those who want a simple command to run without reading the background provided in the rest of this post.)

Why is a conversion necessary?

I did some further digging to understand why Instagram wouldn't upload my MOV files. Turns out, Instagram only supports the H.264 video codec, which came out in 2004, while my MOV files were compressed using the H.265 codec, which came out in 2013. H.264 is still considered the industry standard today, but more and more newer devices are encoding video using H.265 by default. Maybe Instagram will provide support for H.265 soon too. (Or YouTube, which only supports H.264 uploads as well.)

What's a codec?

Codecs are a form of compression technology used to encode (i.e. compress) files for storage and to decode (i.e. decompress) them to replay later too. They can be lossless, meaning every pixel's original color can be reconstructed perfectly from the compressed file, or they can be lossy, meaning the reconstruction is imperfect and the compression is irreversible.

Lossy compressions tend to produce smaller file sizes through the use of two major techniques: intra-frame compression and inter-frame compression. Intra-frame compression works by examining the individual frames of a video and compressing each as if they were their own individual still images. Inter-frame compression, on the other hand, takes advantage of redundancies between frames to further compress videos. For example, videos with lots of unchanging background benefit heavily from inter-frame compression.

How do H.264 and H.265 differ?

With H.264, frames are broken into macroblocks up to 16x16 pixels in size. Each macroblock is compressed by reusing encodings for other macroblocks found in the same frame (intra-frame encoding) or by reusing the encoding for the same macroblock from its previous frames (inter-frame encoding). The inter-frame process of finding matching blocks is called motion estimation/prediction.

H.265 uses coding tree units (CTUs) instead of macroblocks. Each frame is broken up into CTUs that are 64x64 pixels in size and compressed. Units that cannot be compressed efficiently are further broken down into 32x32 CTUs, 16x16 CTUs, or even CTUs as small as 4x4 pixels in size in order to improve the compression rate. Using these variable-sized units, H.265 can shave 50% off file sizes compared to H.264!

Despite the high compression rate of H.265, H.264 remains popular because it doesn't need heavy-duty hardware to run. As modern phones and computers come equipped with more powerful instruments, this issue is less likely to limit the use of H.265.

Why does it matter if the uploaded file is MOV or MP4?

Actually, it doesn't! Technically, MOV files can be encoded using H.264, but it's not recommended because Apple stopped supporting this years ago. I could theoretically use ffmpeg to convert my H.265 MOV file to an H.264 MOV file and then upload the converted MOV video to Instagram without issue.

How does ffmpeg know which codec to use?

If no codec is specified, it uses a default codec. You can find which one it used by scanning for the Video header in the output of this command:

ffprobe <output_file>