[vtkusers] Problems using more than one vtkMPEG2Writer simultaneously, only one creates a working MPEG

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Jun 2 09:21:05 EDT 2008


Hi Thomas Jefferson... is it your real name ?

  I fixed a couple of uninitialized variables:

$ cvs ci -m"BUG: fixed unitialized vars" vtkMPEG2Writer.cxx
/cvsroot/VTK/VTK/IO/vtkMPEG2Writer.cxx,v  <--  vtkMPEG2Writer.cxx
new revision: 1.7; previous revision: 1.6

  Let me know if this works for you now.

-Mathieu

On Wed, May 28, 2008 at 11:13 AM, Jefferson Thomas <foramuyou at gmail.com> wrote:
> Hi,
> I want to use more then one vtkMPEG2Writer in the same time and output
> many MPEG.
> The problem is that every time I try to do it only one of the MPEG
> files is working after that.
> Here is a mininal code :
>
> #include "vtkMPEG2Writer.h"
> #include "vtkWindowToImageFilter.h"
> #include "vtkCylinderSource.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkActor.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkProperty.h"
> #include "vtkCamera.h"
>
> int main(void) {
>
>        vtkCylinderSource *cylinder = vtkCylinderSource::New();
>        cylinder->SetResolution(8);
>
>        vtkPolyDataMapper *cylinderMapper = vtkPolyDataMapper::New();
>        cylinderMapper->SetInputConnection(cylinder->GetOutputPort());
>
>        vtkActor *cylinderActor = vtkActor::New();
>        cylinderActor->SetMapper(cylinderMapper);
>        cylinderActor->GetProperty()->SetColor(1.0000, 0.3882, 0.2784);
>        cylinderActor->RotateX(30.0);
>        cylinderActor->RotateY(-45.0);
>
>        vtkRenderer *renderer = vtkRenderer::New();
>        renderer->AddActor(cylinderActor);
>
>        vtkRenderWindow *window = vtkRenderWindow::New();
>        window->AddRenderer(renderer);
>
>        vtkWindowToImageFilter* w2if =vtkWindowToImageFilter::New();
>        w2if->SetInput(window);
>
>        vtkMPEG2Writer *moviewriter1 = vtkMPEG2Writer::New();
>        moviewriter1->SetFileName("test1.mpg");
>        moviewriter1->SetInputConnection(w2if->GetOutputPort());
>        moviewriter1->Start();
>
>        vtkMPEG2Writer *moviewriter2 = vtkMPEG2Writer::New();
>        moviewriter2->SetFileName("test2.mpg");
>        moviewriter2->SetInputConnection(w2if->GetOutputPort());
>        moviewriter2->Start();
>
>        window->Render();
>
>        w2if->Modified();
>        moviewriter1->Write();
>        moviewriter2->Write();
>
>        moviewriter1->End();
>        moviewriter2->End();
> }
>
> Linking with : -lvtkRendering -lvtkjpeg -lvtkexpat -lvtkftgl
> -lvtkfreetype -lGL -lGLw -lOSMesa -lpthread -ldl -lm -lvtkDICOMParser
> -lvtkpng -lvtktiff -lvtkzlib -lvtkGraphics -lvtkImaging -lvtkIO
> -lvtkFiltering -lvtkCommon -lvtksys -lvtkMPEG2Encode
>
> The output will be two mpeg files "test1.mpg" and "test2.mpg". But
> only "test1.mpg" can be displayed ! What is strange is that they have
> the same size and almost the same content. Only few bytes differ...
> How can it be done properly, so that all the mpgs work after creation ?
> Thomas
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Mathieu



More information about the vtkusers mailing list