syncing audio and AVF video and writing/reading on a RAM circular buffer

alfredsolax's icon

Hi everybody,I'm trying to sync 10 audio files with a 720p h264 video (all the files loaded from a folder), to give them all an ID, to playlist this bundle (10 audio + 1 video) and to manage them as one thing, instead of 11 :)
I'd like to fill both audio and video continuously in a buffer.

Here below the quick "to do" list I have in my mind (see workflow here below).

Workflow:
1 detect second monitor and place a fullscreen black window there
2 drag and drop folder, detect files names (audio tracks + video) and do the “parsing" (song name)
3 preload audio in buffers and video too (partially, part by part for both, or audio first and then video parts?)
4 play sync and check sync (shall we force them with the smpte generator inside the same project?)

I'm stuck on:

• buffering: I'd like to load the first 10sec of the audio and video and when the loading it's completed to read them from the RAM buffer. This way the playback should start almost immediately (it needs to be a super responsive play). At the same time, it will fill in the A/V buffer the other 10 sec, etc...
The new AVF video engine of Max7 seems to be super efficient (with the @output_texture) but it seems it doesn't support the loadram message anymore (and loadram was loading the whole clip anyway, so it's not my case).

• sync: not only the starting point of the audio and video is crucial, but keeping them in sync. I tried by resyncing the video with a metro and a bang by playing from a specific frame every 10 sec but it works only sometimes (and not on Max7, I cannot find the way to move the playhead on the new video player). What about using an internal smpte~ object for example to keep them in sync (as I will send anyway also a smpte signal for the lights sync)?

The great jvkr helped me with this patch, but it uses the loadram. Still a super good starting point!

Thanks again you all in advance and I wish you a super 2015!!!

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

alfredsolax's icon

Anybody? :S

Rob Ramirez's icon

it's not really clear what your question is. i recommend breaking your problem down into simple questions, and posting those simple questions with a simple patch illustrating the issue.

loadram is not available using the avf engine, but it is using the 32 bit qt engine (jit.movie @engine qt). loadram is not necessary for avf engine, and it's very easy to compare the performance of the two engines (simply change the @engine arg). with the avf engine, i would recommend using the asyncread message as opposed to read.

i'm not sure what you're issue with syncing is, so can't really offer advice.

alfredsolax's icon

Hi Rob! Thanks for your reply. I'm basically "driving" a show (audio backing tracks + video + lights via smpte) with Logic Pro (and Digital Performer before it) + a firewire Canopus.
After a few years, I feel the need to use something different, more reliable and less heavy. That's what I'm trying to do :)