Windows: multiple helpers break on non-ASCII (e.g. Korean) paths — missing encoding="utf-8"
Summary
Several helper scripts break on Windows when the repo/project lives under a path containing non-ASCII characters (tested with Korean, but any non-ASCII path is likely affected). Root cause: multiple Path.read_text() / Path.write_text() calls and subprocess.run(..., text=True) calls don't pass encoding="utf-8", so Python falls back to the OS locale encoding (cp949 on Korean Windows), which mangles or crashes on the path/output.
Repro: clone the repo anywhere under a Korean-named directory (or any non-ASCII path) on Windows, run through transcribe.py → render.py on a short clip.
Failures observed
render.pyconcat_segments()—concat_list.write_text(...)(no encoding) writes the ffmpeg concat list with mangled paths →ffmpeg -f concatfails withImpossible to open '...'.render.pysubtitles filter — builds an absolute Windows path (with drive-letter colon and, in our case, Korean directory names) directly into thesubtitles='...'filtergraph string. Even after escaping:, libass/ffmpeg failed to open the file reliably on Windows with non-ASCII path components.render.pymeasure_loudness()/ othersubprocess.run(..., text=True)calls (loudnorm measurement, ffprobe helpers) — noencoding=ontext=True, so decoding ffmpeg's stderr (which echoes the input path) raisesUnicodeDecodeError: 'cp949' codec can't decode byte ....render.pymaster SRT write,pack_transcripts.py,timeline_view.py,transcribe.py—read_text()/write_text()calls withoutencoding="utf-8".
Suggested fix
- Add
encoding="utf-8"to everyPath.read_text()/Path.write_text()call inhelpers/. - Add
encoding="utf-8", errors="replace"to everysubprocess.run(..., text=True, ...)call. - For the subtitles filter in
build_final_composite(): run the ffmpeg subprocess withcwd=edit_dirand pass the subtitles filter path relative toedit_dir(just the filename, e.g.master.srt) instead of an absolute path. This sidesteps both the:/\escaping issues in ffmpeg's filtergraph mini-language and libass's apparent trouble with non-ASCII absolute paths on Windows — and it's simpler than escaping.
We patched a local clone with exactly these changes and confirmed a full transcribe.py → build EDL → render.py --preview --build-subtitles run completes successfully (Korean subtitles burn in correctly, loudnorm two-pass runs, final.mp4 produced) on a path like F:\<Korean folder name>\...\edit\. Happy to open a PR with the diff if useful — flagging as an issue first in case there's a preferred approach (e.g. wrapping in a helper, or setting PYTHONUTF8=1 at entry instead of per-call).
Environment
- Windows 11, Python 3.12 (via
uv), ffmpeg 9.0.1 (gyan.dev full build) - Repo path contains Korean characters (non-ASCII)
Source: browser-use/video-use