I would like to be able to go through an MJPEG file and decode each video 
frame.  I am having two problems with the simple code segment below.  The 
first is that either GetPos() is returning an incorrect value or the 
current frame counter is not getting updated correctly.  Here is some 
sample output of the code below:

Read number: 0, Frame position: 1
Read number: 1, Frame position: 2
Read number: 2, Frame position: 2
Read number: 3, Frame position: 4

This trend of every now and then getting stuck on one frame, then skipping 
the next, continues.  It seems that the getting stuck on one frame and 
skipping frames are always balanced, thus the frame count is never off by 
more than one or two.  

My second problem is that simply dumping the CImage to a bitmap file does 
not create a readable bitmap file.  It was my impression that 
StartStreaming() and GetFrame() deal with decoding the frames so that I 
don't have to.  Is there something I'm missing?  

Here is the code segment:

aviFile = avm::CreateReadFile(filename);
video_stream=aviFile->GetStream(0, AviStream::Video);
video_stream->StartStreaming();
for(uint_t i = 0; i < nframes; i++){
  image_buffer = video_stream->GetFrame(true);
  cout << "Read number: "<<i<<", Frame position: "
       <<video_stream->GetPos()<<endl;
  image_buffer->Dump("test.bmp");
  image_buffer->Release();
}

Thanks,
Kristin Branson


_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile

Reply via email to