Holcombe:MakingDemos: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
 
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:Holcombe}}
{{Template:Holcombe}}
== Making animated demos ==
*Using Psychopy or Visionegg you can create a gif. Then you import the gif using Adobe Flash. You can adjust the speed manipulating the frame duration (Modify document). Finally, you export the file as a swf.


*Patrick normally makes short movies a frame at a time in Keynote and then makes them into movies with Quicktime 7 Pro.
== Making animated gif on OSX, April 2014 ==
*In past years, Quicktime Pro could be used to create movies from a bunch of still frames. Quicktime Pro is no longer supported, however it is possible to still run Quicktime 7 Pro if you manage to find a Quicktime Pro-enabled computer (thanks Patrick Cavanagh for informing me of this).
# From Psychopy, export each frame of your animated display to a .png file. So you have an image sequence of 001.png, 002.png, ...
*Quicktime can still open image sequence, but not from GUI. Have to do it with AppleScript/Automator
# Convert the png files using OSX's built-in sips, e.g. <code>sips -s format gif ./*.png --out gifs</code> to export them to a subdirectory called gifs
<code>
# Download and install the command-line utility gifsicle
tell application "Finder"
# Use gifsicle to combine the gifs into a looping animated gif, e.g. <code>gifsicle --loop *.gif > anim.gif</code>


set theFolder to input as alias
Additionally, I created an ad hoc instructions image to proceed the stimulus images by:
# Drawing it in Keynote and taking a screenshot (command-option-4) of just the screenshot part of it, yielding a .png file on the Desktop
# Converting the .png screenshot to gif, and simultaneously changing it to 96 x 96 pixels (JoV icon style) using <code>sips -s format gif -z 96 96 screenShotOfInstructions.png --out gif</code>
# Adding it into the numbered sequence of gifs by creating copies and calling them e.g. 0001.gif, 0002.gif (and then creating the animated gif)


set thePath to container of theFolder as string
== Making animated demos ==
 
