Video start and stop via script - Script Writing - CHDK Forum

Video start and stop via script

  • 4 Replies
  • 5094 Views
Video start and stop via script
« on: 17 / February / 2012, 17:12:14 »
Advertisements
Hello,

I tried to make a little script in uBASIC to automatically start a new Video after the last one finished after 10 min. on my IXUS120 / SD940 .
Every video gets stopped automatically by the camera after 10 minutes so I thought that I could start a video with "shoot", let the camera wait for 10min and 8 sec and start a new video with "shoot".

But the script only starts the first video and than does nothing.

Code: [Select]
@title video start stop

print "video start stop started"

t=605000

sleep 1000

:shot
  print "Shot number", n
  shoot
  n=n+1
  sleep t
  print "Shot number", n
  shoot
  n=n+1
  sleep t
  print "Shot number", n
  shoot
  n=n+1
  sleep t
  print "Shot number", n
  shoot
  n=n+1
  sleep t
  print "Shot number", n
  shoot
  n=n+1
  sleep t
  print "Shot number", n
  shoot
  n=n+1
  sleep t
  print "Shot number", n
  shoot
  n=n+1
  sleep t
 

:end
  print "shooting finished"
  sleep 1000
  end

It is my first try to do a script . I hope someone can help

Greetings from Germany

*

Offline reyalp

  • ******
  • 14128
Re: Video start and stop via script
« Reply #1 on: 17 / February / 2012, 17:17:05 »
You should use click "shoot_full" or similar rather that shoot. shoot tries to do some still image specific stuff.

Here's an example of this in lua
Code: [Select]
--[[
@description video interval
@param a rec minutes
@default a 0
@param b rec seconds
@default b 10
@param c sleep seconds
@default c 2
@param d count
@default d 2
--]]

rec_time= a*60*1000 + b*1000
sleep_time = c*1000

-- need to wait a bit before start
sleep(1000)
while d > 0 do
press("shoot_half")
sleep(500) -- give AF a chance
press("shoot_full")
release("shoot_full")
release("shoot_half")
sleep(rec_time)
click("shoot_full")
sleep(sleep_time)
d = d - 1
end
Don't forget what the H stands for.

Re: Video start and stop via script
« Reply #2 on: 17 / February / 2012, 17:27:45 »
Thanks mate, it works like a charm.  :)

Thank you so much.



Greetings from Germany

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Video start and stop via script
« Reply #3 on: 17 / February / 2012, 17:40:53 »
The video recording stops automatically when recording reached the maximum time or maximum file size. You can also make a loop and check the video recording status with
Code: [Select]
get_movie_status()
-- 0=stop,
-- 1=pause
-- 4=recording
-- 5=saving

msl
CHDK-DE:  CHDK-DE links

Re: Video start and stop via script
« Reply #4 on: 17 / February / 2012, 18:08:45 »
I added the set_backlight (0) command to the script. Now it is perfekt for long shots.
@msl I will see what I can do with that.

Thanks.



 

Related Topics


SimplePortal © 2008-2014, SimplePortal