Movie Maker: Time gap between movie and its audio file

Hello @chrisir,

It has been a while since I did this so took it out for a spin!

MovieMaker uses FFmpeg under the hood and you can certainly customize.

It some effort to get Movie Maker working on my computer:

Movie Maker tool issues

Code to generate frames:

/**
 * MovieMaker Frame Generator for Testing
 * 
 * Author:  glv
 * Date:    2025-07-19
 * Version: 1 0 1
 * 
 * Description
 *
 * Generates frames for testing:
 * - target frameRate for MovieMaker
 * - background color change at marker (10s)
 *
 * Notes:
 * - frameCount for setup() is 0 and draw() starts at 1; adjust as necessary
 * - saves images from  000001.png to 000601.png
 * - sketch frames show text counting from 0 to 299 (yellow) and 300 to 600 (red) background
 * - tga are really fast!
 * - can increase frameRate for fast rendering! Not with audio. :)
 *
 */

int framesToSave;
int t0, t1;
int marker_10s;

void setup()
  {
  size(300, 300);         
  //surface.setVisible(false); // Does not speed things up!
  
  t0 = millis();
  
  int audioTimeSecs = 20;      // Must be in seconds 
  int desiredFrameRate = 30;   // For MovieMaker!
  
  frameRate(1000);             // Make this 1000 and let the rendering fly!  
  
  marker_10s = 10*desiredFrameRate;
  //println(marker_10s);
  
  framesToSave = audioTimeSecs*desiredFrameRate;
  println("It's show time!");
  println();
  println("audioTimeSecs:", audioTimeSecs);
  println("desiredFrameRate", desiredFrameRate);
  println("framesToSave", framesToSave );
  delay(1000);
  println();
  
  // Common to all text:
  textAlign(CENTER, CENTER);
  textSize(96);
  fill(0);
  }
  
void draw()
  {
  // I wanted this on top of draw for now...

  if(frameCount > framesToSave)  // Saves frames 1 to frameSave - 1
    {
    println("Last unsaved frameCount:", frameCount);
    t1 = millis();
    int dt = t1-t0;
    println("Total time:", nfs(dt/1000.0, 0, 2) + "s");
    println("Average frame:", nfs( (float) dt/framesToSave, 0, 2) + "ms");

    // Unsaved last frame:
    background(0, 255, 0);  
    text("Done!", width/2, height/2);

    //exit(); // Your choice!
    noLoop();  // See last frame
    return;    // Goes directly to end of draw from here!
    }  
    
// These frames will be saved:
  
  println("Saved:", frameCount);  // May slow things down!
    
  if(frameCount > marker_10s)
    background(255, 0, 0);
  else
    background(255, 255, 0);
    
  text(frameCount-1, width/2, height/2);  // Adjusted so starts at 0
  
  saveFrame(dataPath("") + "\\" + "######.tga"); // Hyperdrive! tga is fast!
  //saveFrame(dataPath("") + "\\" + "######.png"); // png is slow! Needs to compress.
  }

This (it is in there) was used to delay audio and worked:

https://superuser.com/questions/982342/in-ffmpeg-how-to-delay-only-the-audio-of-a-mp4-video-without-converting-the-au

There are other tools for doing this!
You will have to explore this… my toolbox needs an update.

Have fun!

:).