View Full Version : Problem encoding VFR streams
KG6ZVP
16th December 2008, 19:33
I really need help. I have been developing software utilizing AVIsynth in conjunction with X264 to encode videos for the PSP. I recently discovered the FFMpegsource("") plugin which allowed direct input of basically any file type without the codecs needing to be installed first. I recently tested it on a variable framerate x264 clip. The results proved disastrous. The actual video framerate was 23.981fps and avisynth read it as 23.692XXXfps. Needless to say, the audio was very, very, very far out of sync in a 20 second clip. Since I am encoding to .mp4 from avisynth, is there anyway for me to allow my input to be passed as vfr? or..
Is there a filter that decides video framerate based on audio sync (like VirtualDub Mod)?
Any help would be appreciated.
KG6ZVP
16th December 2008, 20:01
Sorry to post right back after having just posted, but this is a separate question. Being that I am automatically generating avisynth scripts (all this means is that a file name and path is added to an existing template), I need a way for it to read the DAR and/or SAR and/or PAR of an input file so that the generated aspect ratio is correct. So that you know what I am talking about, here is a generated script:
#AVIsynth script
LoadPlugin("FFmpegSource")
LoadPlugin("Autocrop.dll")
Input_Clip = FFmpegSource("C:\Users\Jim\Documents\Downloads\Timeline[2003]DvDrip[Eng]-aXXo.avi", vtrack=-1, atrack=-1).autocrop(mode=0)
# Get input width and height
i_width = Input_Clip.Width
i_height = Input_Clip.Height
d_a_r = float(i_width) / float(i_height)
#Calculate new video size with width and height divisible by 4, as well as being a maximum size of 480x272 while maintaining aspect ratio.
p_o_height = (d_a_r < 1.7647058823529411764705882352941) ? 272 : 480/float(d_a_r)
p_o_width = (d_a_r < 1.7647058823529411764705882352941) ? 272*d_a_R : 480
p2_o_width = Round(p_o_width/4)*4
p2_o_height = Round(p_o_height/4)*4
o_width = Round(float(p2_o_width))
o_height = Round(float(p2_o_height))
#Get input framerate and round to 3rd decimal place (for PSP compatibility)
first = Input_Clip.Framerate*1000
second = Round(Float(first))
FPS_oi = int(second)
#If framerate numerator is greater than 30000 (30fps, then set it to 29.97fps)
FPS = (FPS_oi > 30000) ? 29970 : FPS_oi
#Change output framerate, resize while maintaining aspect ratio and convert to YV12 to use with X264.exe
Output = Input_Clip.changefps(int(FPS), 1000).LanczosResize(o_width,o_height).converttoyv12()
#Play the clip
Return Output
I AM REALLY A NOOB AT THIS, so any help would be appreciated.
73,
KG6ZVP
Wilbert
16th December 2008, 21:29
Input_Clip = FFmpegSource("C:\Users\Jim\Documents\Downloads\Timeline[2003]DvDrip[Eng]-aXXo.avi", vtrack=-1, atrack=-1).autocrop(mode=0)
Sorry we can't help you. Please read the forum rules (especially rule 6).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.