SFX and Performance issues

Topics: User Forum
Aug 16, 2010 at 6:09 PM
Edited Aug 18, 2010 at 6:50 PM

I am working on a project which requires me to be able to apply sfx such as panning and zoom. I am currently able to achieve the "Ease In/Out" effects using similar to the following:

EffectDefinition easeIn = new EffectDefinition(new Guid("{B4DC8DD9-2CC1-4081-9B2B-20D7030234EF}"));
easeIn.Parameters.Add(new Parameter("InternalName", "Simple2D"));
easeIn.Parameters.Add(new Parameter("ScaleA", 1.15));
easeIn.Parameters.Add(new Parameter("ExponentialProgressDuration", 0.01));

I am unable to use the "Simple3D" class of effects however. Aka, the following does not work:

EffectDefinition panR = new EffectDefinition(new Guid("{B4DC8DD9-2CC1-4081-9B2B-20D7030234EF}"));
panR.Parameters.Add(new Parameter("InternalName", "Simple3D"));
panR.Parameters.Add(new Parameter("ScaleA", 1.15));
panR.Parameters.Add(new Parameter("InitialScaleA", 1.15));
panR.Parameters.Add(new Parameter("MoveA", "left"));
panR.Parameters.Add(new Parameter("MoveSpeedA", 0.4));

The video produced is greyscale with RGB lines overlaying. I did not know if this was specific to Splicer, or if it was one of the elements not quite gotten to in DirectShowLib. I can still pan images using managed code via GDI+, but it's not the most optimal of solutions.

The other thing I've noticed is that currently a slideshow video with no effects or transitions consumes nearly 95% of my CPU, whereas a video with those effects/transitions only consumes approximately 50-70% of my CPU. (Not a huge issue as the effects will almost always be there). However, one of the "requirements" of the project is to be able to produce approximately 10,000 20sec videos an hour. As things stand, I can render approximately 200-250 an hour. I just wondered if anyone had any performance tweaks to the rendering process that they might have made that they would like to share.

EDIT: Noticed what the slowdown was with the GDI+ panning, Track.AddImage(Image image) writes the image to a temporary file first. This was taking about 0.26 seconds on my desktop, which equated to about 20 seconds for approx. 80 frames.

Aug 19, 2010 at 9:01 PM
I have the same issue, and hoping for an answer. In my case both Simple2D and Simple3d do not work. All i get is some gray bevel style image. I used C# clone function to create a panning effect, but the output video of this is choppy. ( a pixel seems to be to big, in terms of the clone Rectangle function). I guess the question for me is How to add new Effects/Transitions to play well with the library?... vg.
Aug 20, 2010 at 5:16 PM
Edited Aug 20, 2010 at 5:17 PM

vgumiel, For smoother panning, use RectangleF instead of Rectangle. It also doesn't matter a whole lot in terms of speed if you use Graphics.DrawImage or Bitmap.Clone. (I currently use a Graphics object and pass it Floating point rectangles, it also allows me to use color matrices for transforms that way.) I believe that the WMM dll support is something in DirectShowLib from stepping through the code, so now looking at possibly using DShow directly in order to either a) get the WMM dlls working, or b) be able to add images frame by frame (not duration based) using the byte information from the Bitmap object.

Currently using an in-house solution for the rendering of videos, so the volume is no longer as big an issue.