1 | <HTML> |
---|
2 | <TITLE>Making a Movie</title> |
---|
3 | <HEAD> |
---|
4 | </HEAD> |
---|
5 | <BODY> |
---|
6 | |
---|
7 | <TABLE WIDTH="100%" > |
---|
8 | <TR> |
---|
9 | <TD> |
---|
10 | </A> |
---|
11 | <A HREF="index.html"> |
---|
12 | <IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents" HEIGHT=16 WIDTH=59></A> |
---|
13 | <A HREF="markertext.html"> |
---|
14 | <IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous" HEIGHT=16 WIDTH=59></A> |
---|
15 | <IMG SRC="../../../../resources/html/IconsGIF/NextGR.gif" ALT="Next" HEIGHT=16 WIDTH=59> |
---|
16 | </TD> |
---|
17 | |
---|
18 | <TD ALIGN="Right"><FONT COLOR="#238E23"><FONT SIZE=-1> |
---|
19 | <B>Geant4 User's Guide</B> <BR> |
---|
20 | <B>For Application Developers</B> <BR> |
---|
21 | <B>Visualization</B> </FONT></FONT> </TD> |
---|
22 | </TR> |
---|
23 | </TABLE> |
---|
24 | |
---|
25 | <CENTER><FONT COLOR="#238E23"><FONT SIZE=+3> |
---|
26 | <b>8.10 Making a Movie</b><BR> |
---|
27 | </FONT></FONT></CENTER> |
---|
28 | <BR> |
---|
29 | |
---|
30 | <HR ALIGN="Center" SIZE="7%"><BR> |
---|
31 | |
---|
32 | These instructions are suggestive only. The following procedures |
---|
33 | have not been tested on all platforms. There are clearly some |
---|
34 | instructions that apply only to Unix-like systems with an X-Windows |
---|
35 | based windowing system. However, it should not be difficult to take |
---|
36 | the ideas presented here and extend them to other platforms and |
---|
37 | systems. |
---|
38 | |
---|
39 | The procedures described here need graphics drivers that can produce |
---|
40 | picture files that can be converted to a form suitable for an MPEG |
---|
41 | encoder. There may be other ways of capturing the screen images and |
---|
42 | we would be happy to hear about them. Graphics drivers currently |
---|
43 | capable of producing picture files are: |
---|
44 | |
---|
45 | <BR><BR> |
---|
46 | <TABLE BORDER=1 cellpadding=2> |
---|
47 | <TR><TD><B>Driver</B></TD><TD><B>File type</B></TD></TR> |
---|
48 | <TR><TD>DAWNFILE</TD><TD>prim then eps using <b>dawn</b></TD></TR> |
---|
49 | <TR><TD>HepRepFile</TD><TD>HepRep1</TD></TR> |
---|
50 | <TR><TD>HepRep</TD><TD>HepRep2</TD></TR> |
---|
51 | <TR><TD>OGLX</TD><TD>eps</TD></TR> |
---|
52 | <TR><TD>RayTracer</TD><TD>jpeg</TD></TR> |
---|
53 | <TR><TD>VRMLFILE</TD><TD>vrml</TD></TR> |
---|
54 | </TABLE> |
---|
55 | <BR> |
---|
56 | |
---|
57 | So far, only DAWNFILE, OGLX and RayTracer have been "road tested". |
---|
58 | Once in a standard format, such as eps, the <b>convert</b> program |
---|
59 | from <a href="http://www.imagemagick.org">ImageMagick</a> can |
---|
60 | convert to ppm files suitable for <b>mpeg2encode</b>. |
---|
61 | |
---|
62 | <h4>8.10.1 OGLX</h4> |
---|
63 | |
---|
64 | Make a macro something like this: |
---|
65 | |
---|
66 | <PRE> |
---|
67 | /control/verbose 2 |
---|
68 | /vis/open OGLSX 600x600-0+0 |
---|
69 | /vis/drawVolume |
---|
70 | /vis/viewer/reset |
---|
71 | /vis/viewer/set/style surface |
---|
72 | /vis/viewer/set/projection perspective 50 deg |
---|
73 | /control/alias phi 30 |
---|
74 | /control/loop movie.loop theta 0 360 1 |
---|
75 | </PRE> |
---|
76 | |
---|
77 | which invokes movie.loop, which is something like: |
---|
78 | |
---|
79 | <PRE> |
---|
80 | /vis/viewer/set/viewpointThetaPhi {theta} {phi} |
---|
81 | /vis/viewer/zoom 1.005 |
---|
82 | /vis/oglx/printEPS |
---|
83 | </PRE> |
---|
84 | |
---|
85 | This produces lots of eps files. Then... |
---|
86 | |
---|
87 | <PRE> |
---|
88 | <a href="make_mpeg2encode_parfile.sh">make_mpeg2encode_parfile.sh</a> G4OpenGL_*eps |
---|
89 | </PRE> |
---|
90 | |
---|
91 | Then edit mpeg2encode.par to specify file type and size, etc.: |
---|
92 | |
---|
93 | <PRE> |
---|
94 | $ diff mpeg2encode.par~ mpeg2encode.par |
---|
95 | 7c7 |
---|
96 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
97 | --- |
---|
98 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
99 | 15,17c15,17 |
---|
100 | < /* horizontal_size */ |
---|
101 | < /* vertical_size */ |
---|
102 | < 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
103 | --- |
---|
104 | > 600 /* horizontal_size */ |
---|
105 | > 600 /* vertical_size */ |
---|
106 | > 1 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
107 | </PRE> |
---|
108 | |
---|
109 | Then convert to ppm: |
---|
110 | |
---|
111 | <PRE> |
---|
112 | for i in G4OpenGL*eps; do j=`basename $i .eps`; command="convert $i $j.ppm"; echo $command; $command; done |
---|
113 | </PRE> |
---|
114 | |
---|
115 | Then |
---|
116 | |
---|
117 | <PRE> |
---|
118 | mpeg2encode mpeg2encode.par G4OpenGL.mpg |
---|
119 | </PRE> |
---|
120 | |
---|
121 | Then, on Mac, for example: |
---|
122 | |
---|
123 | <PRE> |
---|
124 | open G4OpenGL.mpg |
---|
125 | </PRE> |
---|
126 | |
---|
127 | opens a QuickTime player. |
---|
128 | |
---|
129 | <h4>8.10.2 DAWNFILE</h4> |
---|
130 | |
---|
131 | You need to invoke <b>dawn</b> in "direct" mode, which picks up |
---|
132 | parameters from .DAWN_1.history, and suppress the GUI: |
---|
133 | |
---|
134 | <PRE> |
---|
135 | alias dawn='dawn -d' |
---|
136 | export DAWN_BATCH=1 |
---|
137 | </PRE> |
---|
138 | |
---|
139 | Change OGLSX to DAWNFILE in the above set of Geant4 commands and |
---|
140 | run. Then convert to ppm files as above: |
---|
141 | |
---|
142 | <PRE> |
---|
143 | for i in g4_*.eps; do j=`basename $i .eps`; command="convert $i $j.ppm"; echo $command; $command; done |
---|
144 | </PRE> |
---|
145 | |
---|
146 | Then make a .par file: |
---|
147 | |
---|
148 | <PRE> |
---|
149 | <a href="make_mpeg2encode_parfile.sh">make_mpeg2encode_parfile.sh</a> g4_*ppm |
---|
150 | </PRE> |
---|
151 | |
---|
152 | and edit mpeg2encode.par: |
---|
153 | |
---|
154 | <PRE> |
---|
155 | $ diff mpeg2encode.par~ mpeg2encode.par |
---|
156 | 7c7 |
---|
157 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
158 | --- |
---|
159 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
160 | 9c9 |
---|
161 | < 1 /* number of first frame */ |
---|
162 | --- |
---|
163 | > 0 /* number of first frame */ |
---|
164 | 15,16c15,16 |
---|
165 | < /* horizontal_size */ |
---|
166 | < /* vertical_size */ |
---|
167 | --- |
---|
168 | > 482 /* horizontal_size */ |
---|
169 | > 730 /* vertical_size */ |
---|
170 | </PRE> |
---|
171 | |
---|
172 | Then encode and play: |
---|
173 | |
---|
174 | <PRE> |
---|
175 | mpeg2encode mpeg2encode.par DAWN.mpg |
---|
176 | open DAWN.mpg |
---|
177 | </PRE> |
---|
178 | |
---|
179 | <h4>8.10.3 RayTracerX</h4> |
---|
180 | |
---|
181 | <PRE> |
---|
182 | /control/verbose 2 |
---|
183 | /vis/open RayTracerX 600x600-0+0 |
---|
184 | # (Raytracer doesn't need a scene; smoother not to /vis/drawVolume.) |
---|
185 | /vis/viewer/reset |
---|
186 | /vis/viewer/set/style surface |
---|
187 | /vis/viewer/set/projection perspective 50 deg |
---|
188 | /control/alias phi 30 |
---|
189 | /control/loop movie.loop theta 0 360 1 |
---|
190 | </PRE> |
---|
191 | |
---|
192 | where movie.loop is as above. This produces lots of jpeg files |
---|
193 | (but takes 3 days!!!). Then... |
---|
194 | |
---|
195 | <PRE> |
---|
196 | <a href="make_mpeg2encode_parfile.sh">make_mpeg2encode_parfile.sh</a> g4RayTracer*jpeg |
---|
197 | </PRE> |
---|
198 | |
---|
199 | Then edit mpeg2encode.par to specify file type and size, etc.: |
---|
200 | |
---|
201 | <PRE> |
---|
202 | $ diff mpeg2encode.par.orig mpeg2encode.par |
---|
203 | 7c7 |
---|
204 | < 1 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
205 | --- |
---|
206 | > 2 /* input picture file format: 0=*.Y,*.U,*.V, 1=*.yuv, 2=*.ppm */ |
---|
207 | 15,17c15,17 |
---|
208 | < /* horizontal_size */ |
---|
209 | < /* vertical_size */ |
---|
210 | < 8 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
211 | --- |
---|
212 | > 600 /* horizontal_size */ |
---|
213 | > 600 /* vertical_size */ |
---|
214 | > 1 /* aspect_ratio_information 1=square pel, 2=4:3, 3=16:9, 4=2.11:1 */ |
---|
215 | </PRE> |
---|
216 | |
---|
217 | Then convert to ppm, encode and play: |
---|
218 | |
---|
219 | <PRE> |
---|
220 | for i in g4*jpeg; do j=`basename $i .jpeg`; command="convert $i $j.ppm"; echo $command; $command; done |
---|
221 | mpeg2encode mpeg2encode.par g4RayTracer.mpg |
---|
222 | open g4RayTracer.mpg |
---|
223 | </PRE> |
---|
224 | |
---|
225 | <P> |
---|
226 | <HR> |
---|
227 | <A HREF="index.html">Back to contents</A> |
---|
228 | |
---|
229 | </BODY> |
---|
230 | </HTML> |
---|