PDA

View Full Version : Changing video format in live mode



Arjan
September 6, 2004, 15:25:19
I'm using a DFG/SV1 framegrabber and want to size the video according to the view size, so the video fits in the view's client area.
However, zooming the video causes a very high CPU load and I need at least a frame rate of 10 f/s.

To avoid this CPU load I decide not to use zooming and use the several standard video formats only.
In the OnSize of the view I check which video format fits best en switch format when needed.
But the Grabber's setVideoFormat function doesn't work in live video mode and I have to call stopLive, then change format, using setVideoFormat, and call startLive to start live video again.
Stopping and starting the live video again takes quite a long time and is not very conveniant when sizing the view.

Is there a faster way to change video format in live mode?

Stefan Geissler
September 6, 2004, 15:43:41
Hello,

The video format can not be changed in the live mode, because all DirectShow filters used in the filter graph must support the new video format and allocate memory. This is not possible. There is no faster way than calling start- and stoplive.

How did you zoom the live video? It should be possible to set Grabber::setDefaultWindowPosition to false and set window size to the size of your screen. Normally in a 1024 * 768 resolution this should run with 25 fps.

Arjan
September 6, 2004, 16:14:00
Originally posted by Stefan Geissler
Hello,

The video format can not be changed in the live mode, because all DirectShow filters used in the filter graph must support the new video format and allocate memory. This is not possible. There is no faster way than calling start- and stoplive.

How did you zoom the live video? It should be possible to set Grabber::setDefaultWindowPosition to false and set window size to the size of your screen. Normally in a 1024 * 768 resolution this should run with 25 fps.

I tested it using the Scroll & Zoom sample using a 2GHz pc with 512MB memory and 1024*768 screen resolution. Zooming in at 130% the CPU load was about 90% and definitely not with 25fps.

Stefan Geissler
September 7, 2004, 07:51:14
Hello,


i tried following code:


Grabber *grabber=new Grabber();

grabber->showDevicePage();

if( grabber->isDevValid())
{
grabber->setDefaultWindowPosition(false);
grabber->setWindowSize(1024,768);
grabber->startLive();
getch();
grabber->stopLive();
}


On my computer AMD 1600+, 512 MB Ram, Matrox G500 graphicsboard this runs with 15 fps at RGB24 and faster with Y800 video format.

Arjan
September 7, 2004, 08:26:21
And how about the CPU load?
But finally I want to make use of two DFG/SV1 framegrabbers in the same pc to show two different videos in two windows. That will be too much for the CPU when sizing the video freely with setWindowSize. So I planned to use the standard formats (they don't cause a high CPU load) only and select the format that fits best when the mouse button is released after sizing the view.

Stefan Geissler
September 7, 2004, 09:44:16
Hello,

The CPU load is 50% at RGB 32 video format on my computer.