Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!! - page 2 - Feature Requests - CHDK Forum supplierdeeply

Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!

  • 213 Replies
  • 116790 Views
Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #10 on: 02 / August / 2010, 12:36:48 »
Advertisements
How many codes would you have to write and where?


What does your question mean, I cannot understand it ?

Do yourself a favour, buy a Panasonic FZ38 or similar, like I have.

Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #11 on: 09 / August / 2010, 13:52:18 »
Aket - please take the trouble to re-read your posts and the replies. So far you've managed to be unpleasant to two people (note that they are both "Guru Members") who have freely given a great deal of their time to (a) work on CHDK and (b) answer lots of questions politely here. As Reyalp said, this thread is so people can make suggestions - not demands. And no matter how many people ask for something, when they are asking (as you were) for something for nothing, whether they get it depends on the goodwill of people like Reyalp and Whim, not how loudly or aggressively they ask.

And by the way, there's lots of information here and on the Wiki about what you need to know to do development. As you say, "it looks pretty hard".

Got it, sorry I just thought it wasn't so difficult for the guys who know the code, that's why I asked loudly.

How many codes would you have to write and where?


What does your question mean, I cannot understand it ?

Do yourself a favour, buy a Panasonic FZ38 or similar, like I have.

The question is pretty clear and I think we had already too much negativity in here, right? Great suggestion but I already knew of the camera, thanks for helping developing the firmware, but there's a reason we're in Canon forum. Thanks, bye!
« Last Edit: 09 / August / 2010, 13:57:22 by Aket »

Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #12 on: 21 / August / 2010, 15:34:56 »
i'd love this feature too! i'm not a programmer but i have cash. so who wants to get paid?
(hows that for offering my help?)

*

Offline reyalp

  • ******
  • 14080
Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #13 on: 21 / August / 2010, 17:31:05 »
i'd love this feature too! i'm not a programmer but i have cash. so who wants to get paid?
(hows that for offering my help?)
If you are prepared to offer market value for programmer time, I suggest you just buy a DV system with the features you need. It will likely be significantly cheaper, and you will end up with a system much better suited to producing quality video. Also, as I mentioned before, there's no guarantee that all the requested features can be implemented in CHDK. I would guess that it probably can be done, and might even be fairly simple, but no one knows until they've done the research. Just doing that research is likely to take substantial time.

Again, I'm not trying to discourage people from asking for features, or saying this is a bad idea or is not a worthy feature. Quite the opposite: It's a good idea and quite a few people would obviously like to have it.

What I am trying to do is explain why merely asking for something doesn't have a lot of influence on whether it gets done or not. Think about it this way: If some random stranger asks you to spend hundreds or thousands of dollars worth of time on their project, is the major factor going to be how much they want it, or how interesting/rewarding you find the project ?

edit:
Or maybe you'll get lucky and someone who has already spent the time will tell you how to do it  :D
« Last Edit: 21 / August / 2010, 19:15:55 by reyalp »
Don't forget what the H stands for.


*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #14 on: 21 / August / 2010, 18:27:00 »
IMO,  manual control of shutter speed and aperture in video can be done using lua script (with event procedures).
1) To turn off auto-exposure and lock ISO, Tv, Av to their current values use ExpCtrlTool.StopConti() function.
2) To change shutter speed, use SetAE_ShutterSpeed() fuction.  Remember that exposure time cannot exceed 1/fps.
3) To change apreture, use MoveIrisToAv() fuction. Sometimes it can crash camera.
4) I don't know how to change ISO. Maybe SetAE_CdsGainValue() function?
5) To turn on auto-exposure back, use ExpCtrlTool.StartConti() fuction.

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #15 on: 22 / August / 2010, 07:28:10 »
edit: since this is in the feature request section instead of the devel one, a disclaimer is probably in order: do not try the code below if you don't know what you're doing :)

Looks like these event procedures aren't registered by default on a570 (call_event_proc always returns -1).

ExpCtrlTool.* event proc table is at 0xffd1f1d4 for a570 100e, function that registers them is at 0xffd1f704. That one gets called from Capture.Create (among a whole lot of other stuff, hopefully nothing too bad).

SetAE_ShutterSpeed eventproc table is at fff345dc, but I couldn't figure out how to register that one so I called it by its a570 100e entry point directly:

Code: [Select]
buf=call_event_proc("AllocateMemory",4)
if buf > 0 then
    poke(buf,tv)
    --ret=call_event_proc("SetAE_ShutterSpeed",buf)
    ret=call_func_ptr(0xffe0b70c,buf) --SetAE_ShutterSpeed(&tv) on a570 100e
    print("AE_ShutterSpeed=" .. ret)
    call_event_proc("FreeMemory",buf)
end
and exposure changed. So far I've tried overriding to 1/256 s and 1/4 s, the latter crashed a few seconds later (ROMLOG shows assert in AviWriter.c line 606, tMovieReco task).

