# AviSynth - trim videos with different framerates

1. I have 2 videos, with different framerates and different length.
Video 1 is approximately 12 seconds long, 30 fps
Video 1 is approximately 7 seconds long, 29.97 fps
I say approximately because that's the approximate length I get from video player, real length could be something like 12.2 seconds.
I need to trim the longer video to match EXACTLY the shorter video.
I need AviSynth to do this, using the exact clip properties.
I know about FrameCount , FrameRate ,FrameRateNumerator , FrameRateDenominator - I just don't know how to use them to match the lengths.
Thank you.

PS: funny enough, AviSynth can open and StackVertical 2 videos with different framerates, no complaints there!!!
2. Yes, stacking in AviSynth works frame-by-frame, regardless of the frame rates.

You can't match the short clips exactly by time*. But the clips are so short it doesn't matter. Just apply AssumeFPS(30000, 1001) to the 30 fps clip and match frame by frame.

* Say your 29.97 fps clip is 210 frames long. It has an exact duration of 7.007 seconds (210 * 1001 / 30000). A 30 fps clip cannot have that length. It will have to be 210 frames long, exactly 7.0000 seconds (210 * 1000 / 30000) or 211 frames, 7.0333 seconds (211 * 1000 / 30000).
3. This example was using Stack and similar framerates.
But I may need this for other scripts, longer videos / much different framerates (25 & 30, for example).
I was testing something using: v001.framecount/v001.framerate
OR ConvertFPS - convert all to same framerate (usually the lowest one), then Trim using the above formula for length in seconds OR using same number of frames (since they all have same framerate)
But then I got sidetracked by a new project, I'll get back to that one as soon as possible.
4. ConvertFPS() will produce blended frames. That will look very bad with a change from 29.97 to 30.00 fps (or vice versa). ChangeFPS() will duplicate or decimate frames to mach durations. AssumeFPS() just assumes the specified frame rate. It neither adds nor removes frames, just changes the duration of each frame (and hence the overall running time).

Note that I added some information to post #2.
5. Yes, I know about all the FPS commands.
I have used ConvertFPS and it's OK, the video was very slow, doesn't look bad.

7.007 vs 7.000 is perfectly fine.