Sunday, February 21, 2010

Recording EOS movies with synced external audio -
A more dependable way

Requires an Arduino I/O board plus 180 ohms resistor and IR LED, an Apple computer with QuickTime Pro and an USB bus powered audio interface with phantom powered microphone inputs.

Calling the Zephir application from AppleScript (see previous post) added an unwanted delay. This solution is better since it uses the Arduino as an IR transmitter again. The response is much faster and both the QuickTime audio recording and the EOS movie recording stop at the same time. Occasionally there is a one frame inaccuracy but most of the time synchronisation is spot on if the track ends are aligned.



The AppleScript works like in the previous post but only has to send a character over the serial connection to the Arduino to start video recording. You need the free AppleScript extension SerialPort X to make it work.

(*
Simultanuously start and stop EOS movie and QuickTime audio recording.
EOS movie recording starts with a delay after receiving the remote signal but it stops at the same time as the audio recording.
To sync video and external audio align the track ends.
Requires an Arduino I/O board (arduino.cc) plus 180 ohms resistor and IR LED, an Apple computer with QuickTime Pro and an USB bus powered audio interface with phantom powered microphone inputs.
2010, Martin Koch, controlyourcamera.blogspot.com
*)
on countdown()
say "three"
delay 1
say "two"
delay 1
say "one"
delay 1
say "action"
end countdown

-- Uses SerialPort X from http://mysite.verizon.net/vzenuoqe/MacSoft.html
set portRef to serialport open "/dev/cu.usbserial-A6004byf" bps rate 9600 data bits 8 parity 0 stop bits 1 handshake 0
delay 2
if portRef is equal to -1 then
display dialog "Could not open serial port" buttons {"Cancel"} default button 1

else

tell application "QuickTime Player"
activate --get QuickTime Player ready
new audio recording --prepare new audio recording
end tell

tell application "Script Editor"
activate
display dialog "Start recording?" with title "EOS movie + QuickTime audio" buttons {"Cancel", "START"} default button 2
end tell

countdown()

serialport write "R" to portRef -- Write to Arduino to send EOS movie start/stop signal
tell application "QuickTime Player" to start first recording
beep

tell application "Script Editor" to display dialog "Stop recording?" with title "EOS movie + QuickTime audio" buttons {"STOP"} default button 1

serialport write "R" to portRef -- Write to Arduino to send EOS movie start/stop signal
tell application "QuickTime Player"
stop first recording
close first document
end tell

serialport close portRef

end if





The Arduino sketch continuously monitors the serial connection to the computer and sends the movie recording start signal if it receives the character R.

/*
Arduino sketch for simulating a Canon RC-1 remote control
Huge thanks go to http://www.doc-diy.net/photo/rc-1_hacked/index.php for figuring out the Canon RC-1 IR code.
2010, Martin Koch, http://controlyourcamera.blogspot.com
*/
#define irLED_EOS 11 // connect a IR LED with a 180 ohms resistor in series to digital pin 11
byte inbyte = 0;

void setup() {
pinMode(irLED_EOS, OUTPUT);
Serial.begin(9600); //open the serial port
}

void loop() {
inbyte = Serial.read();
if (inbyte == 'R') EOS_REC();
}


void EOS_REC() {
for(int count=0; count<16; count++) { //Burst 1
digitalWrite(irLED_EOS, HIGH);
delayMicroseconds(11);
digitalWrite(irLED_EOS, LOW);
delayMicroseconds(11);
}

delayMicroseconds(5360); //Pause

for(int count=0; count<16; count++) { //Burst 2
digitalWrite(irLED_EOS, HIGH);
delayMicroseconds(11);
digitalWrite(irLED_EOS, LOW);
delayMicroseconds(11);
}
return;
}

1 comment: