Forum

Author Topic: chunk.importVideo not working in standalone python module  (Read 4443 times)

nedimhodzic42

  • Newbie
  • *
  • Posts: 2
    • View Profile
chunk.importVideo not working in standalone python module
« on: November 24, 2022, 05:52:06 PM »
I am currently developing a script using metashape in a standalone python module (as per the steps found in: https://agisoft.freshdesk.com/support/solutions/articles/31000148930-how-to-install-metashape-stand-alone-python-module) which is used to transform video files into point clouds. I've tested ran this script in the GUI and it works but when I run it in a standalone module errors begin to occur. To be more specific, the chunk.importVideo command is not working at all as no frames are being produced from the video file provided. This causes other commands down the line to fail as well. If anyone could provide some assistance on this issue that would be appreciated. I'm currently developing on a mac with an M1 chip, but my team has also tested this in windows and linux environments and the same error occurs.

I'll provide a sample of my code below as well:

doc = Metashape.Document()
doc.clear()
chunk = doc.addChunk()

chunk.importVideo(
        path="to_process/Record_69.mov",
        image_path=os.path.join(framesdir, "frame{filenum}.jpg"),
        frame_step=Metashape.CustomFrameStep,
        custom_frame_step=5,
    )

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15354
    • View Profile
Re: chunk.importVideo not working in standalone python module
« Reply #1 on: November 24, 2022, 06:00:47 PM »
Hello nedimhodzic42,

​Unfortunately, currently it is not possible to use importVideo command using a stand-alone Metashape module, as the procedure relies on Qt functionality, included to Metashape application, but not to the stand-alone module.
Best regards,
Alexey Pasumansky,
Agisoft LLC

nedimhodzic42

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: chunk.importVideo not working in standalone python module
« Reply #2 on: November 24, 2022, 07:23:32 PM »
Hi Alexey,

Thanks for the quick reply. I've also tried extracting the frames from the metashape application itself and then adding them in with the chunk.addPhotos function in the standalone script but that is still not working. Currently in the script I am using the following functions: chunk.importVideo/chunk.addPhotos, chunk.detectMarkers, chunk.machPhotos, chunk.alignCameras, chunk.markers, chunk.updateTransform, chunk.region, chunk.transform.matrix, chunk.buildDepthMaps, chunk.buildDenseCloud and chunk.exportPoints. I'm assuming one or several of these functions aren't compatible within the standalone module. I am trying to automate this process so my next question would be on how to do this. Is there a way to connect to a metashape application instance via cloud or on a server where I can then run my script without the errors I've described previously? Any help on this would be appreciated.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15354
    • View Profile
Re: chunk.importVideo not working in standalone python module
« Reply #3 on: November 25, 2022, 12:39:34 PM »
Hello nedimhodzic42,

Can you please send the script that you are using to support@agisoft.com together with the output that it generates in the terminal upon start?

Also please let me know, if the behavior of the script is different, if you run through Metashape Pro installed to Applications folder on the same machine:
Code: [Select]
/Applications/MetashapePro.app/Contents/MacOS/MetashapePro -r script.py
Best regards,
Alexey Pasumansky,
Agisoft LLC