title: SSIM plugin short_description: GstValidate plugin to detect frame corruptions ...
GstValidate plugin to run the ssim algorithm on the buffers flowing in the pipeline to find regressions and detect frame corruptions. It allows you to generate image files from the buffers flowing in the pipeline (either as raw in the many formats supported by GStreamer or as png) and then check them against pre generated, reference images.
The ssim algorithm will set a value of 1.0 when images are perfectly identical, and -1.0 if they have nothing in common. By default we consider images as similar if they have at least a ssim value of 0.95 but you can override it defining the value under which the test will be considered as failed.
Errors are reported on the GstValidate reporting system. You can also ask the plugin to generate grey scale output images. Those will be named in a way that should lets you precisely see where and how the test failed.
The configuration of the plugin is done through a validate configuration file, specified with the %GST_VALIDATE_CONFIG environment variable. Each line starting with ‘ssim,’ will configure the ssim plugin. In practice each configuration statement will lead to the creation of a #GstValidateOverride object which will then dump image files and if wanted compare those with a set of reference images.
The following parameters can be passed in the configuration file:
Let's take a special configuration where we want to compare frames that are outputted by a video decoder with the ones after a agingtv element we would call my_agingtv. We force to check one frame every 5.0 seconds only (with check-recurrence=5.0) so the test is fast.
The configuration file:
core, action=set-property, target-element-klass=Sink, property-name=sync, property-value=false validatessim, is-config=true, output-video-format="I420", reference-video-format="I420" validatessim, element-classification="Video/Decoder", output-dir=/tmp/test/before-agingtv/ validatessim, element-name=my_agingtv, output-dir=/tmp/test/after-agingtv/, \ reference-images-dir=/tmp/test/before-agingtv/, \ result-output-dir=/tmp/test/failures, check-recurrence=5.0
Save that content in a file called check_agingtv_ssim.config
GST_VALIDATE_CONFIG=check_agingtv_ssim.config gst-validate-1.0 uridecodebin uri=file://a/file ! videoconvert ! agingtv name=my_agingtv ! videoconvert ! autovideosink