MPEG 4 is the most dominant video format for the web, which is supported on a variety of platforms and devices. And FFmpeg is the most popular software for encoding videos. While there are tons of articles about encoding MPEG 4 videos with FFmpeg, most of them fail to warn you about something: most video players will not start the playback until the whole video is downloaded. This could be annoying, especially for large videos.
Here is a video encoded with the following command and played via two methods; the HTML5 video tag and Flash-based video player:
ffmpeg.exe -i big_buck_bunny_trailer-1080p.ogg -c:v libx264 -profile:v baseline -preset slow -b:v 800k -c:a libvo_aacenc -b:a 128k -s 512x288 big_buck_bunny_trailer-288p.mp4
HTML5 Video 1, 2
Flash Player 1
To create a "fast-start" enabled video using FFMpeg, specify
-movflags faststart parameter in the command 3:
ffmpeg.exe -i big_buck_bunny_trailer-1080p.ogg -c:v libx264 -profile:v baseline -preset slow -b:v 800k -c:a libvo_aacenc -b:a 128k -s 512x288 -movflags faststart big_buck_bunny_trailer-288p-faststart.mp4
The following videos should start quickly, long before the video is downloaded completely:
- If the video starts immediately then either the video is already in your browser cache or you have a very fast internet connection.
- Chrome might not play the video at all (reasons unknown to me).
- The older way of enabling fast start plus the gory details are discussed here.