<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE>@font-face {
        font-family: Cambria Math;
}
@font-face {
        font-family: Calibri;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P.MsoAutoSig {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; mso-style-link: "E-mail Signature Char"
}
LI.MsoAutoSig {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; mso-style-link: "E-mail Signature Char"
}
DIV.MsoAutoSig {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; mso-style-link: "E-mail Signature Char"
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
SPAN.E-mailSignatureChar {
        FONT-FAMILY: "Times New Roman","serif"; mso-style-link: "E-mail Signature"; mso-style-name: "E-mail Signature Char"
}
.MsoChpDefault {
        mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=122063919-31072006><FONT face=Arial
color=#0000ff size=2>In this case, unlike many others, the error messages are
actually giving you good information. :)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=122063919-31072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=122063919-31072006><FONT face=Arial
color=#0000ff size=2>The mpeg encoders have to have multiples of 2 or multiple
of 4 in the image size of the movies it generates.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=122063919-31072006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=122063919-31072006><FONT face=Arial
color=#0000ff size=2>Grab the size of the render window with GetSize(), and then
resize the window (probably smaller) to the next multiple of 4 in both
directions, I'm assuming with SetSize(). Then it should work ok.
:)</FONT></SPAN></DIV>
<DIV> </DIV><!-- Converted from text/plain format -->
<P><FONT size=2><FONT face=Fixedsys> Brian Wylie - Org 1424<BR>
Sandia National Laboratories<BR> MS 0822 - Building 880/A1-J<BR>
(505)844-2238
FAX(505)845-0833 <BR>
____
_ __<BR> / __ \____
_________ | | / (_)__ _
__<BR> / /_/ / __ `/ ___/ __ `/ | / / / _ \ | /| /
/<BR> / ____/ /_/ / / / /_/ /| |/ / / __/ |/ |/
/<BR> /_/ \__,_/_/ \__,_/
|___/_/\___/|__/|__/ <BR>
Unleash the Beast</FONT><BR></FONT></P>
<DIV> </DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
vtkusers-bounces+bnwylie=sandia.gov@vtk.org
[mailto:vtkusers-bounces+bnwylie=sandia.gov@vtk.org] <B>On Behalf Of </B>Beau
Sapach<BR><B>Sent:</B> Monday, July 31, 2006 1:37 PM<BR><B>To:</B>
vtkusers@vtk.org<BR><B>Subject:</B> [vtkusers]
vtkMPEG2Writer<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal>Hello everyone,<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>I’m trying to use vtkMPEG2Writer to capture the frames of a
render window into a movie but I keep getting these errors:<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line
61<o:p></o:p></P>
<P class=MsoNormal>horizontal_size must be a even [4:2:0/4:2:2]<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line
61<o:p></o:p></P>
<P class=MsoNormal>vertical_size must be a even [4:2:0]<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line
61<o:p></o:p></P>
<P class=MsoNormal>vertical _size must be a even [field
pictures]<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Generic Warning: In \vtk-5.0.0\Io\vtkMPEG2Writer.cxx, line
61<o:p></o:p></P>
<P class=MsoNormal>vertical _size must be a multiple of 4 [4:2:0 field
pictures]<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>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.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'">void
Recorder::GrabFrame()<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 'Courier New'">{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
vtkImageData * frame = vtkImageData::New();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
vtkUnsignedCharArray * pData =
vtkUnsignedCharArray::New();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
vtkRenderWindow * rw = GetRenderWindow();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
int * dim = rw->GetSize();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
rw->GetRGBACharPixelData(1,1,dim[0]-1,dim[1]-1,1,pData);<SPAN
style="COLOR: green"><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
frame->SetExtent(0,dim[0],0,dim[1],0,0);<SPAN
style="COLOR: blue"><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
frame->SetScalarTypeToUnsignedChar();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
frame->SetNumberOfScalarComponents(4);<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
frame->GetPointData()->SetScalars(pData);<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">void
Recorder::WriteFrame()<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{
<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
vtkMPEG2Writer * mWriter = vtkMPEG2Writer::New();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
if(!started){<BR>
mWriter->SetFileName(“d:\\testvideo.mpg”);<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
mWriter->SetInput(frame);<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
mWriter->Start();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
started = TRUE;<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}else{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
mWriter->SetInput(frame);<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
mWriter->Write();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">void
Recorder::StopRecording()<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
mWriter->End();<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoAutoSig>--<SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><o:p></o:p></SPAN></P>
<P class=MsoAutoSig><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Network
Administrator<o:p></o:p></SPAN></P>
<P class=MsoAutoSig><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">In-Vivo NMR
Centre<o:p></o:p></SPAN></P>
<P class=MsoAutoSig><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">University of
Alberta<o:p></o:p></SPAN></P>
<P class=MsoAutoSig><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">Phone: (780)
492-8098<o:p></o:p></SPAN></P>
<P class=MsoNormal><o:p> </o:p></P></DIV></BLOCKQUOTE></BODY></HTML>