Repository navigation
Let --resolution take just a height or a percentage - #144
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 #137.
-rused to take onlyWIDTHxHEIGHT, so shrinking a clip meant working out a width that keeps the aspect ratio, and doing it again after a crop. Now-rtakes three forms:-r1280x72072050%The new forms use ffmpeg's
scale=-2:<height>. The-2makes ffmpeg pick the width that keeps the aspect ratio, rounded to an even number, which x264 and x265 need. The scale runs after the crop, so with-xthe height and the percentage apply to the cropped area.Changes
twopass.py: a newTwoPass._scale_size()turns-rinto the scale filter's width and height._check_video_size()and_apply_video_filters()both use it instead of splittingWIDTHxHEIGHTthemselves. A Resolution in any other format (like720p,0, or0%) now raises a clearValueErrorinstead of anint()error. An odd height like-r 721raises the existing even-size error for x264 and x265. The aspect-ratio warning only applies toWIDTHxHEIGHT, since the other forms always keep the ratio.__main__.py:RESOLUTION_PATTERNand its error message accept the new forms.web.html: the Resolution field's browser-side check accepts them, rejects0and0%, and shows the hint "e.g. 1280x720, 720, or 50%".README.md: the-rrow lists all three forms, and the Detailed Example notes that-r 1080or-r 75%would have done the same job.Checked
Real x264 encodes of 5 seconds of a 1920x1080, 60 fps Call of Duty clip:
-r 1280x720-r 720-r 50%-r 33%-x 240x0x1440x1080 -r 50%-r 721-r 720pTests
test_twopass.py: scale arguments for each form, a percentage with a crop, odd-height rounding for33%, no aspect warning for a height, and errors for odd heights (x264/x265 only) and bad formats.test_main.py: the web form accepts1280x720,720,50%, and33.3%, and rejects720pand0%.