Log in

View Full Version : ffdshow's libavcodec not compatible with avisynth?


tmpy222
22nd February 2005, 20:57
Hi,
Is ffdshow's dshow (not vfw) libavcodec not compatible with avisynth's directshowsource()?
When playing or encoding a avs file which only has directshowsource("clip.avi"), it goes out of sync if I use ffdshow's dshow libavcodec. If I disable dshow libavcodec and enable vfw libavcodec, every syncs.
Another way to make it sync is to install Xvid 1.x codec and choose Xvid in ffdshow's dshow configuration. In another word, not using dshow libavcodec would make avs file sync.
Is this a known problem?

Thanks.

bond
23rd February 2005, 11:13
make sure you define framerate of the input when using directshowsource:
directshowsource("input.file", fps=25)

tmpy222
23rd February 2005, 11:58
Hi,
Thanks for the reply. Yes, I tried the fps=23.976 setting. It still goes out of sync after playing the clip for a while. I just downloaded the lastest and the greatest ffdshow-20050222-sse.exe. Same problem.
It does play the clip.avi just fine in media player. It only has problem when going through avs file and using libavcodec...

BTW, I'm using YUY2 colorspace in output. Encoder doesn't take YV12.

Thanks.

Irwin
23rd February 2005, 12:48
I wrote about this big problem (with sample scripts, images and small movie) to milan many weeks ago (Nov 2004). No results, and no any response.

If you turn off libavcodec and turn on xvid1 (in ffdshow, codecs section) - everything is OK.

But no option for Div3 movies and also libavcodec is faster.

tmpy222
23rd February 2005, 13:32
Exactly.
Turning off libavcodec and turning on xvid seems to solve the async problem. Maybe libavcodec.dll isn't as compatible as xvid.dll. And people have to install xvid codec for encoding to work.
Anyway, thanks for the reply. I thought I was doing something wrong.
Now I can wait for the fix... :)

Irwin
24th February 2005, 10:34
Originally posted by tmpy222

Now I can wait for the fix...

I don't think so. I wrote to ffdshow developers in november 2004 - and nothing. Maybe they don't understand (my english is terrible) or don't belive me.

Maybe i here describe what's going wrong in ffdshow-libavcodec directshow. Maybe someone from doom9 members resolve this problem.

------------------------------------------------------------
I may presents:

"Innocent Frames and FFdshow-libavcodec Monster from the Outer Space"

Actors:
- FFdshow with libavcodec
- Sample movie (xvid 640x480) lenght in frames = 1000
- Encoding in directshow to xvid 320x240

Light off. silence.


Begin
Orginal movie frame counter: 1 : 2 : 3 : 4 : 5 : 6 : 7 : .... 90 : 91 :....
Encoded movie frame counter: 1 : 2 : 3 : 4 : 5 : 6 : 7 : .... 90 : 91 :....

Example frame number 5 in Encoded movie is a frame number 5 in orginal movie (Example talking head)



Begin (some amazing action here)
Orginal movie frame counter: 98 : 99 : 100 : 101 : 102 : 103 ....
Encoded movie frame counter: 98 : 99 : 176 : 177 : 178 : 179 ....
-!-
Frame number 100 in encoded movie is a 175 from orginal - it means: When in orginal movie you see talking heads, in encoded: another scene with for example: cars in action.
Frames 100-175 from orginal -> ffdshow eats! (about 3 seconds movie) bon appétit!. Results - Audio desync - because ffdshow eat only a video frames (he don't like audio stream ;-)



Middle (suspense going on)
Orginal movie frame counter: 728 : 729 : 730 : 731 : 732 : 733 ....
Encoded movie frame counter: 804 : 805 : 860 : 861 : 862 : 863 ....
-!-
Frame number 730 in encoded movie is a 860 from orginal - we got another (second in this sample movie) eating here. This time 55 frames disapears from this universe.



End (Hidden truth)
Orginal movie frame counter: 868 : 869 : 870 : 871 : 872 : 873 : ... 999 : 1000: END
Encoded movie frame counter: 998 : 999 : 1000 : 1000 : 1000 : 1000 : ...1000 : 1000: END
-!-
Frame number 870 in encoded movie is a 1000, last from orginal. Because in orginal movie no frames left - ffdshow try to hide yours hungry instincts - from now -> to the end of movie - repeat encoding only a one frame (1000).



----
How much ffdshow eats from typical 2h movie? - it depends - sometimes eat from 15-20 places, sometimes from 3-4. Average from one eat is 50-80 frames. 15x50 = 750 frames.

When ffdshow works with libavcodec in directshow always eats frames? NO! - In 50-70% movies he don't eat any single frame. Why? i don't know.

What frames he prefers? - slow motion, fade in or out. He esspecially likes black 2-3 second fade in. But when he really hungry eats even fast high motion scenes.

----

This is very weird bug - because audio desync is no repairable.

Why i use ffdshow to directshow encoding?
Because is very fast (fast processing mode in Vdub) and very best (in quality, resize filter - spline) method to reencoding movies for example to pocketpc with subtitles, swscaler sharpen, postprocessing etc.

tmpy222
24th February 2005, 12:04
Yes, dshow libavcodec seems to drop frames. It happened on 3 out of 3 movies I tried...
Can this be cause by slow system? I only have a slow P3... But VFW libavcodec doesn't drop frames and doesn't go out of sync when NOT using YUY2 or YV12 colorspace. It seems that it only works with RGB colorspace which is slow... Also it's too bad that VFW's filters don't work at all. So I can't use it.
Selecting Xvid in ffdshow would make everything work. YUY2 also works with Xvid and it's fast. So I guess something is really wrong with dshow part of libavcodec in ffdshow...

BTW, the reason I use ffdshow to frameserve is also its speed. Very fast compared to avisynth or Vdub. I get 40%-90% increase in speed! If libavcodec worked, it would have been faster. I can get almost real time encoding on a low end P3. :)

methos
21st April 2006, 11:23
it's a shame this problem still isn't solved... if it was ffdshow would really be the only thing you need to view and recode stuff.. and the recoding of Xvid media would go a little faster.

Mug Funky
21st April 2006, 14:10
you could always do audio and video separately...

or use vfw ffdshow for xvid stuff.

methos
23rd April 2006, 10:30
i do encode them seperately and even decode the audio fully to an uncompressed audio stream.. that isn't the issue here.. for some reason as mentioned above the liba xvid dshow codec just causes a desync when put through an avisynth script. And it would be great if anybody was able to fix that.