Skip to content

Commit

Permalink
improve video generation
Browse files Browse the repository at this point in the history
Speed up by removing Python threading and solely using the signals
emitted by gtkfractal.

Clarify that a video is made up of keyframes and transitions
consisting of a number of frames defined by the duration parameter.
By default the keyframe is shown for one frame but this is
configurable using the stopped parameter.
  • Loading branch information
cjmayo committed May 21, 2019
1 parent 5936fc4 commit a812937
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 214 deletions.
18 changes: 9 additions & 9 deletions doc/gnofract4d-manual/C/gnofract4d-manual.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ are. </para></listitem>
<title>Director</title>
<para>

The <emphasis>Director</emphasis> allows you to create fractal movies.
You first define keyframes (including base keyframes) which are stops
in video. Then, for each of them, you define for how long they last
(<guilabel>duration</guilabel> - in frames), how long still image of
keyframe will stay in video (<guilabel>stopped for</guilabel>) and
interpolation type between several possibilities. When you hit
<guibutton>Render</guibutton> button, Director will render all frames
and put them in directory you selected and then it will try to create
a video using <ulink url="https://www.ffmpeg.org/">
The <emphasis>Director</emphasis> allows you to create fractal videos.
You first define keyframes which are points in the video.
Then, for each of them, you specify how long a still image of the keyframe will
stay in the video (<guilabel>stopped for</guilabel>), how long the transition
is to the next keyframe (<guilabel>transition duration</guilabel> - in frames)
and the interpolation type used for the transition from several possibilities.
When you hit <guibutton>Render</guibutton> button, Director will render all
frames and put them in the directory you selected and then it will create
the video using <ulink url="https://www.ffmpeg.org/">
<emphasis>FFmpeg</emphasis></ulink>.</para>

<para>
Expand Down
11 changes: 6 additions & 5 deletions fract4d/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,15 @@ def get_mu(self, int_type, x):
# create a list containing all the filenames of the frames
def create_list(self):
framelist = []
current = 1
current = 0
for i in range(self.keyframes_count()):
for j in range(self.get_keyframe_stop(i)): # output keyframe 'stop' times
framelist.append(self.get_image_filename(current-1))
framelist.append(self.get_image_filename(current))
current += 1

if i < self.keyframes_count()-1:
# final frame has no transitions following it
for j in range(self.get_keyframe_duration(i)): # output all transition files
if i < self.keyframes_count() - 1:
# skip final frame which has no transitions following it
for j in range(self.get_keyframe_duration(i)): # output all transition files minus keyframe
framelist.append(self.get_image_filename(current))
current += 1

Expand Down
2 changes: 1 addition & 1 deletion fract4d/test_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def testCreateList(self):
# then a sequence of 10 changing frames
self.assertEqual([os.path.join(Test.tmpdir.name, "image_%07d.png") % n for n in range(1,11)], list[4:14])
# then 3 more unchanging frames
self.assertEqual([os.path.join(Test.tmpdir.name, "image_0000010.png")] * 3, list[14:17])
self.assertEqual([os.path.join(Test.tmpdir.name, "image_0000011.png")] * 3, list[14:17])

def testFilenames(self):
self.assertEqual(
Expand Down
Loading

0 comments on commit a812937

Please sign in to comment.