RESOLVED DUPLICATE of bug 251017 251679
[GStreamer] Playing video causes very high CPU usage
https://bugs.webkit.org/show_bug.cgi?id=251679
Summary [GStreamer] Playing video causes very high CPU usage
Kdwk
Reported 2023-02-03 04:47:56 PST
On https://wpewebkit.org/blog/05-new-svg-engine.html, there are a few videos encoded in H.264. My hardware has support for accelerated decoding of this codec. However, when using Epiphany to play the videos on the website, CPU usage is very high, as can be seen in the screencast, and there are lots of dropped frames. If the video is downloaded and played in Clapper (Flatpak), a video player, CPU usage is much lower and there are no dropped frames. Tested: Epiphany Technology Preview (Flatpak) 44.alpha-32-g481e050e5+, WebKitGTK 2.39.7, GStreamer 1.20.5 Fedora Silverblue 37
Attachments
Screencast showing CPU usage of Epiphany when playing video (high) VS Clapper when playing video (low) (4.02 MB, video/webm)
2023-02-03 04:49 PST, Kdwk
no flags
gst.log (1.04 MB, text/x-log)
2023-02-17 01:38 PST, Kdwk
no flags
gst.log (2.12 MB, text/x-log)
2023-02-17 04:00 PST, Kdwk
no flags
gst.log (3.10 MB, text/x-log)
2023-02-17 05:29 PST, Kdwk
no flags
gst.log (4.34 MB, text/x-log)
2023-02-17 06:03 PST, Kdwk
no flags
Kdwk
Comment 1 2023-02-03 04:49:33 PST
Created attachment 464820 [details] Screencast showing CPU usage of Epiphany when playing video (high) VS Clapper when playing video (low)
Philippe Normand
Comment 2 2023-02-04 01:23:26 PST
That's a packaging issue. The GStreamer backend is capable of handling HW decoders but in the flatpak runtime the only GStreamer HW decoder shipped there is disabled. If your GPU is AMD or Intel you can try to set this env var in the flatpak runtime: GST_PLUGIN_FEATURE_RANK=vah264dec:MAX,vah265dec:MAX,vavp8dec:MAX,vavp9dec:MAX
Kdwk
Comment 3 2023-02-04 01:34:55 PST
I'm afraid the problem persists after setting the environmental variable (using Flatseal).
Philippe Normand
Comment 4 2023-02-04 03:08:34 PST
Can you try the env var mentioned in https://bugs.webkit.org/show_bug.cgi?id=251017#c19 ?
Kdwk
Comment 5 2023-02-04 05:40:09 PST
(In reply to Philippe Normand from comment #4) > Can you try the env var mentioned in > https://bugs.webkit.org/show_bug.cgi?id=251017#c19 ? The original env var works, thanks (I made a mistake). Though I must say I don't really understand why the HW decoder is disabled in the runtime...
Kdwk
Comment 6 2023-02-16 02:59:24 PST
Just tried the videos on https://wpewebkit.org/blog/05-new-svg-engine.html again. This time the problem persists even with the GST plugin rank environmental variable set.
Philippe Normand
Comment 7 2023-02-16 03:47:16 PST
Please make sure to install org.freedesktop.Platform.GL.default//22.08-extra And then provide the output of flatpak run --command=gst-inspect-1.0 org.gnome.Epiphany.Devel va
Kdwk
Comment 8 2023-02-16 04:45:13 PST
org.freedesktop.Platform.GL.default//22.08-extra is installed. Plugin Details: Name va Description VA-API codecs plugin Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstva.so Version 1.20.5 License LGPL Source module gst-plugins-bad Source release date 2022-12-19 Binary package GStreamer Bad Plug-ins source release Origin URL freedesktop-sdk vaav1dec: VA-API AV1 Decoder vadeinterlace: VA-API Deinterlacer vah264dec: VA-API H.264 Decoder vah265dec: VA-API H.265 Decoder vampeg2dec: VA-API Mpeg2 Decoder vapostproc: VA-API Video Postprocessor vavp8dec: VA-API VP8 Decoder vavp9dec: VA-API VP9 Decoder 8 features: +-- 8 elements
Philippe Normand
Comment 9 2023-02-16 06:03:36 PST
(In reply to Philippe Normand from comment #4) > Can you try the env var mentioned in > https://bugs.webkit.org/show_bug.cgi?id=251017#c19 ? Did you try this? WEBKIT_GST_DMABUF_SINK_ENABLED=1
Kdwk
Comment 10 2023-02-16 06:09:39 PST
Just tried, same result. VA decoders work fine in Clapper the video player (Flatpak).
Philippe Normand
Comment 11 2023-02-16 07:04:01 PST
(In reply to kdwkleung from comment #10) > VA decoders work fine in Clapper the video player > (Flatpak). Yeah we know, it's already mentioned in earlier comments, no need to repeat :) I'll need a GST_DEBUG="*CAPS*:5" log please...
Kdwk
Comment 12 2023-02-16 20:38:15 PST
How do I obtain this log? Thanks
Philippe Normand
Comment 13 2023-02-17 00:45:26 PST
$ flatpak run --filesystem=home --command=/bin/bash org.gnome.Epiphany.Devel [📦 org.gnome.Epiphany.Devel ~]$ GST_DEBUG="3,webkit*:6" GST_DEBUG_FILE="$HOME/gst.log" GST_DEBUG_NO_COLOR=1 WEBKIT_FORCE_SANDBOX=0 epiphany
Kdwk
Comment 14 2023-02-17 01:16:19 PST
The log file doesn't show up in my home directory after doing these.
Philippe Normand
Comment 15 2023-02-17 01:29:43 PST
Try WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1 instead of WEBKIT_FORCE_SANDBOX?
Kdwk
Comment 16 2023-02-17 01:38:04 PST
Created attachment 465048 [details] gst.log The requested log.
Philippe Normand
Comment 17 2023-02-17 01:41:43 PST
Now with GST_DEBUG="3,webkit*:6,*CAPS*:5"
Kdwk
Comment 18 2023-02-17 04:00:57 PST
Created attachment 465051 [details] gst.log Requested log file(1)
Philippe Normand
Comment 19 2023-02-17 04:55:13 PST
openh264dec0 is still used instead of the va decoder... Are you sure you set the rank as explained in comment 2 ? flatpak run --command=gst-inspect-1.0 org.gnome.Epiphany.Devel vah264dec If the rank shown is still NONE, rm $HOME/.var/app/org.gnome.Epiphany.Devel/cache/gstreamer-1.0/registry.x86_64.bin and: flatpak --env="GST_PLUGIN_FEATURE_RANK=vah264dec:MAX,vah265dec:MAX,vavp8dec:MAX,vavp9dec:MAX" run --command=gst-inspect-1.0 org.gnome.Epiphany.Devel vah264dec
Kdwk
Comment 20 2023-02-17 05:01:55 PST
(In reply to Philippe Normand from comment #19) > openh264dec0 is still used instead of the va decoder... Are you sure you set > the rank as explained in comment 2 ? I set it in the org.gnome.Platform//master runtime by running `flatpak run --command=/bin/bash org.gnome.Platform` and then running `GST_PLUGIN_FEATURE_RANK=vah264dec:MAX,vah265dec:MAX,vavp8dec:MAX,vavp9dec:MAX`. > > flatpak run --command=gst-inspect-1.0 org.gnome.Epiphany.Devel vah264dec Factory Details: Rank none (0) Long-name VA-API H.264 Decoder Klass Codec/Decoder/Video/Hardware Description VA-API based H.264 video decoder Author Víctor Jáquez <vjaquez@igalia.com> Plugin Details: Name va Description VA-API codecs plugin Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstva.so Version 1.20.5 License LGPL Source module gst-plugins-bad Source release date 2022-12-19 Binary package GStreamer Bad Plug-ins source release > > If the rank shown is still NONE, rm > $HOME/.var/app/org.gnome.Epiphany.Devel/cache/gstreamer-1.0/registry.x86_64. > bin > > and: > > flatpak > --env="GST_PLUGIN_FEATURE_RANK=vah264dec:MAX,vah265dec:MAX,vavp8dec:MAX, > vavp9dec:MAX" run --command=gst-inspect-1.0 org.gnome.Epiphany.Devel > vah264dec Factory Details: Rank primary + 2147483391 (2147483647) Long-name VA-API H.264 Decoder Klass Codec/Decoder/Video/Hardware Description VA-API based H.264 video decoder Author Víctor Jáquez <vjaquez@igalia.com> Plugin Details: Name va Description VA-API codecs plugin Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstva.so Version 1.20.5 License LGPL Source module gst-plugins-bad Source release date 2022-12-19 Binary package GStreamer Bad Plug-ins source release
Kdwk
Comment 21 2023-02-17 05:04:24 PST
As of now, the problem persists.
Philippe Normand
Comment 22 2023-02-17 05:08:48 PST
(In reply to kdwkleung from comment #21) > As of now, the problem persists. New log please :) I look forward seeing openh264dec not mentioned in that one.
Kdwk
Comment 23 2023-02-17 05:29:54 PST
Created attachment 465053 [details] gst.log Requested log file(2)
Philippe Normand
Comment 24 2023-02-17 05:35:12 PST
(In reply to Philippe Normand from comment #22) > (In reply to kdwkleung from comment #21) > > As of now, the problem persists. > > New log please :) I look forward seeing openh264dec not mentioned in that > one. grep disagrees. Look, I don't know what you're doing exactly, but you're experiencing the bug because this decoder is used, it's not a hardware decoder.
Philippe Normand
Comment 25 2023-02-17 05:40:42 PST
vah264dec is working fine for me in that page loaded from Ephy TP. Closing.
Kdwk
Comment 26 2023-02-17 06:03:14 PST
Unfortunately it appears the env var got reset before Epiphany is opened when set with your method. I got it to persist by setting it in Flatseal. The gst-inspect-1.0 now consistently reports vah264dec getting max rank. However, the problem persists. This time I'm able to get a new log file. I promise, I checked with both the Text Editor find tool and grep that the file does not contain a single instance of "openh264dec".
Kdwk
Comment 27 2023-02-17 06:03:52 PST
Created attachment 465054 [details] gst.log Requested log file(3)
Kdwk
Comment 28 2023-02-17 06:21:01 PST
Setting WEBKIT_GST_DMABUF_SINK_ENABLED=1 does make CPU usage go down, but the video is basically visually corrupt.
Philippe Normand
Comment 29 2023-02-17 06:25:07 PST
(In reply to kdwkleung from comment #28) > Setting WEBKIT_GST_DMABUF_SINK_ENABLED=1 does make CPU usage go down, but > the video is basically visually corrupt. Thanks, so same behaviour as in bug 251017 :( Let's close this as duplicate because I have no further ideas beyond the issue tracked in bug 251017. *** This bug has been marked as a duplicate of bug 251017 ***
Note You need to log in before you can comment on or make changes to this bug.