Hello,
I’m experimenting to make datamoshing video’s, a little bit like so: http://youtu.be/t1f3St51S9I?t=17s
First I prepare the video, and then I’m moving the cursor backwards and forwards in various patterns.
The script I wrote does something like this: System events tells quicktime to move 5 frames forward, 5 frames backwards, make a screenshot and advance one frame. This small code loops over and over.
When I do short test-clips of a few hundred frames, everything goes fine, but when I let the computer work overnight on thousands of frames, applescript always stops somewhere in between with the error “System events got an error: Connection is Invalid”.
In ‘Activity Monitor’ I see that applescript is taking up all the available memory (the computer has 8Gb of Ram, and applescript took up 5.5Gb. That combined with the other memory usage, almost no free memory was available), making the computer extremely slow. Apparently the script accumulates memory over time. I have no idea why this is happening, but I hope this problem is connected to the invalid connection error.
I thought by increasing the wait-time in between every command I would increase the reliability, but that doesn’t seem to be the case.
Is there something I can try to make it more stable?
Here’s the full script I’m currently working on:
(* An Van Dienderen: Letter Home: Datamosh
The script assumes there is a quicktime file opened in QuictTime Player 7
see for keyboard codes: http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
Cloud wiggle:
1. make a pixel-cloud by playing forward and backwards a part of the video
2. play a part of the video in a regular fashion to allow new pixel-information to go over the pixel cloud, thus creating a combination of glitch-esthetics and regular video footage.
*)
------ USER VARIABLES
set filename to "cloud_10_"
set expected_fps to 25
set cloud_inpoint to 3680 -- (framenumber) in-punt voor het maken van de cloud
set cloud_size to 30 -- (framecount)how much frames will be used to make the pixel-wiggle-cloud
set run_inpoint to 11121 -- (framenumber) in-punt voor het stukje gewoon afspelen
set run_size to 40 -- (framecount) how much frames will be used to make the regular-run
set run_outpoint to 80880 -- (framenumber) to stop the process. Can be used to define a single scene in a larger video
------ SCRIPT VARIABLES
set cursor to 0
set repetition to 0
set wait to "sleep .03"
set loc to "/Users/herculeslab/Desktop/screenshots/" -- screenshots folder
property n : 0
----- initialisation
tell application "QuickTime Player 7" to activate
tell application "System Events"
tell process "QuickTime Player 7" to set frontmost to true
set n to 0
tell application "QuickTime Player 7"
set movie_timescale to time scale of document 1 -- reset each time to frame 1
set multiplier to round (movie_timescale / expected_fps)
set current time of document 1 to 0
end tell
----- / initialisation
repeat while cursor ≤ run_outpoint
-- reset
tell application "QuickTime Player 7" to set current time of document 1 to 0
-- make a pixel-cloud
repeat with i from cloud_inpoint to (cloud_inpoint + cloud_size) by 1
tell application "QuickTime Player 7" to set current time of document 1 to (i * multiplier)
do shell script wait
end repeat
do shell script wait
repeat with i from ((cloud_inpoint + cloud_size) - 1) to cloud_inpoint by -1
tell application "QuickTime Player 7" to set current time of document 1 to (i * multiplier)
do shell script wait
end repeat
do shell script wait
-- play a part of the video regularly
repeat with i from (run_inpoint + repetition) to (run_inpoint + repetition + run_size) by 1
set cursor to i
tell application "QuickTime Player 7" to set current time of document 1 to (i * multiplier)
do shell script wait
end repeat
do shell script wait
do shell script wait
do shell script wait
do shell script wait
-- make screenshot
set n to n + 1
set picPath to (loc & filename & n & ".png") as string
do shell script "screencapture " & quoted form of picPath
-- & " &> /dev/null &" : geen response waarop applescript zal wachten
set repetition to repetition + 1
end repeat
beep
do shell script "sleep .5"
end tell
thanks a lot in advance!
Elias