Skip to content

fix(ffmpeg): detach FFmpeg children from the caller's standard input - #784

Merged
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
JaynouOliver:fix/ffmpeg-stdin-isolation
Nov 15, 2026
Merged

kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
JaynouOliver:fix/ffmpeg-stdin-isolation

Conversation

@JaynouOliver

@JaynouOliver JaynouOliver commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Frame extraction, contact sheets, frame statistics, hflow.testing synthesis and the LeRobot transcode no longer read the caller's standard input.

Why

FFmpeg polls standard input: q stops it with exit status 0, other bytes are discarded. Six invocations inherited it, so while read repo; do hflow import lerobot --repo "$repo" ...; done < repos.txt lost loop input, and a q gave frame count mismatch: 266 parquet vs 107 video access units; Episode.frames() returned a short sample without an error. They now get stdin=subprocess.DEVNULL, or -nostdin for the contact sheet, like the other call sites.

Validation

uv run pytest tests/test_ffmpeg_standard_input.py -q: 4 failed before, 4 passed after. Related suites: 278 passed, 3 skipped. Linux, Python 3.13, FFmpeg 6.1.1 only; the full suite was not re-run on the final patch.

Checklist

  • I added or updated outcome-focused tests for changed business logic.
  • I updated documentation for changed behavior, flags, formats, or requirements. (none needed)
  • 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.

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

FFmpeg reads interactive commands from standard input: 'q' stops it with
exit status 0 and other bytes are discarded. Frame extraction, contact
sheets, frame statistics, synthetic episodes and the LeRobot transcode
inherited the caller's standard input, so a shell read loop or a typed key
could truncate their output or lose the loop's input. Give them /dev/null
or -nostdin, like the other FFmpeg call sites.
@github-actions

Copy link
Copy Markdown

👋 Hi @JaynouOliver — thank you so much for your first contribution to HFlow!

A maintainer will review your pull request as soon as possible. In the meantime:

💡 Tip: one open pull request per contributor at a time. Before starting an issue, check its sidebar for an assignee or a linked pull request. Either one means somebody is already on it; everything else is fair game.

We are excited to have you here and appreciate your help making the project better! 🙌

@JaynouOliver
JaynouOliver marked this pull request as ready for review November 14, 2026 23:01
@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Prevents six FFmpeg calls from consuming the caller’s standard input.

  • Frame extraction and contact sheets leave caller input alone.
  • Frame statistics count the video without consuming caller input.
  • Synthetic episodes render without taking caller input.
  • LeRobot video imports transcode without reading caller input.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "fix(ffmpeg): detach FFmpeg children from..." · Reviewed by Greptile

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this! Validated with Ruff, ty, and the full test suite: 2,608 passed, 47 skipped.

@kstonekuan
kstonekuan merged commit b2b3559 into Hebbian-Robotics:main Nov 15, 2026
5 checks passed
@kstonekuan kstonekuan mentioned this pull request Nov 15, 2026
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.

2 participants