Remote shooting issues - page 2 - General Discussion and Assistance - CHDK Forum

Remote shooting issues

  • 35 Replies
  • 6309 Views
*

Offline reyalp

  • ******
  • 13363
Re: Remote shooting issues
« Reply #10 on: 10 / January / 2015, 20:23:52 »
Advertisements
A data point I wasn't aware of: The MetaCtg assert only seems to happen (on some cameras) if the files are large (large size + fine / superfine). Noted in http://chdk.setepontos.com/index.php?topic=9523.msg112335#msg112335

This appears to be the case for sx160 and elph130
Don't forget what the H stands for.

Re: Remote shooting issues
« Reply #11 on: 01 / August / 2021, 10:13:20 »
I'm not sure if this is the right place since this topic is more than 6 years old, but it seems that I have exactly the same problem:
Since I want to turn off the sensor after the rawopint script finishes (using chdkptp rs, so no images are saved to the camera) to reduce the amount of head of the sensor outside of the capturing time, I would like to switch from record mode to playback mode.
I think that in playback mode, the camera has a problem with missing images on the SD card (for example, the counter of images is at 900 images, but there are actually no images on the SD card).

The camera freezes when the camera was in playback mode and the command rec is called. I'm still able to connect and disconnect to the camera but any command I call after this the camera gives the error message "ERROR: a script is already running".

Then when I try to killscript() the script, the camera crashes. I have attached a log file of the crash.
Strangely, this error is inconsistent, it only occurs about 50% of the time, maybe it's due to a timeout issue: if I repeat the sequence in a short period of time, nothing happens, but if there are more hours between one script run and another, it becomes more unstable.

If I manually delete all photos in playback mode via the Canon menu, the imaginary counter of photos stored on the SD card is back to 0 and the camera does not freeze for the next run.
I have read https://chdk.setepontos.com/index.php?topic=6231.820 and this thread but I am not sure how to solve the problem.
I tried imrm but it doesn't seem to have the same effect as manually deleting all images via the Canon menu.

How can I use the "event procedure named "PT_EraseAllFile"" for the g1x, or is that too complicated?

The sequence is:
rec
exec sys.sleep(2000)
luar set_zoom(28)
luar sleep(2000)
luar set_mf(1) --set focus to manual
luar set_focus(-1) --set focus distance to infinite
luar sleep(1000)
luar set_capture_mode(4) --set to AV mode
luar set_user_av96(416) --set AV value
luar set_ev(-128) --set EV value
luar set_iso_mode(100) --set ISO
luar set_raw_nr(1) --dark frame: 0=Auto 1=OFF, 2=ON
rs "D:/input/" -script=D:/rawopint_rs.lua -shots=10 -int=5
exec sys.sleep(1000)
d A/RAWOPINT.CSV "D:/sunset/"
exec sys.sleep(1000)
play
exec sys.sleep(2000)
exec con:call_function(0xff099f1c)
exec sys.sleep(1000)
imrm
exec sys.sleep(1000)
luar set_lcd_display(0)
« Last Edit: 01 / August / 2021, 11:18:27 by dolomiti_timelapse »
If you want to see a sunset or sunrise of Dolomiti Val Gardena shot with CHDK visit
Telegram: t.me/DolomitiTimelapse
Instagram: dolomiti_timelapse
YouTube: https://www.youtube.com/channel/UCEJHg--ujxLkjMrevJXh-Gw

*

Offline reyalp

  • ******
  • 13363
Re: Remote shooting issues
« Reply #12 on: 01 / August / 2021, 15:12:39 »
I'm not sure if this is the right place since this topic is more than 6 years old, but it seems that I have exactly the same problem:
Here is fine, though keeping it in the main thread for your project would also be fine.

Quote
The camera freezes when the camera was in playback mode and the command rec is called. I'm still able to connect and disconnect to the camera but any command I call after this the camera gives the error message "ERROR: a script is already running".
This doesn't sound like one of the classic remoteshoot issues previously discussed in this thread. It sounds like the rec command is hanging, which is odd since the CHDK script part should time out if the switch fails, but maybe the C function itself is hanging.

