Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Import mp4 files as an object Using Python

Anonymous

Import mp4 files as an object Using Python

Anonymous
Not applicable

Hey guys I have a question pertaining to mp4

 

From what I can see from tutorials and such there seems to be a way for Maya to import mp4 using the actual program itself (file->import etc.). I was wondering if it was possible to do the same thing but within a script. So far I've seen things like launch() but that just launches the video separate from maya. I wish to have it so that it creates an .mp4 object within the workspace if that makes sense

 

Thanks

Reply
Accepted solutions (1)
1,802 Views
3 Replies
Replies (3)

stuzzz
Collaborator
Collaborator

Here's a quick script for "importing" a video to a file node.

 

path = "PathToMyVideo"

filenode = cmds.createNode("file")
cmds.setAttr("%s.fileTextureName" % filenode, path, typ="string")

 

Anonymous
Not applicable

Hey, thanks for the reply,

 

I tried running your script but I don't see anything being created in the outliner (which I'm assuming is what is suppose to happen right?)

Screenshot_1.jpg

0 Likes

stuzzz
Collaborator
Collaborator
Accepted solution

Sorry buddy, I missed your notification.

 

By creating a file node, you are not supposed to see it in Outliner unless Display-> DagObjectsOnly is unticked. 

It's in your scene anyway. To name of your node in encapsulated in the "filenode" variable so to select it just type:

 

cmds.select(filenode, replace=True)