Haven't tried Av or ISO yet, but those eventprocs are similar to shutter speed and probably not registered either (MoveIrisToAv entry 0xffe05ba4, eventproc table fff34168 and SetAE_CdsGainValue entry 0xffe0b964 is actually in the same event proc table with SetAE_ShutterSpeed so highly likely not registered).

Also need to find current *v96 values for a starting point for adjustment (I haven't searched, propcases would be an obvious first look).

btw, http://chdk.setepontos.com/index.php/topic,1075.msg19070.html#msg19070
« Last Edit: 22 / August / 2010, 07:31:56 by fudgey »

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #16 on: 22 / August / 2010, 11:10:26 »
Okay well I wrote a little Lua script VideoExp.lua to control Tv and Av during video record (or idle live view). it's here: VideoExp.lua
Please note that in it's current form it's strictly for a570is 100e only (and it tries to prevent you from running it on other cameras) because it uses hard coded entry points for the functions that set Av and Tv since I couldn't figure out how to register them using eventprocs only.

It appears that these adjustments aren't the most stable thing out there. It's probably Tv adjust that causes problems. My camera crashes every time I set Tv slower than the 30 Hz frame rate (even in 15 Hz mode), but Tv=1/32 s seems to work fine in the 60 Hz video mode. Worryingly the camera sometimes crashes after Tv adjustments in the faster range too. This doesn't mean Av adjustment would be bug free either, I haven't tested this enough to tell.

ND filter and ISO (Sv) are still missing from the script. ND is something I'm not going to be able to test at all.


Oh, I forgot to make the script test for rec mode. Running in play mode probably results in a crash, I did that at one point by accident.

edit: turns out 'prop=require "propcase"' crashes the camera during video record. Maybe other file access is a no-no during video too? So a new version (link updated) it now checks for rec mode too. It's possible that some crashes were due to file i/o instead of tv adjust...
« Last Edit: 22 / August / 2010, 13:24:10 by fudgey »

*

Offline reyalp

  • ******
  • 14080
Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #17 on: 22 / August / 2010, 15:14:55 »
Nice.
<- should spend more time hacking, less http://xkcd.com/386/

http://chdk.wikia.com/wiki/User:ReyalP/EventProcNotes may help you find registration functions. As you mentioned earlier, some of them do unknown Other Stuff, so beware.

This is all from a540. Where I've noted something like
 RAM 0x9ED8 -> FFEFC3C8
It means that I found the event proc table in the data that gets copied to RAM. Presumably, if they are copied to RAM they some entry points could change before they are registered. The procedure for find the ram based tables is pretty simple. Find name,function pairs in the canon data segment in ROM, translate that to a RAM address (<table address> - <ROM data start> + 0x1900), then search for the resulting address as a literal value. So for example, in a570 100e, SetAE_ShutterSpeed is found in a table starting at FFF33FB8.  Data starts at FFF2D320  -> 0x8598. The only obvious code reference to this value is  sub_FFE04358. If you backtrack through the callers, you find it associated with InitializeAdjustmentFunction

Regarding the crashes, it is possible that adjusting some of these things are expected to be synchronized.
Don't forget what the H stands for.


*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #18 on: 22 / August / 2010, 18:11:56 »
Thanks reyalp, that got all three registered. New version available at http://pastebin.com/Nm5r9V7p.

This one is no longer camera model dependent, but it's possible that it will still only work (without modification) on a some cameras from the same era (FYI, the a570 is a Digic III vxworks camera from year 2008 or so). To debug you may want to print + sleep after each call_event_proc command to see if they return -1, which for this script quite likely means the event procedure was not found (doesn't mean it doesn't exist, it may just be unregistered).

I used SetCDSGain for ISO control since SetAE_CdsGainValue needed an input value to be placed in RAM (0x8ba4 for a570) with poke. Their effect seems to be the same, a range 0-ish to 1024-ish seems to cover the camera's ISO range (probably just the true ISO range, not artificial software extensions like ISO 1600 on a570, but I really don't know for sure...just a gut feeling that this number is connected to 10-bit PGA HW control).

The script is still not stable (and possibly never will be). Expect crashes every now and then. I didn't experience SD card corruption even though several video recordings got cut with battery removal.

Sv (ISO) adjust doesn't start from startup value but instead resets to zero, sorry.

Re: Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!!
« Reply #19 on: 25 / August / 2010, 19:56:13 »
Thanks Fudgey, this is a great start! - being able to lock in the ISO to a low value should improve video quality immensely. 
From what I gather, you'll need to "roll your own" CHDK to include the "native call" support, (required to run this LUA script).

I'm not overly confident in doing this, I'd like to know if anyone else has compiled CHDK with "Native Call Support" for a Canon G7?
Perhaps once we can verify this works as a LUA script on a number of camera's, it can be included within the main CHDK build?

Thanks again all for your amazing work!

 

Related Topics