# Movie Maker: Time gap between movie and its audio file

**URL:** <https://discourse.processing.org/t/movie-maker-time-gap-between-movie-and-its-audio-file/46748>\
**Category:** Beginners\
**Created:** [July 17, 2025, 9:54pm UTC](https://discourse.processing.org/t/movie-maker-time-gap-between-movie-and-its-audio-file/46748 "2025-07-17T21:54:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 19, 2025, 10:17pm UTC](https://discourse.processing.org/t/movie-maker-time-gap-between-movie-and-its-audio-file/46748/2 "2025-07-19T22:17:58Z")

</div>

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](https://discourse.processing.org/t/movie-maker-tool-issues/46767)_

Code to generate frames:

```auto
/**
 * 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](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!

`:)`.

---

_[View the full topic](https://discourse.processing.org/t/movie-maker-time-gap-between-movie-and-its-audio-file/46748)._
