CHDK Wiki
Register
Advertisement

Canon P&S cameras saving files on a FAT formatted SD card are limited to a 4G file size as a result of using that format.

The following uBASIC script can be used to restart video recording periodically to get around this 4G file size limit. It creates a new video file each time it restarts allowing recording until the SD card fills with only a brief gap between each video file. Save it to your SD card with a .bas extension (ex: video.bas).

@title MultiMovie
@param x time per file in seconds 
@default x 590
   f=0
   print "recording started..."
   press "shoot_half" 
   sleep 1500

:new
   f=f+1 
   click "shoot_full" 
   if f=1 then release "shoot_half"
   print "file number: ";f
   s=get_tick_count 
 
:loop
   t=(get_tick_count-s)/1000
   if t>x then goto "reload" 
   print "file number: ";f 
   print "time left: ", x-t, "s"  
   sleep 900 
   goto "loop"

:reload
   print "reloading..." 
   click "shoot_full" 
   print "waiting for video..."

:waitloop
   q=get_movie_status 
   if q=1 then goto "new" 
   print "status:",q 
   sleep 100 
   goto "waitloop"

Modified from a script written by outslider and posted on the CHDK forum by Vash11779 .



Listed below is a more sophisticated script written in Lua by msl.

This script allows you to turn the backlight on & off by pressing the DISP button, halt the script by pressing the MENU button and restart recording by pressing the SET button.


Save it to your SD card with a .lua extension (e.g. vid_ext.lua).

--[[
********************************
Licence: GPL
(c) msl 2012/04/25
********************************
@title Video extended
@param a Auto (re)start [1]
@default a 1
@param b Time in s 0=max
@default b 0
]]

function StartStopVideo()
    local rec, vid = get_mode()
    local vid_button = get_video_button() -- get_video_button() available changeset 1829
    if rec == true and vid == true  and vid_button == 0 then
        press("shoot_full")
        sleep(300)
        release("shoot_full")
    elseif rec == true and vid_button == 1 then
        click("video")
    end
end

function restore()
    if get_movie_status() == 4 then StartStopVideo() end
    cls()
    set_console_layout(0,0,25,5)
    set_console_autoredraw(1)
end

if a<0 or a>1 then a=0 end
if b<0 then b=0 end
restart = a
record_time = b
BL=0
TC=false
time_start = 0
time_now = 0

set_console_layout(9,1,39,6)
if restart==1 then
    cls()
    print("Automatic Video (Re)Start")
    if record_time > 0 then print("record time:", record_time, "s") end
    sleep(2000)
end
set_console_autoredraw(0)

while true do
    if TC == false and record_time > 0 then
        time_start = get_tick_count()
        TC = true
    end
    cls()
    if restart ~= 1 then print("[SET] Start/Stop Video") end
    print("[DISP]  On/Off Backlight")
    print("[MENU]  End")
    console_redraw()
    wait_click(900)
    if is_pressed("display") then
        set_backlight(BL)
        if BL == 1 then BL=0 else BL=1 end
    end
    if is_pressed("set") and restart ~= 1 then
        StartStopVideo()
    end
    if is_pressed("menu") then
        restore()
        break
    end
    if TC == true and record_time > 0 then
        if get_tick_count() - time_start >= record_time * 1000 + 2000 then
            StartStopVideo() -- stop video
            TC = false
        end
    end
    status = get_movie_status()
    if (status < 4 or status > 4) and restart == 1 then
        StartStopVideo()
        cls()
        print("Start recording")
        console_redraw()
        sleep(5000)
        if BL == 1 then set_backlight(0) end
    end
end
Advertisement