Reduce video to pre-determined file size using Windows 10, cmd and ffmpeg.
Use H.264 and Two-Pass encoding.
Calculate your bitrate using bitrate = target file size / duration
Target file size in kilobits. Duration in seconds. 1 MB = 8192kb
Split the bitrate between video and audio, about 3/4 video, 1/4 audio. The sum of the audio and video bitrate must not exceed the calculated bitrate.
-c:a libfdk_aac
does not work for me.
ffmpeg -y -i input -c:v libx264 -b:v CALCULATED BITRATE HERE -pass 1 -an -f null nul && ^ffmpeg -y -i input -c:v libx264 -b:v CALCULATED BITRATE HERE -pass 2 -c:a aac -b:a CALCULATED BITRATE HERE output.mp4
ffmpeg -y -i 1.mp4 -c:v libx264 -b:v 555k -pass 1 -an -f null nul && ^ffmpeg -y -i 1.mp4 -c:v libx264 -b:v 555k -pass 2 -c:a aac -b:a 128k output.mp4
See https://trac.ffmpeg.org/wiki/Encode/H.264#twopass