|This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.
It used to be possible to import a movie (.mov/.avi/other) file into Scratch as a sequence of costumes to be used in an animation. Sound, however, could not be imported and needed to be added separately.
Converting to Images
|Most of these tutorials require software to be able to do this. If software is unwanted, then online converters are recommended.
Open the movie in iMovie and export it as an Image Sequence using Share > Export with Quicktime.
The frame rate can be changed using the 'Options' button. A lower frame rate is recommended for longer videos.
Open the frames with Gimp using the 'Open as layers' function and export as a .gif file. Use Shift+click to select multiple files.
To add sounds, go back to iMovie, and export the sounds as mp3 using Share > Export with Quicktime and choosing MP3 as the export format.
|This section requires MAGIX Movie Edit Pro 17/MX Plus to be installed before beginning this tutorial.
Select a video file from the Media Pool and double-click on it. A more advanced way is to drag and drop the video file into the arranger.
Go to File > Export Movie... > Animated GIF.
Set any wanted options and choose the directory to save the GIF, then click 'OK'. Depending on the movie/video being exported, it may take some time due to the file size.
The Audio can be exported as well by going to File > Export Movie... > Audio as wave or Audio as MP3.
Alternative using Photoshop
|This requires Adobe Photoshop to be installed.
Open Photoshop and then choose File > Import > Video frames to layers... and then choose the video files. Frame rate settings can be changed and parts to convert into layers can be chosen.
The video can now be exported as an animated .gif file.
The following command can be used:
ffmpeg -i video.mpg image%d.jpg
This will generate a sequence of JPEG images from a video file, which can then be imported into Scratch as costumes.
It may be easier to use an external program such as GIMP to convert the images into a single animated GIF.
Importing the Image
Drag the .gif file to the costumes area of a sprite and wait for them to be added.
|If larger movies are imported, Scratch may crash due to memory overload.
Finally, add the following script to iterate through the costumes:
when gf clicked forever next costume
Something similar to the following may need to be added:
wait (0.05) secs
to get the timing correct, especially if sounds are being imported as well.
A more accurate script for exact timing using the timer is as follows. Enter the frames per seconds at the end.
when gf clicked reset timer forever switch costume to ((timer) / ((1) / (. . .::grey)) end
Sounds can be played using this script.
when gf clicked forever play sound (movie sounds v) until done