Spherical Video PTZ: Examples - GstD
Spherical Video PTZ |
---|
Getting Started |
User Guide |
Examples |
Performance |
Contact Us |
For instructions on how to build and install Gstreamer Daemon (GstD) follow this guide.
Using System Memory
- With this pipeline, you can take an input image, dynamically adjust PTZ properties, and save the output to a file sink.
- Ensure that the gstd daemon is running in background.
pipeline_create p1 filesrc location=sample.jpg ! jpegdec ! imagefreeze ! videoconvert ! videoscale ! video/x-raw,format=RGBA ,width=1920,height=1080 ! rrpanoramaptz name=ptz ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=./sample.ts
- This script enables you to process an equirectangular image, utilizing gstd to perform a horizontal panning effect and encapsulate this into a 15-second video. To use this script, follow these steps:
- Copy the provided code into a file named
sample.sh
. - Make sure the
gstd
daemon is running in the background on your system. This is necessary for the script to function correctly as it relies on gstd to manage the GStreamer pipeline. - Make the script executable con
chmod +x sample.sh
. - Execute the script by running
./sample.sh <path_to_your_image.jpg>
.
./sample.sh sample.jpg
#!/bin/bash if [ "$#" -ne 1 ]; then echo "Usage: $0 <path_to_image>" exit 1 fi image_path="$1" counter=0 loops=0 duration=15 # Video duration in seconds frame_interval=0.02 # Time between frames in seconds total_frames=$(echo "scale=0; $duration / $frame_interval" | bc) gst-client pipeline_create p1 "filesrc location=${image_path} ! jpegdec ! imagefreeze ! videoconvert ! videoscale ! video/x-raw,format=RGBA,width=1920,height=1080 ! rrpanoramaptz name=ptz ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=./sample.ts" gst-client pipeline_play p1 while [ $loops -lt $total_frames ]; do gst-client --quiet element_set p1 ptz pan ${counter} ((counter++)) if [ $counter -ge 360 ]; then counter=0 fi ((loops++)) sleep $frame_interval done gst-client pipeline_stop p1 gst-client pipeline_delete p1
You can play the video using:
gst-launch-1.0 filesrc location=./sample.ts ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink