The
MP4 files consist of
chunks of data, called
atoms. These atoms stores information like subtitles, etc. The special atom, called
moov atom is responsible for storing information regarding how to play the video like
dimensions,
frames per second and such which is important to begin playing a video on
HTML video player. But atoms can appear in any order, so web servers like
Nginx spends some CPU, memory and disk I/O to find the
moov atom so that
HTML video based clients can start playing the video. To optimize for HTTP Pseudo-streaming, it's important to move the
moov atom to the beginning, so that web servers like
Nginx optimize for faster pseudo-streaming resulting in playing of playbacks without having to wait for the entire file to arrive or to be scanned. ffmpeg -i sample_input.mp4 -movflags faststart -acodec copy -vcodec copy sample_output.mp4 • -movflags faststart does the optimization by moving the index (moov atom) to the beginning of the file. • -acodec copy extracts the audio from the input file unaltered. • -vcodec copy extracts the video from the input file unaltered. By doing this optimization, we effectively prevent web servers, like
nginx, from spending relative amount of computation in finding the moov atom hence increasing the playback performance on
HTML video based client. ==Seeking==