saving avi file
Posted: 19 March 2010 08:14 AM   [ Ignore ]
New Member
Rank
Total Posts:  5
Joined  2010-02-02

hello, I’ve succesfully integrated in my software (winform in c#) necessary code for capture two pseye camera; after that i’d like to save pseye stream to an avi file. I’ve tryed some solutions like saving bitmap frame and create avi file, but they don’t seem to work with high performance.
someone have some ideas to solve that???

thank you

Profile
 
 
Posted: 19 March 2010 03:58 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  585
Joined  2009-09-17

What is the frame rate you are running? Also are you trying to save both camera streams at the same time?
Are you saving color video?

Profile
 
 
Posted: 19 March 2010 11:05 PM   [ Ignore ]   [ # 2 ]
New Member
Rank
Total Posts:  5
Joined  2010-02-02

well, yes both camera streams is required, color is not important, and about framerate the highest is better (min 75 fps).
of course i’ve tryed to set 320x240 color mode at 187 fps and my pc run at 99% so it’s quite impossible to add another task for capture streams at max fps.

another problem caome yesterday, I can’t change resolution, color and framerate before start capture, the idea is simple, I choose resolution, color mode and fps and start capture. I’ve tryed camera1.device.resolution\framerate\colormode with appropriate var but they don’t work . :(

Profile
 
 
Posted: 20 March 2010 12:54 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  585
Joined  2009-09-17
serapheye - 19 March 2010 11:05 PM

well, yes both camera streams is required, color is not important, and about framerate the highest is better (min 75 fps).
of course i’ve tryed to set 320x240 color mode at 187 fps and my pc run at 99% so it’s quite impossible to add another task for capture streams at max fps.

another problem caome yesterday, I can’t change resolution, color and framerate before start capture, the idea is simple, I choose resolution, color mode and fps and start capture. I’ve tryed camera1.device.resolution\framerate\colormode with appropriate var but they don’t work . :(

Could you paste your capture code (or at least the code outline)? You should not be using 99% CPU just by running two cameras. On the other hand, capturing two cameras 320x240 32bit @ 187fps will require about 219MB/s throughput on your hard drive which is unlikely that you can do on your pc. Therefore unless you compress the video in some way, you won’t be able to save these streams. The monochrome capture will obviously require about 54MB/s which is also a bit difficult to achieve unless you have your drives setup in RAID0 configuration. Since these rates are the continuous rates and not burst rates, it is advisable to implement some form of FIFO buffering in memory before saving the streams to the disk. Because of all of this, you must have really fast hardware and a lot of space on your drive to accomplish what you want to do. What are the specs of your machine?

Profile
 
 
Posted: 20 March 2010 02:06 AM   [ Ignore ]   [ # 4 ]
New Member
Rank
Total Posts:  5
Joined  2010-02-02

you choose from 3 radiobutton the setting you prefer (320x240 @125 , 320x240 @187 and 640x480 @75) :


var:

int numCameras = 0;
      int gain = 0;
      int frame = 75;

CLEyeCameraResolution res = CLEyeCameraResolution.CLEYE_VGA;

  if (radioButton1.IsChecked == true)
        {
          frame = 187;
          res = CLEyeCameraResolution.CLEYE_QVGA;
        }
        if (radioButton2.IsChecked == true)
        {
          frame = 75;
          res = CLEyeCameraResolution.CLEYE_VGA;
        }
        if (radioButton3.IsChecked == true)
        {
          frame = 125;
          res = CLEyeCameraResolution.CLEYE_QVGA;
        }
        }

the code for start button is this:

// crea camera e parti
          if (numCameras >= 1)
          {
            camera1.Device.Create(CLEyeCameraDevice.CameraUUID(0));
                camera1.Device.Resolution = res;
                camera1.Device.Framerate = frame;
              gain = camera1.Device.Gain;
              label5.Content = gain.ToString();
              camera1.Device.AutoGain = true;
              camera1.Device.Start();
          }
          if (numCameras == 2)
          {
              camera2.Device.Create(CLEyeCameraDevice.CameraUUID(1));
                  camera2.Device.Resolution = res;
                camera2.Device.Framerate = frame;
              camera2.Device.AutoGain = true;
              camera2.Device.Start();

          }

          label1.Content = “Res1: ” + camera1.Device.Resolution.ToString();
          label3.Content = “FPS1: ” + camera1.Device.Framerate.ToString();

/////////////////////////

my test machine is a laptop (quite old unfortunately) core 2 duo t5600 @1,83 ghz , 2,5 Gb ddr2 and a seagate hd 7200 rpm 32MB cache.

in theory video lenght is quite short, like at max 1 minute.

Profile
 
 
Posted: 20 March 2010 01:21 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  585
Joined  2009-09-17

Well if you are talking <1 minute video, then you might want to do this:

1. Allocate enough RAM to store the video.
  For example for two color video streams 320x240 @ 75fps, you’ll need to allocate 2.57GB of memory.
  You obviously need to have at least 3GB or more of memory on your system.
  Also you should be running x64 version of Windows since in x86 the system can only see 3GB of RAM.

2. You need to make sure this memory is paged-in in your process to avoid any paging lockups during the capture process.
3. After you have filled the RAM, stop recording and save this data to the disk in video file format of your choice. You might chose to process this data in memory of even compress it before saving it to the disk.

As an alternative you might want to install one of the new SSD flash hard-drives that advertise very high throughput such as ~100-200MB/s write speeds. Keep in mind that Windows is not a real-time OS and use enough buffering before writing to the disk.

The upcoming PCI-Express SSD Z-Drive from OCZ looks really promising and as they advertise will handle max 800MB/s reads and 750MB/s writes.

As you can see the camera outputs huge amounts of data and a lot of people don’t have a feel of how large this numbers are until you try doing what you want to do.

Profile
 
 
Posted: 20 March 2010 02:33 PM   [ Ignore ]   [ # 6 ]
New Member
Rank
Total Posts:  5
Joined  2010-02-02

I’m running under 7 professional x64, I will try what you suggested, (saving streams on ram, compress it after stopping rec and save avi file) I think also I will buy a more powerful machine in order to capture at max camera capabilities, for other “standard” pc I will limit fps, res and colour.

Any ideas about why I can’t change res and fps?

thank you for your help.

Profile
 
 
Posted: 20 March 2010 03:03 PM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  585
Joined  2009-09-17
serapheye - 20 March 2010 02:33 PM

I’m running under 7 professional x64, I will try what you suggested, (saving streams on ram, compress it after stopping rec and save avi file) I think also I will buy a more powerful machine in order to capture at max camera capabilities, for other “standard” pc I will limit fps, res and colour.

Any ideas about why I can’t change res and fps?

thank you for your help.

You have to set resolution, color-mode and frame-rate before you create the camera. Since you are building high performance app, you might want to look at the c++ samples. Is it advisable that you use multiple threads to do all of this and two separate memory buffers, one for each camera stream.

Profile
 
 
Posted: 20 March 2010 11:31 PM   [ Ignore ]   [ # 8 ]
New Member
Rank
Total Posts:  5
Joined  2010-02-02

that’s all??? d’oh… smile

Profile
 
 
 
 


RSS 2.0     Atom Feed