FFmpeg - MP4 Faststart

From PiRho Knowledgebase
Jump to navigationJump to search

Normally, a MOV/MP4 file has all the metadata about all packets stored in one location. This data is usually written at the end of the file, but it can be moved to the start for better playback by adding +faststart to the -movflags

ffmpeg -i <input.file> -c copy -f mp4 -movflags +faststart <output.file>

Depending on the size of your input it can take a few more seconds usually to perform the second pass to move the moov atom to the beginning of the file.
This will… allow the video to begin playing before it is completely downloaded by the viewer.
Reference: [FFmpeg: FFmpeg Formats Documentation]
Reference: [superuser: Any downsides to always using the -movflags faststart parameter?] Reference: [FFmpeg: H.264 Video Encoding Guide]