[vtkusers] vtkMPEG2Writer

Beau Sapach beau.sapach at ualberta.ca
Mon Jul 31 15:37:20 EDT 2006


Hello everyone,

 

I'm trying to use vtkMPEG2Writer to capture the frames of a render window
into a movie but I keep getting these errors:

 

Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line 61

horizontal_size must be a even [4:2:0/4:2:2]

 

Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line 61

vertical_size must be a even [4:2:0]

 

Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line 61

vertical _size must be a even [field pictures]

 

Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line 61

vertical _size must be a multiple of 4 [4:2:0 field pictures]

 

 

Here is the code behind my Recorder object.  This is somewhat simplified so
I'm sure if it were compiled would cause some problems, I can already see
one memory leak.  Nonetheless, if anyone sees any obvious problems with
this, please let me know!  The functions are called in the order they are
presented.

 

 

void Recorder::GrabFrame()

{

      vtkImageData * frame = vtkImageData::New();

      vtkUnsignedCharArray * pData = vtkUnsignedCharArray::New();

      vtkRenderWindow * rw = GetRenderWindow();

      

      int * dim = rw->GetSize();

      

      rw->GetRGBACharPixelData(1,1,dim[0]-1,dim[1]-1,1,pData);

      frame->SetExtent(0,dim[0],0,dim[1],0,0);

      frame->SetScalarTypeToUnsignedChar();

      frame->SetNumberOfScalarComponents(4);

      frame->GetPointData()->SetScalars(pData);

}

 

void Recorder::WriteFrame()

{           

      vtkMPEG2Writer * mWriter = vtkMPEG2Writer::New();

 

      if(!started){
            mWriter->SetFileName("d:\\testvideo.mpg");

            mWriter->SetInput(frame);

            mWriter->Start();

            started = TRUE;

      }else{

            mWriter->SetInput(frame);

            mWriter->Write();

      }

 

}

 

void Recorder::StopRecording()

{

      mWriter->End();

}

 

 

 

--

Network Administrator

In-Vivo NMR Centre

University of Alberta

Phone: (780) 492-8098

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060731/b698c366/attachment.htm>


More information about the vtkusers mailing list