-
Notifications
You must be signed in to change notification settings - Fork 125
feat: Add AV1 video codec support #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
43388a3 to
e25a6ca
Compare
This commit adds support for AV1 video decoding in lilliput, following the same pattern as HEVC support with build flag gating. Changes: - Add AV1 decoder enablement behind build flag (av1Enabled) - Update FFmpeg build scripts to include --enable-decoder=av1 and --enable-libaom - Add codec gating logic to reject AV1 when disabled (default) - Add basic tests for AV1 support and decoder creation - Include test AV1 video file for validation Usage: Enable AV1 support: go build -ldflags="-X=github.com/discord/lilliput.av1Enabled=true" Features: - AV1 video detection in containers (MP4, WebM, etc.) - First-frame extraction from AV1 videos - Same security model as HEVC (disabled by default)
06616f5 to
314f0d3
Compare
| static int avcodec_decoder_copy_frame(const avcodec_decoder d, opencv_mat mat, AVFrame* frame) | ||
| { | ||
| if (!d || !d->codec || !d->codec->codec || !mat || !frame) { | ||
| return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point (not in this pr) we should probably move to more modern c++ features like std::optional/std::expected instead of spitting out -1 for errs no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure - in the meantime I think we should stick with numeric return codes, as C++ exceptions have bitten us recently.
salarkhan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignored all the .h or .a files, but the rest lgtm
Summary
This PR introduces AV1 video codec support to lilliput, adding the dav1d AV1 decoding library to FFmpeg for improved AV1 and AVIF processing performance. It also ensures comprehensive dependency header coverage and licensing compliance across all platforms.
Key Changes
Core Features
Implementation Details
Build System Updates:
--enable-decoder=av1,--enable-libdav1d)Dependency Infrastructure:
third-party-licenses/Code Changes:
av1Enabledcontrols AV1 support (disabled by default)avcodec_decoder_create()to accept AV1 enablement parameterTesting:
avcodec_test.gotestdata/av1-mp4.mp4)Usage
Enable AV1 support:
go build -ldflags="-X=github.com/discord/lilliput.av1Enabled=true"Run AV1 tests:
Dependencies Added
Security Considerations
References
This implementation provides a foundation for efficient AV1 video processing while maintaining lilliput's security-first approach to codec support and ensuring complete dependency management across all supported platforms.