Ensure resolution is divisible by 2 after scaling #4507
Merged
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.
I had an issue where some video files would not play with the renderer's max resolution set to 640x480. It turned out that the
scale
filter had calculated an output resolution with an odd number of pixels for the height, which caused libx264 to crash.This PR adds a black 1-pixel pad in either axis if needed, with the output centered. This makes the resolution divisible by 2 along both axes. It only applies to one usage of the
scale
filter because the others either get their output resolutions from the renderer's max resolution (instead of calculating some oddball res), or already have even-number padding implemented (usingconvertToModX
). So, now all cases should be accounted for.One bit of inconsistency is that multiples of 2 are enforced, instead of multiples of 4 as in the existing code with
convertToModX
. If multiples of 4 are required for some reason, then this should be edited to make it so.