Quote
If I manually delete all photos in playback mode via the Canon menu, the imaginary counter of photos stored on the SD card is back to 0 and the camera does not freeze for the next run.
Have you tried adding -filedummy to the remoteshoot command?
This creates an empty file with the appropriate name on the camera for each remoteshoot, which avoids some of the known problems. You can then delete the files after switching to play with imrm.

Another thing I noticed in your script: You turn off the LCD with luar set_lcd_display(0) at the end. I would recommend turning it on before attempting to switch to rec. Using mode switch while the display is off causes problems in some cases. I would try this before other stuff, since IMO, it's a more likely match for your description.

Quote
How can I use the "event procedure named "PT_EraseAllFile"" for the g1x, or is that too complicated?
In general, you could look the address up in your platform/sub func_by_name.csv (http://subversion.assembla.com/svn/chdk/trunk/platform/g1x/sub/100e/funcs_by_name.csv for g1x 100e) and then use call_function like you do for the other one, but beware that you need to determine what parameters and other prerequisites there might be.
From https://chdk.setepontos.com/index.php?topic=11481.msg114716#msg114716, you need to pass it the address of a function that returns 0. If you are calling it directly, (using call_function or call_func_ptr, as opposed to with call_event_proc) the parameter actually needs to be a pointer to variable containing the address.

To set this up from chdkptp, you probably need to call malloc and poke to get the parameter set up.

The g1x disassembly looks like the function pointer might be optional, but calling directly, you'd need to pass it a pointer containing null, so you'd still need the malloc and poke. I don't have a camera of this generation to check.

edit:
Here's what the sequence for using PT_EraseAllFile would look like, using call_function. Note that it would be simpler if you get native calls enabled in CHDK CFG. I tested the equivalent on d10 and it appear to work, erasing all images in rec mode. However, I don't have a g1x so the below is untested.

All addresses are for g1x 100e
Code: [Select]
# allocate a buffer
# 0xff00420c,malloc
exec ptr=con:call_function(0xff00420c,4)
# set the contents of the buffer to the address of a function that returns 0
# in this case PT_ShootPicture, which is a "hook" eventproc that defaults to no-op.
# 0xff077f48,PT_ShootPicture_FW
# disassembly
# PT_ShootPicture_FW 0xff077f48
#    mov     r0, #0
#    bx      lr
exec con:execwait(string.format([[poke(%d,0xff077f48)]],ptr))
# call PT_EraseAllFile with the buffer
# 0xff077f50,PT_EraseAllFile_FW
exec con:call_function(0xff077f50,ptr)
# free the buffer
# 0xff004264,free
exec con:call_function(0xff004264,ptr)
« Last Edit: 01 / August / 2021, 17:21:42 by reyalp »
Don't forget what the H stands for.

Re: Remote shooting issues
« Reply #13 on: 02 / August / 2021, 07:57:18 »

This doesn't sound like one of the classic remoteshoot issues previously discussed in this thread. It sounds like the rec command is hanging, which is odd since the CHDK script part should time out if the switch fails, but maybe the C function itself is hanging.

It is also hanging in play mode when just trying to open the menu or clicking the left or right button.
(The screen was off, I was navigating with the chdkptp GUI and in the live mode stream there was only displayed "Unidentified Image")

Quote
Have you tried adding -filedummy to the remoteshoot command?
This creates an empty file with the appropriate name on the camera for each remoteshoot, which avoids some of the known problems. You can then delete the files after switching to play with imrm.

Yes I have tried -filedummy. Actually it isn't documented in https://github.com/tudelft/chdkptp/blob/master/USAGE.TXT
But I could not find the dummy files in the DCIM directory, I believe they have not been created?

Quote
Another thing I noticed in your script: You turn off the LCD with luar set_lcd_display(0) at the end. I would recommend turning it on before attempting to switch to rec. Using mode switch while the display is off causes problems in some cases. I would try this before other stuff, since IMO, it's a more likely match for your description.

I changed my code accordingly. The sunrise script worked fine. But as mentioned above I still got the camera freezing by clicking buttons in the play mode (and it is not possible to switch the camera off, I need to call killscript() before, since in my case it is not possible to retrieve the dummy battery from the camera).

Quote

edit:
Here's what the sequence for using PT_EraseAllFile would look like, using call_function. Note that it would be simpler if you get native calls enabled in CHDK CFG. I tested the equivalent on d10 and it appear to work, erasing all images in rec mode. However, I don't have a g1x so the below is untested.

All addresses are for g1x 100e
Code: [Select]
# allocate a buffer
# 0xff00420c,malloc
exec ptr=con:call_function(0xff00420c,4)
# set the contents of the buffer to the address of a function that returns 0
# in this case PT_ShootPicture, which is a "hook" eventproc that defaults to no-op.
# 0xff077f48,PT_ShootPicture_FW
# disassembly
# PT_ShootPicture_FW 0xff077f48
#    mov     r0, #0
#    bx      lr
exec con:execwait(string.format([[poke(%d,0xff077f48)]],ptr))
# call PT_EraseAllFile with the buffer
# 0xff077f50,PT_EraseAllFile_FW
exec con:call_function(0xff077f50,ptr)
# free the buffer
# 0xff004264,free
exec con:call_function(0xff004264,ptr)

 :o :o

Thanks! Without your code snippet, I never would have figured out how to do this. I will also try this out and see if it brings the desired effect, But before I need someone of my family to restart the camera (I think they did it at least 30 times in the last few days... :'( )

Yes I need the native calls enabled in CHDK CFG, but I need still some more time to set up and to build my own firmware. I found out that with set_config_value I'm not able to change the native call function setting.

Update:
I tested the code snippet and it works fine in the first 5 test runs I did, no more "Unidentified Image" in paly mode, and more important no freezing's of any kind! I believe this not only alleviated symptoms but treated the source of the problem. Let's see how it performs in the next few days. Hopefully with this genuine hack the reliability will be back as high as before!
« Last Edit: 02 / August / 2021, 11:11:57 by dolomiti_timelapse »
If you want to see a sunset or sunrise of Dolomiti Val Gardena shot with CHDK visit
Telegram: t.me/DolomitiTimelapse
Instagram: dolomiti_timelapse
YouTube: https://www.youtube.com/channel/UCEJHg--ujxLkjMrevJXh-Gw


*

Offline reyalp

  • ******
  • 13363
Re: Remote shooting issues
« Reply #14 on: 02 / August / 2021, 12:57:14 »
It is also hanging in play mode when just trying to open the menu or clicking the left or right button.
(The screen was off, I was navigating with the chdkptp GUI and in the live mode stream there was only displayed "Unidentified Image")
Hmm, this is odd. If you can describe the minimal steps needed to reproduce that would be helpful. Is it just
start camera with USB connected
rec
remoteshoot
play
attempt to use menu?

Quote
Yes I have tried -filedummy. Actually it isn't documented in https://github.com/tudelft/chdkptp/blob/master/USAGE.TXT
FWIW, that's not the official chdkptp source, it's someones very old random personal fork. The current official source is at https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk

You can also the same descriptions as appear in USAGE.TXT with help -v

Quote
But I could not find the dummy files in the DCIM directory, I believe they have not been created?
Yes you're right.  I didn't think of it when I posted, but -filedummy won't actually do anything when you use remoteshoot -script, because that replaces the camera side script that is responsible for creating the files. Sorry about that  :-[

You could borrow the from rlib_shoot_filedummy http://subversion.assembla.com/svn/chdkptp/trunk/lua/rlibs.lua but it would be a bit of work to integrate into rawopint.


Quote
I will also try this out and see if it brings the desired effect, But before I need someone of my family to restart the camera (I think they did it at least 30 times in the last few days... :'( )
FWIW, some people use a power supply controlled from a raspberry pi or microcontroller. Most cameras power on automatically if the power button is permanently held. This is how the http://escursionisticivatesi.it/webcam/ were set up. There are some additional caveats I can describe if you decide you want to go down that route.

Quote
Yes I need the native calls enabled in CHDK CFG, but I need still some more time to set up and to build my own firmware. I found out that with set_config_value I'm not able to change the native call function setting.
I believe the chdkde builds (https://forum.chdk-treff.de/download_dev.php) default to native calls enabled. I can also provide you with builds if you want.

Quote
I tested the code snippet and it works fine in the first 5 test runs I did, no more "Unidentified Image" in paly mode, and more important no freezing's of any kind! I believe this not only alleviated symptoms but treated the source of the problem.
Great, glad to hear it worked.
Don't forget what the H stands for.

Re: Remote shooting issues
« Reply #15 on: 03 / August / 2021, 12:54:11 »
It is also hanging in play mode when just trying to open the menu or clicking the left or right button.
(The screen was off, I was navigating with the chdkptp GUI and in the live mode stream there was only displayed "Unidentified Image")

Hmm, this is odd. If you can describe the minimal steps needed to reproduce that would be helpful. Is it just
start camera with USB connected
rec
remoteshoot
play
attempt to use menu?

Yes:
start with power source and USB connected.
(normally after a restart of the camera the camera has no freezing's when navigating in play mode)
wait for sunset/sunrise
run chdkptp script attached.
wait for sunset/sunrise
run chdkptp script attached (here (on the second run) the camera most of the times freezes).
repeat...

yesterday I could run as many runs I wanted(with -shot=5 and -int=5 instead of -shots=900 -int=15 in line 30) the runs where all fine!
And this morning the script stopped at the "change to rec mode" message and did not reached line 9 where message "zoom set to 28%" is displayed.

Maybe I need to wake up the camera after some hours chilling in play mode?

Quote
FWIW, some people use a power supply controlled from a raspberry pi or microcontroller. Most cameras power on automatically if the power button is permanently held. This is how the http://escursionisticivatesi.it/webcam/ were set up. There are some additional caveats I can describe if you decide you want to go down that route.

I am not a fan of this approach as I believe it would increase complexity and error proneness. Also, the microcontroller needs to be accessible via USB since I only access the entire project through Anydesk. AFAIK, all the projects I have done with microcontrollers have required me to be on site to update the code on the microcontroller, etc.

Quote
I believe the chdkde builds (https://forum.chdk-treff.de/download_dev.php) default to native calls enabled. I can also provide you with builds if you want.
Thanks!
Native calls are not per default enabled in the DE build but the setting remains enabled if the camera is rebooted, which is great!
My brother updated the firmware of the camera to CHDK_DE_g1x-100e-1.6.0-6007-full.

Again the chdkptp script works without problems when little time has elapsed between the runs. I have now tested it from a few seconds to about 30 minutes.

FYI:
The first time I run rawopint for a test run I got an error after the first and only photo was transferred to the pc:
WARNING: capture_get_data error timed out
ERROR: timed out
ERROR: error on line 30
I run the chdkptp script again without any changes and it work from the second run on fine.
« Last Edit: 03 / August / 2021, 14:21:59 by dolomiti_timelapse »
If you want to see a sunset or sunrise of Dolomiti Val Gardena shot with CHDK visit
Telegram: t.me/DolomitiTimelapse
Instagram: dolomiti_timelapse
YouTube: https://www.youtube.com/channel/UCEJHg--ujxLkjMrevJXh-Gw

*

Offline reyalp

  • ******
  • 13363
Re: Remote shooting issues
« Reply #16 on: 03 / August / 2021, 23:49:59 »
And this morning the script stopped at the "change to rec mode" message and did not reached line 9 where message "zoom set to 28%" is displayed.
So, the same symptom as before, hanging in 'rec', which previously seemed to be fixed with the PT_EraseAllFile code?
Quote
Maybe I need to wake up the camera after some hours chilling in play mode?
I'm not aware of anything like that. The only power saving type things I'm aware of in playback mode is lens retract and the option of the camera turning off completely after some time. The CHDK "disabled LCD off" option also affects the power off behavior.

Maybe try without the lens retract override? It doesn't seem like it should be, but it is poking internals that have to do with sitting in play mode.

Does the computer stay on all the time, or is it powered off or in sleep in between?
Quote
I am not a fan of this approach as I believe it would increase complexity and error proneness.
Yes, it definitely adds complexity, especially to develop remotely.

Quote
Native calls are not per default enabled in the DE build but the setting remains enabled if the camera is rebooted, which is great!
Hmm, that should be true for the standard builds as well.


Quote
Again the chdkptp script works without problems when little time has elapsed between the runs. I have now tested it from a few seconds to about 30 minutes.

FYI:
The first time I run rawopint for a test run I got an error after the first and only photo was transferred to the pc:
WARNING: capture_get_data error timed out
ERROR: timed out
ERROR: error on line 30
I run the chdkptp script again without any changes and it work from the second run on fine.
That basically means either the camera didn't take a picture in the expected time (default 20 seconds, I think). Very hard to guess what happened without additional debugging.

It could also happen if the flag were cleared, but it's hard to see how that would fail and then work with no script changes.
Don't forget what the H stands for.

Re: Remote shooting issues
« Reply #17 on: 04 / August / 2021, 02:58:36 »
So, the same symptom as before, hanging in 'rec', which previously seemed to be fixed with the PT_EraseAllFile code?
Yes, also this morning it was hanging in 'rec'.

Quote
I'm not aware of anything like that. The only power saving type things I'm aware of in playback mode is lens retract and the option of the camera turning off completely after some time. The CHDK "disabled LCD off" option also affects the power off behavior.

Maybe try without the lens retract override? It doesn't seem like it should be, but it is poking internals that have to do with sitting in play mode.

Does the computer stay on all the time, or is it powered off or in sleep in between?
Yes I will try now without retract override. Is there maybe a way to undo the retract override changes before changing to rec?
The PC is the hole time powered on.

Perhaps @c_joerg has a bit more experience with this behaviour, as he seems to be using the g1x as I would like, with Lens Retraction Override and Wait in Play Mode and perhaps also using Rawopint.

I think he doesn't use remote shoot... Maybe I could also try to shoot all the images on the sd card and then transfer them to the pc?
Also the idea of creating a dummy file as suggested from you earlier could be worth an attempt? Is it possible to use the lib (functions) directly in the rawopint code or do I have to copy the right code line into the rawopint code?
« Last Edit: 04 / August / 2021, 03:03:13 by dolomiti_timelapse »
If you want to see a sunset or sunrise of Dolomiti Val Gardena shot with CHDK visit
Telegram: t.me/DolomitiTimelapse
Instagram: dolomiti_timelapse
YouTube: https://www.youtube.com/channel/UCEJHg--ujxLkjMrevJXh-Gw


*

Offline reyalp

  • ******
  • 13363
Re: Remote shooting issues
« Reply #18 on: 04 / August / 2021, 12:57:23 »
Yes I will try now without retract override. Is there maybe a way to undo the retract override changes before changing to rec?
I don't know, but it's something we can investigate if it turns out to be the cause. I'd be somewhat surprised if it is the cause, but I don't have better ideas.

Quote
I think he doesn't use remote shoot... Maybe I could also try to shoot all the images on the sd card and then transfer them to the pc?
You should be able to do that using a slight modification of your existing rawopint_rs wrapper. I think all you need to change is to hardcode anything that's currently initialized from rs_opts.* and then run like
Code: [Select]
luar < file.lua
then download the images with imdl. If you delete the files using imdl -rm or imrm I'd generally suggest doing that in playback mode.

Quote
Also the idea of creating a dummy file as suggested from you earlier could be worth an attempt? Is it possible to use the lib (functions) directly in the rawopint code or do I have to copy the right code line into the rawopint code?
I think saving on the camera is the better test, but if that solves it then trying filedummy would be worthwhile.

Looking at the CLI code
Code: [Select]
con:exec('rs_opts='..opts_s..' '..shootscript,{libs={'rs_shoot'},execinfo=execinfo})
it includes the rlibs when using -script, so you should just need to call rlib_shoot_filedummy() at the appropriate point in rawopint. I think I would put it just before hook_raw.continue()
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1129
Re: Remote shooting issues
« Reply #19 on: 05 / August / 2021, 03:43:53 »
Perhaps @c_joerg has a bit more experience with this behaviour, as he seems to be using the g1x as I would like, with Lens Retraction Override and Wait in Play Mode and perhaps also using Rawopint.

About my experience:
- I use G1x with Lens Retraction Override only for a short test
- I never used Lens Retraction Override with remote shoot
- I never used Lens Retraction Override with rawopint
- I run a script with Lens Retraction Override on SX50 without any problems over 24 days

M100 100a, M3 101a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

 

Related Topics