Changing Framerate
Some video applications require video with a specific framerate. If your clip has a different framerate than what you need you can use AviSynth filters to accomplish it. These filters are particularly useful for converting PAL video to NTSC or vice versa.
ConvertFPS
ConvertFPS(clip Clip, clip Clip2, float new_rate, int numerator, int denominator,
string preset name for ratio, int "zone", int "vbi")
Argument | Type | Default | Req | Description |
Clip | Cliplast | Clip to adjust the framerate | ||
Clip2 | Clip | Clip with desired target framerate | ||
new_rate | Floating Point Decimal | New framerate | ||
numerator | Positive Integer | Numerator for framerate ratio | ||
denominator | Positive Integer | Denominator for framerate ratio | ||
preset name for ratio | String | Preset name for ratio | ||
"zone" | Positive Integer | Line to start blending in Switch Mode | ||
"vbi" | Integer | Vertical Blanking Interval for Switch Mode |
ConvertFPS changes the framerate of your clip by adding or removing frames as necessary. Playback speed is unaffected so audio isn't changed at all, and audio sync shouldn't be altered at all.
New frames are created by blending two adjacent existing frames together. ConvertFPS doesn't take interlacing into account. If your video clip is interlaced you'll need to deinterlace before increasing the framerate using this filter.
Clip2
Rather than setting the framerate manually, you may prefer to have AviSynth look at an existing clip instead. Specifying Clip2 will do just that.
new_rate
Use this argument to specify the framerate as the number of frames per second (fps) in decimal form. Standard framerates include 25 (PAL), 29.97 (NTSC), and 23.976 (NTSC film). Other framerates may also be used.
numerator
framerates are normally written as decimals, such as 29.97fps or 23.976fps, the standards actually call for ratios, like 30000/1001 (29.97) or 24000/1001 (23.976). While they may be indistuingishable from each other to the human eye, these slight differences can cause other software which expects the correct ratio to have problems. When dealing with NTSC video it's almost always best to use the ratios instead of the nearly equivalent decimals. This argument represents the numerator in the ratio (30000 for NTSC or 24000 for NTSC film).
denominator
This is the denominator in a ratio-based framerate. For NTSC or NTSC film it should be 1001. See Numerator (directly above) for more information.
preset name for ratio
Rather than explicitly setting a ratio for your target framerate, you can use a preset that describes it instead. ConvertFPS recognizes the following presets.
numerator | denominator | |
"ntsc_film" | 24000 | 1001 |
"ntsc_video" | 30000 | 1001 |
"ntsc_double" | 60000 | 1001 |
"ntsc_quad" | 120000 | 1001 |
"ntsc_round_film" | 2997 | 125 |
"ntsc_round_video" | 2997 | 100 |
"ntsc_round_double" | 2997 | 50 |
"ntsc_round_quad" | 2997 | 25 |
"film" | 24 | 1 |
"pal_film" | 25 | 1 |
"pal_video" | 25 | 1 |
"pal_double" | 50 | 1 |
"pal_quad" | 100 | 1 |
zone
This argument turns on Switch Mode. Instead of blending entire frames, in Switch Mode ConvertFPS will display the top of the first frame, with the middle blended into the second frame, followed by the bottom of the second frame. Zone must be set to a number greater than 0 and less than the horizontal resolution of your video clip.
"vbi"
When you specify the Zone argument you should also set vbi equal to either 49 (for PAL output) or 45 (NTSC output). Vbi is ignored if zone isn't given.
Example Code
Convert interlaced video from PAL to NTSC framerate:AviSource("SourceClip.avi")
Bob().ConvertFPS("ntsc_double")
SeparateFields().SelectEvery(4,0,3)
Convert NTSC film (23.976fps) video to PAL (25fps) framerate:
Mpeg2Source("SourceClip.d2v")
ConvertFPS(25)
When To Use It
When you want to convert from to a different framerate without adjusting the audio and don't mind blended frames.changefps
ChangeFPS (clip, float fps, bool "linear")
ChangeFPS (clip, int numerator [, int denominator], bool "linear")
ChangeFPS (clip1, clip2, bool "linear")
ChangeFPS (clip, string preset, bool "linear")
Argument | Type | Default | Req | Description |
Clip | Cliplast | Clip to adjust the framerate | ||
Clip2 | Clip | Clip with desired target framerate | ||
fps | Floating Point Decimal | New framerate | ||
numerator | Positive Integer | Numerator for framerate ratio | ||
denominator | Positive Integer | Denominator for framerate ratio | ||
preset name for ratio | String | Preset name for ratio | ||
"linear" | Boolean | true | Request frames in display order |
ChangeFPS changes the framerate of your clip by adding or removing frames as necessary. New frames are duplicates of existing frames in the video. Playback speed is unaffected so audio isn't changed at all, and audio sync shouldn't be altered at all.
Clip2
Rather than setting the framerate manually, you may prefer to have AviSynth look at an existing clip instead. Specifying Clip2 will do just that.
fps
Use this argument to specify the framerate as the number of frames per second (fps) in decimal form. Standard framerates include 25 (PAL), 29.97 (NTSC), and 23.976 (NTSC film). Other framerates may also be used.
numerator
framerates are normally written as decimals, such as 29.97fps or 23.976fps, the standards actually call for ratios, like 30000/1001 (29.97) or 24000/1001 (23.976). While they may be indistuingishable from each other to the human eye, these slight differences can cause other software which expects the correct ratio to have problems. When dealing with NTSC video it's almost always best to use the ratios instead of the nearly equivalent decimals. This argument represents the numerator in the ratio (30000 for NTSC or 24000 for NTSC film).
denominator
This is the denominator in a ratio-based framerate. For NTSC or NTSC film it should be 1001. See Numerator (directly above) for more information.
preset name for ratio
Rather than explicitly setting a ratio for your target framerate, you can use a preset that describes it instead. ChangeFPS recognizes the following presets.
numerator | denominator | |
"ntsc_film" | 24000 | 1001 |
"ntsc_video" | 30000 | 1001 |
"ntsc_double" | 60000 | 1001 |
"ntsc_quad" | 120000 | 1001 |
"ntsc_round_film" | 2997 | 125 |
"ntsc_round_video" | 2997 | 100 |
"ntsc_round_double" | 2997 | 50 |
"ntsc_round_quad" | 2997 | 25 |
"film" | 24 | 1 |
"pal_film" | 25 | 1 |
"pal_video" | 25 | 1 |
"pal_double" | 50 | 1 |
"pal_quad" | 100 | 1 |
Example Code
Convert interlaced video from PAL to NTSC framerate:AviSource("SourceClip.avi")
Bob().ChangeFPS(preset="ntsc_double")
SeparateFields().SelectEvery(4,0,3)
Convert NTSC film (23.976fps) video to PAL (25fps) framerate:
Mpeg2Source("SourceClip.d2v")
ChangeFPS(25)
When To Use It
When you want to convert from to a different framerate without adjusting the audio and don't want blended frames.AssumeFPS
AssumeFPS(clip Clip, clip Clip2, float fps, int numerator, int denominator,
string preset, bool "sync_audio")
Argument | Type | Default | Req | Description |
Clip | Cliplast | Clip to speed up or slow down | ||
Clip2 | Clip | Clip with desired target framerate | ||
fps | Floating Point Decimal | New framerate | ||
numerator | Integer | Numerator for framerate ratio | ||
denominator | Integer | Denominator for framerate ratio | ||
preset | String | Standard framerate preset | ||
"sync_audio" | Boolean | Keep audio in sync |
AssumeFPS changes the framerate of a video clip without adding or removing frames. It simply sets them to play at a different speed. It can also stretch or compress the audio to keep it in sync with the video, although this involves decoding and resampling, which is a lossy process.
Clip2
Rather than setting the framerate manually, you may prefer to have AviSynth look at an existing clip instead. Specifying Clip2 will do just that.
fps
Use this argument to specify the framerate as the number of frames per second (fps) in decimal form. Standard framerates include 25 (PAL), 29.97 (NTSC), and 23.976 (NTSC film). Other framerates may also be used.
numerator
Framerates are normally written as decimals, such as 29.97fps or 23.976fps, the standards actually call for ratios, like 30000/1001 (29.97) or 24000/1001 (23.976). While they may be indistuingishable from each other to the human eye, these slight differences can cause other software which expects the correct ratio to have problems. When dealing with NTSC video it's almost always best to use the ratios instead of the nearly equivalent decimals. This argument represents the numerator in the ratio (30000 for NTSC or 24000 for NTSC film).
denominator
This is the denominator in a ratio-based framerate. For NTSC or NTSC film it should be 1001. See Numerator (directly above) for more information.
preset
Rather than explicitly setting a ratio for your target framerate, you can use a preset that describes it instead. ConvertFPS recognizes the following presets.
numerator | denominator | |
"ntsc_film" | 24000 | 1001 |
"ntsc_video" | 30000 | 1001 |
"ntsc_double" | 60000 | 1001 |
"ntsc_quad" | 120000 | 1001 |
"ntsc_round_film" | 2997 | 125 |
"ntsc_round_video" | 2997 | 100 |
"ntsc_round_double" | 2997 | 50 |
"ntsc_round_quad" | 2997 | 25 |
"film" | 24 | 1 |
"pal_film" | 25 | 1 |
"pal_video" | 25 | 1 |
"pal_double" | 50 | 1 |
"pal_quad" | 100 | 1 |
sync_audio
Setting this to True will keep the audio in sync by resampling it. When you're done you'll usually need to resample the audio to return it to its original samplerate. You can do this with the SSRC filter.
Example Code
Speed up an AVI encoded from DVD from NTSC filme framerate (23.976fps) to PAL framerate:AviSource("NTSC_film_Source.avi")
AssumeFPS(25, audio_sync=true).SSRC(48000)
Turn NTSC video into slow motion footage:
Mpeg2Source("NTSC_Source.d2v")
AssumeFPS("NTSC_Double")
When To Use It
AssumeFPS is most useful for Changing NTSC film sources to PAL or progressive PAL to NTSC film framerate. It's capability for keeping audio sync is generally only good for two channel audio.
Written by: Rich Fiscus