Log in

View Full Version : How to change frame rates using Avisynth with audio in sync?


rs008f
20th December 2003, 04:56
I have some Divx/Xvid files with unusual frame rates such as 19.2 fps, 24.3 fps, 30 fps. I need to convert them to NTSC compatible frame rates such as 23.976 fps or 29.97 fps while keeping the audio in sync. How can I do this with Avisynth? What are the command lines? I'm gonna use the scripts with CCE to convert to MPEG-2.

ThunderGatti
21st December 2003, 01:21
I believe "changefps" does this... although it might be "convertfps". I haven't used them in a while, but I know one of them will do what you want.

Just load the avs into Vdub and play it to see which one works best for you.

cweb
21st December 2003, 12:04
With 23.976fps to 25 I just use assumefps() and speed up the audio using Besweet's built in preset.

With the other rates I use convertfps() and leave the audio alone (because it sounds like chipmunks otherwise..).

Leak
21st December 2003, 15:42
Originally posted by cweb
With 23.976fps to 25 I just use assumefps() and speed up the audio using Besweet's built in preset.

With the other rates I use convertfps() and leave the audio alone (because it sounds like chipmunks otherwise..).

I don't know Besweet, but if changing the framerate too much causes chipmunkiness it'd probably be a good idea to use SoundTouch/SoundStretch instead, even if you're just going from 23.976 to 25 fps, as it'll do a timestretch without changing the pitch (and without leaving noticeable artefacts, at least if you're not changing it too much).

http://sky.prohosting.com/oparviai/soundtouch/

On the same page you can also find a WinAmp plugin called pacemaker, which allows you to try out different settings on an audio file in realtime.

np: Kid606 - Total Recovery Is Possible (Kill Sound Before Sound Kills You)

scharfis_brain
21st December 2003, 15:49
the speedup from 23.976 to 25 fps will give
the chipmunkyness-effect, but this won't be noticable.
It is only a pitch of one half-tone.

cypher_soundz
23rd December 2003, 03:12
Hi,
I am also trying to convert a clip (from 25fps to 15fps) in order to be played on a pda. could someone tell me how to convert the audio of a clip as besweet will make the audio sound strange. Whats the difference between assumefps() and convertfps()?
Regards
cyph

celtic_druid
23rd December 2003, 06:24
Originally posted by cypher_soundz
Whats the difference between assumefps() and convertfps()?

AssumeFPS
AssumeFPS(clip, float fps, bool "sync_audio")
AssumeFPS(clip, int numerator[, int denominator], bool "sync_audio")

The AssumeFPS filter changes the frame rate without changing the frame count (causing the video to play faster or slower). It only sets the framerate-parameter
If sync_audio is true, it also changes the audio sample rate to match the duration of the video, the pitch of the resulting audio gets shifted.

This is also a method to change only the sample rate of the audio alone.

ConvertFPS [yuy2]
ConvertFPS(clip, float new_rate, int "zone", int "vbi")

[not ready for 2.5 yet]

ConvertFPS() is a video filter for Avisynth. It is available as of Avisynth 1.0beta7.

The filter attempts to convert the frame rate of clip to new_rate without dropping or inserting frames, providing a smooth conversion with results similar to those of standalone converter boxes. The output will have (almost) the same duration as clip, but the number of frames will change proportional to the ratio of target and source frame rates.

The filter has two operating modes. If the optional argument zone is not present, it will blend adjacent video frames, weighted by a blend factor proportional to the frames' relative timing ("Blend Mode"). If zone is present, it will switch from one video frame to the next ("Switch Mode") whenever a new source frame begins, that is, usually somewhere in the middle of a target frame. Switch Mode assumes that the output will be shown on a TV where each frame is scanned from top to bottom. The parameter zone specifies the height of the transition region in which the current frame will be blended into the next.

Blend Mode will cause visible, although slight, blurring of motion. This is a typical artifact of frame rate conversion and can be seen on commercial video tapes and TV programs as well. When working with interlaced video, it is important to let the filter operate on individual fields, not on the interlaced frames. (See Examples below.)

Switch Mode is an attempt to avoid motion blurring, but comes at the expense of slight flicker and motion artifacts. Horizontal and vertical pans may show a slight wobble. Still frames from this conversion show "broken" or "bent" vertical lines in moving scenes. Scene transitions may occur in the middle of a frame. Nevertheless, the results do look less blurry than in "Blend Mode".

Neither mode is perfect. Which one to choose depends on personal preference and on the footage to be converted. Switch Mode is probably only suitable if the output will be shown on a TV, not on a computer screen.

Frame rate conversion is inherently difficult. This filter implements two common methods used by commercial Prosumer-level converter systems. The results are typically quite good. More sophisticated systems employ motion interpolation algorithms, which are difficult to get right, but, if done right, do yield superior results.

Footage converted with this filter should not be converted again. Blurriness builds up quickly in subsequent generations.

The audio data are not touched by this filter. Audio will remain synchronized, although the length of the audio data may slightly differ from that of the video data after the conversion. This is because the output can only contain an integer number of frames. This effect will be more pronounced for shorter clips. The difference in length should be ignored.

Parameters:

new_rate Target frame rate. Can be integer or floating point number. In Blend Mode, new_rate must be at least 2/3 (66.7%) of the source frame rate, or an error will occur. This is to prevent frame skipping. If you need to slow down the frame rate more than that, use Switch Mode.
zone (Optional) If specified, puts the filter into Switch Mode. Integer number greater or equal to zero. If zero, the filter will perform a hard switch, that is, it will immediately display the next frame below the switch line. If greater than zero, specifies the height (in lines) of the transition zone, where one frame is gradually blended into the next. zone=80 yields good results for full-size video (480/576 active lines). The transition is done in the same way as in PeculiarBlend(). zone must be less or equal than the number of lines of the target frame that correspond to the duration of the source frame. This is typically 5/6 or 6/5 of the target frame height, that is, a few hundred lines. An error occurs if a larger value is chosen.
vbi (Optional) In Switch Mode, specifies that the filter should apply a timing correction for the vertical blanking interval (VBI). Integer number greater than zero, indicating the height of the VBI of the target frames, in lines. Typically vbi=49 for PAL and vbi=45 for NTSC, but these values are not critical. Ignored in Blend Mode.

How about next time you look at the docs yourself?

cypher_soundz
24th December 2003, 01:23
thanks , if you have a problem with answering the question then don't answer it ;) i was unclear what the diference between the two types were and was asking for some clarification.
i was not being lazy :sly:

Jeroi
6th December 2010, 21:07
video1 = directshowsource("clip1", fps=29.760, covertfps=true)
video2 = directshowsource("clip2", fps=29.760, covertfps=true)

video1+video2