Spherical Video PTZ/Examples/Gst-launch: Difference between revisions

From RidgeRun Developer Wiki
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|next=Examples/GstD|metakeywords=}}
{{Spherical Video PTZ/Head|previous=Examples|next=Examples/GstD|title=Gst-launch Spherical Video PTZ Examples|description=This wiki page is about the Gst-launch examples for Spherical Video PTZ product}}
</noinclude>
</noinclude>


Line 7: Line 7:
'''1.''' Download the sample image, if you haven't already.
'''1.''' Download the sample image, if you haven't already.


<syntaxhighlight lang=bash line>
<syntaxhighlight lang="bash" line>
cd $SAMPLES
cd $SAMPLES
wget "https://unsplash.com/photos/PYpkPbBCNFw/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzExNTE1MTQxfA&force=true" -O example_image.jpg
wget "https://unsplash.com/photos/PYpkPbBCNFw/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzExNTE1MTQxfA&force=true" -O example_image.jpg
Line 13: Line 13:


'''2.''' export the following variables.For these examples, we'll use the following settings, but feel free to adjust them according to your needs.
'''2.''' export the following variables.For these examples, we'll use the following settings, but feel free to adjust them according to your needs.
<pre>
<syntaxhighlight lang="bash" line>
# OUTPUT_PATH: The file path where the processed video will be saved.
# OUTPUT_PATH: The file path where the processed video will be saved.
export OUTPUT_PATH=example_image.ts
export OUTPUT_PATH=example_image.ts
Line 20: Line 20:
# HOST_IP: The IP address of the host machine for receiving the stream.
# HOST_IP: The IP address of the host machine for receiving the stream.
export HOST_IP=10.42.0.1
export HOST_IP=10.42.0.1
</pre>
</syntaxhighlight>


==Using System Memory==
==Using System Memory==
===Display===
===Display===
* '''Video Test Pattern Display:''' Generates a test pattern, applies PTZ (Pan, Tilt, Zoom) transformations, and adjusts the output size for display.
* '''Video Test Pattern Display:''' Generates a test pattern, applies PTZ (Pan, Tilt, Zoom) transformations, and adjusts the output size for display.
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 videotestsrc pattern=0 ! "video/x-raw,width=1920,height=1080" ! rrpanoramaptz zoom=2.1 ! "video/x-raw,width=1920,height=1080" ! queue ! videoconvert ! autovideosink
gst-launch-1.0 videotestsrc pattern=0 ! "video/x-raw,width=1920,height=1080" ! rrpanoramaptz zoom=2.1 ! "video/x-raw,width=1920,height=1080" ! queue ! videoconvert ! autovideosink
</pre>
</syntaxhighlight>


* '''Image Zoom and Display:''' Takes an equirectangular image, applies a zoom effect, and displays the result. Use this to showcase specific features of panoramic images.
* '''Image Zoom and Display:''' Takes an equirectangular image, applies a zoom effect, and displays the result. Use this to showcase specific features of panoramic images.
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 filesrc location=$SAMPLES/example_image.jpg ! jpegdec ! imagefreeze ! videoconvert ! video/x-raw,format=RGBA ! rrpanoramaptz zoom=1.5 ! videoconvert ! autovideosink
gst-launch-1.0 filesrc location=$SAMPLES/example_image.jpg ! jpegdec ! imagefreeze ! videoconvert ! video/x-raw,format=RGBA ! rrpanoramaptz zoom=1.5 ! videoconvert ! autovideosink
</pre>
</syntaxhighlight>


===Recording===
===Recording===
* '''Record PTZ-Transformed Video:''' Captures an input image, applies PTZ transformations, and encodes the output into a video file. This pipeline is useful for creating panoramic videos with dynamic perspectives.
* '''Record PTZ-Transformed Video:''' Captures an input image, applies PTZ transformations, and encodes the output into a video file. This pipeline is useful for creating panoramic videos with dynamic perspectives.
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 filesrc location=$SAMPLES/example_image.jpg  ! jpegdec ! imagefreeze ! videoconvert ! videoscale ! video/x-raw,format=RGBA ,width=1920,height=1080 ! rrpanoramaptz zoom=1.5 ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=$OUTPUT_PATH
gst-launch-1.0 filesrc location=$SAMPLES/example_image.jpg  ! jpegdec ! imagefreeze ! videoconvert ! videoscale ! video/x-raw,format=RGBA ,width=1920,height=1080 ! rrpanoramaptz zoom=1.5 ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=$OUTPUT_PATH
</pre>
</syntaxhighlight>
To decode and view the video, use:
To decode and view the video, use:
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 filesrc location=$OUTPUT_PATH ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink
gst-launch-1.0 filesrc location=$OUTPUT_PATH ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink
</pre>
</syntaxhighlight>


