Windows: -vsync removed in ffmpeg 9.x breaks frame extraction; non-ASCII paths crash subprocess output decoding
Environment
- OS: Windows 10 Pro, Windows PowerShell / Git Bash
- Plugin version: watch@claude-video 0.2.0
- ffmpeg/ffprobe: 9.0.1-full_build-www.gyan.dev
- Windows account name contains non-ASCII (Korean) characters, so
%USERPROFILE%and the default temp dir (%TEMP%) also contain non-ASCII characters
Ran into two separate bugs trying /watch on a plain YouTube URL on a fresh Windows install. Both are in skills/watch/scripts/frames.py (one also affects whisper.py).
Bug 1 — -vsync removed in ffmpeg 9.x
extract_scene_candidates() and extract_keyframes() in frames.py pass -vsync vfr to ffmpeg:
cmd += [
"-i", str(Path(video_path).resolve()),
"-vf", vf,
"-vsync", "vfr",
]ffmpeg 9.0.1 has dropped the global -vsync option entirely (it was deprecated in favor of the per-output -fps_mode for a long time, and appears to now be a hard error):
$ ffmpeg -hide_banner -loglevel error -f lavfi -i color=c=red:s=64x64:d=1 -vsync vfr -frames:v 1 out.jpg
Unrecognized option 'vsync'.
Error splitting the argument list: Option not foundEvery --detail balanced / token-burner (scene) and --detail efficient (keyframe) run fails outright on ffmpeg 9.x. --detail transcript still works since it never shells out to ffmpeg for frames.
Fix: replace -vsync vfr with -fps_mode vfr in both call sites (frames.py lines ~256 and ~615 in the 0.2.0 tag). Confirmed this resolves extraction with ffmpeg 9.0.1 and produces correct scene-change frames.
Bug 2 — non-ASCII working-directory path breaks subprocess.run(..., capture_output=True, text=True)
Every subprocess.run(cmd, capture_output=True, text=True) call in frames.py and whisper.py (get_metadata, extract_scene_candidates, extract_at_timestamps, extract_keyframes, and the two ffprobe/Whisper calls in whisper.py) relies on Python's default text-mode decoding, which uses locale.getpreferredencoding(). On this Windows machine that's cp949 (Korean code page), not UTF-8.
ffmpeg/ffprobe print the resolved absolute path back in some of their stdout/stderr (e.g. showinfo, error messages, Output #0, ... to <path>), and the temp working directory (%TEMP%\watch-xxxx\...) is itself made of UTF-8-encoded Korean characters from the username. Decoding those bytes as cp949 raises UnicodeDecodeError inside the background reader thread subprocess.Popen spawns for capture_output=True + text=True (see Lib/subprocess.py:_readerthread). Because that thread's exception isn't propagated to the caller, subprocess.run() just returns with result.stdout / result.stderr set to None instead of raising — which cascades into confusing downstream failures:
get_metadata()silently computesduration_seconds: 0.0(viajson.loads(result.stdout or "{}")falling back to{}) instead of erroring, soframes.pyprintsextracting scene-aware frames over full 0.0sand proceeds with a bogus duration.extract_scene_candidates()then crashes withTypeError: expected string or bytes-like object, got 'NoneType'atSHOWINFO_TS_RE.finditer(result.stderr)becauseresult.stderrcame backNone.
Repro (no video download needed — any ffprobe/ffmpeg call against a path containing non-ASCII characters, decoded with a non-UTF-8 locale, will hit this):
UnicodeDecodeError: 'cp949' codec can't decode byte 0xec in position 3839: illegal multibyte sequenceFix: pass encoding="utf-8", errors="replace" explicitly on every subprocess.run(..., capture_output=True, text=True) call in frames.py and whisper.py, since ffmpeg/ffprobe/yt-dlp output is UTF-8 regardless of the OS locale.
Separately (not patched, just noting): the final summary print(f"...— delete when done._") in watch.py hit a similar UnicodeEncodeError: 'cp949' codec can't encode character '—' when stdout isn't explicitly UTF-8 (e.g. piped/redirected on Windows with a non-UTF-8 active code page). Setting PYTHONIOENCODING=utf-8 works around it, but the skill might want to set sys.stdout.reconfigure(encoding="utf-8", errors="replace") (or similar) at the top of watch.py so this doesn't depend on the caller's environment.
Suggested fix summary
frames.py:-vsync vfr→-fps_mode vfr(2 call sites).frames.py+whisper.py: addencoding="utf-8", errors="replace"to everysubprocess.run(..., capture_output=True, text=True)call (6 call sites total).watch.py: consider forcing UTF-8 stdout so the final report print doesn't depend on the console/locale encoding.
Happy to open a PR with these changes if useful — they're small, targeted diffs and I've verified /watch <youtube-url> works end-to-end on Windows (ffmpeg 9.0.1, non-ASCII user path) after applying all three.
Source: bradautomates/claude-video