FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Video, Camera
(Moderator: REAS)
   [PROBLEM] Duplicated Frames
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: [PROBLEM] Duplicated Frames  (Read 951 times)
heliodrop

WWW
[PROBLEM] Duplicated Frames
« on: Dec 28th, 2004, 1:10am »

Hi!
I've tried the following script:
 
Code:
boolean newFrame = false;
 
void setup () {
  size(160, 120);
  beginVideo(width, height, 1);
}
 
void videoEvent () {
  newFrame = true;
}
 
void loop () {
  if (newFrame) {
    image(video, 0, 0);
    saveFrame("webcam_duplicate-####.tif");
    newFrame = false;
  }
}

 
The result is a serie of TIFFs like:
webcam_duplicate-0000.tif, webcam_duplicate-0140.tif, webcam_duplicate-0305.tif, webcam_duplicate-0472.tif, webcam_duplicate-0639.tif, etc...
The numbers are not consecutive because the loop() increases the counter each time (even if there isn't a newFrame). But this is not a problem.
 
My problem:
There is always 2 duplicate (and consecutive) frames:
webcam_duplicate-0140.tif is exactly the same as webcam_duplicate-0305.tif,
webcam_duplicate-0472.tif is exactly the same as webcam_duplicate-0639.tif,
etc...
 
The problem subsists with all configurations (I've tried different FPS and SIZE), even with 1 FPS.
Sometimes (e.g: with increased FPS and decreased SIZE), i can have up to 4 consecutive duplicate images.
 
 
I've tried the application WinVDIG > QTCap.
(WinVDIG is what processing uses? right?)
I recorded a movie with QTCap (into a .mov) and analysed the resulting file frame by frame.
And there is no duplicated frames, the result is OK.
 
 
So, my questions are:
- Why have I this problem with processing and not with WinVDIG > QTCap ?
- Did someone experienced the same problem ?
 
My configuration:
Processing-0068
WinVDIG_101
Windows 98 SE
Webcam: Typhoon Webshot II USB 300K
 
Any help would be appreciated.
Thanks in advance!
 
fry

WWW
Re: [PROBLEM] Duplicated Frames
« Reply #1 on: Dec 29th, 2004, 9:52am »

a couple thoughts...
 
1) running your app multiple times will generally give you different frame numbers for which the movie is updated (simply because the timing is likely to change).
 
2) if the movie is looping, of course you're going to get duplicates. though it looks like what you're getting are consecutive frames.
 
3) the video lib uses quicktime for java, so if quicktime is lying to us about when a new frame is available, then that could be triggering newFrame incorrectly.
 
4) visual inspection of whether frames look different in the movie doesn't tell you whether things are actually stored as separate frames in the file. whatever was used to encode the movie may be the culprit.  
 
5) all that said, there may be a bug in processing's video code, but this would be the first i've heard of this particular case, and as simple as that piece of code is, i'm guessing it's one of the other four things mentioned.
 
heliodrop

WWW
Re: [PROBLEM] Duplicated Frames
« Reply #2 on: Jan 4th, 2005, 6:00pm »

hi fry.
 
on Dec 29th, 2004, 9:52am, fry wrote:
1) running your app multiple times will generally give you different frame numbers for which the movie is updated (simply because the timing is likely to change).
Shure, and it's not a problem.
 
on Dec 29th, 2004, 9:52am, fry wrote:
2) if the movie is looping, of course you're going to get duplicates. though it looks like what you're getting are consecutive frames.
Maybe I doesn't explained it well,
but the script I posted uses a webcam and doesn't load a MOV, so there is no looping problem.
(Later, I used QTCap to make a .mov, just to check if my camera was ok).
 
on Dec 29th, 2004, 9:52am, fry wrote:
3) the video lib uses quicktime for java, so if quicktime is lying to us about when a new frame is available, then that could be triggering newFrame incorrectly.
I think the problem is here (but WinVDIG>QTCap is ok, that's why I doesn't understood).
If no one had this problem, it's certainly due to my configuration.
 
on Dec 29th, 2004, 9:52am, fry wrote:
4) visual inspection of whether frames look different in the movie doesn't tell you whether things are actually stored as separate frames in the file. whatever was used to encode the movie may be the culprit.
As I said previously, the script uses a webcam. The problem appeared using a webcam, and not an encoded movie.
I only inspected the MOV visually (because on processing reference, the videoEvent() method isn't used for video playback).
 
on Dec 29th, 2004, 9:52am, fry wrote:
5) all that said, there may be a bug in processing's video code, but this would be the first i've heard of this particular case, and as simple as that piece of code is, i'm guessing it's one of the other four things mentioned.
You're right, an error with a so simple code cannot pass unperceived.
 
So that's what I thought, I'm the only one with this problem.
Anyway, thank you for your help.
 
Pages: 1 

« Previous topic | Next topic »