rawopint vs ptp - Script Writing - CHDK Forum

rawopint vs ptp

  • 15 Replies
  • 9128 Views
*

Offline reyalp

  • ******
  • 14082
rawopint vs ptp
« on: 27 / March / 2018, 16:54:49 »
Advertisements
This was sent in PM, but seems more suited for general discussion
Quote
i´m trying to make a timelapse with my IXUS 750. Rawopint works great on the camera and i also can start it over a raspberry with chdkptp and .loadfile. The only problem i´ve got is the SD card. The "old" IXUS 750 only works with "standard" sd cards, so i´m limited to 2gb.
My solution/wish with chdkptp:
start rawopint and take one picture (loadfile)
download the picture to the raspberry (imdl)
delete pictures (imrm)
restart after x seconds

Question:
The values get lost when the rawopint script ends. Is it possible to save and load the values from previous made pictures?
maybe from rawopint.csv, or do you know an other workaround?
That's an interesting question and an application I hadn't considered.

This capability doesn't currently exist. If you have some coding skill, you could look at the simulation code. I haven't kept it up to date with rest of rawopint so it doesn't currently work, but it does show loading the values from a rawopint.csv log. rawopint treats the first exposure specially so loading the values is only part of the solution.

Some other suggestions:
* Instead of 1 shot a time, do ~1000 images (or whatever your card can hold if it's less). There would still be some gaps and variation between segments, which may or may not be OK for your purposes

* Get a camera that supports SDHC. You should be able to pick up a slightly more modern camera on ebay, amazon etc. pretty cheap. Note however that if you get more than about 1000 images on a card, PTP control and transfer becomes impossible (this is a limit of the Canon firmware, it just displays "connection error")

* Convert rawopint to use PTP remote capture, so it saves directly to the raspberry pi. This should only require minimal changes in rawopint (mostly just calling init_usb_capture), but you'd need to write supporting code on the chdkptp side to receive the images. I might be convinced to add the chdkptp side support for this, since a general "receive images from a camera side script" option seems like it would be useful. This might still need to switch to playback or reboot periodically to avoid the 1000 image limit.

* Use a wifi enabled card that supports auto delete. However, I suspect most are SDHC these days.

* 4GB SD cards (not SDHC) cards do exist, so if you don't need a lot more, that could be an option. They might be comparatively expensive and hard to find.

* If you don't need the kind of speed and exposure control rawopint provides, you could try the pi controled multilapse script discussed in https://chdk.setepontos.com/index.php?topic=13261.0 or waterwingz "ultimate" https://chdk.setepontos.com/index.php?topic=9969.0 which has some options for periodic PTP downloading.
Don't forget what the H stands for.

Re: rawopint vs ptp
« Reply #1 on: 29 / March / 2018, 15:50:29 »
Hi reyalp,

thanks for your help.
Of course, getting an other cam from ebay would be the easiest way, but i was hoping I could use my cam from the drawer.
Every wifi card I found is SDHC and a 4gb SD card isnt a great help.

I wanted to capture a sporting event, which will last for about 6 hours. So it will start at daylight and will end with floodlight. Thats why I want to use rawopint.

Unfortunately, I have no idea of programming.

*

Offline reyalp

  • ******
  • 14082
Re: rawopint vs ptp
« Reply #2 on: 29 / March / 2018, 23:32:43 »
Of course, getting an other cam from ebay would be the easiest way, but i was hoping I could use my cam from the drawer.

I wanted to capture a sporting event, which will last for about 6 hours. So it will start at daylight and will end with floodlight. Thats why I want to use rawopint.
If you want to use rawopint and don't want to do any significant programming, the 1000 images at a time option seems like the most viable. You would still need a small chdkptp side script to run it, but it would just need to run the loadfile and imdl -rm ... in a loop. If you use = for loadfile command, chdkptp will wait for the script to finish.

I'm a bit surprised you got rawopint to work with loadfile: The CHDK menu options values aren't set when you start a script over PTP, so I would expect you to need to define a lot of them before the loadfile command, or edit the script to set them. Did you do something like this?

I may still look into making it work with remote shoot, when would you need this?

Some other comments and questions:
By default, rawopint would let the exposures get quite long, which might not be good if you want to capture action. You can adjust the exposure and ISO limits, but the low light performance of this camera isn't going to be great.

If you don't need the smooth exposure change that rawopint provides, the other scripts I mentioned might be better options

Are you planning to use external power? Your camera probably won't run 6 hours on the standard battery.

Do you want to shoot at some specific interval, or as fast as possible?

Are you planning to make a timelapse movie of the images, or do something else with them?
Don't forget what the H stands for.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: rawopint vs ptp
« Reply #3 on: 30 / March / 2018, 07:29:53 »
I'm a bit surprised you got rawopint to work with loadfile: The CHDK menu options values aren't set when you start a script over PTP, so I would expect you to need to define a lot of them before the loadfile command, or edit the script to set them. Did you do something like this?
I have made a special script version for Bluestone_7 with "normal" variables instead script header.

All relevant facts have already been discussed in the German forum: http://forum.chdk-treff.de/viewtopic.php?p=31646#p31646
That's why also my request to remoteshoot and the interval option: https://chdk.setepontos.com/index.php?topic=13385.0

I think the best possibility for this task with the Ixus750 is chdkptp with the remoteshoot function on a Raspi or another small PC and an external power supply.

msl
CHDK-DE:  CHDK-DE links


*

Offline reyalp

  • ******
  • 14082
Re: rawopint vs ptp
« Reply #4 on: 30 / March / 2018, 13:32:52 »
I have made a special script version for Bluestone_7 with "normal" variables instead script header.

All relevant facts have already been discussed in the German forum: http://forum.chdk-treff.de/viewtopic.php?p=31646#p31646
Thanks, that makes sense. I thought about making lua code to load params in a rawopint.0 file (really, just strip the # and run it as lua), but it's impossible to recover the table values without also parsing the script header  :(

Quote
I think the best possibility for this task with the Ixus750 is chdkptp with the remoteshoot function on a Raspi or another small PC and an external power supply.
Yes, if you don't need rawopint exposure control, remoteshoot with an interval should be pretty simple.

One thing I'm not sure about is whether the 1000 image "communication error" limit (https://chdk.setepontos.com/index.php?topic=11032.msg107935#msg107935) is an issue using remoteshoot.

I suspect it may only come into play if you switch to playback or restarting with too many images present, but I don't recall actually testing it.
Don't forget what the H stands for.

Re: rawopint vs ptp
« Reply #5 on: 30 / March / 2018, 13:36:04 »
msl has already helped me with the variables, my attemt to set the variables in chdkptp/loadfile or in rawopint.lua failed.
Quote
Are you planning to use external power? Your camera probably won't run 6 hours on the standard battery.
I made a battery adapter with a USB mini-B connector.
Quote
Do you want to shoot at some specific interval, or as fast as possible?
Are you planning to make a timelapse movie of the images, or do something else with them?
As fast as possible. The interval with picture download will be about 3-4 seconds. So 1 real minute will be 1 second in the movie.
Quote
I may still look into making it work with remote shoot, when would you need this?
4 weeks would be good, 2 weeks would be great (for testing). I do not want to annoy you, you certainly have something more important to do.
I thought rawopint would be the best choice for changing lightning conditions, but I will do some tests with ultimate and remoteshoot.

Thanks for your help

*

Offline reyalp

  • ******
  • 14082
Re: rawopint vs ptp
« Reply #6 on: 01 / April / 2018, 19:44:19 »
edit:
The most recent version of the attached script is available from chdkptp svn in the extras directory: https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk/lua/extras/rawopint_rs.lua

The chdkptp changes are in the official builds, so there's no need to download chdkptp lua files.
-----

I added support for using an external script to shoot with chdkptp remoteshoot. This turned out to be both simpler and better than I expected, so thanks for suggesting it  :D

To use it, you need to replace the .lua files in your chdkptp install with the ones from: https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk

You can download a zip using the button next to "checkout"
(edit 2019: the changes are in the official builds now)

To use it, use
remoteshoot -script=<name of script file on your PC>

For this to work well, the script and remoteshoot have to expect the same number of shots, and the interval between shots. To accomplish this, the camera side options from remoteshoot are passed to the script, in an array called rs_opts.

I've attached an example based the script that msl posted. Note that this file should be on the PC (or pi) where chdkptp is running, and it expects the original rawopint to be installed on the camera, not msl's modified version.

With this, you should just be able to use something like
Code: [Select]
rs -script=rawopint_rs.lua -shots=10000 -int=4

Note there is no "clean" way to stop this before all the shots are done. If you kill the camera side script in the usual way with the menu key, chdkptp should timeout after a while. If you kill chdkptp, rawopint will probably continue shooting but save the files on the SD.

edit:
I successfully shot 1500 shots using this method with sx710. Note if you shoot thousands of images, you need to make sure the file names are unique. You can use the shotseq substitution in the remoteshoot command to do this, e.g. to number the images with 5 digit sequential numbers, you could use
Code: [Select]
rs -script=rawopint_rs.lua -shots=10000 -int=4 IMG_${shotseq,%05d}${ext}

« Last Edit: 23 / December / 2019, 01:05:01 by reyalp »
Don't forget what the H stands for.

Re: rawopint vs ptp
« Reply #7 on: 02 / April / 2018, 09:46:42 »
Hi reyalp,

you are the best, thanks for the quick implementation.
I tested it on my Win7 PC and shot 1500 pictures, with an interval of 2 seconds. (no "communication error" at 1000 pictures)

just some questions:
If I want to change the values (for example "Display off"), do I change the rawopint_rs.lua file?
Can it shoot unlimited pictures (0=unlimited)? Or should I set -shots=999999 and kill the camera to stop the script?
I tried:
Code: [Select]
-shots=0
Quote
ERROR: invalid shot count

I´m using chdkptp r795


*

Offline reyalp

  • ******
  • 14082
Re: rawopint vs ptp
« Reply #8 on: 02 / April / 2018, 12:04:24 »
If I want to change the values (for example "Display off"), do I change the rawopint_rs.lua file?
Yes.
Quote
Can it shoot unlimited pictures (0=unlimited)? Or should I set -shots=999999 and kill the camera to stop the script?
You need to do the second one, remoteshoot doesn't understand 0. Even if it did, the result would be identical, you'd still have to kill the script on the camera.

If you know how much time you want to shoot for, you could calculate shots from your interval, assuming its long enough for the camera to actually keep up. E.g. 6 hours, 2 sec interval =6*60*60/2=10,800

If the exposure gets long as it gets dark, this can affect the interval. 2 seconds might work in daylight, but if exposure becomes 1 second each shot might take more.
Don't forget what the H stands for.

Re: rawopint vs ptp
« Reply #9 on: 02 / April / 2018, 14:48:45 »
If the exposure gets long as it gets dark, this can affect the interval. 2 seconds might work in daylight, but if exposure becomes 1 second each shot might take more.

I understand that, but it will shoot as fast as possible or will it stop, crash,...?

 

Related Topics