Jump to content

How do I upload .movs as Reviews using the API?


mitch.s

Recommended Posts

Uploading files for review with the API is not possible at the moment but you can encode and host the files yourself if you want to automate it with the API.

 

How to publish reviewable versions and how to setup the hosting/encoding is explained here: http://support.ftrack.com/customer/portal/articles/1156767-self-hosting-and-encoding

 

Let me know if you need any more assistance.

 

Regards,

Carl

Link to comment
Share on other sites

  • 3 weeks later...

Ok...

Custom encoded/hosted movs play fine in the FTrackApp when the movs are added (using python) to shots but not when they are added (using python) to tasks.

 
In detail:
____________________________________________________________________________________________________________
 
1) We have a SHOT with a TASK in it.
 

2) encoded .mp4 and .webm using ffmpeg

 

3) hosted the mov files on our custom server (not the ftrack one).

 

4) configure our web server to serve the encoded files.

 

5a) Adding the movie to the SHOT:

assetType=####assetName=####asset = ftrack.Task(SHOT_Id).createAsset(assetName, assetType)assetVersion = asset.createVersion(taskid=SHOT_Id)# Create a mp4 componentreviewCompMP4 = assetVersion.createComponent(name='ftrackreview-mp4', file='http://##CUSTOM_WEB_URL##/TestMov.mp4')metaData = json.dumps({'frameIn' : 0,'frameOut' : 141,'frameRate' : 25})reviewCompMP4.setMeta(key='ftr_meta', value=metaData)# Create a webm componentreviewCompWEBM = assetVersion.createComponent(name='ftrackreview-mp4', file='http://##CUSTOM_WEB_URL##/TestMov.webm')metaData = json.dumps({'frameIn' : 0,'frameOut' : 141,'frameRate' : 25})reviewCompWEBM.setMeta(key='ftr_meta', value=metaData)asset.publish()

- Clicking the icon next to the version [NOT WORKING]

- Clicking the play button underneath the component [WORKING]

- Appearing and Playing in the FTrackReview app [WORKING]

 

 

5b) Adding the movie to the TASK:

assetType=####assetName=####asset = ftrack.Task(TASK_Id).createAsset(assetName, assetType)assetVersion = asset.createVersion(taskid=TASK_Id)# Create a mp4 componentreviewCompMP4 = assetVersion.createComponent(name='ftrackreview-mp4', file='http://##CUSTOM_WEB_URL##/TestMov.mp4')metaData = json.dumps({'frameIn' : 0,'frameOut' : 141,'frameRate' : 25})reviewCompMP4.setMeta(key='ftr_meta', value=metaData)# Create a webm componentreviewCompWEBM = assetVersion.createComponent(name='ftrackreview-mp4', file='http://##CUSTOM_WEB_URL##/TestMov.webm')metaData = json.dumps({'frameIn' : 0,'frameOut' : 141,'frameRate' : 25})reviewCompWEBM.setMeta(key='ftr_meta', value=metaData)asset.publish()

- Clicking the icon next to the version [NOT WORKING]

- Clicking the play button underneath the component [WORKING]

- Appearing and Playing in the FTrackReview app [NOT WORKING]

 

_____________________________________________________________________________________________________________

 

 

So, we're almost there...

How do you play movs in the FTrackReview app that are added (using API) to TASKS ? (5b)

How do you trigger movs added with the API by clicking the icon next to the version ? (5a and 5b)

 

Any suggestions?

 

Link to comment
Share on other sites

Hi Mitch,

 

In both 5a and 5b, it looks like we have issues. Firstly, you should not be able to reference a shot on the version and second, you should not be able to create assets on tasks and this is why the versions is not working in ftrackreview.

 

To make the versions playable in ftrackreview and the overlayplayer from tasks. You should create the asset on a shot and reference the task on the version.

 

Example:

