MotionBuilder 2020 get Embedded Timecode using python api

MotionBuilder 2020 get Embedded Timecode using python api

Anonymous
Not applicable
1,483 Views
2 Replies
Message 1 of 3

MotionBuilder 2020 get Embedded Timecode using python api

Anonymous
Not applicable

Hi,
I am trying to automate some tasks in MotionBuilder using the python api, part of our current work follow is. 

Creating a story video track

Importing a mov file

Open the Asset Settings

Enable "Show Embedded Timecode" which displays the embedded timecode in the Mark In field

copy the "Mark In" to the "In".

 

I have written the following code to automate all this but it don't seem to work.

```

lSystem = FBSystem()

path = "D:/Path/To.mov"

lStoryTrack = FBStoryTrack(FBStoryTrackType.kFBStoryTrackVideo)

lStoryClip = FBStoryClip(path, lStoryTrack, lSystem.LocalTime)

 

lStoryClip.ShowEmbeddedTimecode = True

lStoryClip.Start = lStoryClip.MarkIn

```

 

I have printed what's in "lStoryClip.MarkIn" but just get "FBTime(0)" this would indicate ShowEmbeddedTimecode does not store the Embedded Timecode in MarkIn like it does in the interface., is there another way to get the Embedded Timecode in the python api?

 

Thanks,

Mark

0 Likes
Accepted solutions (1)
1,484 Views
2 Replies
Replies (2)
Message 2 of 3

Mocappy
Advocate
Advocate
Accepted solution

Hi Mark,

 

Been going through Story stuff my self recently. There are a few attributes that are "hidden", and this is one of them. Sometimes worth having a look in the "Property View/Properties Window" for things like this and what they're called. Then you can do a "PropertyList.Find".

 

This should find what you're after...

from pyfbsdk import FBStory, FBStoryTrackType

for storyTrack in FBStory().RootFolder.Tracks:
    # Check if Video Track
    if storyTrack.Type == FBStoryTrackType.kFBStoryTrackVideo:
        # Loop over all Story Clips
        for storyClip in storyTrack.Clips:
            # Get Mark In (Embedded Timecode)
            if storyClip.PropertyList.Find('Mark In (Embedded Timecode)'):
                print storyClip.PropertyList.Find('Mark In (Embedded Timecode)').Data.GetTimeString()
            # Get Mark Out (Embedded Timecode)
            if storyClip.PropertyList.Find('Mark Out (Embedded Timecode)'):
                print storyClip.PropertyList.Find('Mark Out (Embedded Timecode)').Data.GetTimeString()

And yes, you're right. It looks like "Show Embedded Timecode" only changes the display, not the actual"Mark In/Out" value.

 

Hope this helps,

Message 3 of 3

Anonymous
Not applicable

Thank you @Mocappy that has worked perfect, I can now scrap my hacky subprocess ffmpeg command to get it form the metadata 🙂