Max Jitter videos get stuck

Linh Truong's icon

Hi all! I am running a video installation with pressure sensors from an Arduino triggering specific video clips. When they are not being triggered, I have a blank video clip that plays instead. However, sometimes the videos get stuck. They will trigger on but not turn off until I click the read message for the black video. Vice versa, the opposite will happen where the videos trigger initially, but then after a while, the videos stop triggering. This is resolved when I click the video files read messages. I have tried routing the bangs to the read messages and then to the jit.movie, but this causes Max to crash eventually. I'm a newbie to Max/MSP/Jitter and would appreciate any feedback about how to fix this issue or how to streamline/edit my patch in a more efficient way. Thanks in advance for your help!

FYI, I am using Max 8.6.4 on a Mac Mini M2 16 GB Sonoma 14.6.1 if any of that is helpful info.

Max Patch
Copy patch and select New From Clipboard in Max.

Wil's icon

You will get much better performance staying on gl.

Max Patch
Copy patch and select New From Clipboard in Max.

If your movies are getting stuck, which I am currently have the same issue (especially with my current setup where movies change really fast, jump to random frame, then play, change again) convert to .hap

***you probably don't need that jit.gl.node - just wanted to introduce it

Linh Truong's icon

Wil - thank you SO much for your suggestions. This is a much better way to patch for my project, and I converted the videos to .hap. I have been testing it out the past week, but my patch is still crashing every few hours. I'm still figuring out what the issue is! I did not have this issue the last location this installation was in, but it's the same exact setup and is crashing in a new location. I may try re-installing Max next.

For now, I'm running a shell script on my Mac Mini that reopens my patch every time it crashes. I'm posting it here in case anyone else finds it useful:

1. Create the script

Open Terminal and run:

nano ~/restart_max_with_logging.sh

2. Paste this script

#!/bin/bash

LOG_FILE=~/max_restart_log.txt
PATCHER_PATH="/path/to/your/patcher.maxpat" # Change this to your patch name
MAX_APP="/Applications/Max.app"

echo "Starting Max MSP monitor..." >> "$LOG_FILE"
while true; do
    if ! pgrep -x "Max" > /dev/null; then
        TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
        echo "[$TIMESTAMP] Max crashed! Restarting..." >> "$LOG_FILE"
        open -a "$MAX_APP" "$PATCHER_PATH"
    fi
    sleep 5  # Check every 5 seconds
done

3. Save and exit (Ctrl + X, then Y, then Enter).

4. Make the script executable

chmod +x ~/restart_max_with_logging.sh

5. Run the script in the background

nohup ~/restart_max_with_logging.sh &
  • nohup ensures it keeps running even if you close the Terminal.

6. View the log

To check the crash log:

cat ~/max_restart_log.txt

LSka's icon

Regarding the crashes, you might try to use a dedicated jit.movie for each video with @autostart 0, send the "read" message on load, then use the "start" and "stop" messages to trigger the videos.