opensourcecheemsburgers / RustyTube

A rusty Youtube client.
GNU Affero General Public License v3.0
578 stars 31 forks source link

Webkit green screen on first video #2

Open opensourcecheemsburgers opened 9 months ago

opensourcecheemsburgers commented 9 months ago

Webkit-based browsers have a green screen when playing the first video after opening RustyTube.

The audio still plays fine and it is easily fixed by changing formats.

philn commented 9 months ago

On which platform is this happening? Linux I guess?

I can reproduce the issue with org.gnome.Epiphany.Devel which ships with openh264dec by default, which is known to be very buggy...

The Epiphany.Devel runtime includes gstva though, which is a plugin allowing hardware-accelerated encode/decode on Intel and AMD GPU. It's disabled though, so you need to enable decoders one by one, with this env var: GST_PLUGIN_FEATURE_RANK=vah264dec:max,vavp9dec:max ...

With the VA decoder the output is black in Epiphany.Devel ;) But in Canary it renders fine.

You can check which decoder is used with this env var: GST_DEBUG=videodecoder:5.

opensourcecheemsburgers commented 9 months ago

Yeah, it is happening in both Epiphany and in the Linux Tauri app which uses webkit2gtk-rs.

Why is webkit so bad? Oh right, Apple...

Anyways, I'll take a closer look tomorrow :)

philn commented 9 months ago

Apple has nothing to do about this.

opensourcecheemsburgers commented 9 months ago

Fair point, the webkit and webkit2gtk/linux issues are just very cumbersome.

Checking the decoder, it gives avdec_h264.

Using the following command still does not fix the issue:

export GST_DEBUG=videodecoder:5 && export GST_PLUGIN_FEATURE_RANK=avdec_h264,avdec_h265,avdec_vp9 && cargo tauri dev

Note: I added the others, because Youtube also uses those too.

philn commented 9 months ago

The syntax you used is incorrect and i wasn't asking about avdec but va.

opensourcecheemsburgers commented 9 months ago

Using the following also still gives a green screen:

export GST_PLUGIN_FEATURE_RANK=vah264dec:max,vavp9dec:max && cargo tauri dev
philn commented 9 months ago

Maybe you don't have those decoders? gst-inspect-1.0 vah264dec shows anything?

opensourcecheemsburgers commented 9 months ago

That might be the issue:

No such element or plugin 'vah264dec'
opensourcecheemsburgers commented 9 months ago

After installing gst-plugin-va via yay -S gst-plugin-va and doing a cargo clean, it still gives a green screen.

The result of gst-inspect-1.0 vah264dec is:

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>
  Documentation            https://gstreamer.freedesktop.org/documentation/va/vah264dec.html

Plugin Details:
  Name                     va
  Description              VA-API codecs plugin
  Filename                 /usr/lib/gstreamer-1.0/libgstva.so
  Version                  1.22.9
  License                  LGPL
  Source module            gst-plugins-bad
  Documentation            https://gstreamer.freedesktop.org/documentation/va/
  Source release date      2024-01-24
  Binary package           Arch Linux gst-plugins-bad 1.22.9-2
  Origin URL               https://www.archlinux.org/

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstVideoDecoder
                         +----GstH264Decoder
                               +----GstVaH264Dec

Pad Templates:
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-h264
                profile: { (string)constrained-baseline, (string)baseline, (string)main, (string)high, (string)progressive-high, (string)constrained-high }
                  width: [ 1, 4096 ]
                 height: [ 1, 4096 ]
              alignment: au
          stream-format: { (string)avc, (string)avc3, (string)byte-stream }

  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:VAMemory)
                  width: [ 64, 4096 ]
                 height: [ 64, 4096 ]
                 format: NV12
      video/x-raw(memory:DMABuf)
                  width: [ 64, 4096 ]
                 height: [ 64, 4096 ]
                 format: NV12
      video/x-raw
                  width: [ 64, 4096 ]
                 height: [ 64, 4096 ]
                 format: NV12

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:

  automatic-request-sync-point-flags: Flags to use when automatically requesting sync points
                        flags: readable, writable
                        Flags "GstVideoDecoderRequestSyncPointFlags" Default: 0x00000003, "corrupt-output+discard-input"
                           (0x00000001): discard-input    - GST_VIDEO_DECODER_REQUEST_SYNC_POINT_DISCARD_INPUT
                           (0x00000002): corrupt-output   - GST_VIDEO_DECODER_REQUEST_SYNC_POINT_CORRUPT_OUTPUT

  automatic-request-sync-points: Automatically request sync points when it would be useful
                        flags: readable, writable
                        Boolean. Default: false

  compliance          : The decoder's behavior in compliance with the h264 spec.
                        flags: readable, writable
                        Enum "GstH264DecoderCompliance" Default: 0, "auto"
                           (0): auto             - GST_H264_DECODER_COMPLIANCE_AUTO
                           (1): strict           - GST_H264_DECODER_COMPLIANCE_STRICT
                           (2): normal           - GST_H264_DECODER_COMPLIANCE_NORMAL
                           (3): flexible         - GST_H264_DECODER_COMPLIANCE_FLEXIBLE

  device-path         : DRM device path
                        flags: readable
                        String. Default: null

  discard-corrupted-frames: Discard frames marked as corrupted instead of outputting them
                        flags: readable, writable
                        Boolean. Default: false

  max-errors          : Max consecutive decoder errors before returning flow error
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1 

  min-force-key-unit-interval: Minimum interval between force-keyunit requests in nanoseconds
                        flags: readable, writable
                        Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 0 

  name                : The name of the object
                        flags: readable, writable
                        String. Default: "vah264dec0"

  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"

  qos                 : Handle Quality-of-Service events from downstream
                        flags: readable, writable
                        Boolean. Default: true
philn commented 9 months ago

Is this env var set? GST_PLUGIN_FEATURE_RANK=vah264dec:max,vavp9dec:max ?

opensourcecheemsburgers commented 9 months ago

Yep, I checked the environment vars using:

$ env

It gives:

GST_PLUGIN_FEATURE_RANK=vah264dec:max,vavp9dec:max
// other env vars