Skip to content

GSCapture: Fix build with FFmpeg 8/9 - #14872

Closed
tleibert wants to merge 1 commit into
PCSX2:masterfrom
tleibert:ffmpeg-supported-config
Closed

GSCapture: Fix build with FFmpeg 8/9#14872
tleibert wants to merge 1 commit into
PCSX2:masterfrom
tleibert:ffmpeg-supported-config

Conversation

@tleibert

Copy link
Copy Markdown

FFmpeg 8.0 (lavc 62) removed the public AVCodec::pix_fmts and AVCodec::sample_fmts fields, so GSCapture.cpp no longer compiles on distributions shipping FFmpeg 8+ (Arch Linux currently ships FFmpeg 9.0.1, where this was caught).

This replaces the direct field access with avcodec_get_supported_config() (added in FFmpeg 8.0) when building against lavc >= 62, and keeps the existing field access for older FFmpeg versions. The new symbol is only added to the dynamic import list on lavc >= 62, so runtime loading on older FFmpeg is unaffected.

Changes:

  • Video encoder pix fmt selection in BeginCapture() now queries AV_CODEC_CONFIG_PIX_FORMAT.
  • Audio encoder sample fmt check/fallback queries AV_CODEC_CONFIG_SAMPLE_FORMAT; when the codec reports no list (i.e. all formats are supported), the requested format is assumed to be fine.
  • GetVideoFormatList() builds its list from the queried config.

Tested on Arch Linux (FFmpeg 9.0.1, clang 22): the modified translation unit compiles cleanly.

FFmpeg 8.0 (lavc 62) removed the public AVCodec::pix_fmts and
AVCodec::sample_fmts fields, breaking compilation of GSCapture.cpp
on distributions shipping FFmpeg 8 or newer (e.g. Arch Linux now
ships FFmpeg 9).

Query the supported pixel/sample formats through
avcodec_get_supported_config() when building against lavc >= 62,
and keep the old field access for older FFmpeg versions. The
symbol is only imported on lavc >= 62, so dynamic loading on
older versions is unaffected.
@github-actions github-actions Bot added the GS label Aug 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for submitting a contribution to PCSX2

As this is your first pull request, please be aware of the contributing guidelines.

Additionally, as per recent changes in GitHub Actions, your pull request will need to be approved by a maintainer before GitHub Actions can run against it. You can find more information about this change here.

Please be patient until this happens. In the meantime if you'd like to confirm the builds are passing, you have the option of opening a PR on your own fork, just make sure your fork's master branch is up to date!

@SternXD

SternXD commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Duplicate of #14831

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants