Skip to content

fix(lerobot): preserve AUD start codes when transcoding video (#743) - #744

Open
shobhitagnihotri69 wants to merge 1 commit into
Hebbian-Robotics:mainfrom
shobhitagnihotri69:fix/743-lerobot-transcode-aud-split
Open

shobhitagnihotri69 wants to merge 1 commit into
Hebbian-Robotics:mainfrom
shobhitagnihotri69:fix/743-lerobot-transcode-aud-split

Conversation

@shobhitagnihotri69

@shobhitagnihotri69 shobhitagnihotri69 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #743. In hflow.importers.lerobot._transcode_mp4_to_h264, replace custom _split_h264_by_aud with canonical hflow.video.split_annex_b_stream.

Why

_split_h264_by_aud used offset = boundary_index + 5 which stripped the start code (00 00 00 01) and NAL type byte (09) from each access unit, leaving the primary picture type byte dangling at the front of each frame. This produced non-conforming Annex B payloads that failed split_annex_b_stream validation with ValueError: no access-unit delimiter (AUD, NAL type 9) found.

Using the existing, spec-compliant hflow.video.split_annex_b_stream keeps the full AUD intact and produces valid, decodable H.264 access units matching the canonical video convention.

Validation

  • Added test_transcode_mp4_to_h264_preserves_aud_and_annex_b_structure in tests/test_lerobot_converter.py.
  • uv run pytest tests/test_lerobot_converter.py tests/test_lerobot_workflow.py tests/test_lerobot_export.py (110 passed).
  • uv run ruff check (All checks passed).
  • uv run ruff format --check (323 files already formatted).
  • uv run ty check (All checks passed).

Checklist

  • I added or updated outcome-focused tests for changed business logic.
  • I updated documentation for changed behavior, flags, formats, or requirements.
  • I ran uv run ruff check --fix, uv run ruff format, and uv run ty check.
  • I ran the relevant pytest suite.
  • I did not add recordings, generated media, credentials, private URLs, or runtime artifacts.
  • I preserved stored-data compatibility or documented an explicit version change.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous finding fully addressed and no new issues found.

Summary

The PR uses split_annex_b_stream to preserve complete AUD markers in transcoded H.264 frames.

  • LeRobot video imports keep each AUD with its H.264 frame.

Reviews (2) · Last reviewed commit: "test(lerobot): add _requires_system_ffmp..." · Reviewed by Greptile

Comment thread tests/test_lerobot_converter.py
@shobhitagnihotri69
shobhitagnihotri69 force-pushed the fix/743-lerobot-transcode-aud-split branch from a8ce67d to 6c7f8db Compare October 28, 2026 05:28

This branch has not been deployed

No deployments
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.

[Bug]: LeRobot converter _split_h264_by_aud strips AUD start codes and corrupts access unit boundaries

1 participant