Continuous video playback - Gstreamer issue

Environment
Module: Colibri-iMX8x 4GB
BSP: Linux5.7.0
(Linux Reference Multimedia 5 LTS
Downstream SoC vendor based kernel
Wayland/XWayland graphics back-end included)
Board: Colibri Development Board

Our customer wants a QT app that continuously plays video files.
but it ends with an error.
I’ve attached a simple QT project that reproduces the problem.

project: video_test
execute file: exec
log: log
video file: test.mp4 (480x800 60fps)

If you repeat play and stop several times, the following error will be issued at the end and you will not be able to play.
(video_test:1199): GStreamer-CRITICAL **: 04:09:35.933: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed
Error: “Failed to allocate required memory.”

I think there is a problem with the Gstreamer plugin.
In the case of 30fps, it is unlikely to occur.
Please let me know any workaround for this.
files.tar.xz (2.4 MB)

Best regards.

Hi @developer0916, without knowing too much of the problem, does it happen outside Qt? (ie. gst-launch-1.0 or gplay-1.0). Also, I see that this is using Qt6. Did you try in Qt5?

Thanks,
Alvaro.

This is using BSP 5.7.0 as is. That is, QT5.14.

It does not occur in Ubuntu for the reason that Gstreamer seems to be the problem.
It also does not occur when Colibri-iMX8x plays by CPU.

Furthermore I am now also trying with Verdin-iMX8MP and it does not occur.
The papline is a little different here.
v4l2h264dec → vpudec

Best regards.

Can you share the Gstreamer pipeline to reproduce this in Colibri iMX8X?

Thanks.

please check attached file.
Source code has pipeline.

Best regards.

Thanks, just saw it.

filesrc location=/home/root/test.mp4 ! qtdemux ! h264parse ! v4l2h264dec ! videoconvert ! autovideosink

Did you managed to get the issue outside of Qt? Just to clarify that this is not a Qt issue (also, this removes the need to compile the Qt app making the debug easier).

Also, did you monitor the memory in case it is a memory issue? (ie. htop)

Kind regards.

I am trying with opencv now.

The memory used is kept at about 2%.
No memory leakage has occurred.

Best regards.

1 Like

We are trying with

watch -n1 gst-launch-1.0 filesrc location=/home/root/test.mp4 ! qtdemux ! h264parse ! v4l2h264dec ! videoconvert ! autovideosink

In Multimedia Image 5.7.0. So far no issue after +100 times.

I tried with opencv.
I works 1000 times.

However, it seems that it may take an hour or more before the problem occurs.
Originally, many files are played one after another.
I will continue to monitor progress.

However, if it is a QT problem, I think that the same phenomenon will occur in other modules.

python code

import cv2
import time

cnt=1
while True:
    start = time.time()
    cap = cv2.VideoCapture('filesrc location=test.mp4 ! qtdemux ! h264parse ! v4l2h264dec ! videoconvert ! appsink', cv2.CAP_GSTREAMER)

    while(cap.isOpened()):
        ret, frame = cap.read()
        if ret == True:
            cv2.imshow("Video", frame)

            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
        else:
            break
        now = time.time()
        if now - start > 1 :
            break
    cv2.destroyAllWindows()
    print(cnt)
    cnt=cnt+1

Best regards.

We left the video playing through the whole night and the video was still looping in the morning.

Once the error comes out it won’t play again and you need a restart, right?

We can try with your OpenCV code.

It seems my source code was bad.
I re-created the QT code.

The cause seems to be a leak in the file descriptor.
I added logging of file descriptors.
This does not happen unless the playback is stopped and played quickly.
It only stops happening with a small lag in between.
It may not happen in Python due to slow processing.

file2.tar.xz (299.5 KB)

Best regards.

Hmm, could it be that we need to manually stop the Gstreamer pipeline during the playback?

To be honest I would try to workaround this at least for the time being… If you know that the playback is stopped, I would leave a few seconds before resuming the player.

To keep the file size small, only one video is used, but it is originally used to switch between various videos.
At least with QT5, it is possible to work around it by waiting a bit.

By the way, is it possible to make this topic private?

Best regars.

Yes, customer should try that… Let’s see if it improves… We tried manually stopping the pipeline and launching it again (since this was manual, maybe 200-300 ms between stop and play) but we couldn’t reproduce the issue.

I’ve unlisted the topic, so one can only access with direct link. I can close it or delete it, let me know.

I have found a very simple BUG.
Only Colibri-iMX8x does not play video properly even with the videowidget sample code that comes with QT5. This does not happen with other modules.
This is easily reproducible.

The same is true for the Python code I wrote above.
The video does not display correctly.

Best regards.

Thanks for the feedback. Let us check and we will get back to you, but if it only happens with Colibri iMX8X I don’t think we will be able to solve it any time soon, as it is probably related with low level components.

Alvaro.

That does not happen with the boot2qt6.2.3 OS image. It is probably solvable, but I don’t know what the difference is at the moment.

Best regards.

Can it be workaround’ed? For example, leaving some time between video playbacks.

There is no workaround.
The only way to reproduce it is to play it back.
Video does not play normally or flickers.
No continuous playback.

Best regards.