RVMedia 8.0 has been released.
A brief list of changes since RVMedia 7.0:
- local (USB) web cameras:
- new TRVWebCamProperties component, displays a dialog for editing properties of the selected local web camera;
- methods and properties for changing properties of local web cameras (such as brightness, contrast, etc.);
- more camera video modes are supported in Windows; added support for camera video modes in Linux; only supported video modes are shown;
- user-friendly camera names in Linux.
- in TRVCamera component, color control methods are improved for all cameras that support changing them (brightness, contrast, saturation, sharpness, hue)
- full-screen mode for video viewers
- resizing viewers in TRVCamMuliView component (together with the parent component)
- remote IP-cameras and video streams:
- proxy settings;
- code for controlling and changing parameters of IP cameras is optimized;
- improved authentication, a login dialog.
- built-in MJpeg reading is optimized, both for local files and remote streams
- GStreamer 1.0 support (so both v0.1 and 1.0 are supported);
- new properties for GStreamer 1.0 configuration;
- improved authentication, a login dialog.
- new properties for FFmpeg configuration;
- improved authentication, a login dialog;
- more precise timing between video frames.
- data transfer between TRVCamSender and TRVCamReceiver components is improved, especially for large data (such as files)
- RAD Studio 10.4 is supported
Main changes since the last release (RVMedia 7.5.1)
- much better support for local cameras in Linux
- much faster reading MJpeg streams via HTTP (without using FFmpeg or GStreamer)
- more properties to configure FFmpeg
- more precise timing when displaying FFmpeg video
- more properties to configure GStreamer 1.0, UDP support, protocol detection from URL, ability to create a pipeline for other data sources and video formats
- possibility to modify GStreamer 1.0 pipeline (so you can add commands for recording or streaming)
- the code for controlling and changing properties of IP-cameras is rewritten completely; now it is much more optimal, and some new commands are supported.
As you can see, in this release I decided to complete, optimize and improve existing features.
New features (such as ONVIF, reading remote sound streams, Linux FMX) are moved to future updates.
Local cameras in Linux
Note: currently, only Lazarus (Free pascal) version of RVMedia supports Linux. Linux FireMonkey support is planned for future.
In this update we completed support of USB webcams in Linux.
Before this update, in Linux, TRVCamera could only display video from local cameras. It could not change their properties, even video resolution.
Now, a complete set of features is implemented.
Listing cameras (video capture devices)
Previously, TRVCamera.VideoDeviceList listed paths to cameras, like ‘/dev/video1’, ‘/dev/video2’, etc.
Now, this property returns user-friendly names of devices.
Paths are accessible using TRVCamera.VideoDeviceIdList property.
TRVCamera.FillVideoDeviceList method uses user-friendly names of devices as well.
Only supported video capture devices are included in the property (previously, it might include other devices).
Since this version, TRVCamera methods for managing camera video modes work not only in Windows, but also in Linux.
In Linux, TRVCamVideoMode structure contains only 3 fields: Width, Height (frame size) and PixelFormat.
To get a name of pixel format, use GetWebCamPixelFormat method defined in mrvlcl_lin_WebCamera.pas
The screenshot shows the demo in Demos\Lazarus\Cameras\WebCamera.
You can see a list of cameras and a list of video modes.
When you switch TRVCamera to a web camera, the initial video mode is chosen according to VideoResolution property (the most similar video mode is selected).
Later, you can change video mode using SetCamVideoMode method.
Since this version, the color managing properties and methods of TRVCamera work for video capture devices in Linux (of course, if they support these properties), including:
Dialog for changing properties
TRVWebCamDialog is now available in Linux version as well.
It looks differently from the Windows version:
As you can see, the dialog lists properties supported by the camera, and allows changing their values.
Values of integer, boolean, menu type are represented using a trackbar, checkbox, combobox respectively.
For a comparison, this is how Windows dialog looks like:
In Windows, the dialog is localized completely (see Language property].
In Linux, property names are read from the system, they are English only (other controls on the dialog are localized).
On request, we can localize names of most frequently used properties.
the only feature that was not implemented for local cameras in Linux is their movement. If you have a PTZ local camera and wish to help us to test its movement control in Linux, please let me know.
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.
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:
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:
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.
New properties for FFmpeg
In this update, the following properties are added to TRVCamera.FFmpegProperty:
- ProbeSize sets probing size in bytes, i.e. the size of the data to analyze to get stream information. A higher value will enable detecting more information in case it is dispersed into the stream, but will increase latency.
- FrameDrop allows dropping video frames if they are received too late. Dropping frames is useful if RVMedia cannot display them in time, to decrease latency. RVMedia can drop delayed frames later, but this property allows dropping them as soon as possible, preventing a time waste for processing frames that will not be displayed. This property is implemented not by FFmpeg library but by RVMedia itself.
- CustomProperties: TStringsList – a list of properties that can be passed to FFmpeg. It is useful for properties that are not published in TRVCamera.FFmpegProperty. These properties are the same properties that can be added to a command line of ffplay utility. Please consult FFmpeg manual for a list of available properties.
Other changes related to FFmpeg
1. Delays between video frames is calculated with higher precision.
2. When loading FFmpeg from the specific path, RVMedia adds the path to DLLs to the application %PATH% environment variable (without modifying the system variable). It helps FFmpeg libraries to find each other, if the path to them is not in the system %PATH% variable.
If FFmpeg and GStreamer are not used, RVMedia can display MJpeg video streams from a file or via HTTP protocol.
Since this update, TRVCamers uses larger buffers when reading network MJpeg streams.
If video frames are large, it makes reading much more faster and efficient (lower CPU use), and eliminates latency that was possible in previous versions of RVMedia.
IP camera control
The code that controls IP cameras and changes their properties is rewritten completely.
Previously, all commands were spread all over MRVCamera unit inside TRVCamera class.
Now, they are separated into classes: TRVFoscamAPI_Ver1, TRVFoscamAPI_Ver1_2, TRVPanasonicAPI, TRVDLinkAPI, TRVAxisAPI.
TRCamera component interacts with TRVIPCameraAPI class that encapsulates the classes listed above.
The new code is much more compact, clear, and more easy to modify.
Several operations are implemented more efficiently, especially a user list management.
Brightness control is now supported for Panasonic cameras (and compatible).
There is a change that affects compatibility. All operations on TRVCamera.Users collection property are applied to the IP camera immediately. It is not always desirable (for example, it makes sense to add a user as a single operation, instead of adding a new user, then changing user name, password and role).
Previously, you could disable sending changes to IP camera, then call TRVCamera.UpdateUsers to apply all changes. This ways is not optimal for most cameras. So we removed UpdateUsers, and added AddUser and ModifyUser methods instead.
Changes in demo projects
“Properties” button is added to the Lazarus version of this demo, like in VCL and FMX versions.
It displays a webcam properties dialog, which is cross-platform since this version.
This demo supports a list of video modes both in Windows and Linux, see the screenshot above
“Brightness” and “Contrast” trackbars are fixed. Now they are implemented properly, using GetColorControlPropertyRange method. Now they are available both for IP cameras and local video capture devices (USB webcams)
AddUser and ModifyUser are used instead of UpdateUsers to manage a user list for the selected IP camera.
(because of UpdateUsers, the old version of this demo cannot be compiled using RVMedia 8 )
3) The list of sample cameras (which is used in many demos) is updated. Dead cameras are removed, new public cameras are added. Descriptive names are assigned to both new and old cameras.