Skip to content

Version 2.5.0#60

Merged
gkozlenko merged 1 commit intomasterfrom
version-2.5.0
Feb 20, 2026
Merged

Version 2.5.0#60
gkozlenko merged 1 commit intomasterfrom
version-2.5.0

Conversation

@gkozlenko
Copy link
Owner

@gkozlenko gkozlenko commented Feb 20, 2026

Index Format Update

The index file format has been updated to version 3 to support the maxFragmentDuration() method and precise HLS #EXT-X-TARGETDURATION calculation. Existing version 2 index files must be regenerated.

HLS and Fragmenting

  • Soft threshold: Introduced a soft threshold (10% tolerance) when cutting video fragments to hit target chunk sizes more accurately and prevent overshoots.
  • Audio-only: Added support for audio-only streams (setting PCR timestamps, disabling segment merging for playback stability).
  • Precision & Offsets: Eliminated timestamp drift by using the source stream timescale and added support for negative sample offsets (ctts atom).

Codec Parsing and Logic

  • Robust parsing: H.264 (AVCC) and H.265 (HVCC) parsing logic has been refactored: it is now stateless and includes strict buffer bounds and configuration version checks.
  • HEVC Open GOP fix: Added a fix for initial HEVC frames (patching CRA to BLA) to eliminate visual artifacts at chunk boundaries.

Performance Optimizations

  • FragmentReader: Optimized I/O and reduced garbage collection (GC) pressure by introducing a coalesced read strategy and removing intermediate arrays.
  • HLS Packetizer: Removed unnecessary data copying and optimized the sample counter to work with different PIDs.
  • FragmentListBuilder: Improved performance by deriving duration directly from sample data and fixing truncation errors for the last fragment.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 version 2.5.0 of the node-video-lib package, delivering a comprehensive set of enhancements focused on improving video processing capabilities. The update primarily addresses HLS and MP4 handling, refines codec parsing for H.264 and H.265, and significantly boosts performance in fragment reading operations. These changes collectively aim to provide a more precise, robust, and efficient library for video stream manipulation.

Highlights

  • Index Format Update: The index file format version has been bumped from 2 to 3 to support the new maxFragmentDuration() method in FragmentList, which enables precise HLS #EXT-X-TARGETDURATION calculation. This update increases the header size from 32 to 40 bytes, requiring existing index files to be regenerated.
  • HLS and Packetizer Improvements: Implemented a soft threshold (0.9 tolerance) for video fragmentation to prevent excessive chunk durations, added support for audio-only streams by setting PCR timestamps to audio packets, and fixed timestamp drift and last fragment truncation. Support for negative sample offsets in the ctts atom was added, and packetizer optimizations were made to improve performance.
  • Codec Parsing and Logic Refactoring: Refactored H.264 (AVCC) and H.265 (HVCC) parsing to be stateless and robust, including strict bounds checks and validation. An HEVC Open GOP fix was implemented to patch initial HEVC CRA to BLA, resolving visual artifacts, and unit tests were added for robustness.
  • Performance Optimizations: Significant optimizations were made to the FragmentReader, including implementing coalesced reads with a max 512KB buffer and 4KB gap limit, reducing garbage collection pressure by removing intermediate arrays and using single-pass loops, and eliminating redundant sort operations.
Changelog
  • package-lock.json
    • Updated the package version to 2.5.0.
  • package.json
    • Updated the package version to 2.5.0.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2026

Test Coverage Summary Statistics

  • Lines: 95.55%
  • Statements: 95.55%
  • Functions: 92.59%
  • Branches: 89.3%

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces significant improvements, including an index format update (v2 to v3), HLS packetizer enhancements, and performance optimizations. However, the provided diff only contains version bumps in package.json and package-lock.json. Since the index format change is backward-incompatible (requiring regeneration of existing files), a major version bump to 3.0.0 is recommended per Semantic Versioning (SemVer) principles. Additionally, the logic changes described in the PR body are missing from the current diff, and there is a potential conflict between the supported Node.js version (>=10.0.0) and the devDependencies (ESLint 10 requires Node.js >=20).

Index Format Update

The index file format has been updated to version 3 to support the
`maxFragmentDuration()` method and precise HLS `#EXT-X-TARGETDURATION`
calculation. Existing version 2 index files must be regenerated.

HLS and Fragmenting
- Soft threshold: Introduced a soft threshold (10% tolerance) when
  cutting video fragments to hit target chunk sizes more accurately
  and prevent overshoots.
- Audio-only: Added support for audio-only streams (setting PCR
  timestamps, disabling segment merging for playback stability).
- Precision & Offsets: Eliminated timestamp drift by using the source
  stream timescale and added support for negative sample offsets
  (`ctts` atom).

Codec Parsing and Logic
- Robust parsing: H.264 (AVCC) and H.265 (HVCC) parsing logic has
  been refactored: it is now stateless and includes strict buffer
  bounds and configuration version checks.
- HEVC Open GOP fix: Added a fix for initial HEVC frames (patching
  CRA to BLA) to eliminate visual artifacts at chunk boundaries.

Performance Optimizations
- FragmentReader: Optimized I/O and reduced garbage collection (GC)
  pressure by introducing a coalesced read strategy and removing
  intermediate arrays.
- HLS Packetizer: Removed unnecessary data copying and optimized
  the sample counter to work with different PIDs.
- FragmentListBuilder: Improved performance by deriving duration
  directly from sample data and fixing truncation errors for the
  last fragment.
@gkozlenko gkozlenko merged commit 719c2ce into master Feb 20, 2026
4 checks passed
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.

1 participant