[Apalis i.MX8QM] How to get 60fps when play 4K video on Weston with GStreamer

Hi,

I am testing Apalis i.MX8QM with 4K 60fps video on Weston with GStreamer but it cannot reach 60fps.

My environment is:

Video test: videotestsrc_4k60_h265.mp4
This video is created by command (on another machine):

gst-launch-1.0 videotestsrc num-buffers=600 \
             ! video/x-raw,width=3840,height=2160,framerate=60/1,format=NV12 \
             ! vaapih265enc ! h265parse ! qtmux \
             ! filesink location=videotestsrc_4k60_h265.mp4

Test command:

gst-launch-1.0 -v filesrc location=videotestsrc_4k60_h265.mp4 \
                ! qtdemux ! h265parse ! v4l2h265dec \
                ! queue \
                ! fpsdisplaysink video-sink=waylandsink text-overlay=false

Result is video is played in just 30 FPS.

I also tried scaling video with imxvideoconvert_g2d, and FPS is also under 30.

gst-launch-1.0 -v filesrc location=videotestsrc_4k60_h265.mp4 \
                ! qtdemux ! h265parse ! v4l2h265dec \
                ! imxvideoconvert_g2d ! video/x-raw,width=1920,height=1080 \
                ! queue \
                ! fpsdisplaysink video-sink=waylandsink text-overlay=false

My questions are:

  • Does Apalis i.MX8QM support 4k 60fps video.
  • If so, in what cases 4k 60fps can be achieved, like which configuration needs to be changed or need some kind of special video format, or something else.
  • In case video is scaled, can 60 fps be achieved.

Thank you very much,
Trung

Hi @dothanhtrung , sorry for the late reply. According to NXP should be possible.

Where do you have the video saved? Could it be a read bottleneck? Can you try and save the video in the RAM (/tmp) and see if that improves the performance? Thanks

Alvaro.

1 Like

Where do you have the video saved?

Sorry. I saved video in a micro sdcard. That might affect the FPS.

Can you try and save the video in the RAM (/tmp) and see if that improves the performance?

Thank you for your suggestion. I have tried saving the video in /tmp. Although it doesn’t improved the fps of video play with gst-launch-1.0, it really increases performance in my another use case, which plays video with GStreamer API in a Qt window.

I can see in weston-debug that:

  • when play video with gst-launch-1.0, video window , which is created by waylandsink, is not in correct size: 3783x2128 instead of 3840x2160.
    View 1 (role wl_subsurface, PID 1593, surface ID 16, sub-surface, ...):
            position: (28, 32) -> (3811, 2160)  <===== view size 3783x2128
            [fully opaque]
            outputs: 0 (HDMI-A-1) (primary)
            dmabuf buffer
                    format: 0x3231564e NV12
                    modifier: 0xf000000000000001
    
  • when play video with gstreamer and Qt, window is created by Qt, video is displayed in correct size: 3840x2160.

Thank you very much for your help. Now I can play the test video above in 60 FPS with 2 conditions:

  • Video file is stored in ram, or internal flash memory (mmcblk0).
  • Video window is prepared by Qt, not by waylandsink, and GStreamer displays video in that Qt window.

Thanks for the confirmation!

Very interesting. I would understand that the Qt framework adds some overhead when is the other way around and it un-intentionally helps and while waylandsink is suboptimal. Any scaling will definitely affect performance.

Can you share some sample code of the Qt application you used to reproduce this? I think it would be quite helpful for other users :slight_smile:

Thanks,
Alvaro.

Can you share some sample code of the Qt application you used to reproduce this? I think it would be quite helpful for other users

Ah yes. Not exactly same as my application but I have submitted a similar example for using waylandsink with Qt at:

1 Like

Thanks @dothanhtrung ! Did the Qt approach solve your question?

Yes. Thank you. I would like to mark this topic as solved.

1 Like