Closed Talkless closed 1 year ago
We can try playing h264 from file:
wget https://archive.org/download/big_buck_bunny_1080p_CLHD/big_buck_bunny_1080p_CLHD.mp4
env GST_DEBUG_NO_COLOR=1 GST_DEBUG="GST_TRACER:7" GST_TRACERS="latency(flags=pipeline+element)" GST_DEBUG_FILE=trace.log timeout 5s ./gst-launch-1.0 filesrc location=$(pwd)/big_buck_bunny_1080p_CLHD.mp4 ! queue max-size-buffers=0 ! qtdemux ! queue max-size-buffers=0 ! h264parse ! queue max-size-buffers=0 ! imxvpudec_h264 ! queue max-size-buffers=0 ! glimagesink
Now gst-stats-1.0
shows smaller latency when we use file source instead of rtsp:
0xaaaafac0ca10.imxvpudech264-0.src: mean=0:00:00.006786511 min=0:00:00.004894840 max=0:00:00.022958374
Finally revisiting this. I did a glass-to-glass measurement. First, I measured the latency I get when recording something with a USB camera and showing the recording on the same PC the camera is connected to. Then, I set up an RTSP server that encodes the camera signal and sends it to the board. There, I ran your pipeline.
Important: The camera was set up to record 640x480 at 30 fps.
My glass-to-glass measurements showed similar latency figures. However, interestingly, when I replaced imxvpudec_h264
with avdec_h264
, I got almost identical latency. This tells me that imxvpudec
is not the reason for this latency. It is unclear at this point what is.
You can try it yourself. Replace imxvpudec_h264
with avdec_h264
and do a glass-to-glass measurement.
Thanks for your test @dv1 , but after getting latest image from device manufacturers I can get very low latency, about 200ms:
Not sure why thought, but I don't complain :) .
https://github.com/Freescale/gstreamer-imx/assets/292191/508ae026-2526-41b2-86d4-61cae6a51b24
Our software on Linux Desktop uses this GSTreamer v1.22.1 to achieve VA-API-based hardware-accelerated IP camera video decoding with just about 220ms delay from reality using this pipeline:
Meanwhile, on IMX8MM device (some Chinese-made "panel pc") with this pipeline:
I get ~400ms "lag" from the reality. I had to increace
latency=200
forrtspsrc
to make video framerate stable.I see same latency without
qmlglsink
, by usingglimagesink
ingst-launch-1.0
, and if I enable tracing like this:I get these statistics:
Highlight:
0xaaaafd2398a0.imxvpudech264-0.src: mean=0:00:00.163509955 min=0:00:00.074685122 max=0:00:00.242467406
So only
imxvpudech264
element itself results basically half of the whole latency.Is this inherently unavoidable with IMX devices, or could it be reduced?