Windows: escape the metadata path, decode JSON as UTF-8, find a font - #135
Open
DarkStyleee wants to merge 2 commits into
Open
Windows: escape the metadata path, decode JSON as UTF-8, find a font#135DarkStyleee wants to merge 2 commits into
DarkStyleee wants to merge 2 commits into
Conversation
…font on Windows Three small Windows failures, none of them covered by browser-use#131 or browser-use#128. grade.py passed a temp file path straight into metadata=print:file=. Inside a filter option value the drive colon reads as an option separator, so ffmpeg reports "No option name near 'UsersRunner...'" and the analysis dies before a single frame is sampled. The path is now escaped the way render.py already escapes the subtitles path. Verified with --analyze on a real capture: the filter it computes is byte-identical to the one from a run where the path parses. render.py and timeline_view.py read the transcript and the EDL with read_text(), which decodes with the locale codepage. This does not raise on a non-ASCII transcript, which would at least be visible. On cp1251 it returns mojibake: "привет" comes back as "Рїсђрёрірес‚", and the subtitles are built from that. Both files are JSON, so UTF-8 is the only correct decoding. FONT_CANDIDATES listed macOS and Linux paths only. load_font falls back to ImageFont.load_default(), so the timeline still renders, in a bitmap font at a fixed size. Consolas and Arial appended.
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…oted path Review on browser-use#135 pointed at the write side and at a gap in the escaping. The concat list is written with the locale codepage, so a segment under a path with non-ASCII characters is written in a form ffmpeg cannot open: "Impossible to open ..." and the render stops. The same list written as UTF-8 concatenates. This is the write half of the read fix already in this branch. The master SRT had the same problem with a worse ending, since it is the artifact the viewer sees: written in a codepage, libass reads it as UTF-8 and the subtitles come out as mojibake. browser-use#131 carries this one line too. Keeping it here so the branch fixes reading and writing together rather than half of each. pack_transcripts.py reads the same transcript JSON with the locale codepage. What transcribe.py writes is ASCII-escaped by json.dumps, so this one needs an externally produced transcript to bite, but the read should still name UTF-8. _esc_filter_path escaped the drive colon but not the quote, while the value it produces is wrapped in single quotes. A temp path under a user named O'Brien would close the quoted section early. render.py escapes both; now this does too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows failures around paths and text encoding, each one reproduced on this machine. The branch leaves out the stdout reconfigure from #131 and the subtitles path escaping from #128, so it can land on top of either.
grade.py, filter option value._sample_frame_statspasses a temp file path intometadata=print:file=. Inside a filter option value the drive colon reads as an option separator, so the graph never builds and the analysis dies before a frame is sampled:The path is now escaped the way
render.pyescapes the subtitles path, colon and quote both. Verified with--analyzeon a real capture: the filter it computes is identical to a run where the path parses.Reads decoded with the locale codepage.
render.pyandtimeline_view.pyload the transcript and the EDL withread_text(). What happens next depends on the bytes, and both outcomes are worse than an obvious error. A real EDL from my project, holding Cyrillic beat labels, dies withUnicodeDecodeError: 'charmap' codec can't decode byte 0x98. A payload that happens to map cleanly comes back as mojibake instead:"привет"reads as"Рїсђрёрірес‚", and the subtitles are built from that.pack_transcripts.pyreads the same JSON the same way. All three files are JSON, so UTF-8 is the only correct decoding.Writes encoded with the locale codepage. The concat list is written with
write_text(), so a segment under a non-ASCII path is written in a form ffmpeg won't open ("Impossible to open ..."), and the concat stops. Written as UTF-8, the same list works. The master SRT has the same bug with a worse ending, because it's the artifact the viewer sees: libass reads it as UTF-8 and the subtitles come out garbled. #131 carries that one line as well; it's here so this branch fixes reading and writing together rather than half of each.timeline_view.py, fonts.FONT_CANDIDATESlists macOS and Linux paths only.load_fontfalls back toImageFont.load_default(), so the timeline still renders, in a bitmap font at a fixed size. Consolas and Arial appended.Windows 11, Python 3.11.9, ffmpeg N-121793.