FFmpeg to make ~10MB video¶
$ cd my_video_folder
$ ls
input_video.mov
class site said,
variable bit rate 1080p MP3:
$ ffmpeg -i input_video.mov -vcodec libx264 -crf 25 -preset medium -vf scale=-2:1080 -acodec libmp3lame -q:a 4 -ar 48000 -ac 2 output_video.mp4
If your file is still more than 10MB, such as 10.3MB, use -fs
parameter.
-fs limit_size (output)
Set the file size limit, expressed in bytes. No further chunk of bytes is written after the limit is exceeded.
The size of the output file is slightly more than the requested file size.
so, Try -fs 9.5M
you may get 9.7MB around. try untill you get less than to 10MB video, anyway.
$ ffmpeg -i input_video.mov -vcodec libx264 -crf 25 -preset medium -vf scale=-2:1080 -acodec libmp3lame -q:a 4 -ar 48000 -fs 9.5M -ac 2 output_video.mp4
Your video may cut by 9.5MB period. Check your end of video.
If so, try this.
fixed bit rate 1080p MP2:
$ ffmpeg -i input_video.mov -vcodec libx264 -b:v 1000k -vf scale=-2:1080 -acodec mp2 -b:a 256k -ar 48000 -ac 2 output_video.mp4
Changing -preset medium
will not help
ref.ffmpegでH.264のプリセットのベンチマーク
ref.H.264 Video Encoding Guide