Resolve Frame Drop Issue in Video Frame Reduction
Summary of the Changes
This PR specifically addresses the frame drop issue encountered during the frame reduction process in FYVideoCompressor. The changes made are:
-
Improvement in Frame Reduction Logic: The
reducemethod inReduceFrameEvenlySpacedhas been modified to correctly handle frame indexes, usingoriginalFPS * videoDurationas the loop condition. This effectively prevents frame drops, ensuring that each frame is appropriately processed. -
Refinement of Video Compression Settings: The video settings in the
createVideoSettingsWithBitratefunction have been refined to usetargetFPSaccurately, ensuring consistent frame rates during video compression.
Testing and Verification
These changes have been rigorously tested with various video files to ensure the frame drop issue is effectively resolved.
Invitation for Review
I would appreciate feedback from the FYVideoCompressor maintainers and contributors on these changes.
I previously submitted a PR to FYVideoCompressor to fix issues with frame rate handling, but noticed it hasn't been updated for some time. Since these fixes were important for my projects, I've created a new library at https://github.com/JEJEMEME/JMVideoCompressor that incorporates these improvements.
Key enhancements include:
- Support for HEVC (H.265) codec with HDR preservation
- Enhanced frame rate reduction strategies
- More flexible configuration options
- Modern async/await API
- Progress reporting and cancellation support
- Detailed analytics on compression results
I wanted to share this in case others are encountering similar issues. The new implementation builds upon the concepts from FYVideoCompressor while addressing these limitations.