Last active
June 20, 2022 20:55
-
-
Save mrtj/a1a287577eadc9d490d35861e92fff2f to your computer and use it in GitHub Desktop.
Example usage of backpack.kvs.KVSSkyLine class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import panoramasdk | |
from backpack.kvs import KVSSkyLine, KVSFileCredentialsHandler | |
# You might want to read these values from Panorama application parameters | |
stream_region = 'us-east-1' | |
stream_name = 'panorama-video' | |
# The example Dockerfile writes static configuration variables to this file | |
# If you change the .env file path in the Dockerfile, you should change it also here | |
DOTENV_PATH = '/panorama/.env' | |
class Application(panoramasdk.node): | |
def __init__(self): | |
super().__init__() | |
# ... | |
credentials_handler = KVSFileCredentialsHandler() | |
self.skyline = KVSSkyLine( | |
stream_region=stream_region, | |
stream_name=stream_name, | |
credentials_handler=credentials_handler, | |
dotenv_path=DOTENV_PATH | |
) | |
# This call opens the streaming pipeline: | |
self.skyline.start_streaming() | |
# called from video processing loop: | |
def process_streams(self): | |
streams = self.inputs.video_in.get() | |
for idx, stream in enumerate(streams): | |
# Process the stream, for example with: | |
# self.process_media(stream) | |
# TODO: eventually multiplex streams to a single frame | |
if idx == 0: | |
self.skyline.put(stream.image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment