Resize videos larger than full HD to sizes within full HD using gstreamer running on i.MX8M Mini

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Resize videos larger than full HD to sizes within full HD using gstreamer running on i.MX8M Mini

637 Views
KATA_KAN
Contributor II

Dear, All.

My name is KATA_KAN. 
I am developing software for a board equipped with i.MX8M Mini.

I'm currently testing video playback using gstreamer running on Linux (not yocto).
At that time, it became necessary to resize and display videos that were larger than Full HD (2520x1080) to within Full HD.

I tried running the pipeline below, but an error occurred at the runner-up point of decodebin, and it didn't seem to go beyond that to specifying the size.

# gst-launch-1.0 filesrc location=/root/demo/21_9_sample.mp4 ! decodebin ! video
/x-raw,width=2520,height=1080 ! waylandsink window-width=1920 window-height=1080
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

====== AIUR: 4.6.3 build on Jun  1 2023 15:24:03. ======
        Core: MPEG4PARSER_06.17.20  build on Oct 20 2021 06:06:48
 file: /usr/lib/imx-mm/parser/lib_mp4_parser_arm_elinux.so
------------------------
    Track 00 [video_0] Enabled
        Duration: 0:00:15.033333000
        Language: und
    Mime:
        video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)avc, width=(int)2520, height=(int)1080, framerate=(fraction)30/1, codec_data=(buffer)0142c032ffe100146742c0328c8d4013c044f2cb350101010784423501000468ce3c80
------------------------
====== VPUDEC: 4.6.3 build on Jun  1 2023 15:24:06. ======
        wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Jun  1 2023 15:23:54)
        vpulib: 1.1.1
        firmware: 1.1.1.65535
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstAiurDemux:aiurdemux0: GStreamer encountered a general stream error.
Additional debug info:
../plugins/aiurdemux/aiurdemux.c(1137): aiurdemux_pull_task (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstAiurDemux:aiurdemux0:
streaming stopped, reason error, state 3
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
#

Is there a way to accomplish this process without error?
By the way, if the video size was set to the same aspect ratio of 1680x720, it could be played normally.

Best Regards, KATA_KAN.

Tags (1)
0 Kudos
6 Replies

607 Views
brian14
NXP TechSupport
NXP TechSupport

Hi @KATA_KAN,

Thank you for contacting NXP Support.

You can use the following Gstreamer pipeline:

gst-launch-1.0 filesrc location=<name_of_the_video.mp4> ! qtdemux ! h264parse ! vpudec ! queue ! glimagesink render-rectangle='<0, 0, 1920, 1080>'

Please try and tell me if it works.

Have a great day!

0 Kudos

596 Views
KATA_KAN
Contributor II

Hello, @brian14 .

I tried the pipeline I received, but it didn't work because of the following error.

# gst-launch-1.0 filesrc location=/root/demo/21_9_sample.mp4 ! qtdemux ! h264par
se ! vpudec ! queue ! glimagesink render-rectangle='<0, 0, 1920, 1080>'
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink: Failed to bind OpenGL API: EGL_BAD_PARAMETER
Additional debug info:
../ext/gl/gstglimagesink.c(1100): _ensure_gl_setup (): /GstPipeline:pipeline0/GstGLImageSinkBin:glimagesinkbin0/GstGLImageSink:sink
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...
#

How should I fix the pipeline?

Best Regards, KATA_KAN.

0 Kudos

578 Views
brian14
NXP TechSupport
NXP TechSupport

Hi @KATA_KAN

Thank you for testing the pipeline of my last reply.

Could you please tell me your BSP version? If it is possible, could you please use the latest release and try the same pipeline?

I would like to discard the problem with OpenGL and verify if it is a resolution issue.

Have a great day!

0 Kudos

560 Views
KATA_KAN
Contributor II

Hello, @brian14 .

>Could you please tell me your BSP version?
The BSP used in our environment is the 2022/11/11 version of LinuxLink and the 5.10.72-ts-aarch64 kernel.

>If it is possible, could you please use the latest release and try the same pipeline?
Since the BSP default is being customized for our custom board, it is difficult to update it immediately.
I'll give it a try.

>I would like to discard the problem with OpenGL and verify if it is a resolution issue.
Thank you.

Best Regards, KATA_KAN.

0 Kudos

524 Views
brian14
NXP TechSupport
NXP TechSupport

Hi @KATA_KAN

It seems that the problem is the VPU supported resolution.
In the specification for iMX8M Mini the VPU supports 1080p60 for H264, therefore the resolutions above 1080p can't be processed for the VPU.

Have a great day!

0 Kudos

519 Views
KATA_KAN
Contributor II

Thank you, @brian14 .

>It seems that the problem is the VPU supported resolution.
>In the specification for iMX8M Mini the VPU supports 1080p60 for H264, therefore the resolutions above 1080p can't be processed for the VPU.
I understand that due to the specifications of the i.MX8M Mini's VPU, it is not possible to handle videos of 1080p or higher in H264 format.

It was very helpful to know that this was not possible.
Regarding this operation, we will proceed with the design assuming that it is not applicable.

This question will be closed. Thank you very much.

Best Regards, KATA_KAN.