Arduino On Makes Video Choppy

Jan 31, 2014 at 9:55am

Arduino On Makes Video Choppy

Hey All,

Situation:
I’m in a red alert zone with a deadline going up in a gallery. I’m noticing performance problems last minute. I’m using an Arduino Uno via ArduinoInOutForDummies hooked up to an analog sensor in order to control parameters of a video, and PWM output on 4 pins to light LED’s. The patch consists of multiple scenes some at 1080p, and some at 720p, Apple Pro Res 422. Overdrive is off.

What I’m noticing is that by the Arduino merely being on the playback becomes choppy, despite my performance says it’s running at 59-60fps.

What’s concerning is the fact that the Arduino is on period, while not being mapped to any parameters is what causes the choppiness. If I disconnect the Arduino from being mapped to the parameters, the video playback becomes choppy. I tried lowering the baudrate from 57600 to 28800 which helped a bit, but still craptacular in general.

Any suggestions? I need Arduino in and out and I found ArduinoInOutForDummies the easiest to setup. My patch is a bit messy as it’s a work in progress but I attached it. There’s a tab labeled (Arduino Input which as all the Arduino Stuff) It uses some MSP externals that I didn’t attach because I wonder if this might be a setting I’m overlooking.

Computer Specs:
Gallery Computer Specs:
iMac
Max 6.1.6 installed
Processor: 3.1 GhZ Intel Core i5
Memory: 8 GB 1333 MHz DDR3
Graphics: AMD Radeon HD 6970M 2048 MB
230GB / 250 GB of available space.

Thanks in advance.

Attachments:
  1. Forums-Patch.zip
#279699
Feb 1, 2014 at 2:33am

Most likely an issue with contention on the scheduler. Try using speedlim on the arduino messages, or adjust scheduler settings in Max Preferences.

#279751
Feb 2, 2014 at 4:29am

Try this smoother for the arduino input. The instructions to install are in the text file. The patch below is from one version that I used to get analog input to control video. If you still have problems then maybe you need to experiment with the video codec and see which works best…

edited to add: I found that video was very jittery, even with arduino at 0, before I used the smoother and found the best codec…good luck dude.

<code>

– Pasted Max Patch, click to expand. –

</code>

#279847
Feb 2, 2014 at 3:02pm

Hey Guys,

Some New Observations:
Dropped all the movies down to 720p. Works better, which is strange because I’m doing all the GL optimizations and CPU we’re only at 20 – 30% so it doesn’t seem like a RAM issue to me (8GB after all). I’m wondering if it’s the iMac’s Radeon Graphics card :(

Also, another observation (any expert advice is welcome!!!), I have the videos playing on a “playlist” patch (if I recall it’s based off of one of Benson’s patches, but I’m not on my computer so I can’t check the source). Essentially, some “scenes” have two video’s playing, which is where most of the lagginess appears despite running at “60 fps”. What I notice is the videos go through the playlist once (which consists of 5 scenes) then when it goes through it again (it’s in a gallery running all day), then the lagginess tends to appear. If I pause the movie, and start again, then the performance is normal. I obviously can’t keep doing this because it’s running in a museum all day. Any suggestions?

@Jesse: Looked at the scheduler, looked through the Max manual, but wasn’t entirely certain what to tweak (although I’m sure it’s experiemntal). I might try looking at using the speedlim smartly.

@Whorl: Thanks! I actually looked at this before, I may implement it. The issue is not the Arduino values not being smooth but the performance of the computer with dropped frames.

#279901
Feb 2, 2014 at 8:53pm

Did you take a look at jit.gl.hap yet?

#279909
Feb 10, 2014 at 1:49am

Hey Duffield,

Did you manage to get it sorted?

I am now having problems getting my potentiometer talking to max through ArduinoInOutForDummies…

it used to work fine! I have upgraded to mavericks and max 6.1 recently so maybe this is the problem. Can I ask which version and set up you are using?

#280567
Feb 10, 2014 at 4:55pm

Hey Worl,
Thanks for asking! I wanted to follow up just didn’t know if I’d get trolled for replying to a week old thread!

It’s up and running and the curator is happy. We had to go to 720p :( and there’s some frame droppage when mixing between two sources, but it there’s a good chance that the curator might want to tour the project so we can work on optimizing.

@Jesse: Tried to look into jit.gl.hap but ran into some issues, so we didn’t end up using it because the entire sequencing of the piece required the loop report to output a bang when @loop is 0. With jit.qt.movie, loop report still works when reaching the end of the video, regardless of the looping state (should I mention it to the developer of jit.gl.hap?). I had some other issues regarding reporting of frames and syncing to external audio tracks, but that’s tricky to explain, and I might need to investigate more thoroughly when there’s time. Because I didn’t use it, I can’t gauge how much the performance would have increased or if it was a fix, as changing the architecture of the patch last minute felt like it could make the whole thing less stable.

@whorl My ArduinoInOutForDummies works fine! I’m on Max 6.1.3, OSX 10.8.5. I just installed OSX 10.9 on my other computer, so I can see if there’s issues there? I did tweak the ArduinoInOutForDummies code slightly, mainly because I started with SensorBox, then realized I wanted to do some output to, and wanted to keep the Baud rate at 56700 so my data would behave the same. AdruinoInOut is usually 115200 by default. You can change this back by changing the baudrate in the Arduino sketch and changing the [serial] argument if you want I found that sometimes my ArduinoInOutForDummies wouldn’t sync properly at first, but then I stole the Sensorbox port system and have had no problems. Oh I should also mention that I don’t like bpatchers or externals where possible ;p. I do this so that I don’t have to think about installing externals/abstractions and I essentially de-encapsulated the code within the ArduinoInOutForDummies abstraction. If you don’t understand my redecorating, just toss me a message and I’ll help you out. Haha and if you think my maintenance here is whacky, you should see what I did to the Sensor Tamer bpathcer :)

I attached what I did maybe it’s your fix?

Also, I just downloaded OSX 10.9 on my new laptop and am doing compatibility tests to see what works what doesn’t, although I don’t think it’s gonna affect ArduinoInOutForDummies.

#280660
Feb 10, 2014 at 5:09pm

Hey Duffield,

I like what you did with the patch man…cool stuff.

For some reason however it doesn’t like me. It doesn’t want to recognise the usb port my arduino is connected to…only bluetooth. Do you know why this might be?

#280665
Feb 10, 2014 at 5:25pm

seemed to have sorted now. Not sure what the problem was but it’s coming through nicely now…cheers

#280667
Feb 11, 2014 at 12:21am

Rob Ramirez of Cycling74 is the author of jit.gl.hap – if there’s an issue with loop reporting when @loop is 0 I’m sure he’d want to know.

#280682

You must be logged in to reply to this topic.