*Jan2015  Using Psychopy you can save your animated display directly to an image sequence, using e.g. myWin.saveMovieFrames('exported/frame.png').
set theName to name of theFolder
Then you can use "ffmpeg -i frames%03d.png out.webm" if the files have that form starting with 'frames' and followed by a 3-digit number to save as a webm movie file which will open in VLC (but at the wrong framerate, I couldn't get ffmpeg framerate manipulation to work)
 
*Using Psychopy you can save your animated display directly to a movie file, using e.g. myWin.saveMovieFrames('exported/frame.mov'). But watch out for [http://groups.google.com/group/psychopy-users/browse_thread/thread/4169b4e9725a872f dissolving movie files problem] THIS DOESN'T WORK AS OF 2015, SEE LINE ABOVE FOR NEW TECHNIQUE
set theSequence to (get first file of theFolder as alias)
*Using Visionegg you can create a gif. Then you import the gif using Adobe Flash. You can adjust the speed manipulating the frame duration (Modify document). Finally, you export the file as a swf.
 
*Patrick normally makes short movies a frame at a time in Keynote and then makes them into movies with Quicktime 7 Pro. In past years, Quicktime Pro could be used to create movies from a bunch of still frames. Quicktime Pro is no longer supported, however it is possible to still run Quicktime 7 Pro if you manage to find a Quicktime Pro-enabled computer (thanks Patrick Cavanagh for informing me of this).
end tell
*Quicktime Player 7 (but not Quicktime Player) [http://forums.macosxhints.com/archive/index.php/t-63657.html can still open image sequence], but not from GUI. Quicktime Player 7 can be found in Snow Leopard's [http://dougscripts.com/itunes/2009/08/snow-leopards-quicktime-player-duality/ Optional Installs]. To use the functionality, have to do it with AppleScript/Automator.
 
*Here's a script I made- drag the folder containing the image sequence onto the app: [[Image:ImageSequenceToMovie.app.zip‎]] or a more [http://macscripter.net/viewtopic.php?id=25547 user-friendly one] from the internet called Sequimago
 
*After the movie is made, you can change its playback speed with [http://www.xs4all.nl/~jeschot/home.html JES Deinterlacer] (Project:Custom:Movie speed)
tell application "QuickTime Player 7"
 
activate
 
open image sequence theSequence
 
set imageSequence to thePath & theName & ":" & theName & ".mov"
 
tell document 1
 
with timeout of 500 seconds
 
save self contained in imageSequence


end timeout
==Illustrator to Photoshop way of making an animated GIF==
* Adobe CS5. Created a single image in Illustrator with each frame as a layer.
* Exported as *psd and opened in Photoshop.
* Ordered frames, durations etc. using the Animations palette.
* Fading with the 'Tweening' function. (Creates new frames intermediate to selected frames. Can also handle motion and scaling I think.)
* Exported using 'Save for web and devices...' with 16 colour palette to keep the file size down.


close
==A Better Way?==
Unfortunately the above technique doesn't always play at the appropriate frame rate. Instead, once you have modified your psychopy code to save frames as images, you can use Adobe software to animate them and export as a Flash .swf file.


end tell
===Using Adobe Imageready===
If you don't have Adobe Imageready on your computer (it will be in the Photoshop folder in your Applications folder), a copy has been burned to a DVD and left on the black shelving unit in the main lab area. To install it, simply drag and drop the folder from the disc to your Applications folder.
# Place all the images in one folder
# Import the folder of images to Imageready (File:Import:Folder as Frames)
# Find the animation tools palette. If you can't see it, you can open it from (Window:Animation). If there is a tick mark next to Animation (indicating that it should be open) but you still can't see the animations palette, restore the default workspace (Window:Workspace:Default Palette Locations)
# Within the palette, select the delay between frames. To change the inter-frame delay for all the frames at once, select all the images in the animations palette (click-select the first image and then shift-click-select the last one), and press the downward arrow underneath any of the frames to open up a drop down menu which sets the timing for frame display.
# Select the loop options in the bottom left-hand corner of the Animation Palette.
# Finally export the file as a .swf (File:Export:Macromedia Flash SWF).


end tell
== Animated demo playback problems ==
</code>
*The recent versions of Quicktime (including Quicktime 7 and X) no longer play all my 2-frame movie demos correctly. When most of my movies are played with looping turned on, it only displays the first frame even though it's a two-frame movie. It does  display both frames when it is not set to loop. So a decent demo can be created by making a extended replication of the two frames, even though that yields a large file size. That's what I had to do for the demos for my TiCS article. I have also tried viewing the two-frame movies in looped fashion in the following applications that play quicktime movies:
*The recent versions of Quicktime (including Quicktime 7 and X) no longer play all my 2-frame movie demos correctly. When most of my movies are played with looping turned on, it only displays the first frame even though it's a two-frame movie. It does  display both frames when it is not set to loop. So a decent demo can be created by making a extended replication of the two frames, even though that yields a large file size. That's what I had to do for the demos for my TiCS article. I have also tried viewing the two-frame movies in looped fashion in the following applications that play quicktime movies:
**VLC: doesn't show both frames
**VLC: doesn't show both frames

Latest revision as of 17:35, 10 June 2015

Recent members

Alex Holcombe
• Ryo Nakayama



Technical

Skills Checklist
Python Programming
Psychopy/VisionEgg Installation Notes
R analysis,plot,stats
Statistics
Buttonbox
Buttonbox with photocell
Programming Cheat Sheets



Making animated gif on OSX, April 2014

  1. From Psychopy, export each frame of your animated display to a .png file. So you have an image sequence of 001.png, 002.png, ...
  2. Convert the png files using OSX's built-in sips, e.g. sips -s format gif ./*.png --out gifs to export them to a subdirectory called gifs
  3. Download and install the command-line utility gifsicle
  4. Use gifsicle to combine the gifs into a looping animated gif, e.g. gifsicle --loop *.gif > anim.gif

Additionally, I created an ad hoc instructions image to proceed the stimulus images by:

  1. Drawing it in Keynote and taking a screenshot (command-option-4) of just the screenshot part of it, yielding a .png file on the Desktop
  2. Converting the .png screenshot to gif, and simultaneously changing it to 96 x 96 pixels (JoV icon style) using sips -s format gif -z 96 96 screenShotOfInstructions.png --out gif
  3. Adding it into the numbered sequence of gifs by creating copies and calling them e.g. 0001.gif, 0002.gif (and then creating the animated gif)

Making animated demos

  • Jan2015 Using Psychopy you can save your animated display directly to an image sequence, using e.g. myWin.saveMovieFrames('exported/frame.png').

Then you can use "ffmpeg -i frames%03d.png out.webm" if the files have that form starting with 'frames' and followed by a 3-digit number to save as a webm movie file which will open in VLC (but at the wrong framerate, I couldn't get ffmpeg framerate manipulation to work)

  • Using Psychopy you can save your animated display directly to a movie file, using e.g. myWin.saveMovieFrames('exported/frame.mov'). But watch out for dissolving movie files problem THIS DOESN'T WORK AS OF 2015, SEE LINE ABOVE FOR NEW TECHNIQUE
  • Using Visionegg you can create a gif. Then you import the gif using Adobe Flash. You can adjust the speed manipulating the frame duration (Modify document). Finally, you export the file as a swf.
  • Patrick normally makes short movies a frame at a time in Keynote and then makes them into movies with Quicktime 7 Pro. In past years, Quicktime Pro could be used to create movies from a bunch of still frames. Quicktime Pro is no longer supported, however it is possible to still run Quicktime 7 Pro if you manage to find a Quicktime Pro-enabled computer (thanks Patrick Cavanagh for informing me of this).
  • Quicktime Player 7 (but not Quicktime Player) can still open image sequence, but not from GUI. Quicktime Player 7 can be found in Snow Leopard's Optional Installs. To use the functionality, have to do it with AppleScript/Automator.
  • Here's a script I made- drag the folder containing the image sequence onto the app: File:ImageSequenceToMovie.app.zip or a more user-friendly one from the internet called Sequimago
  • After the movie is made, you can change its playback speed with JES Deinterlacer (Project:Custom:Movie speed)

Illustrator to Photoshop way of making an animated GIF

  • Adobe CS5. Created a single image in Illustrator with each frame as a layer.
  • Exported as *psd and opened in Photoshop.
  • Ordered frames, durations etc. using the Animations palette.
  • Fading with the 'Tweening' function. (Creates new frames intermediate to selected frames. Can also handle motion and scaling I think.)
  • Exported using 'Save for web and devices...' with 16 colour palette to keep the file size down.

A Better Way?

Unfortunately the above technique doesn't always play at the appropriate frame rate. Instead, once you have modified your psychopy code to save frames as images, you can use Adobe software to animate them and export as a Flash .swf file.

Using Adobe Imageready

If you don't have Adobe Imageready on your computer (it will be in the Photoshop folder in your Applications folder), a copy has been burned to a DVD and left on the black shelving unit in the main lab area. To install it, simply drag and drop the folder from the disc to your Applications folder.

  1. Place all the images in one folder
  2. Import the folder of images to Imageready (File:Import:Folder as Frames)
  3. Find the animation tools palette. If you can't see it, you can open it from (Window:Animation). If there is a tick mark next to Animation (indicating that it should be open) but you still can't see the animations palette, restore the default workspace (Window:Workspace:Default Palette Locations)
  4. Within the palette, select the delay between frames. To change the inter-frame delay for all the frames at once, select all the images in the animations palette (click-select the first image and then shift-click-select the last one), and press the downward arrow underneath any of the frames to open up a drop down menu which sets the timing for frame display.
  5. Select the loop options in the bottom left-hand corner of the Animation Palette.
  6. Finally export the file as a .swf (File:Export:Macromedia Flash SWF).

Animated demo playback problems

  • The recent versions of Quicktime (including Quicktime 7 and X) no longer play all my 2-frame movie demos correctly. When most of my movies are played with looping turned on, it only displays the first frame even though it's a two-frame movie. It does display both frames when it is not set to loop. So a decent demo can be created by making a extended replication of the two frames, even though that yields a large file size. That's what I had to do for the demos for my TiCS article. I have also tried viewing the two-frame movies in looped fashion in the following applications that play quicktime movies:
    • VLC: doesn't show both frames
    • Movist: doesn't show both frames
    • Quicktime Player 7:doesn't show both frames
    • SimpleMovieX: doesn't show both frames. Claims to allow export to image sequence, but this gives an error message. Stills are in fact created, but hiding in a subdirectory of /private/var/folders/ . I used a recursive directory listing "ls -R" to find them. Can also create movie from image sequence, via manual Edit->Copy within Preview.app and Edit->Paste in SimpleMovieX
    • Firefox: shows both frames, but has "double-vision". Shows old movies that quicktime shows as blank, but also with 'double vision'
    • MacVCD: shows both frames!
    • Google Chrome: shows both frames! Stutters slightly when loop renews. Doesn't display old movies like "difftlocatn22frps.mov". Also, displays .mov files but doesn't display the same movie if it ends in .qt