Use the correct stream bitrate for strict min/max rates - #223
Merged
Conversation
This was referenced Sep 11, 2026
ekisu
force-pushed
the
fix/strict-filesize-bitrate
branch
from
September 12, 2026 00:53
3d408cd to
77b4d16
Compare
ekisu
force-pushed
the
fix/strict-filesize-bitrate
branch
from
September 12, 2026 00:56
77b4d16 to
127dfba
Compare
calculate_bitrate returns video_bitrate/audio_bitrate, but the strict_filesize_constraint block still interpolated an undefined bitrate variable, producing minrate=nilk/maxrate=nilk which ffmpeg cannot parse. Select the bitrate of the constrained stream (video for video formats, audio for audio-only).
ekisu
force-pushed
the
fix/strict-filesize-bitrate
branch
from
September 12, 2026 01:16
127dfba to
c9a7386
Compare
Owner
Author
|
Approved. |
ekisu
marked this pull request as ready for review
September 12, 2026 19:37
This was referenced Sep 12, 2026
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.
Summary
Use
video_bitratefor video min/max constraints andaudio_bitratefor audio-only constraints. A bitrate refactor left this block referencing an undefinedbitrate, emittingminrate=nilk/maxrate=nilk.Related to the strict-filesize reports in #48; this does not close the issue's separate speed/synchronization report.
Tracked in #217.
Verification
nilkflags for both AVC and MP3. Depending on encoder/version, these produce parse errors or leave the requested bounds unapplied.b,minrate, andmaxrate; a generated two-second PCM fixture encoded to MP3 uses 128k for all three.python -m unittest -v tests.testcases.test_strict_filesize: 2 passed (~3s).This corrects the flags; it is not a guarantee that every codec meets an exact output-byte limit.
Current harness-based verification (supersedes historical test notes)
Rebased onto master
72d9d11, which includes #226 and #227. Tests load the normal built script and drive real mpv.Real AVC and audio-only MP3 encodes now use shared process/log/range helpers. Tests inspect output media and numeric b/minrate/maxrate arguments. Pinned Nix: 16 tests, 15 passed, 1 existing audio skip.
Latest rebase verification
Rebased onto master
72d9d11after #227 merged. Normal build and the complete pinned-Nix suite pass, with two expected skips (audio fixture and unavailable optional libaom-av1 encoder).