This is about my 12th draft of this function, and I think I have it so I'm pretty happy with its results, its API, etc.

One important note: I deliberately did not infer the type (photo or movie) from the given extension.  Doing so could cause problems downstream with jpgs getting replaced with mp4s unless more error-catching logic is written.  So, I left this as two separate arguments for the sake of clarity.