===Streaming===
===Streaming===
* '''Live Streaming with PTZ Controls:''' Streams a live video feed with PTZ controls, encoding the content in H.264 format for UDP transmission. Example of use for for real-time broadcasting of panoramic content.
* '''Live Streaming with PTZ Controls:''' Streams a live video feed with PTZ controls, encoding the content in H.264 format for UDP transmission. Example of use for for real-time broadcasting of panoramic content.
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 videotestsrc pattern=18 ! rrpanoramaptz !  nvvidconv ! nvv4l2h264enc idrinterval=30 insert-aud=true insert-sps-pps=true insert-vui=true ! h264parse ! mpegtsmux ! udpsink port=$PORT host=$HOST_IP
gst-launch-1.0 videotestsrc pattern=18 ! rrpanoramaptz !  nvvidconv ! nvv4l2h264enc idrinterval=30 insert-aud=true insert-sps-pps=true insert-vui=true ! h264parse ! mpegtsmux ! udpsink port=$PORT host=$HOST_IP
</pre>
</syntaxhighlight>


Client setup for receiving the stream:
Client setup for receiving the stream:
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 udpsrc port=$PORT address=$HOST_IP ! queue ! tsdemux ! h264parse ! queue ! decodebin ! videoconvert ! fpsdisplaysink
gst-launch-1.0 udpsrc port=$PORT address=$HOST_IP ! queue ! tsdemux ! h264parse ! queue ! decodebin ! videoconvert ! fpsdisplaysink
</pre>
</syntaxhighlight>


==Using NVMM (GPU Acceleration)==
==Using NVMM (GPU Acceleration)==
Line 59: Line 59:
===Recording===
===Recording===
* '''GPU-Accelerated Video Recording:''' Encondes the video in H.264 format, and saving it to a file.  
* '''GPU-Accelerated Video Recording:''' Encondes the video in H.264 format, and saving it to a file.  
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 videotestsrc pattern=0 ! nvvidconv ! "video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1080" ! rrpanoramaptz zoom=1.5 ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=$OUTPUT_PATH
gst-launch-1.0 videotestsrc pattern=0 ! nvvidconv ! "video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1080" ! rrpanoramaptz zoom=1.5 ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=$OUTPUT_PATH
</pre>
</syntaxhighlight>
To decode and view the video, use:
To decode and view the video, use:
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 filesrc location=$OUTPUT_PATH ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink
gst-launch-1.0 filesrc location=$OUTPUT_PATH ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink
</pre>
</syntaxhighlight>


===Streaming===
===Streaming===
* '''GPU-Accelerated Video Streaming:''' Streams a live video feed with PTZ controls, encoding the content in H.264 format for UDP transmission.
* '''GPU-Accelerated Video Streaming:''' Streams a live video feed with PTZ controls, encoding the content in H.264 format for UDP transmission.
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 videotestsrc pattern=0 ! nvvidconv ! "video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1080" ! rrpanoramaptz ! nvvidconv ! nvv4l2h264enc idrinterval=30 insert-aud=true insert-sps-pps=true insert-vui=true ! h264parse ! mpegtsmux ! udpsink port=$PORT host=$HOST_IP
gst-launch-1.0 videotestsrc pattern=0 ! nvvidconv ! "video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1080" ! rrpanoramaptz ! nvvidconv ! nvv4l2h264enc idrinterval=30 insert-aud=true insert-sps-pps=true insert-vui=true ! h264parse ! mpegtsmux ! udpsink port=$PORT host=$HOST_IP
</pre>
</syntaxhighlight>


Client setup for receiving the stream:
Client setup for receiving the stream:
<pre>
<syntaxhighlight lang="bash">
gst-launch-1.0 udpsrc port=$PORT address=$HOST_IP ! queue ! tsdemux ! h264parse ! queue ! decodebin ! videoconvert ! fpsdisplaysink
gst-launch-1.0 udpsrc port=$PORT address=$HOST_IP ! queue ! tsdemux ! h264parse ! queue ! decodebin ! videoconvert ! fpsdisplaysink
</pre>
</syntaxhighlight>


<noinclude>
<noinclude>
{{Spherical Video PTZ/Foot|Examples|Examples/GstD}}
{{Spherical Video PTZ/Foot|Examples|Examples/GstD}}
</noinclude>
</noinclude>

Latest revision as of 18:37, 13 February 2025


Previous: Examples Index Next: Examples/GstD






Setting up the environment

1. Download the sample image, if you haven't already.

cd $SAMPLES
wget "https://unsplash.com/photos/PYpkPbBCNFw/download?ixid=M3wxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNzExNTE1MTQxfA&force=true" -O example_image.jpg

2. export the following variables.For these examples, we'll use the following settings, but feel free to adjust them according to your needs.

# OUTPUT_PATH: The file path where the processed video will be saved.
export OUTPUT_PATH=example_image.ts
# PORT: The port number used for UDP streaming.
export PORT=1234
# HOST_IP: The IP address of the host machine for receiving the stream.
export HOST_IP=10.42.0.1

Using System Memory

Display

  • Video Test Pattern Display: Generates a test pattern, applies PTZ (Pan, Tilt, Zoom) transformations, and adjusts the output size for display.
gst-launch-1.0 videotestsrc pattern=0 ! "video/x-raw,width=1920,height=1080" ! rrpanoramaptz zoom=2.1 ! "video/x-raw,width=1920,height=1080" ! queue ! videoconvert ! autovideosink
  • Image Zoom and Display: Takes an equirectangular image, applies a zoom effect, and displays the result. Use this to showcase specific features of panoramic images.
gst-launch-1.0 filesrc location=$SAMPLES/example_image.jpg ! jpegdec ! imagefreeze ! videoconvert ! video/x-raw,format=RGBA ! rrpanoramaptz zoom=1.5 ! videoconvert ! autovideosink

Recording

  • Record PTZ-Transformed Video: Captures an input image, applies PTZ transformations, and encodes the output into a video file. This pipeline is useful for creating panoramic videos with dynamic perspectives.
gst-launch-1.0 filesrc location=$SAMPLES/example_image.jpg  ! jpegdec ! imagefreeze ! videoconvert ! videoscale ! video/x-raw,format=RGBA ,width=1920,height=1080 ! rrpanoramaptz zoom=1.5 ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=$OUTPUT_PATH

To decode and view the video, use:

gst-launch-1.0 filesrc location=$OUTPUT_PATH ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink

Streaming

  • Live Streaming with PTZ Controls: Streams a live video feed with PTZ controls, encoding the content in H.264 format for UDP transmission. Example of use for for real-time broadcasting of panoramic content.
gst-launch-1.0 videotestsrc pattern=18 ! rrpanoramaptz !  nvvidconv ! nvv4l2h264enc idrinterval=30 insert-aud=true insert-sps-pps=true insert-vui=true ! h264parse ! mpegtsmux ! udpsink port=$PORT host=$HOST_IP

Client setup for receiving the stream:

gst-launch-1.0 udpsrc port=$PORT address=$HOST_IP ! queue ! tsdemux ! h264parse ! queue ! decodebin ! videoconvert ! fpsdisplaysink

Using NVMM (GPU Acceleration)

Recording

  • GPU-Accelerated Video Recording: Encondes the video in H.264 format, and saving it to a file.
gst-launch-1.0 videotestsrc pattern=0 ! nvvidconv ! "video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1080" ! rrpanoramaptz zoom=1.5 ! nvvidconv ! nvv4l2h264enc ! h264parse ! mpegtsmux ! filesink location=$OUTPUT_PATH

To decode and view the video, use:

gst-launch-1.0 filesrc location=$OUTPUT_PATH ! tsdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! autovideosink

Streaming

  • GPU-Accelerated Video Streaming: Streams a live video feed with PTZ controls, encoding the content in H.264 format for UDP transmission.
gst-launch-1.0 videotestsrc pattern=0 ! nvvidconv ! "video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1080" ! rrpanoramaptz ! nvvidconv ! nvv4l2h264enc idrinterval=30 insert-aud=true insert-sps-pps=true insert-vui=true ! h264parse ! mpegtsmux ! udpsink port=$PORT host=$HOST_IP

Client setup for receiving the stream:

gst-launch-1.0 udpsrc port=$PORT address=$HOST_IP ! queue ! tsdemux ! h264parse ! queue ! decodebin ! videoconvert ! fpsdisplaysink



Previous: Examples Index Next: Examples/GstD