Repository navigation
Give the second pass the same constant frame rate as the first - #147
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 #146.
The first pass forced a constant frame rate (
-fps_mode cfr) and the second pass didn't, so the two passes could see a different number of frames from the same trim (122 against 121 on 2 seconds of a 1080p60 clip). The second pass reads the first pass's stats frame by frame, so on Windows AV1's second pass crashed, and x265 loggedslice=P but 2pass stats say Bon every two-pass encode.Change
TwoPass._generate_params()gives the second pass the samefps_mode_flag(self.probe): "cfr"as the first, so older ffmpeg builds get-vsync cfron both. Hardware codecs run only the second pass, so their output is now constant frame rate too, matching the software codecs.Checked
Windows (ffmpeg 8.1 gyan.dev essentials), 10 seconds of a 1080p60 Call of Duty clip at
-s 5:av10xC0000005)x265slice=P but 2pass stats say Bin redx264vp9hevc_nvencOn macOS, a verbose x265 encode no longer logs the B-frame warning or the
slice=Perror.With the fix, AV1 retries that reuse the first pass's stats (#139, PR #145) also work: on Windows a retry from 6 to 5.1 MiB landed at 4.95 MiB, the same as a full re-encode. libaom's first pass is cheap, so the retry is only about 10% faster.
Tests
test_twopass.py: every codec's passes all use-fps_mode cfr, and an ffmpeg 4.4 probe gets-vsync cfron both passes. The full suite passes on macOS and Windows.