assetType=####assetName=####asset = ftrack.Task(SHOT_Id).createAsset(assetName, assetType)assetVersion = asset.createVersion(taskid=TASK_Id)# Create a mp4 componentreviewCompMP4 = assetVersion.createComponent(name='ftrackreview-mp4', file='http://##CUSTOM_WEB_URL##/TestMov.mp4')metaData = json.dumps({'frameIn' : 0,'frameOut' : 141,'frameRate' : 25})reviewCompMP4.setMeta(key='ftr_meta', value=metaData)# Create a webm componentreviewCompWEBM = assetVersion.createComponent(name='ftrackreview-mp4', file='http://##CUSTOM_WEB_URL##/TestMov.webm')metaData = json.dumps({'frameIn' : 0,'frameOut' : 141,'frameRate' : 25})reviewCompWEBM.setMeta(key='ftr_meta', value=metaData)asset.publish()

This way you should be able to start ftrackreview from the task and see the version.

 

 

Cheers

Link to comment
Share on other sites

Ok. I see how I should use Assets and Assetversions in practice. Having seen how to use them I still have difficulties to grasp the concept of assets. (I thought it was just a necessary code layer for architectural purposes).

 

From reading the definition of an asset I understand that it's some kind of container for assetversions. In this logic I would tend to keep Assets an Assetversions inside the same task/entity ... I can't discern why the asset MUST be created on the shot and the assetversion on the task

 

Purely hypothetically :

What if on the Sequence level (or even Episode level) I created an (sequence)Asset and differentiated it's child Assetversions on shot-tasks by using adequate nomenclature ?

What if on top of that I created (shot)Assets on shots in that sequence with its own Assetversions on other or even the same shot-tasks ?

Is there an advanced reason why one would want to 'nest' Assets in that way or why it's even made possible in FTrack?

 

Could you explain the concept of Assets more in depth please?

 

Thanks in advance.

Link to comment
Share on other sites

A 2nd thing...

 

When uploading movs through the FTrack UI you can 'overlayplay' the mov by clicking the icon(thumbnail) next to the version (1).

When doing it throught the API you need to browse to the composition and click the play button to trigger the overlayplayer. That's not very intuitive.

 

playmov.jpg

 

 

- Is there a way to trigger the overlayplayer by clicking (1) for movs inserted with the API?
[YES ADD THUMBNAIL ON ASSETVERSION]
 

In extension, to avoid openening the task UI on the left before you preview, is it possible (using code) to trigger the overlayplayer with the last assetversion (instead of a thumb) of the task by clicking (2)?

Link to comment
Share on other sites

I cannot access your image. Can you try to upload it again or send it to me in an email(carl.claesson@ftrack.com).

 

Yes, by adding a thumbnail to the assetversion it will be playable in the overlay player. The same thing goes for the task and shot, if you run setThumbnail on the them with the same thumbnail as the version they will be playable.

Link to comment
Share on other sites

Thx Carl, works as expected.

 

A small footnote:

To assign a thumb duplicate/instance the setThumbnail() with localpath or with hostedpath (obtained by getThumbnail() ) does not work.

You must set the instance thumbnail using the 'thumbid':

thumbPathLocal = '###LOCALPATH###/thumbnail.jpg'assetVersion.createThumbnail(thumbPathLocal)thumbId = assetVersion.get('thumbid')task.set('thumbid', thumbId)
Link to comment
Share on other sites

Yes, but if you want to run a script to 'update' all shots and tasks with the correct thumb, you will need to set it with the 'thumbid' because you are not creating the thumb at that particular moment.

 

Having some kind of script editor inside the FTrack UI would be great for this purpose too...

 

PS:

Being able to set all properties is one of the great things about FTrack .As long as you use this method with care of course!
Eg. to create (fake)group entities by setting 'parent_id' allows an open project structure...

Link to comment
Share on other sites

If you have the thumbnail id, you can do something like this to get the filepath from the components:

import ftrackthumb_id = //Some thumbnail idattachment = ftrack.Attachment(thumb_id)if attachment.get('parent_type') == 'asset_version':    version = ftrack.AssetVersion(attachment.get('parent_id'))    for component in version.getComponents():        filepath = component.getImportPath()        # Do something with filepath

Note that if the component is a ftrackreview component. This will only return a unique file id and not an actual path.

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...