Skip to content

Conversation

@NicolasHug
Copy link
Contributor

@NicolasHug NicolasHug commented Oct 5, 2025

While investigating some TODOs, I realized one key thing: we're explicitly asking NVDEC to output cudaVideoSurfaceFormat_NV12, which means NVDEC does the 10 -> 8 bit conversions for us!

That's quite different from how the default CUDA interface works - see comment.

This PR documents doesn't introduce any behavior change, it just clarifies a few things in the comments and consequently resolves a few TODOs.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 5, 2025
# video.
# Test to illustrate current difference in behavior between the BETA and
# the default interface: this video isn't supported by NVDEC, but in the
# default interface, FFMPEG fallsback to the CPU while we don't.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Above is a drive-by, I was able to confirm that the default interface can decode this video because it falls back to the CPU. I will open a separate issue to discuss the CPU fallback behavior - I think we'll want to do a few changes eventually.

pytest.skip("TODONVDEC P2 - investigate and unskip")
# It works on the default interface because FFmpeg fallsback to the
# CPU, while the BETA interface doesn't.
pytest.skip("Asset not supported by NVDEC")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note above how we're now not skipping this test anymore for the H265_10BITS asset. Support for H265_10BITS isn't introduced by this PR, it was already working before, but now we know we can safely unskip it.

Also, this isn't visible in this PR and not in scope anyway, but there's something interesting: on H265_10BITS, the frame we decode with the BETA interface looks good, but it is slightly different than the on from the default CUDA interface. The difference is due to the fact that in the BETA interface, the 10 -> 8 bit conversion is done by NVDEC itself, while in the default interface it's done later via filtergraph in convertAVFrameToFrameOutput().

So overall we should expect small differences for 10bit videos between the BETA and default interface. I will follow-up on that by creating an issue. Generally, the BETA interfaces allows for drastically simpler code (no explicit conversion needed!)

@NicolasHug NicolasHug merged commit 8f75c54 into meta-pytorch:main Oct 6, 2025
50 checks passed
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