AnsweredAssumed Answered

Dynamic parameters to transform

Question asked by rjohnson on Jul 18, 2013
I need to create a transform that will extract a single frame from a video file at a given position from the start and save the resultant image (jpeg or png) as a separate document. The position will vary with each call to the transformation. This is more or less exactly what the video-thumbnail-context.xml sets up except that the frame position is fixed at 10 seconds and the output becomes a thumbnail of the video file not a separate document.

I believe that I could transform the video and grab a frame at a fixed position quite easily using


or by action using

var action = actions.create("transform");
// Store the transformed version in the same folder as the source
action.parameters["destination-folder"] = document.parent;
action.parameters["assoc-type"] = "{}contains";
action.parameters["assoc-name"] = + "transformed";
// If it's already plain text, make html, otherwise make plain text
if(document.mimetype == "text/plain") {
   action.parameters["mime-type"] = "text/html";
} else {
   action.parameters["mime-type"] = "text/plain";
// Execute

by setting up a transform from video/mp4 to jpeg or png.

Having looked at the underlying java bean for the action I can see that it will accept an options parameter which is a key value pair that it will use in the transform context.

What I cannot work out is how to pass that options string either using document.transformDocument (which does not appear to support a third parameter) or via an action because I cannot see how I might name the option in action.parameters to ensure it gets passed and used.

So, before I spent a few hours trying, I thought I would post here and see if some kind soul could point me in the right direction, or tell me I'm wasting my time and will have to do it another way.


Bob Johnson