How can I grab the Viewport or the Camera rendering in a python script?

I am trying to capture frames from the viewport, then encode using ffmpeg and streaming to an endpoint.

I can’t find an example of grabbing the render of the camera in the scene. How can I “grab” the camera and find the frames being rendered?

Hi Adam. The omni.kit.viewport.utility extension has two methods for capturing the viewport:

  • omni.kit.viewport.utility.capture_viewport_to_buffer()
  • omni.kit.viewport.utility.capture_viewport_to_file()

I briefly show how to use the file capture function here: Omniverse Developer Q&A - 12/9/2022 - YouTube. You can also look at omni.kit.capture.viewport for an example of how the Movie Capture window does it.

The viewport’s active camera is rendered. You can change the camera with this snippet: Change the Viewport’s Active Camera — Omniverse Kit documentation

1 Like

This is great thank you, much appreciated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.