Changes

Jump to navigation Jump to search
no edit summary
(this page is a work in progress, this is a compagnon page to a MAPs article about the same subject).
== Introduction ==
</texcode>
Here are some excerpts of this file (frame number in magenta in the top-left of each image):
[[File:Project1_a-0.jpg|150px]]
[[File:Project1_a-2.jpg|150px]]
[[File:Project1_a-3.jpg|150px]]
 
The number of frames needed for a movie can be large. For example, consider a five-minute movie at 30 frames per second: we would need 5 x 60 x 30 = 9,000 frames. If there are a lot of calculations for each frame, this could pose an issue. Therefore, during development, it could be useful to speed up the the processes : sometimes, it's possible to speed up or adjust the timing. For instance, assume the loop in the preceding code at line 12 is changed to:
<texcode>
currentframe := (#1-1)*100 ;
if currentframe == 0: currentframe := 1; fi;
</texcode>
 
The first page of the file will correspond to frame 1, the second to frame 100, the third to frame 200, and the last one, the fourth, to frame 300. This allows us to obtain a rough idea of the movie without generating every single page. However, as will become clear later, this approach is not always feasible.
 
Now that we have a PDF file, we need to convert the PDF pages to JPG images. This can be easily done with external tools like ImageMagick (https://imagemagick.org), a free open-source software for manipulating digital images. Once installed on your system, the command
<texcode>
convert myfile.pdf p_%03d.jpg
</texcode>
will convert the 300 pages of `myfile.pdf` to 300 images named `p_000.jpg`, `p_001.jpg`, ..., `p_299.jpg`. The next step is to assemble the images into a movie, which is done with the free ``ffmpeg`` (https://ffmpeg.org) tool. The command
<pre>
ffmpeg -y -r 30 -i JPGdir/p_%03d.jpg -c:v libx264
-pix_fmt yuv420p Movie-a.mp4
</pre>
 
Project1-A : [[File:Project1-A.mp4]]
36

edits

Navigation menu