Skip to content

Instantly share code, notes, and snippets.

@pigeonhill
Last active January 4, 2020 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pigeonhill/5a28408376932618d005d45e20101554 to your computer and use it in GitHub Desktop.
Save pigeonhill/5a28408376932618d005d45e20101554 to your computer and use it in GitHub Desktop.
Garry's Version of Danne's Script
-- movie tlapse
--[[
Movie intervalometer
Garry's version of Danne's script ;-)
Rev 0.32
--]]
console.hide()
menu.close()
delay_value = 0
start_time = 0
time_now = 0
interval_time = 0
stop_time = 0
expt = 0
interval_start = 0
interval_stop = 0
stop_recording = 0
menu.set("Movie","Presets","OFF")
menu.set("Movie","FPS override","OFF")
menu.set("Movie","RAW video","OFF")
menu.set("RAW video", "Rec trigger", "OFF")
menu.set("RAW video", "Pre-record", "0 frame")
menu.set("Presets", "frame burst", 0)
menu.set("Presets", "iso average", "OFF")
function shutter()
-- string in, number out
local r = menu.get("Expo","Shutter","")
local count = 0
while r == nil do -- just in case
r = menu.get("Expo","Shutter","")
count = count + 1
if count > 5 then break end
end
local e = r:find(',') -- accounts for movie mode
if e ~= nil then
r = r:sub(1,(e-1))
end
if r:find('"') ~= nil then
r = tonumber((r:gsub('"','')))
else
r = r:sub(2)
r = 1/(tonumber(r))
end
return r
end
function main()
expt = shutter() -- ML shutter value at start, ie may get changed later in the script
console.hide()
menu.close()
-- Refresh screen
camera.gui.mode = 2
msleep(200)
camera.gui.mode = 0
-- End this script if not a 5D3
if camera.model_short ~= "5D3" then
display.notify_box("Script only works works on a 5D3",2000)
msleep(2000)
return
end
-- Check a few things
if stop_time < interval_time then
display.notify_box("Adjust stop time, then rerun",2000)
msleep(2000)
return
end
if expt > 5 or expt < 0.15 then
display.notify_box("Adjust exposure, then rerun",2000)
msleep(2000)
return
end
while not lv.running do
display.notify_box("Switch on LV")
msleep(1000)
end
while lv.overlays ~= 2 do
display.notify_box("Press INFO to get to ML overlays")
msleep(1000)
end
menu.open() -- and switch on stuff
menu.set("Movie","Presets","Full-res LiveView")
menu.set("Movie","Shutter range","Full range")
menu.set("Expo","Expo. Override","ON")
menu.set("Expo","ExpSim","ON")
menu.set("RAW video","Aspect ratio","3:2")
menu.set("RAW video", "Rec trigger", "Half-shutter: pre only")
menu.set("RAW video", "Pre-record", "1 frame")
menu.set("Presets", "frame burst", 0)
menu.set("Presets", "iso average", "OFF")
menu.select("Movie","FPS override")
key.press(KEY.SET)
msleep(500)
menu.select("Movie","RAW video")
key.press(KEY.SET)
msleep(500)
menu.close()
camera.gui.mode = 2
msleep(200)
camera.gui.mode = 0
while camera.mode ~= MODE.MOVIE do
display.notify_box("\n\n".."Enable MOVIE mode")
msleep(1000)
end
msleep(1000)
while not menu.visible do
display.notify_box("Press TRASH")
msleep(1000)
end
while menu.visible do
display.notify_box("Expo = "..(menu.get("Expo","Shutter",""))..": OK?")
msleep(1000)
end
interval_time = 1000*tlmenu.submenu["interval"].value
stop_time = 1000*tlmenu.submenu["recording time"].value
while movie.recording == false do
display.notify_box("Press Movie Start")
msleep(1000)
end
display.notify_box("Started")
time_now = dryos.ms_clock
start_time = time_now
interval_start = time_now
stop_recording = (stop_time + start_time)
interval_stop = (interval_start + interval_time)
local count = 0
local remain1 = 0
local remain2 = 0
key.press(0)
-- The timelapse loop
while dryos.ms_clock < stop_recording do
time_now = dryos.ms_clock
if time_now > interval_stop then
remain1, remain2 = math.modf((stop_recording - time_now)/1000)
count = count + 1
display.notify_box(remain1.."s / "..count.."f")
-- reset interval
interval_stop = time_now + interval_time
key.press(KEY.HALFSHUTTER)
key.press(KEY.UNPRESS_HALFSHUTTER)
end
-- Press rec to stop
if key.last == KEY.REC then
display.notify_box("Terminated")
menu.set("Movie","Presets","OFF")
menu.set("Movie","FPS override","OFF")
menu.set("Movie","RAW video","OFF")
while camera.mode == MODE.MOVIE do
display.notify_box("\n\n".."Switch off MOVIE mode")
msleep(1000)
end
camera.shutter.value = expt
return end
end
-- stop recording
key.press(KEY.REC)
display.notify_box("Finished running")
menu.set("Movie","Presets","OFF")
menu.set("Movie","FPS override","OFF")
menu.set("Movie","RAW video","OFF")
while camera.mode == MODE.MOVIE do
display.notify_box("\n\n".."Switch off MOVIE mode")
msleep(1000)
end
camera.shutter.value = expt
end
tlmenu = menu.new
{
parent = "Movie",
name = "Timelapse",
help = "Movie timelapse",
submenu =
{
{
name = "run timelapse",
select = function(this) task.create(main) end,
help = "Records single frames in a MLV chunk",
},
{
name = "interval",
min = 2,
max = 600,
value = 10,
unit = UNIT.TIME,
update = function(this) tlmenu.value = this.value end,
help = "Default is 10 seconds",
},
{
name = "recording time",
min = 0,
max = 10000,
unit = UNIT.TIME,
help = "Stop recording after specified amount of time",
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment