-
Notifications
You must be signed in to change notification settings - Fork 8
feat(filter): get output dimensions from filter graph directly #103
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added `libc` as a dependency in `Cargo.toml` and updated `Cargo.lock`. - Enhanced frame allocation logic in `VideoReducer` to ensure valid compression factors and prevent excessive frame creation. - Updated error handling in hardware acceleration functions to manage memory allocation failures more effectively. - Removed unnecessary unsafe implementations for `VideoDecoder` and `VideoReader` structs. Change-Id: I427ed0a717da7c58410ac6ef72bafff41b54306f
Change-Id: I5edc765bc30bd61d3e6efd48448cbcf67073658e
Change-Id: Ibb2f8713890e3b890a86818010f379be29fbdc25
Change-Id: I0ecc12607b636bfe3e67c3700dccbb112b88518b
Change-Id: I7b359149596e59be6f3ea124dac32736542cbcd6
… pyproject.toml - Modified the PyO3 dependency in both Cargo.toml and pyproject.toml to add the "abi3-py39" feature, ensuring compatibility with Python 3.9. Change-Id: I7250e1ce8e47d0e6a9969f051533d607a146ba19
- Introduced a new field `seek_verified` to cache the result of seek verification in the `VideoReader` struct. - Updated the `needs_sequential_mode` method to utilize the cached result, reducing overhead from repeated verification. - Added a new method `verify_seek_works` to perform runtime seek verification, ensuring accurate seek functionality for videos. This change enhances performance by avoiding unnecessary seek checks for videos that have already been verified. Change-Id: I7bbc5c3b20d3500b7adba82f41d9c950a9f3ab66
Change-Id: Id3fc46e50505aa614a1f7002fe56c4e3542aeef9
- Updated the filter creation functions to use a fallback pixel format name of "yuv420p" when the video format is unknown. - Improved the handling of hardware acceleration formats by implementing a similar fallback mechanism for the hardware acceleration pixel format. This change ensures more robust filter creation by preventing potential errors due to undefined pixel formats. Change-Id: Ie1df3c470c905f5b814c1bbc9088bd0793c29815
Change-Id: I176963efac78c546b3929625add704f2eb2ab4cb
Change-Id: I6c8da09da737857122e2fb75e98cea4d51d38f6b
Change-Id: Idfb64c746af374d824c1ce10c23727fe927fdd99
- Simplified error handling in `convert_yuv_to_ndarray_rgb24` and `convert_nv12_to_ndarray_rgb24` by consolidating error mapping. - Improved logging for shape vector creation failures to enhance debugging capabilities. - Cleaned up formatting and removed unnecessary whitespace in multiple files for better readability. Change-Id: I7c1e2f3a4b5c6d7e8f9a0b1c2d3e4f5g6h7i8j9k
Change-Id: Ifecd893f0f7b6c944d6f37fb7f308b589c1974f3
Change-Id: I85ebd53404d64057a97a5d6bea05aaf566b13805
Change-Id: Ieb8884a878851c0f45a6653201b887cb003fc96b
Change-Id: Ia144027b2c966ec9a30f002eb454e10aaf491840
…when first keyframe has negative PTS Change-Id: I07672cc616f404aca02bbcafbf1f856e5e43cb1f
Change-Id: I94d62771783fcb2e75470f4183a720880832e1f6
…o earlier Closed GOP keyframe for proper reference frames Change-Id: Ic35a1ee98bf8b9232a5dffa9fe67126be800868a
…videos Fixes frame mismatch issues by ensuring decoder buffer has packets after seek. Change-Id: Ib9b10c5de2ddca4719e27129511cc1b14860a42b
Change-Id: I3436aece5e042f6248efa5e1e097cc29dcc4ede8
Change-Id: Iaaa7fdc28fd70815783e87b426abc0f17d9045de
Change-Id: I8cf247c52a67bac19a682e861c8b6a76b4c60a89
Change-Id: I41ce6de1ae7ae91af8d64fb67b8c7c4f31613801
Change-Id: I2a69687983a06055c411e58ea9538d2ec000fb73
Change-Id: I0b09747fe9d9b05bb159192945bc670c70a4661e
Change-Id: I2d847a76a1588f8a6dbd79a676381024ac9b4dd3
Change-Id: Ide17a41b01e5a9bae2167f1a5c46943609492c9d
…th/height mode Add scale filter with original dimensions when skip_scale=true to normalize format, fixing "Input changed" errors for videos that switch pixel format (e.g., yuv420p -> yuv444p) mid-stream. Change-Id: Ic0dbaf9bc3b8e6fca01f438c770e1e2a17549899
Change-Id: Ia2a5ca461c7c754afc014152190b026e3725c4a8
Change-Id: Ia755ae865f8c4487ab4b957d1b950f0a9b0c8788
Change-Id: I0979a9f65589f20410fad4f288eed85cfa452243
Change-Id: I0308ee03dfbc5c7e9363b2070bf623b697c90b4a
Change-Id: I6277cd77fe8a72e902795a86352ac321503d34a2
Change-Id: I1e997c11840c55f3ff14ab2f1ffeb1e7865ad498
Change-Id: Ib0c930d50e743730b089bdbe36327c6262d78c85
…p unused codes Change-Id: I5ad65b00141594a124d77fdfd24d2d6d0ee44580
- Skip-forward in get_batch/get_batch_safe: continue from current position for sequential reader[i] - Skip filter/color conversion for non-target frames in get_batch_safe - Add fallback in __getitem__ for videos with broken seek Change-Id: I70dbb5c467b90642e9c08ed9a62b09c5c21ee624
Change-Id: I23be51580e24cc9c94c6c8fe2a89ff59dbb3b126
Change-Id: I4d69a273647a9bf90c1a5d8fd1da6a0799c83a77
gcanat
approved these changes
Jan 8, 2026
Owner
gcanat
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.
Nice! LGTM. ✌️
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, output dimensions were derived by manually parsing the filter string. This approach was fragile and failed to handle more complex FFmpeg filter expressions, such as:
scale='min(720,iw)':'min(720,ih)'scale=iw/2:ih/2force_original_aspect_ratio=decreasepad/cropfilters with expressionsThis change removes the string-based inference and instead queries the validated filter graph directly via
av_buffersink_get_w/hto obtain the actual output dimensions. This approach is more accurate, correctly handles cases with rotation metadata, and fully supports the complete range of FFmpeg filter syntax.One caveat is that
yuv420prequires both dimensions to be even. To make this explicit and avoid silent misbehavior, an error is now returned to the user when this constraint is violated.I have tested the following filter configurations, all of which now work correctly with the new approach: