Unsolved Qt multimedia application performance on iMX8M Plus EVK
-
Hello,
I am creating a media player application to play streams from the camera, local files (MP4, MKV), and online streams (WebRTC).
The attached image shows the MP4 video (1080p, 30fps) being played in the sample application. The webcam stream (720p) is in the top-right corner, and the online stream (1080p 30fps) is in the bottom-right corner in picture-in-picture mode.I have an NXP i.MX8M Plus EVK board, and decided to use the Qt framework to develop the application.
I referred to i.MX Yocto Project's User Guide [https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf], which guides through the process to create the Linux image using Yocto. I followed all the steps to create a full image (imx-image-full, to include Qt6) for the imx8mp-lpddr4-evk machine, using fsl-imx-wayland distro.
Qt6 application
After flashing the image to the board, I ran the video widget sample application [https://github.com/qt/qtmultimedia/tree/6.4/examples/multimedia/videowidget] provided in Qt6 to play an MP4 file with a resolution of 1920x1080. In an ideal state (video not being played) the CPU consumption remains around 3-5%. However, as soon as the video is played, the CPU consumption shoots to approximately 50%. The CPU core gets completely exhausted when running 3 streams simultaneously, and streaming starts to freeze intermittently.GStreamer using gst-launch-1.0
Also, I verified the CPU consumption by playing the same video using a gstreamer pipeline as mentioned in i.MX8 GStreamer User Guide [https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors%40tkb/15/2/i.MX8GStreamerUserGuide.pdf].gst-launch-1.0 filesrc location=<filename.mp4> ! qtdemux name=d d.video_0 ! queue ! h264parse ! vpudec ! queue ! waylandsink
and
gst-launch-1.0 filesrc location=<filename.mp4> ! qtdemux name=d d.video_0 ! queue ! h264parse ! v4l2h264dec ! imxvideoconvert_g2d ! queue ! waylandsink
In both cases, the CPU consumption with gstreamer remains around 5%, which is 10th of the Qt application.
So it is apparent that Qt does not use hardware components (VPU coders and GPU) and uses CPU for the processing of the video.
Are there any verified ways that can play the video in an integrated window in the Qt application with CPU utilization of around 10%?