Skip to content

Fix ffprobe output parsing and unquoted paths in shell commands - #30

Open
pradeepreddycv wants to merge 1 commit into
google:mainfrom
pradeepreddycv:fix/ffprobe-parse-and-path-quoting
Open

Fix ffprobe output parsing and unquoted paths in shell commands#30
pradeepreddycv wants to merge 1 commit into
google:mainfrom
pradeepreddycv:fix/ffprobe-parse-and-path-quoting

Conversation

@pradeepreddycv

Copy link
Copy Markdown

Two robustness fixes for real-world inputs:

  1. utils/probe.py — robust duration parsing. get_video_duration runs ffprobe
    with stderr=subprocess.STDOUT, folding decoder warnings (e.g.
    "[h264 @ ...] time_scale/num_units_in_tick invalid or unsupported") into
    stdout, then calls float(result.stdout) — raising "could not convert string
    to float" on files with noisy-but-valid metadata. Switched to
    stderr=subprocess.PIPE + text=True and parse the numeric line via regex.
    (Same fragility as ffprobe returns error on mpeg-ts inputs #29.)

  2. utils/video_reader.py — quote paths in shell commands. load_video_1p0 and
    load_video_1p5 build ffmpeg commands as f-strings run under shell=True with
    the video path unquoted, so any path containing a space breaks with
    "No such file or directory". Wrapped all interpolated paths in shlex.quote().

Test: ran inference on a clip with malformed timing metadata under a directory
containing a space — fails on main, succeeds with these changes.

@google-cla

google-cla Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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