cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Thingworx extension to compress videos

MA8731174
14-Alexandrite

Thingworx extension to compress videos

Hello Community,

    I am working on thingworx 9.3 and i want to have compression functionality in thingworx.

Usecase:- User would be able to upload vidoes from mashup into fileRepository but before storing into repository it needs to be compress and must have size of around 1.5 mb of file. Is it possible to do that?

 

IDEA 1:

Have a phython backend to compress the video and then video can come into thingworx repository via post request

 

IDEA 2: 

Have/Create an extension directly in thingworx so that user can upload it and then it would be compressed and save it in repository.

 

 

Background: I have vuforia studio experience and there the experience gets the video files which are 10 in number and then it shows the videos in experience. i cannot directly upload the videos in experience because i have around 90 experiences for this usecase and each experience has different model and different vidoes in it so that i have made it dynamic and upload the files in repository and getting them from there 

 

thats why i need mashup to load the files in repository but important is the videos need to be compressed. and that i dont want to do manuually again and again. i want to merge it into system so that it can be done automatically and save it in repository.

ACCEPTED SOLUTION

Accepted Solutions

Generally it's better to have one configurable, dynamic experience than 100 fixed ones. It's easier to manage and maintain. Many things in Vuforia can be done in a dynamic way, so I think that's the better way.

View solution in original post

16 REPLIES 16

You can do this with by creating a thingworx extension, yes.

Ma understanding you want to use lossy compression to get under a certain size. You will have to search for a java media library that can do that, or you can run your python backend and have TWX send it over and receive the compressed result.

 

In any case you would want to do this in the background, depending on the size and the recoding you might run into timeouts otherwise.

MA8731174
14-Alexandrite
(To:Rocko)

What  do you think is the best approach to either create an extension for this task or get the results from phython and get via POST?

 

If i would like to create an extension what are the best steps to create a java extension for beginner? as i found this link below:-

 

https://support.ptc.com/help/thingworx/platform/r9.5/en/index.html#page/ThingWorx/Help/Best_Practices_for_Developing_Applications/EclipsePluginInstallingThePlugin.html#wwID0E4MA4

But when i click this above link it just does not show me this plugin to download but it does shows lot of other stuff.  Would you like to recommend me steps to create an extension easily.

 

 

Java extension to compress videos and images.

https://stackoverflow.com/questions/50042483/mp4-video-compressor-in-java

 

 

 

 

Did you do step 4 and 5 correctly? You have to go by "Add" then "Local".

Maybe there is a tutorial for extensions in the community section "IoT Tips"? e.g. here: https://community.ptc.com/t5/IoT-Tips/Create-An-Extension-Part-1/ta-p/827938

 

It's a good capability to know how to write extensions, but I don't think this usecase is the best one as the services may run a long time and it may cause you timeouts. You wouldn't want to execute long-running tasks in your IoT platform, you would launch it and come back later, ideally.

(Of course, when your compression is always just 10 sec that's fine to do in an extension but you can't know what people upload)

 

When you have your python stuff ready, make it available via REST, and then just use ContentLoaderFunctions to call it.

MA8731174
14-Alexandrite
(To:Rocko)

I am unable to do the first step even i could not find the extension to download on that page (can you please tell me) and secondly yes i will do with phython and just get it in thingworx with ContentLoaderFunctions.

 

One more question:- If i have pvz file in thingworx, is it somehow possible to see the sequences and stepnames from it? i just need simply an info about whats in there in pvz file to do some stuff in thingworx?

 

 

For me, the plugin is in the TWX 9.5 product download, last item in the list:

Rocko_0-1726646172149.png

PVZ is is a zipped file, but the contained files are binary, not sure what you can make of them. Maybe the ThingView widget has some useful services to support this, it comes with the  Creo View WebGL Extension.

MA8731174
14-Alexandrite
(To:Rocko)

Thanks @Rocko but what i want to see the sequence names and step names in the pvz file after i upload it in thingworx. My thingworx IOT is 9.3 version. Is it possible that i can download this widget in thingworx and get this information there. 

 

My usecase: I have experience (vuforia studio) there i get the model from thingworx and it shows user animations and also video on each step so for example if there are 10 steps in the model i manually upload the 10 videos also in thingworx and user is able to see the video on each step if he wants and also sees an animation.  

 

As you can see in the screenshot below so the Location, Buidling, Machine and Experience_Parts. This is the file repository hierarchy which i have for each experience and as you can see each exp has one model and videos (total steps 10 so i upload manually 10 videos). 

 

Mashup

Jamal8548_1-1726648074867.png

File Repository

