Home

Dynamic parameters to transform

You are here

1 post / 0 new
Dynamic parameters to transform

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

document.transformDocument(to-mime-type,destination)

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"] = "{http://www.alfresco.org/model/content/1.0}contains"; 
action.parameters["assoc-name"] = document.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
action.execute(document); 

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.

Thanks

Bob Johnson

4.2.c

Good luck

Bob Johnson

P.S. If this was useful, please mark it as such - it might help someone else to.