Best FFMpegWriter settings for Instagram-compatible MP4 exports?

Hi everyone,

I’m generating Python animations using Matplotlib and exporting them as .mp4 files with matplotlib.animation.FFMpegWriter at 30 FPS.

I’ve noticed that when I upload these videos to Instagram Reels, some upload without issue, while others are reported as unsupported, even though they were generated using the same workflow.

This made me wonder whether there are recommended FFmpeg settings that should be passed to FFMpegWriter to maximize compatibility with Instagram (or social media platforms in general).

For example:

  • Should I explicitly set the codec (e.g., libx264)?

  • Is it necessary to specify a pixel format such as yuv420p?

  • Are there recommended encoding options (profile, level, CRF, bitrate, etc.)?

  • Are there any known issues with the default FFmpeg arguments used by FFMpegWriter that could cause compatibility problems?

My goal is to export high-quality MP4 videos that are consistently accepted by Instagram Reels without needing to re-encode them afterwards.

I’d appreciate any recommendations or best practices from people who have encountered similar issues.

Thanks!