Thursday, January 24, 2013

Flight Deck - GPS Sail Data Over Video



I took a borrowed gopro out for a quick sail on sunday. Afterwards I thought it would be cool to overlay a GPS speed. That was a rather bad idea.

I have been fighting with every night this week and final got a workable process:

1. Open GPX file in excel and calculate speed, heading, VMG etc. There is a local weather tower which I have used for calculating/displaying TWA, AWA, AWS. I think these calculations are wrong in this video.  Speed and heading were calculated with Vincenty formula for distance between two Latitude/Longitude points. Other calculations are discussed elsewhere. 

2. Model a dashboard with text etc in rhino. I used text objects for everything that looks like text. The needles are blocks that can be transformed up and down or around the circle. 

3. Create a rhino script that reads the excel data and modifies the text and blocks. You also need to decide on a frame rate. As the gps data logs at around 1 second and you need to render at a higher frame rate, you need to interpolate between the recorded times. Interpolating headings is irritating around 360 degrees. 

4. Render each frame in sequence. The rhino script rendered and named the images for the sequence. Some important settings - make a green background so it can be green-screened over the sailing video. Make sure the text is added to render. Set the render size to the same as the sailing video size (my case, 1280x720). This finishes with thousands of renders labled 0.jpg to 1500.jpg (or whatever)

5. Virtual Dub can be used to render all of these frames to a single AVI file. Remember to set the frame rate. While my video was shot at 30FPS, I rendered the dashboard at 5 FPS to save on rendering time. At this stage set virtual dub to 5 FPS.

6. Open the gopro video and the dashboard video in Wax 2.0 and use the Chroma Key filter as described by this annoying kid. I needed to convert my gopro video to AVI in Virtual Dub also as Wax appears to be limited in the formats it can open. The gopro and dashboard need to by synced manually at this stage.

7. Final edits, music and text were done in Windows Live Movie Maker, because Wax is very clunky. 

I say it was a bad idea cause I have had a horrible time with the video softwares. To get to this point I have downloaded 20 programs/codecs and learnt Lightworks only to find it wouldn't encode my video. Struggles with formats etc and colossal files (like a 5min blank with that was 12 gig!). Virtual Dub is gold, and it looks like a good idea to keep everything as an AVI file as early and as long as possible. 

Syncing the boat video with the dash video was tricky and inaccurate. Next time I will walk between some known points holding the camera close to the GPS. Like up and down a few marina fingers.

If anyone else is interested leave a comment below and I'll tidy up the excel and rhinoscript files then provide links. 

4 comments:

  1. Video sucks to manipulate.

    Doesn't gpsactionreplay have some ability to do this? All you would need is to sync the video and the gps times somehow; that cosworth system has a button you push to put a spike in the gps data. Tap the hull at the same moment and you're good.

    ReplyDelete
  2. This article seems a neat way to mix Video & GPS-
    http://www.roostersailing.com/wordpress/?p=3468

    ReplyDelete
  3. I've tried gpsactionreplay but I'm going to look into Flight Deck

    ReplyDelete
  4. Btw, the velocity output of a GPS is a heap more accurate than taking two points and dividing by the elapsed time, all GPS units calculate velocity on the way to working out position so I'd be surprised if you couldn't get it written to file.

    ReplyDelete