Hi folks,<br><br>Here is a small piece of code to create animation file (*.avi) file with the help of vtkAVIWriter<br><br>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">vtkWindowToImageFilter *windowToImage =
vtkWindowToImageFilter::New();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">windowToImage->SetInput(pRenderWindow );</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">windowToImage->SetInputBufferTypeToRGBA();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">vtkAVIWriter *avw = vtkAVIWriter::New();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">avw->SetInputConnection(windowToImage->GetOutputPort());</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">avw->SetFileName(<span style="color:rgb(163,21,21)">"animation.avi"</span>);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">avw->SetQuality(2);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">avw->SetRate((<span style="color:blue">int</span>)srate);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">avw->Start();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas;color:blue">double</span><span style="font-size:9.5pt;font-family:Consolas"> tIter = startIndex;</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><br>
<span style="color:blue">while</span>(tIter <= endIndex)</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">{</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>/* Code
to Display Results (Contours and/or vectors) */</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>windowToImage->Modified();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>avw->Write();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>/* Code
to increment the counter */</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>tIter
+= timeStep;</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">}<span style> </span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">avw->End();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">avw->Delete();</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:9.5pt;font-family:Consolas">windowToImage->Delete();</span></p>
<p class="MsoNormal"> </p>
Using this simple code, I am able to generate animation (video) file. When I wanted to present this animation in powerpoint, it so happened that, full animation played without any problem. And at the end of the movie, instead of stopping at the last frame, it showing black screen.<br>
<br>Can any one of you help me to overcome this problem?<br><br>Thanks in advance<br><br>Regards<br><br>