2019-05-01_Linux_Format

(singke) #1

56 LXF249May 2019 http://www.linuxformat.com


TuTorialS St op-motion animation


Action!
With everything set up, it’s time to make your movie.
This could be considered as the difficult stage,
depending on how much planning you’ve done
(you have made a storyboard, haven’t you?).
In truth, however, if the Raspberry Pi is securely
positioned, with a reliable power supply, and the shutter
button correctly connected, you shouldn’t have any
trouble. The worst that’s going to happen is probably
a bit of back- or neck-ache as you make those small
adjustments to your characters.
Your recording of the movie should follow this simple
procedure: set up scene > take shot > move character/
object(s) > take shot > move character/object(s) >
take shot. This should continue until your movie is
complete, or you’re ready to take a break.
As every image is saved into the same folder with an
individual file name, stopping and then restarting the
following day should not be a problem. Nothing is likely
to be overwritten, for example.
When you’re ready to stop recording the movie,
press Ctrl+C on your Pi’s keyboard. This will terminate
the stopmotion.py program and close the preview. With
the movie complete, it’s time to compile those

hundreds or thousands of individual images into a
single movie file. Before you do that, however, it’s a
good opportunity to look for any images that didn’t
quite work out.
For example, if you took multiple attempts at a
particular shot, you can delete the ones you don’t want
(or move them to another directory). It’s also a good
chance to get a look at the overall movie in a sort of
‘film strip’ view. This will reveal if the lighting is
consistent, for example, or if your camera has drifted
or been obviously knocked when shooting. In some
cases, it might be possible to retake a shot if it is
particularly poor. However, it may be easier to simply
drop the image, and hope for the best.
When you’re ready to compile the images, browse to
the /stopmotion directory within the terminal (or
press F4 from within the desktop file manager to open a
terminal). Then run:
avconv -r 15 -i stopmotion/frame%03d.jpg -qscale 2
animation.h264
Wait while the process completes. Keep in mind the
relatively low specification of your Raspberry Pi, and the
fact that it is essentially creating a movie in high
definition. This may take a while, so go and recover –
maybe have a good shoulder rub.
The completed file animation.h264 can be run in
your preferred media player. For instance, to play in the
Raspberry Pi’s omxplayer, use
omxplayer animation.h264
Find the video is a bit jerky? Try altering the frame
rate and recompiling it, represented in the avconv
command with the -r 15 value. The higher the figure,
the smoother the animation. Note that the animation
will also become shorter as you increase the frame rate.

Sharing with the world
With your movie completed, you may want to “um” and
“ahh” over the problems. Or you might prefer to just get
it out there to find out what people think of it.
Pretty much anywhere to which you can currently
upload movies is suitable. Better still, as the movie is
probably only a few seconds long, it won’t take long to
upload – so you can think about uploading the stop-
motion movie to YouTube, Facebook, Twitter and so on.
Alternatively, you could upload it to your preferred
cloud storage account. From here, it should be easy to
access it from your mobile device and upload the file to
Instagram, say.

Audio!
One shortcoming that you will have noticed with the
creation of a stop-motion movie is the lack of sound.
You have two main options to get around this.
The first is to load up a desktop video editing suite on
your main PC (your Raspberry Pi probably isn’t up to
it!). Import the stop-motion video and add a soundtrack.
This might be audio you already have saved to your PC,
whether that’s music or sound effects. Alternatively,
you could record some custom sound effects or
dialogue to accompany the action.
However, there is also the option to add audio when
you upload the video to YouTube. The Creator Studio
enables you to add sounds from YouTube’s library of
royalty free songs. The selection is pleasingly vast, so
choose carefully!

it’salmost
alwaysmore
convenientto
usea Raspberry
Piwithout
thedisplay.
However,fora
cameraproject
likethisit’s
wisetohave
a monitor
connected.using
thepreview
featurewill
ensuretheshot
is linedupandin
focus.Whattype
ofdisplayyou
useis upto
you,although
thelarger,
thebetter.

ligHtingBalance


Shadows can ruin even the best stop-motion animations, yet this
problem can be easily avoided with a bit of forward planning. Lighting
is the secret, but you need to avoid relying on daylight or a standard
ceiling light. This needn’t cause you to break the bank, either; small
LED lights perfect for this can be bought for just a few pounds.
Positioning the lights to the left and right of the animation ‘stage’
enables you to cancel out any shadows cast by you or the camera.
If you’re animating with objects, toys or modelling clay, a third light
from above will also help to cancel out shadows.
With the shadows banished, you should also ensure the white
balance is set correctly. If you’re using the recommended PiCamera
software, auto white balance will probably work.
You can adjust this yourself by altering the awb_mode property,
which by default is set to awb_mode=auto. Alternatives include
sunlight and cloudy , though tungsten , fluorescent and
incandescent are set for typical indoor lighting temperatures.
Meanwhile, you can even go as far as disable awb_mode with
the off setting. You can then specify a precise awb_gains setting
(between 0.9 and 1.9). Consistent lighting will result in a better
stop-motion movie, so take the time to set this up accurately.

With a Raspberry Pi Camera Module
attached you can turn the Pi into an
all-in-one stills and video camera.
Free download pdf