Skip to content

Conversation

@Dan-Flores
Copy link
Contributor

@Dan-Flores Dan-Flores commented Nov 12, 2025

This PR adds preset as an option in the VideoEncoder API, and is build on the CRF changes in #1031.
To review just these changes, see 9eee77f

preset is a readable string in libx264, so the docstring suggests those strings. Occasionally (as in the case of the libsvtav1 codec), preset can be an int, so both types are accepted.

To test, test_video_encoder_against_ffmpeg_cli is updated to try combinations of pixel_format, crf, and preset.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 12, 2025
@Dan-Flores Dan-Flores marked this pull request as ready for review November 13, 2025 04:25
Copy link
Contributor

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Dan-Flores , 9eee77f LGTM.

Did you empirically observe the effect of this parameter, e.g. does using preset="slow" produce a smaller output file than using preset="fast"?

@Dan-Flores
Copy link
Contributor Author

Did you empirically observe the effect of this parameter, e.g. does using preset="slow" produce a smaller output file than using preset="fast"?

Yes, I originally had a test for this but felt it had potential to be flaky.
FFmpeg's verbose logs also indicate the preset is being consumed correctly.

@Dan-Flores Dan-Flores merged commit e170212 into meta-pytorch:main Nov 13, 2025
70 of 78 checks passed
@Dan-Flores Dan-Flores deleted the preset_encode_option branch November 13, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants