Spherical Video PTZ: Examples - Gst-launch
Spherical Video PTZ |
---|
Getting Started |
User Guide |
Examples |
Performance |
Contact Us |
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