Wednesday 25 September 2019

Joining GoPro video files together automatically

GoPros split up large video files into chapters, joining them back together into a single, large file is a bit fiddly.  Here's how to do it automatically using the Automator application I created (StitchGoProSession.app)

tl;dr;

Install ffmpeg using Homebrew and then drop the folder containing your GoPro chapters onto the Automator application StitchGoProSession.app

The details:

There are a few moving parts, the most important is to have ffmpeg installed.  I did this using Homebrew and the bash script in the Automator application depends on that path.  It's easy enough to change in the script, which is listed below.

Essentially the StitchGoProSession automator application is a wrapper round the bash script, but the first step is 'GetFolderContents', which produces a list of the files in the folder, which are then passed through to the script.

Tuesday 11 June 2019

Using Automator to hack together tests of MessageBird's IVM flows

I'm in the fortunate position of being able to do some freelance work for my former employer (DrDoctor), helping them transition their Interactive Voice Message/Interactive Voice Response functionality from a well known SaaS telecomm's behemoth to their main telecomm's provider MessageBird.  Specifically moving to using their Flow Builder.

Part of that involved extensive acceptance testing of the flows we would be using for patient interactions.  This started as as very manual process, with me POSTing to the MessageBird API, receiving a call and recording it with a microphone.  This was both slow and error-prone as there were quite a few occasions when I failed to hit the record button in time (as the application didn't have focus), or I had the gain set on the mic incorrectly, or because I was thinking about the other two issues I selected the wrong option in the IVR menu.  Bad times.

However, I'm a nerd and once I start doing repetitive work I think to myself: a machine should do this while I read about AI/Blockchains/Quantum Computing etc.  With that in mind I realised that I could do almost all of this work 'in the box' (as my music producing friends say) using Automator to join up all the moving parts.

It ended up a bit Heath Robinson/Rube Goldberg, but it worked.  Automator does this:
  1. Display a list of test scenarios
  2. Remember which one is selected
  3. Generate a GUID 
  4. POST to MessageBird via curl in the Terminal
  5. Launch QuickTime 
  6. Run an AppleScript that waits until FaceTime isn't running and then saves the audio file from step 5 using the values from steps 2 and 3 to name it
I used Loopback (from Rogue Amoeba) to route the audio out of FaceTime to the input of the QuickTime audio recording.

The magic happens because when my iPhone rings, I'm able to take the call on my computer. So basically I run the Automator workflow (using the keyboard combo 'cmd + r', obvs) and wait for the call to come from MessageBird.  When FaceTime rings I accept the call on my Mac, and respond to the IVR menu on my Mac as well.  When I end the call the audio file is saved automatically (with a meaningful name, from the list of scenarios) and I can send it off to my Product Owner for review (and they in turn can send it to the client if they wish).

They say a picture speaks a 1000 words, so hopefully this video will show what all the words above mean in practice ...