Log in

View Full Version : Avisynth and Incorrect frame rate


belonesox
24th May 2010, 07:32
I frequently encounter situations, when avisynth in VirtualDub preview showed all OK, but on saving video it doubles frame rate!

Please, consider small sample (example archive attached, ≈200Kb):

clock.avi AVI file, 32496 frames, 57:30.90, record for system clock, from 16:32 to 17:30
clock.avs Dummy AVISYNTH script ( DirectShowSource("clock.avi") )


If we open clock.avs in VirtualDub, and jump to frame at time 10:00, we see 16:42.

If we save the video (by VirtualDub, version of VD and choosen codec does not matter) open saved video and jump to frame at time 10:00, we see 16:53.

Avisynth version 2.5.8.

What is going on? Is it bug or some feature?

Thanks in advace,
Sincerely Stas Fomin
http://lib.custis.ru/Avisynth_and_Incorrect_frame_rate

Alex_ander
24th May 2010, 08:20
Use actual framerate value as DirectShowSource parameter ('fps=...') + 'convertfps=true'. However, DirectShowSource() has very limited control over default DS filter it uses from your system. For example it can't always turn off forced deinterlacing coming from playback configuration of that filter. Therefore it is usually better to use AviSource() for avi's rather than DirectShowSource().
Sorry, I can't test your sample at the moment.

tebasuna51
24th May 2010, 13:05
I can't reproduce your problem:

- open clock.avs in VirtualDub, jump to frame at time 10:00, we see 16:42. 'File Information' -> fps = 9.417
- open clock.avi in VirtualDub, jump to frame at time 10:00, we see 16:42. 'File Information' -> fps = 9.417

After encode clock.avs with Xvid to clock2.avi, and clock.avi to clock3.avi
- open clock2.avi in VirtualDub, jump to frame at time 10:00, we see 16:42. 'File Information' -> fps = 9.417
- open clock3.avi in VirtualDub, jump to frame at time 10:00, we see 16:42. 'File Information' -> fps = 9.417

Maybe your DirectShow system (if you encode clock.avs) or vfw decoders (if you encode clock.avi) don't work fine.
BTW, your clock.avi have H264 video in avi container and isn't fully compliant.

belonesox
24th May 2010, 21:15
Use actual framerate value as DirectShowSource parameter ('fps=...') + 'convertfps=true'.

My input videos are screencasts that automatically processed by ffmpeg/avisynth, so screencast fps is not known before and I am little lazy to find it out and generate custom avisynth script.


Therefore it is usually better to use AviSource() for avi's rather than DirectShowSource().

Thank you very much! It works for me!
(Why I miss this obvious workaround?…)


Maybe your DirectShow system (if you encode clock.avs) or vfw decoders (if you encode clock.avi) don't work fine.

May be…
I see this bug on 3 PC, but all have identical codecs pack.
Can you give me advice how can I debug it?



BTW, your clock.avi have H264 video in avi container and isn't fully compliant.

Yes, it generated by ffmpeg. And ffmpeg complaints about «Seems stream 0 codec frame rate differs from container frame rate», and I do not know how to fix it.
I just try stupid and greedy heuristic with two repacking of ffmpeg with libx264/ultrafast_lossless preset. It seems it helps, but I am not sure.

um3k
24th May 2010, 22:09
I wouldn't call AviSource a workaround. DirectShowSource, on the other hand, I would call a last resort when all else fails. It's just too darn unpredictable...