Last modified: 2013-10-15 15:36:58 UTC
I notice that there doesn't seem to be a way in the API data for transcode status or imageinfo to get the actual URLs of transcoded media output. prop=transcodestatus lists the formats/sizes but doesn't expose URLs to the actual resources: https://commons.wikimedia.org/w/api.php?action=query&prop=transcodestatus&titles=File:Malta%20-%20Mellieha%20-%20Misrah%20iz-Zjara%20tal-Papa%20Gwanni%20Pawlu%20II%2001%20%280%29%20ies.ogv&format=jsonfm prop=imageinfo&iiprop=url|size lists the URL to the original media file, but none of the transcodes: https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&titles=File:Malta%20-%20Mellieha%20-%20Misrah%20iz-Zjara%20tal-Papa%20Gwanni%20Pawlu%20II%2001%20%280%29%20ies.ogv&format=jsonfm&iiprop=url|size For lower-level tools doing a preview, or native app playback, it would be very nice to have direct access to the transcodes. (I can probably fake the URLs by knowing what they happen to be relative to the base media file, but I don't know if that's stable.)
Here's the workaround I'm using in ogv.js demo to take the original-media URL, a known height & format, and return the URL to the transcode: function transcodeUrl(url, height, format) { var matches = url.match(/^(.*)\/(.\/..)\/(.*?)$/), baseUrl = matches[1], hash = matches[2], filename = matches[3]; return baseUrl + '/transcoded/' + hash + '/' + filename + '/' + filename + '.' + height + 'p.' + format; }
Ignoring that its kind of broken (integer keys not allowed in xml format), not properly documented, and imo a confusing way to extend an api module, I believe you can get that info via: http://commons.wikimedia.org/w/api.php?action=query&titles=File:Folgers.ogv&prop=videoinfo&viprop=derivatives&format=jsonfm
Oh yay! Lemme close this out as WORKSFORME then.... but I'll file some bugs on that, there's some inconsistencies in the output. :D