Skip to content

Fix macOS build compatibility with FFmpeg 5-8#368

Open
jasontitus wants to merge 8 commits intodmlc:masterfrom
jasontitus:master
Open

Fix macOS build compatibility with FFmpeg 5-8#368
jasontitus wants to merge 8 commits intodmlc:masterfrom
jasontitus:master

Conversation

@jasontitus
Copy link

Summary

  • Adds version-gated preprocessor guards to support FFmpeg 5 through 8 while maintaining backward compatibility with FFmpeg 4.x
  • Fixes include: bsf.h include for AVBSFContext, const AVCodec*/const AVInputFormat* signatures, ch_layout channel API, av_packet_side_data_get replacement, buffersink pix_fmts runtime option fix, and macOS linker flag fix
  • Adds comprehensive pytest suite for video, audio, and A/V readers
  • Adds MANIFEST.in for source distribution packaging

Test plan

  • Built successfully with FFmpeg 8.0.1 on macOS (Apple Silicon)
  • VideoReader: frame count, FPS, single frame read, batch read all pass
  • AudioReader: mono and stereo decoding verified
  • All version guards preserve backward compatibility with older FFmpeg

🤖 Generated with Claude Code

Jason Titus and others added 8 commits February 19, 2026 18:27
Decord was written against FFmpeg 4.x APIs which have breaking changes
in newer versions. This adds version-gated preprocessor guards to
support FFmpeg 5 through 8 while maintaining backward compatibility.

- Add bsf.h include for AVBSFContext (FFmpeg 5+)
- Use const AVCodec*/const AVInputFormat* signatures (FFmpeg 5+)
- Replace av_stream_get_side_data with av_packet_side_data_get (FFmpeg 7+)
- Replace channels/channel_layout with ch_layout API (FFmpeg 6+)
- Gate avcodec_close calls removed in FFmpeg 7+
- Fix buffersink pix_fmts option via format filter (FFmpeg 7+)
- Skip -rdynamic linker flag on macOS (unsupported by Apple ld)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
FFmpeg 7+ changed the buffer source filter's pix_fmt option from
AV_OPT_TYPE_INT to AV_OPT_TYPE_PIXEL_FMT, requiring format name
strings instead of integer values. Also sanitize sample_aspect_ratio
with zero denominators which cause infinity values rejected by FFmpeg 7+.

https://claude.ai/code/session_01KjK6BLv2fUvXjZo1JU4e6S
Fix FFmpeg 7.x filter graph compatibility
Replace missing count_down.mov and sample-mov-file.mov references with
big_buck_bunny.mp4 and file_example_MOV_1280_1_4MB.mov, update shape
assertions to match, and fix shape() calls to use shape property.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
131 tests covering VideoReader, AudioReader, AVReader, bridge,
NDArray, and logging. Uses big_buck_bunny.mp4 and an MP3 file as
test-media fixtures tracked in git (.gitignore updated with
exceptions for test-media/).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document supported FFmpeg versions (4.x through 8.x) and the
API changes each version requires. Remove outdated PPA instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants