GStreamer support
RVMedia 7.3 implemented support of GStreamer 1.0. So now we support both version 1.0 and outdated version 0.1. Of course, version 1 is highly recommended.
RVMedia can use GStreamer to display remote video streams, if
TRVCamera.DeviceType = rvdtRTSP or rvdtHTTP.
All the new features below are for GStreamer 1, they do not work with GStreamer 0.1.
Protocol recognition
Since this update, when GStreamer 1 is used, TRVCamera recognizes a protocol by the value of
URL property, so rvdtRTSP and rvdtHTTP work identically (like with FFmpeg).
TRVCamera checks for http://, https://, rtsp://, udp://
UDP video streams
We implemented a special processing for UDP video streams in GStreamer. There is no UDP option in DeviceType, but you can specify rvdtRTSP or rvdtHTTP, UDP will be recognized by 'udp://' in URL.
If you want to listen the specific port for UDP video stream, you can specify an empty URL host name, only a port, e.g. 'udp://:5000'.
Two formats of UDP streams are supported:
- MJPEG (if
VideoFormat = rvvfMJPEG)
- H.264 (otherwise)
Custom video source and video decode
When displaying video using GStreamer, RVMedia builds a
GStreamer pipeline string, which consists of:
1. video source
2. video decoding
3. converting video frames to the format supported by RVMedia
4. displaying video (by implementation of appsink)
Normally, this process is performed behind the scenes, the programmers can use high-level properties to control it.
Video source is defined by the properties: DeviceType, URL, CameraPort, RTSPPort, UserName, UserPassword,
ProxyProperty.
Video decoding is defined by VideoFormat property.
The example of GStreamer pipeline string containing video source and video decode commands is:
Code: Select all
souphttpsrc location="https://www.trichview.com/videotest/h264.avi " ! avidemux ! h264parse ! avdec_h264
But what if you want to implement another video source or a video format that is not listed in VideoFormat property?
Since this version, RVMedia allows you to do it using a low-level property:
TRVCamera.GStreamerProperty.LaunchString.
If it is assigned, it is used for defining video source and decoding instead of the properties listed above.
Please consult the GStreamer manual for pipeline format and available elements.
Inserting custom commands in GStreamer pipeline
What if you do not want to change video source and decoding, but want to add additional functionality? For example, you may wish to implement a streaming server or to record video to a file, in addition to displaying video.
(you can use
TRVCamRecorder component for recording, but an alternative way may be useful).
Since this version, RVMedia allows you to do it using
TRVCamera.GStreamerProperty.LaunchStringMiddle.
It is inserted in the pipeline between the step 2(decoding) and the step 3 (converting).
In this string, you can use 'tee' element to split the pipeline into two or more branches.
Please consult the GStreamer manual for pipeline format and available elements.
Additional buffering options
A customer provided us with the devices for testing:
- raspberry-photo.jpg (62.27 KiB) Viewed 76030 times
These are two Raspberry Pi boards connected wirelessly. One of them has a camera and should be installed on a quadcopter. Another one is connected to a computer via the ethernet cable, and sends an UDP video stream to the specific port.
This stream is displayed successfully with RVMedia using GStreamer, however, artifacts appears regularly.
After several experiments, I found a way to solve this problem, by adding additional buffers ('queue2' element) before the final step 4 (RVMedia appsink).
So I added a new property
TRVCamera.GStreamerProperty.UseQueue.
It maybe useful for other video sources as well.
Specifying GStreamer folder
Normally, GStreamer is installed by its setup application, which adds a path to GStreamer files to an environment variable.
RVMedia uses this variable to find the GStreamer location.
But what if you do not want to use the setup and to add environment variables?
Since this version, you can load GStreamer from the specific folder using
LoadGStreamerLibraries procedure. This procedure works both for GStreamer 1 and 0.1.
Also, since this version, RVMedia adds the path to GStreamer DLLs to the application %PATH% environment variable (without modifying the system variable). It helps GStreamer libraries to find each other, if the path to them is not in the system %PATH% variable.