Freescale / gstreamer-imx

GStreamer 1.0 plugins for i.MX platforms
Other
182 stars 127 forks source link

imxg2dvideotransform & framerate=1/1 #318

Closed d-lareg closed 1 year ago

d-lareg commented 1 year ago

SOC: i.MX 8M+ gstreamer-imx version: master

Hi, I would like to exec a pipeline that only provides one image per second, no matter what the source stream is. I have a local RSTP stream running with 25FPS. The following pipeline works fine:

gst-launch-1.0 -ve rtspsrc location="rtsp://192.168.1.2:8554/Streaming/Channels/101" latency=1000 ! queue ! rtph264depay ! h264parse ! imxvpudec_h264 ! imxg2dvideotransform ! video/x-raw,width=768,height=512 ! videorate ! "video/x-raw,framerate=1/1" ! fakesink

Since imxg2dvideotransform also has a framerate property I would like to execute the frame dropping using the VPU with:

gst-launch-1.0 -ve rtspsrc location="rtsp://192.168.1.2:8554/Streaming/Channels/101" latency=1000 ! queue ! rtph264depay ! h264parse ! imxvpudec_h264 ! imxg2dvideotransform ! video/x-raw,width=768,height=512,framerate=1/1 ! fakesink

But the mentioned pipeline crashes and only runs if I set framerate=25/1 which is doing nothing.

Is this a bug or is this behavior intended?

dv1 commented 1 year ago

This is intended behavior. imxg2dvideotransform has framerate caps, not properties. The framerate is not converted. That is, if the upstream caps at its sinkpad contain for example 25/1, then the caps at its srcpad will also contain 25/1. imxg2dvideotransform does colorspace conversion (with basic colorimetry support), rotation (in 90-degree steps), input cropping, and scaling, but no framerate conversions. You need to use videorate for that.

But the crash is a bug. I'll investigate that, and I will close this issue once I figured out why this crash happens. Can you produce logs for the second pipeline, once with framerate set to 1/1 (to trigger the crash), and once set to 25/1 (to trigger the "doing nothing" situation)?

d-lareg commented 1 year ago

Hi, and thanks for your quick response. My choice of words was a little bit misleading. The pipe does not crashes but throws an error. The log for GST_DEBUG=3 is attached. gst_log.txt

dv1 commented 1 year ago

Yes, this makes sense. The framerate won't be changed by the existing elements - it will still be 25 FPS. But you apply a capsfilter that limits the allowed caps to 1 FPS. Hence the not-negotiated error. A videorate element is what you want here.

Can you elaborate on "and only runs if I set framerate=25/1 which is doing nothing" though? What do you mean, "doing nothing"? As in: It is redundant, since 25 FPS is already the input framerate? Or as in: nothing arrives at the fakesink?

d-lareg commented 1 year ago

If I set framerate=25/1 everything works fine since it matches the stream framerate. I wasn't clear about that it is only filter. You can close the issue since everything works as expected. 👍

dv1 commented 1 year ago

Alright!