Spherical Video PTZ/Examples/GstD: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
{{Spherical Video PTZ/Head|previous=Examples/Gst-launch|next=Performance}} | {{Spherical Video PTZ/Head|previous=Examples/Gst-launch|next=Performance|title=GstD Spherical Video PTZ Examples|description=This wiki page is about the GstD examples for Spherical Video PTZ product}} | ||
</noinclude> | </noinclude> | ||
Line 8: | Line 8: | ||
* With this pipeline, you can take an input image, dynamically adjust PTZ properties, and save the output to a file sink. | * 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. | * Ensure that the gstd daemon is running in background. | ||
< | <syntaxhighlight lang="bash"> | ||
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 | 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 | ||
</ | </syntaxhighlight> | ||
* 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: | * 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: | ||
Line 18: | Line 18: | ||
# Execute the script by running <code>./sample.sh <path_to_your_image.jpg></code>. | # Execute the script by running <code>./sample.sh <path_to_your_image.jpg></code>. | ||
< | <syntaxhighlight lang="bash"> | ||
./sample.sh sample.jpg | ./sample.sh sample.jpg | ||
</ | </syntaxhighlight> | ||
<syntaxhighlight lang="bash" line> | <syntaxhighlight lang="bash" line> | ||
Line 56: | Line 56: | ||
You can play the video using: | You can play the video using: | ||
< | <syntaxhighlight lang="bash"> | ||
gst-launch-1.0 filesrc location=./sample.ts ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink | gst-launch-1.0 filesrc location=./sample.ts ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink | ||
</ | </syntaxhighlight> | ||
<noinclude> | <noinclude> | ||
{{Spherical Video PTZ/Foot|Examples/Gst-launch|Performance}} | {{Spherical Video PTZ/Foot|Examples/Gst-launch|Performance}} | ||
</noinclude> | </noinclude> |
Latest revision as of 18:39, 13 February 2025
Spherical Video PTZ |
---|
![]() |
Getting Started |
User Guide |
Examples |
Performance |
Contact Us |
For instructions on how to build and install Gstreamer Daemon (GstD) follow Building_GStreamer_Daemon Wiki 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