feat: implement soft threshold for video fragmentation#58
Conversation
Summary of ChangesHello @gkozlenko, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant improvement to video fragmentation by implementing a soft threshold mechanism. This change allows for more precise control over video chunk durations, mitigating the problem of fragments exceeding their target length due to strict keyframe alignment. The modification ensures better adherence to desired fragment sizes for video while maintaining strict adherence for audio, leading to more predictable and efficient media processing. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Test Coverage Summary Statistics
|
There was a problem hiding this comment.
Code Review
This pull request introduces a soft threshold for video fragmentation, which is a nice improvement to get chunk durations closer to the target. The implementation is straightforward and the logic is sound. New constants are introduced for thresholds, which is good practice. I appreciate the addition of comprehensive tests for the new functionality, which cover both video and audio-only scenarios. I have one minor suggestion to improve the test code by reducing duplication.
Add a 10% tolerance (0.9 threshold) when cutting video fragments to prevent excessive chunk durations. Previously, the splitter strictly waited for a keyframe after exceeding the target duration, often causing significant overshoots. By allowing cuts slightly before the target duration is reached, resulting chunk sizes align much closer to the requested target. Audio-only streams remain unaffected (1.0 threshold) and are cut strictly at the target due to their high sample granularity.
a710003 to
bab88df
Compare
Add a 10% tolerance (0.9 threshold) when cutting video fragments to prevent excessive chunk durations. Previously, the splitter strictly waited for a keyframe after exceeding the target duration, often causing significant overshoots.
By allowing cuts slightly before the target duration is reached, resulting chunk sizes align much closer to the requested target. Audio-only streams remain unaffected (1.0 threshold) and are cut strictly at the target due to their high sample granularity.