Fix cropping window stalling on repeated use in the same session#331
Merged
Conversation
…tall on repeated use on Linux Agent-Logs-Url: https://github.com/fourMs/MGT-python/sessions/682682bd-1b41-4253-bae7-913f4e0d8fa8 Co-authored-by: alexarje <114316+alexarje@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix cropping function to work multiple times
Fix cropping window stalling on repeated use in the same session
Apr 13, 2026
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.
On Linux,
cv2.imshow/cv2.waitKeymust run on the main thread. The manual crop UI was invoked viathreading.Thread, which worked on the first call but left OpenCV's GUI subsystem in a broken state — causing every subsequent crop call in the same session to stall indefinitely.Changes
musicalgestures/_cropvideo.py: Replacethreading.Threadwithsubprocess.run(sys.executable, '_cropping_window.py', ...)inmg_cropvideo_ffmpeg. Each crop invocation now runs in a fresh, isolated process — which is what_cropping_window.pywas already designed for (it accepts CLI args and printsw h x yto stdout).get_first_frame_as_image,get_box_video_ratio) needed to feed the subprocess.stderrin the error message.