Jamal8548_2-1726648296634.png

 

So, when i start the experience the model would be loaded from the thingworx because of the parameters i pass in experience (Location, building, machine and experienc_parts) . 

 

It works well but now the customer asked that in each model i want 3 sequences and now i am thinking when i upload the pvz file in thingworx then i want the sequence name and may be step names also so that i can make folder  hierarchy with this information in thingworx and then show the user his desired videos on the experience. 

 

WOuld that widget be the well fit for it and please let me know how can i download it as it does not come by default. 

Thank you

 

 

 

 

 

 

Thingview was the wrong idea. You would need this extension to look into the pvz file:

https://github.com/mvonhasselbach/CreoViewRWExtension

Give it a try.

 

MA8731174
14-Alexandrite
(To:Rocko)

The error when i imported the extension.

   "Extension Exception: Extension must have a metadata.xml file." 

any idea? why its like that?

 

i found metadatafile thats fine now but now second error as below:
Extension: CreoViewRWHelper - could not find all specified JAR files. Please check application log for missing JAR errors.

 

<FileResource
                 description=""
                 file="creoviewrwextension.jar"
                 type="JAR"></FileResource>
<FileResource

 

I'm not sure that it needs this file in order to work.

Works without issues here. metadata.xml is in the zip.

Do you import the right way? Import>Extension>locate Zip File.

The zip also contains the jar file you mentioned.

 

You need to download the release zip file, not the source zip. https://github.com/mvonhasselbach/CreoViewRWExtension/releases/tag/v1.5.0

 

MA8731174
14-Alexandrite
(To:Rocko)

Yes actually, i am doing the same way. I am also going to import --> Extension ---> Zip file.

 

The jar file i cannot see in the folder actually.

 zip download and unzip

Jamal8548_0-1726658412855.png

 

The Jar file named creoviewrwextension.jar is not there in the lib folder as below you can see screenshot. I unzip the folder.

 

Jamal8548_1-1726658447625.png

 

 

 

MA8731174
14-Alexandrite
(To:Rocko)

Thank you very much for the effort you have put into your replies, it really helps a lot. I am finally able to have the extension in thingworx and will test it further. I will write further if there will be some query in this regard. 

MA8731174
14-Alexandrite
(To:Rocko)

There are four formats for output which are mentioned in documentation. When i use these formats as output to get JSON. I am unable to get the stepname or stepdescription in the sequences.

 

Jamal8548_1-1726665270768.png

With this below output format (WT_SED2_NESTED ) I am able to get the name of the sequences though. But it would be useful to get the stepName also which are present in the sequence. Do you have pvz file also just for test or to see if its possible.

 

Thank you!

 

 

Jamal8548_0-1726665230508.png

 

This is beyond my expertise - maybe you can ask in the CAD/Creo forums of the community about this.

MA8731174
14-Alexandrite
(To:Rocko)

Okay Thanks! But what do you think generally about my solution? Is it a good idea way i am implementing the requirement? My usecase is just to show animation steps with videos and images may be. and each step can have also two videos to play and thats why i was building a hierarchy like this below:=

 

OLD HIERARCHY

LOCATION > BUILDING > MACHINE > EXPERIENCE ---> Model (folder) - Video (folder)

 

before when i used to go in experience it loads the model from thingworx and i upload manually 10 videos becuase i had 10 steps in animation. so when user click on next button it sees the video on each step.

 

 

NEW HIERARCHY IDEA

LOCATION > BUILDING > MACHINE > EXPERIENCE ---> SEQUENCE 1, SEQUENCE 2 --> THEN IN EACH sequence the step name folder like for eg 01 and then in this folder there will be 2 videos may be and 1 image to show in vuforia studio.

 

because now requirement is more then one sequence and also there can be more then one video on each step and that was the only reason that i needed sequence name and step name to create a folders and put media in it and then somehow i will fetch them in the vuforia studio.

 

So instead of making 100 of experiences i will get the videos and model from thingworx and read the params from the experience link and load the desired data because user has to click some link always to go onto experience. It will be easy to manage in thingworx and one place for all the experiences and media etc.

 

Any suggestions?

 

 

 

Generally it's better to have one configurable, dynamic experience than 100 fixed ones. It's easier to manage and maintain. Many things in Vuforia can be done in a dynamic way, so I think that's the better way.

Hi @MA8731174 


I wanted to see if you got the help you needed.


If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Please note that industry experts also review the replies and may eventually accept one of them as solution on your behalf.


Of course, if you have more to share on your issue, please pursue the conversation.

Thanks,

Catalina
PTC Community Moderator
Announcements


Top Tags