Cannot play a 4K mkv content with v4l2h265dec plugin

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot play a 4K mkv content with v4l2h265dec plugin

karimchtx
Hi, I'm currently trying to play a 4K content on an IMX8 based board, an apalis imx8. I planed to use the v4l2h265dec decoder, as at first glance, the imx vpudec plugin is not available for this processor, though it's supported on imx8m and mx8mm. I've designed the following pipeline: root@apalis-imx8:~# XDG_RUNTIME_DIR=/run/user/0 gst-launch-1.0 -v filesrc location=/media/sda1/4K_content.2160p.UHD.BLURAY.REMUX.HDR.HEVC.x265.mkv ! matroskademux name=d d. ! queue ! h265parse ! v4l2h265dec ! waylandsink Unfortunately, I systematicaly get the following error, whatever I try to change the pipeline.

Setting pipeline to PAUSED ... Pipeline is PREROLLED ... Got context from element 'sink': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayWayland\)\ gldisplaywayland0"; Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h265, level=(string)5.1, tier=(string)high, profile=(string)main-10, codec_data=(buffer)012220000000b0000000000099f000fcfdfafa00000f04a00001002140010c01fff00b00000030000030099148c0c00000fa40001770140a10001003d420101222000000300b00000030000030099a001e020021c4db148e490a50bc06d4244026d9400000fa4000177018930397800057bcc0017d7be78f1e8a2000100084401c072f69bfb64a70001003d4e010538428219561c292e3a1fdf34154454d4520546974616e2046696c6520332e382e31362028342e382e31362e302920202020202080, stream-format=(string)hvc1, alignment=(string)au, width=(int)3840, height=(int)2160, pixel-aspect-ratio=(fraction)1/1, fraction)24000/1001 /GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h265, level=(string)5.1, tier=(string)high, profile=(string)main-10, codec_data=(buffer)012220000000b0000000000099f000fcfdfafa00000f04a00001002140010c01fff00b00000030000030099148c0c00000fa40001770140a10001003d420101222000000300b00000030000030099a001e020021c4db148e490a50bc06d4244026d9400000fa4000177018930397800057bcc0017d7be78f1e8a2000100084401c072f69bfb64a70001003d4e010538428219561c292e3a1fdf34154454d4520546974616e2046696c6520332e382e31362028342e382e31362e302920202020202080, stream-format=(string)hvc1, alignment=(string)au, width=(int)3840, height=(int)2160, pixel-aspect-ratio=(fraction)1/1, fraction)24000/1001 /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:sink: caps = video/x-h265, level=(string)5.1, tier=(string)high, profile=(string)main-10, codec_data=(buffer)012220000000b0000000000099f000fcfdfafa00000f04a0000100214002000000300b00000030000030099148c0c00000fa40001770140a10001003d420101222000000300b00000030000030099a001e020021c4db148e490a50bc06d4244026d9400000fa4000177018930397800057bcc0017d7be78f1e8a2000100084401c072f69bfb64a70001003d4ec9bb89248219561c292e3a1fdf34154454d4520546974616e2046696c6520332e382e31362028342e382e31362e302920202020202080, stream-format=(string)hvc1, alignment=(string)au, width=(int)3840, height=(int)2160, pixel-aspect-ratio=(fractimerate=(fraction)24000/1001 /GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:src: caps = video/x-h265, level=(string)5.1, tier=(string)high, profile=(string)main-10, stream-format=(string)byte-stream, alignment=(string)au, width=(int)3840, heigh, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)24000/1001, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true /GstPipeline:pipeline0/v4l2h265dec:v4l2h265dec0.GstPad:sink: caps = video/x-h265, level=(string)5.1, tier=(string)high, profile=(string)main-10, stream-format=(string)byte-stream, alignment=(string)au, width=(int)3840, hei60, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)24000/1001, chroma-format=(string)4:2:0, bit-depth-luma=(uint)10, bit-depth-chroma=(uint)10, parsed=(boolean)true ERROR: from element /GstPipeline:pipeline0/GstMatroskaDemux:d: Internal data stream error. Additional debug info: ../git/gst/matroska/matroska-demux.c(5715): gst_matroska_demux_loop (): /GstPipeline:pipeline0/GstMatroskaDemux:d: streaming stopped, reason not-negotiated (-4) Execution ended after 0:00:00.131678311 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Total showed frames (0), playing for (0:00:00.132085050), fps (0.000).

