Repository navigation
Put the MP4 index at the front of the file with +faststart - #143
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #140.
ffmpeg writes an MP4's index (the
moovbox) after the video data, because it doesn't know where each frame lands until the encode finishes. A player streaming the file from a link (Discord, a browser) has to fetch the end of the file before it can start.-movflags +faststartmakes ffmpeg move the index to the front when it finishes, so playback can start from the first few kilobytes.Change
TwoPass._generate_params()adds"movflags": "+faststart"to the second pass for every MP4 codec. It uses the same"vp9" in codecrule as_output_filename(), so the two can't disagree about which files are.webm. The first pass writes to a null output and doesn't get the flag.+faststarthas been in ffmpeg since 2013, so there's no version check.The flag shows up in the printed and
--dry-runcommands on its own.Checked
A real 5-second x264 encode of a phone clip lists its top-level boxes as
ftyp, moov, free, mdat(before:ftyp, free, mdat, moov).Tests
test_twopass.py: for every codec inCODEC_ENCODERS, the last pass has-movflags +faststartunless the codec isvp9, and no earlier pass has-movflags.