I think $duration is a value in seconds here, however the getISO8601Duration() method is expecting a time string like:

  12:03:02

I think you need to pass it through WikiaFileHelper::formatDuration() first.  Better yet, create a formatISO8601Duration() method to do it directly rather than building a string, parsing it, then building a second string.