Is there something obviously wrong in my pipeline ? Thanks for your feedback. K.

Sent from the GStreamer-devel mailing list archive at Nabble.com.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Cannot play a 4K mkv content with v4l2h265dec plugin

Nicolas Dufresne-5
Le lundi 22 mars 2021 à 05:15 -0500, karimchtx a écrit :

> Hi, I'm currently trying to play a 4K content on an IMX8 based board, an
> apalis
> imx8. I planed to use the v4l2h265dec decoder, as at first glance, the imx
> vpudec plugin is not available for this processor, though it's supported on
> imx8m and mx8mm. I've designed the following pipeline: root@apalis-imx8:~#
> XDG_RUNTIME_DIR=/run/user/0 gst-launch-1.0 -v filesrc
> location=/media/sda1/4K_content.2160p.UHD.BLURAY.REMUX.HDR.HEVC.x265.mkv !
> matroskademux name=d d. ! queue ! h265parse ! v4l2h265dec ! waylandsink
> Unfortunately, I systematicaly get the following error, whatever I try to
> change
> the pipeline.
[snip]
>  streaming stopped, reason not-negotiated (-4) Execution ended after
> 0:00:00.131678311 Setting pipeline to PAUSED ... Setting pipeline to READY ...
> Setting pipeline to NULL ... Total showed frames (0), playing for
> (0:00:00.132085050), fps (0.000).
> Is there something obviously wrong in my pipeline ? Thanks for your feedback.
> K.

Not negotiation is a common pipeline error. It means what two elements in your
pipeline could not negotiate their format. It does not say which one though, but
I suspect the v4l2h265dec ! waylandsink is the culprit. You need your compositor
to support the pixel format produced by your decoder.

To confirm this, add videoconvert to see if that make it display something,
don't expect 4K if software video conversion is taking place. Next step, inspect
the caps, you can use -v to see the caps being set on each pads. The video/x-raw
caps will have formats which will help you. You can also use weston-info to list
the format supported by your compositor. Remember that this is still downstream
and NXP carries a large amount of patches accross gstreamer, weston, mesa etc.
So you may need to use these patches if you aren't using their vendor OS.

>
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Cannot play a 4K mkv content with v4l2h265dec plugin

karimchtx
Hi Nicolas,

Thanks for your quick reply.
You're definitly right in your analysis.
A couple hours after my posts, I've slightly changed my pipeline as
following:

 gst-launch-1.0 -v filesrc location=/media/sda1/solo.mkv  ! video/x-matroska
! aiurdemux  ! h265parse ! v4l2h265dec !  imxvideoconvert_g2d ! ! queue !
waylandsink


You were right, I needed an explicit plugin before waylandsink for the
conversion.
But:

