Precision synchronisation of twinned cameras in movie mode - General Discussion and Assistance - CHDK Forum
supplierdeeply

Precision synchronisation of twinned cameras in movie mode

  • 8 Replies
  • 2673 Views
Precision synchronisation of twinned cameras in movie mode
« on: 19 / February / 2012, 16:13:49 »
Advertisements
To delay the video capture task by some arbitrary amount (microseconds), the safest bet is with FPS override IMO. See http://magiclantern.wikia.com/wiki/VideoTimer for the math behind FPS timers.

Very interesting.

Just to be clear, which clock is used by the movie capture task ?

Re: Precision synchronisation of twinned cameras in movie mode
« Reply #1 on: 19 / February / 2012, 16:14:25 »
That link refers to LiveView mode.

Are the shutter speed and fps set there also applied to movie capture ?

In the Powershots, would you expect the A/V output synch pulses to be exactly synchronised with the sensor capture ?
« Last Edit: 19 / February / 2012, 16:24:21 by Microfunguy »

*

Offline a1ex

  • *****
  • 671
  • ML dev
Re: Precision synchronisation of twinned cameras in movie mode
« Reply #2 on: 19 / February / 2012, 16:43:17 »
LiveView and movie recording share the same capture code, at least on DSLRs. So that link applies to both.

Here are the tasks (they are designed as state machines): http://a1ex.bitbucket.org/ML/states/

About state machines: http://magiclantern.wikia.com/wiki/StateObjects (I don't know how it's in compacts).

MovRecState is for movie recording (encoding and such). LVState/EvfState seem to do LiveView capture.

I don't know much about A/V output.

*

Offline srsa_4c

  • ******
  • 4285
Re: Precision synchronisation of twinned cameras in movie mode
« Reply #3 on: 19 / February / 2012, 16:47:37 »
That link refers to LiveView mode.
For a good reason.
Quote
Are the shutter speed and fps set there also applied to movie capture ?
Yes. (The only camera I've seen that puts the sensor / liveview in a different mode on start of the capture was the A410).
Fairly easy to try:
Write a value (16bit probably, start with 1000 for example) to 0xC0F06014 and then write 1 to 0xC0F06000.
The needed value may depend on the liveview mode. Incorrect values will cause a crash. The "electronic shutter speed" will be 1/fps. When the picture becomes overexposed, some (yet) unknown task will adjust the framerate / exposure.
Quote
In the Powershots, would you expect the A/V output synch pulses to be exactly synchronised with the sensor capture ?
Both depend on the same clock, but since the liveview buffer is triple buffered, there will be some delay. The movie record task also gets notification from the liveview task (as I wrote some months ago elsewhere).


Re: Precision synchronisation of twinned cameras in movie mode
« Reply #4 on: 19 / February / 2012, 17:28:56 »
@srsa_4c

Quote
Your framerate hack works also (but I don't find it useful enough

So, you have changed the movie framerate of a Powershot ?

What exactly did you do to demonstrate this ?

Next week, I will be buying a pair of S95's.

I will use them for any video-synch tests.

Although the A/V output frame-synch pulses could be monitored, it is physically slightly inconvenient as the display blanks and the latest  USB Mini 8-pin connectors are awkward to modify.

We can probably disable A/V out and enable the display on demand by writing the mmio address.

Another way is to flash the autofocus led VERY briefly at some point in the movie-frame processing.
Alternatively, turn it on at a known entry point and off at a known exit point to generate pulse of sufficient width to be detected by a phototransistor and processing by a microcontroller.

Do we know of any suitable locations ?

Best of all would be to generate an led flash in-synch with the clock.

*

Offline srsa_4c

  • ******
  • 4285
Re: Precision synchronisation of twinned cameras in movie mode
« Reply #5 on: 19 / February / 2012, 19:04:04 »
So, you have changed the movie framerate of a Powershot ?
What exactly did you do to demonstrate this ?
Fairly easy to try:
Write a value (16bit probably, start with 1000 for example) to 0xC0F06014 and then write 1 to 0xC0F06000.
::)
Don't know whether SDM supports "poke". If not, you could use CHDK and Lua. Or hack a user interface into SDM for this.
Although the A/V output frame-synch pulses could be monitored, it is physically slightly inconvenient as the display blanks and the latest  USB Mini 8-pin connectors are awkward to modify.
I would go with the video-out synch. The AV-out sense bit is probably in
Code: [Select]
physw_status[x] somewhere, and there are eventprocs which enable and disable the audio/video output.

Quote
Do we know of any suitable locations ?
You could mess with that DIGIC register from any task and check the synch pulses on the tv-out cables. But you'll need to find out the correct values for 0xC0F06014 before.

Before you buy anything: this method with that register is a side effect IMHO. If its shadow copy is correct, it's usually written with "1"! But if you write 1 to it, you'll certainly get a crash. Other registers would also need to be involved, but those are unknown at this moment. Better use your existing cameras for these experiments.

Re: Precision synchronisation of twinned cameras in movie mode
« Reply #6 on: 19 / February / 2012, 19:35:41 »

So, you have changed the movie framerate of a Powershot ?
What exactly did you do to demonstrate this ?

I do not mean how did you implement it (which you explained), I mean did you actually record video at a lower fps ?

Quote
The AV-out sense bit is probably in
Code: [Select]
physw_status[x] somewhere, and there are eventprocs which enable and disable the audio/video output.

I have already done this previously, it works fine.

I am not sure slowly drifting the fps will actually bring the two cameras into synch when there is a permanent random phase-difference  of their clocks.


*

Offline srsa_4c

  • ******
  • 4285
Re: Precision synchronisation of twinned cameras in movie mode
« Reply #7 on: 19 / February / 2012, 20:15:56 »
I do not mean how did you implement it (which you explained), I mean did you actually record video at a lower fps ?
Yes. Even with changing fps in the middle of recording (this was on the A420). You need to be careful not to set too low or too high framerate.
Now that I retried with the A470, I usually get a crash with a modified framerate after a few seconds. It may have to do with audio which, unlike in the DSLRs, can't be switched off.
Better wait with that purchase...
Quote
I am not sure slowly drifting the fps will actually bring the two cameras into synch when there is a permanent random phase-difference  of their clocks.
That clock is usually above 30MHz. But of course, we're talking about two independent clock generators.


Re: Precision synchronisation of twinned cameras in movie mode
« Reply #8 on: 19 / February / 2012, 20:41:14 »
Better wait with that purchase...

I am buying them anyway because they may be the last models we can precision synch for still images.

Quote
But of course, we're talking about two independent clock generators.


With reference to this : http://magiclantern.wikia.com/wiki/Register_Map#HEAD_Timers

Are we saying for the HEAD4 timer you can change how often it generates an interrupt and that interrupt is serviced by a certain interrupt handler that writes the frame image to memory or the SD card ?

So, does 0xC0F07150 ( Timer ticks until interrupt) get fed with a value that determines how often the interrupt is generated ?

None of that tells us WHEN the frame was actually captured.

0xC0F0700C (0x01 to stop/standby) would allow the timer on one camera to be paused VERY briefly to possibly bring into synch with the other cameras timer ?


Presumably these clock signals are always present, not just when you are in video mode ?
« Last Edit: 19 / February / 2012, 20:43:08 by Microfunguy »

 

Related Topics