MP4 made in FFMPEG cannot play / be opened

I am trying to make a video by combining a sequence of PNG images. It seems to be working fine except, the outputted MP4 cannot actually be opened / play with Quicktime. So basically it’s not working. I can’t figure out what the issue is or how to even go about debugging this because I don’t get an error or anything. Below is my code:

var ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
var ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
var command = ffmpeg();

command
    .size('2000x2000')
    .input('Aussie1_Export/test_%04d.png')
    .inputFPS(1)
    .output('Aussie_Export_Video/test.mp4')
    .outputFPS(30)
    .noAudio()
    .on('error', (error) => { console.log('error'); })
    .run();

Answer

When saving to MP4 using a typical H.264 encoder, ffmpeg will convert to YUV color encoding but pick the highest fidelity pixel format which, for a RGB source, is YUV 4:4:4. This format is not compatible with most players. Solution is to manually force YUV 4:2:0 output. Add -pix_fmt yuv420p just before the output filename.

.outputOptions('-pix_fmt yuv420p')