at first sight, it works.
But the video is sometime freezing during many seconds...(but gstreamer
doesn't crash).
Regarding the CPU, the vpu is effectively working.
I can't figure out how to explain the "freezing" sequences.

I tried to play the same media within souphttpsrc, it's working as well but
the playback is still stuttering in "fast sequences" of the movie.

And finally, I just can't figure ou what's happening and how could I debug /
monitor the plugins task.

Any suggestion would be welcome.

Best Regards,

Karim







--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Cannot play a 4K mkv content with v4l2h265dec plugin

Nicolas Dufresne-5
Le lundi 22 mars 2021 à 14:34 -0500, karimchtx a écrit :

> Hi Nicolas,
>
> Thanks for your quick reply.
> You're definitly right in your analysis.
> A couple hours after my posts, I've slightly changed my pipeline as
> following:
>
>  gst-launch-1.0 -v filesrc location=/media/sda1/solo.mkv  ! video/x-matroska
> ! aiurdemux  ! h265parse ! v4l2h265dec !  imxvideoconvert_g2d ! ! queue !
> waylandsink
>
>
> You were right, I needed an explicit plugin before waylandsink for the
> conversion.
> But:
>
> at first sight, it works.
> But the video is sometime freezing during many seconds...(but gstreamer
> doesn't crash).
> Regarding the CPU, the vpu is effectively working.
> I can't figure out how to explain the "freezing" sequences.
>
> I tried to play the same media within souphttpsrc, it's working as well but
> the playback is still stuttering in "fast sequences" of the movie.
>
> And finally, I just can't figure ou what's happening and how could I debug /
> monitor the plugins task.

Few things to try:

Add queues before/after your decoder, to help parallelism and mimic what playbin
would do. Try and make sure imxvideoconvert_g2d runs in zero-copy. Try and
change aiurdemux with matroskademux, just in case the NXP demuxer have timing
issues (that being said, it's quite good for a downstream demuxer). You may want
to test with fakevideosink to make sure you decoder is keeping up, as if it's
already the case, you can start looking at graphics.

>
> Any suggestion would be welcome.
>
> Best Regards,
>
> Karim
>
>
>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Cannot play a 4K mkv content with v4l2h265dec plugin

karimchtx
Hi Nicolas,

Thanks a lot for your recommendations.
It helped me a lot to tune my pipeline !

I have integrated the matroskademux, as well as queues before/after the hw
decoding.
As I'm writing this mail, the movie is still playing.
It is very smooth...but sometime it's still stuttering a little bit though
it's drastically better than yesterday.

My guess is it's maybe related to frame-rate issues. The movie is typically
in 23.976 fps, the tv is currently setup @ 60fps. I'll try @ 24 fps and @ 30
fps later.

Or maybe is it still related to bitrate (it's an action movie...in a galaxy
far, far away...) in fast sequences and thus maybe the "queue" elements
should be tuned as well in their size ?



Karim



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Cannot play a 4K mkv content with v4l2h265dec plugin

Nicolas Dufresne-5


Le mar. 23 mars 2021 05 h 45, karimchtx <[hidden email]> a écrit :
Hi Nicolas,

Thanks a lot for your recommendations.
It helped me a lot to tune my pipeline !

I have integrated the matroskademux, as well as queues before/after the hw
decoding.
As I'm writing this mail, the movie is still playing.
It is very smooth...but sometime it's still stuttering a little bit though
it's drastically better than yesterday.

My guess is it's maybe related to frame-rate issues. The movie is typically
in 23.976 fps, the tv is currently setup @ 60fps. I'll try @ 24 fps and @ 30
fps later.

Or maybe is it still related to bitrate (it's an action movie...in a galaxy
far, far away...) in fast sequences and thus maybe the "queue" elements
should be tuned as well in their size ?

As it's 4K, you can tune the queue before the display sink with a larger max size. E.g. max-size-byte=0 (unlimited)

Though, at this level, the stutter could be cause by colliding events in your compositor, or GPU spike if the GPU is being used. Wayland have mechanism to improve accuracy further, bit this is not yet implemented.




Karim



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Cannot play a 4K mkv content with v4l2h265dec plugin

karimchtx
Thanks Nicolas.
That's actually what I did, set max-size-bytes=0.

Finally I found out the problem was better related to the parameters of the
monitor used.
It's a 4K Samsung big-screen. And additional features such as "auto smooth"
options were activated.
We've deactivated this option as the screens used in production won't have
this option set.

And there we are, the playback is smooth...let's say at 99 % :)

I still need to investigate furether inot wayland/weston regarding the
mode's frequency.
I've set weston with:

[output]
name=HDMI-A-1
mode=3840x2160@60

Knowing that the movie framerate is @ 24000/1001

If I change it to 3840x2160@24...the playback is completely and awfully
stuttering. Well that's a part of wayland/weston that's a bit obscure  for
my understanding.

Thanks again, I've appreciated your help on this subject.

K.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel