Re: to slow frame capturing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




Michael Nielsen wrote:

Jacek Dylak wrote:

    I use simple AverMedia card with BT878 chip.

    I need to capture frame by frame and process each. I try to do this
    with the
    following code, but I get only 12 frames per second. I need at least
    20 fps,
    but I don't what is wrong with my code, or what needs to be change,
    to get
    frames more frequently.

    Is it a matter of coding or the chipset?

    I would be very thankful if somebody could help me.
    Jacek

    ///////////////////
    //capture code

    dev.Open("/dev/video0");

    //get memory buffer size
    dev.GetMemoryBuffer(&stMemBuf);

    //map memory for frame buffer
    szFrame = (char*)
    mmap(0,stMemBuf.size,PROT_READ|PROT_WRITE,MAP_SHARED,dev,0);

    //set channel to COMPOSITE and mode to PAL
    dev.SetSource(1,VIDEO_MODE_PAL);

    //set capture image size and pixel format
    stMemMap.width = IMAGE_WIDTH;
    stMemMap.height = IMAGE_HEIGHT;
    stMemMap.format = VIDEO_PALETTE_GREY;

    //capture frame 0
    stMemMap.frame = nFrame;
    ioctl(dev,VIDIOCMCAPTURE,&stMemMap);

    while (m_bProcessing)
    {
      stMemMap.frame = nFrame;
      ioctl(dev,VIDIOCSYNC,&stMemMap.frame);

      stMemMap.frame = 1 - nFrame;
      ioctl(dev,VIDIOCMCAPTURE,&stMemMap);

      ProcessFrame(..); //actually do nothing, simply count up frames

      nFrame = 1 - nFrame;
    }

    _______________________________________________
    Video4linux-list mailing list
    Video4linux-list@xxxxxxxxxx

    https://listman.redhat.com/mailman/listinfo/video4linux-list


I'm using a WinTV grabber (BT878 I think), and I acheive about 25 fps on
a 800Mhz Linux box, with a cpu loading of 0.1 % (just capture no processing).
This is the max for a PAL device.

Incidentally indicating the types of the variables you have makes it a little easier to understand
code fragments.

I found that the maximum speed comes from capturing to the current buffer, and THEN synchronisi ng the last capture, synchronising your last capture first, and then capturing, seems to cause
the system to operate at about 50% speed.  I'm not sure why.

If you have further questions, drop me an email. (mike@xxxxxxxxx)

regards
    mike.

--
#include -----------------------------------------------------------------------
                 (Ingeniør) Michael Nielsen BE(Hons)
-----------------------------------------------------------------------
           At arbejede er godt, så længe man husker at leve!
           (To work is good as long as we remember to live!)


I have had the same problem and I have solved it. Take a look at xawtv/FAQ first. In this document a algorithem have been made, and it works. The problem with your code is that the capture is not folded, but continues (that the reason for the 50%).

If you want a full source off my own program send a mail to agn@xxxxxxxx :-)

Anders Gnistrup







[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux