Skip to content

Conversation

@mstoeckl
Copy link
Contributor

@mstoeckl mstoeckl commented Sep 7, 2022

This should be enough to close #155 .

I'm making this PR very early, because I sometimes use wf-recorder to test that sway/wlroots with high bit depth work properly. It may be quite a while before the prerequisites to actually use the new formats from this PR will be available in released software.

This can be tested with FFmpeg 6.0 (released early 2023), and sway built from the mstoeckl/sway/extra-bit-depths branch, and wlroots using the Vulkan renderer (requires git master or >= 0.17.0, set WLR_RENDERER=vulkan). Run a nested instance of sway, and invoke swaymsg output '*' render_bit_depth 16 or swaymsg output '*' render_bit_depth 16f to set the output buffer bit depth. (A nested instance is recommended here, because to test this with sway with the DRM backend, you'd need a relatively recent GPU so that the system that lists the appropriate plane formats in drm_info.)

As FFmpeg does not currently have alpha-less variants of RGBA64,
BGRA64, or RGBAF16, we use the alpha variants instead. This is not
a significant problem in practice, because a) source buffers often
have the X channel filled with ones b) encoding video generally
drops the alpha channel c) worst case, the user can strip alpha with
filters. If alpha-less formats ever become available, wf-recorder can
switch to them.
@ammen99
Copy link
Owner

ammen99 commented Aug 9, 2023

This can be tested with FFmpeg 6.0 (released early 2023)

Does this mean it won't compile with some earlier versions? Or will it just fail at runtime? It seems at least to compile here on FFmpeg 5.1.2.

@mstoeckl
Copy link
Contributor Author

mstoeckl commented Aug 9, 2023

Does this mean it won't compile with some earlier versions? Or will it just fail at runtime

When compiled with older FFmpeg, if the compositor provides a half-float format (like WL_SHM_FORMAT_XBGR16161616F), wf-recorder will fail at runtime, producing an "Unknown format: " error. The 16 bit integer formats have been available in FFmpeg since about 2011.

@ammen99
Copy link
Owner

ammen99 commented Aug 9, 2023

Ok, then we can safely merge. Thanks!

@ammen99 ammen99 merged commit ba5e4f4 into ammen99:master Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for high bit depth screencopy buffers

2 participants