The following command from my experience produces the smallest file size while still retaining an eye pleasing 144p and 12 fps!
ffmpeg -i "$@" -vf "scale=-2:144" -c:v libx264 -crf 51 -r 12 -level 1 -preset veryslow -ac 1 -c:a aac -ar 7350 -b:a 5 -cutoff 1k -profile main "${@%.*}_compressed.mp4"
The actual script I use is the following if you wish to copy it for quick compression. By default ffmpeg doesn't handle more than one file at a time via the bash "*" autocomplete feature, so this script rectifies that as well as keeping the original file extension for quick compression of audio as well as using "mat2's" metadata cleaning command for "MP4s" to remove a few extra bytes of metadata.
for i in "$@"; do ffmpeg -i "$i" -vf "scale=-2:144" -c:v libx264 -crf 51 -r 12 -level 1 -preset veryslow -ac 1 -c:a aac -ar 7350 -b:a 5 -cutoff 1k -profile main "output.mp4" ffmpeg -i "output.mp4" -y -map 0 -codec copy -loglevel panic -hide_banner -map_metadata -1 -map_chapters -1 -disposition 0 -fflags +bitexact -flags:v +bitexact -flags:a +bitexact "${i%.*}_compressed.mp4" mv "${i%.*}_compressed.mp4" "${i%.*}_compressed.${i##*.}" rm output.mp4 done
Sometimes a video will have better compression by changing "-profile main" to "-profile baseline" if the palette is smaller, such as a cartoon, so I would recommend running the script twice if you're unsure to achieve lowest filesize possible.
If you'd like to change around some settings to increase the quality, the settings you might not recognize immediately are: -c:v (Video Codec) -crf (Constant Rate Factor, higher number means higher compression. Outside of the scale of the video, this setting effects the file size the most) -r (Framerate) -preset (How long the operation will take, longer means smaller file size with this video codec) -ac (Audio Channels/different audio in available speakers) -c:a (Audio Codec) -ar (Audio Rate) -b:a (Audio Bitrate, video bitrate when used with this video codec and the CRF setting doesn't do anything so it's not here) -cutoff (This will cut off the audio at a certain point, you could even reduce the size further by lowering this number further e.g. to a value of "500" but you will be missing certain higher pitched sounds from the original audio).

