I have created a custom GStreamer plugin named brightness I checked it with the gst-inspect-1.0
and gst-launch-1.0
commands and am able to get video output. I used the following command:
gst-launch-1.0 filesrc location=sample-15s.mp4 ! decodebin ! videoconvert ! video/x-raw,format=RGB ! brightness brightness=1.0 ! videoconvert ! vp8enc ! webmmux ! filesink location=capture1.webm
Codebaselink: link
In the codebase, I am setting all data to 0, so I expect a black video in the output file, capture1.webm
. However, I’m getting the same video as the input. I also added a print statement after setting the data to 0, and it printed 0 as expected. I’m not sure why the output is not as expected.
_transform_frame_ip function details:
static GstFlowReturn gst_brightness_transform_frame_ip(GstVideoFilter *filter, GstVideoFrame *frame) {
GstBrightness *brightness = GST_BRIGHTNESS(filter);
guint8 *data = GST_VIDEO_FRAME_PLANE_DATA(frame, 0);
gsize size = GST_VIDEO_FRAME_COMP_PSTRIDE(frame, 0) * GST_VIDEO_FRAME_HEIGHT(frame);
printf("frame received:%f\n", brightness->brightness);
for (gsize i = 0; i < size; i++) {
gint pixel = data[i] + (gint)(brightness->brightness * 255.0);
data[i] = 0; //CLAMP(pixel, 0, 255);
}
return GST_FLOW_OK;
}
I am expecting black video in the output file.