Vals del vampiro animation

⇠ Back to Blog:Hacks
m
(Steps for producing the Vals del vampiro animation.)
(One intermediate revision by one user not shown)
Line 13: Line 13:
 
<center><wz tip="Code to crop the frames, taking into account the unintentional drift of the camera.">[[File:mathematica-crop-vampire.png|600px]]</wz></center>
 
<center><wz tip="Code to crop the frames, taking into account the unintentional drift of the camera.">[[File:mathematica-crop-vampire.png|600px]]</wz></center>
  
Then, I did some batch re-masterization of the colour, as it was a bit dark. I used Imagemagick's [http://www.fmwconcepts.com/imagemagick/autowhite/index.php autowhite] script:
+
This indeed corrected for the drift, as shown in these two comparisons overlaying the vampire from the beginning and the end of the animation with (left) and without (right) correction.
 +
 
 +
<center><wz tip="">[[File:vampiro-corrected-drift.jpg|200px]]</wz></center>
 +
 
 +
Then, I did some batch re-masterization of the colour, as it was a bit dark. I used Imagemagick's [http://www.fmwconcepts.com/imagemagick/autowhite/index.php autowhite] script.
  
 
<pre>
 
<pre>
Line 19: Line 23:
 
</pre>
 
</pre>
  
The cropping was done from the first frame till the last without the manual zoom (DSC_6687.JPG), whose list was put in the file processed by Mathematica. The frames where the manual zoom kicked in I had to crop by hand since the boundaries then changed rather wildly. I initially thought this I had to do for only the few frames before the full image was captured but then the aspect ratio was wrong. This allowed me however to exaggerate the zoom beyond that allowed by the camera (digital zoom), which makes a better effect.
+
Processing the cropped or full image did turn out to make no significant difference, as shown below.
  
 +
The cropping was done from the first frame till the last without the manual zoom (DSC_6687.JPG), whose list was put in the file processed by Mathematica. The frames where the manual zoom kicked in I had to crop by hand since the boundaries then changed rather wildly. I initially thought this I had to do for only the few frames before the full image was captured but then the aspect ratio was wrong. This allowed me however to exaggerate the zoom beyond that allowed by the camera (digital zoom), which makes a better effect, as seen from the snapshots below from the 1st, middle and last frames of the animation (actually the middle, yellow, frame turns out to be one of those we removed for synchronization):
  
Finally, we resized the pictures to turn them into a movie, keeping high resolution (2400):
+
<center><wz tip="Raw frames (left), autowhited (center), cropped then autowhited (final frames, right).">[[File:frames-vampiro-full-cropped-processed.png|400px]]</wz></center>
 +
 
 +
Finally, one can also resize the pictures before turning them into a movie, keeping high resolution (2400):
  
 
<pre>
 
<pre>
for photo in *.JPG;  do convert $photo -resize 2400 rs-$photo; done
+
for photo in aw-cr-*.jpg;  do convert $photo -resize 2400 rs-$photo; done
 
</pre>
 
</pre>
  
Line 37: Line 44:
  
 
<pre>
 
<pre>
mencoder "mf://rs-*.JPG" -mf fps=2.33334 -ovc lavc -o ./vals1.avi
+
mencoder "mf://rs-*.jpg" -mf fps=2.33334 -ovc lavc -o ./vals1.avi
 
</pre>
 
</pre>
 +
 +
The final editing was done with kdenlive, which requires no instructions.
 +
{{wl-publish: 2019-06-09 15:38:05 +0000 | Laussy }}

Revision as of 15:38, 9 June 2019

Carlos Sánchez, who has all the talents, composed a song (El Vals del vampiro), for which Elena, in a sequence of events that I did not follow in details, came to compose the lyrics. They decided to make a stop-motion animation to release the piece on YouTube. At this point, I got involved for the minor technical aspects of assembling the artwork (also from Elena) into the said animation. These are the steps I followed to do so.

The artwork consists of watercolour painting for the background and separate images for the vampire and its victim. We (Elena and myself) then proceeded to capture each frame from above, with the camera. We found it difficult to place the characters without significant fluctuations, even when taking marks. Stabilizing the camera was another issue (?!) and despite it was mounted on a good tripod, since it took a few hours to capture all the frames, the small drift of the setup resulted in a quite significant change of the size of the images between the beginning and the end.

Screenshot 20190608 123137.png

This is not too much of an issue as this merely produce a small zoom and the video concludes with an intentional zoom anyway. Besides, the zooming plugin of kdenlive turned-out to significantly alter the quality of the images, so we had to crop the frames externally, which allowed us to correct for the drift.

I used imagemagick for that, choosing the 4/3 aspect ratio which was that of the pictures. Unfortunately, our camera shoots in 3/2, so the part I had to do manually resulted to be slightly more than anticipated (see below). The automatic part I did by interpolating the size from the first frame to the last before the intentional zoom, to correct for the drift.

Mathematica-crop-vampire.png

This indeed corrected for the drift, as shown in these two comparisons overlaying the vampire from the beginning and the end of the animation with (left) and without (right) correction.

Vampiro-corrected-drift.jpg

Then, I did some batch re-masterization of the colour, as it was a bit dark. I used Imagemagick's autowhite script.

for f in cr-*.jpg; do ./autowhite "$f" ""aw-${f%%.*}".jpg"; done

Processing the cropped or full image did turn out to make no significant difference, as shown below.

The cropping was done from the first frame till the last without the manual zoom (DSC_6687.JPG), whose list was put in the file processed by Mathematica. The frames where the manual zoom kicked in I had to crop by hand since the boundaries then changed rather wildly. I initially thought this I had to do for only the few frames before the full image was captured but then the aspect ratio was wrong. This allowed me however to exaggerate the zoom beyond that allowed by the camera (digital zoom), which makes a better effect, as seen from the snapshots below from the 1st, middle and last frames of the animation (actually the middle, yellow, frame turns out to be one of those we removed for synchronization):

Frames-vampiro-full-cropped-processed.png

Finally, one can also resize the pictures before turning them into a movie, keeping high resolution (2400):

for photo in aw-cr-*.jpg;  do convert $photo -resize 2400 rs-$photo; done

We had to remove some frames for proper synchronization with the song. This was done initially by hand, but for subsequent processing, we used the following command from the "removed" folder of the first set to remove the same frames between the subsequent batches:

ls -1 | xargs -i mv ../../frames-2nd-attempt/{} ../../frames-2nd-attempt/removed

The encoding was done at the frequency of the song's beat, provided by Carlos:

mencoder "mf://rs-*.jpg" -mf fps=2.33334 -ovc lavc -o ./vals1.avi

The final editing was done with kdenlive, which requires no instructions.