Chromium | vaapi | 4k Videos shutter/lag

Hello,
i have the Problem on an F34 and F35 machine.

4k Videos shutter/lag in chromium.
To make this “easier” i tested with a local file - no youtube.

The only “real” error is in the End of this Thread.
Rest is Information about the System.

Mediainfo about the file:

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L5.2
Format settings                          : CABAC / 5 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 5 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 56 s 200 ms
Bit rate                                 : 51.4 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 60.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.103
Stream size                              : 345 MiB (100%)
Writing library                          : x264 core 163 r3060 5db6aa6
Encoding settings                        : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box                  : avcC

on f34 im using chromium-freeworld.
on f35 i tested brave and chromium-freeworld.

f34 is using libva-intel-driver > i965 > Intel(R) Pentium(R) 3558U @ 1.70GHz
f35 is using intel-media-driver (newer cpu) > iHD Driver > Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz


Lets focus on F34.

Before we dive in >
If i play the test-video with mpv via

mpv --hwdec=vaapi --vo=vaapi /root/h264.mp4

Everything plays fine and smooth no lag, no shutter.

vainfo:

libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_10
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.11 (libva 2.11.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile - 2.4.1
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD

I tested the following chromium-versions:

93.0.4577.63
96.0.4664.110
97.0.4692.99

i start chromium freeworld with

chromium-freeworld --no-sandbox --enable features=VaapiVideoDecoder

starting video →
chrome://gpu is showing me:

Graphics Feature Status

Canvas: Hardware accelerated
Canvas out-of-process rasterization: Disabled
Compositing: Hardware accelerated
Multiple Raster Threads: Disabled
Out-of-process Rasterization: Hardware accelerated
OpenGL: Enabled
Rasterization: Hardware accelerated on all pages
Raw Draw: Disabled
Skia Renderer: Enabled
Video Decode: Hardware accelerated
Video Encode: Software only. Hardware acceleration disabled
Vulkan: Disabled
WebGL: Hardware accelerated
WebGL2: Hardware accelerated

Video Acceleration Information:

Decoding (VideoDecoder)
Decode h264 baseline    16x16 to 4096x4096 pixels
Decode h264 main        16x16 to 4096x4096 pixels
Decode h264 high        16x16 to 4096x4096 pixels
Decode vp9 profile0     16x16 to 4096x4096 pixels
Decoding (Legacy VideoDecodeAccelerator)
Decode h264 baseline    16x16 to 4096x4096 pixels
Decode h264 main        16x16 to 4096x4096 pixels
Decode h264 high        16x16 to 4096x4096 pixels
Decode vp9 profile0     16x16 to 4096x4096 pixels
Encoding

chrome://media-internals is showing me:

dimensions      "3840x2160"
duration        56.2
event   "kPlay"
info    "Effective playback rate changed from 0 to 1"
kAudioDecoderName       "FFmpegAudioDecoder"
kAudioTracks    [{"bytes per channel":4,"bytes per frame":24,"channel layout":"5.1","channels":6,"codec":"aac","codec delay":0,"discard decoder delay":true,"encryption scheme":"Unencrypted","has extra data":true,"profile":"unknown","sample format":"Float 32-bit planar","samples per second":48000,"seek preroll":"0us"}]
kBitrate        51597504
kFrameTitle     ""
kFrameUrl       "file:///root/h264.mp4"
kIsAudioDecryptingDemuxerStream false
kIsPlatformAudioDecoder false
kIsPlatformVideoDecoder true
kIsRangeHeaderSupported true
kIsSingleOrigin true
kIsStreaming    false
kIsVideoDecryptingDemuxerStream false
kMaxDuration    56.2
kRendererName   "RendererImpl"
kResolution     "3840x2160"
kStartTime      -0.021333
kTextTracks     []
kTotalBytes     "0x159ae416"
kVideoDecoderName       "VDAVideoDecoder"
kVideoTracks    [{"alpha mode":"is_opaque","codec":"h264","coded size":"3840x2160","color space":"{primaries:BT709, transfer:BT709, matrix:BT709, range:LIMITED}","encryption scheme":"Unencrypted","has extra data":true,"hdr metadata":"unset","natural size":"3840x2160","orientation":"0°","profile":"h264 high","visible rect":"0,0 3840x2160"}]
origin_url      "file:///"
pipeline_buffering_state        {"for_suspended_start":false,"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
pipeline_state  "kPlaying"
player_id       6
render_id       7
url     "file:///root/h264.mp4"


So Hardware Acceleration is working fine - it seems.
No Errors in the console output.

also i can see in intel_gpu_top - its working.

intel-gpu-top: Intel Haswell (Gen7) @ /dev/dri/card0 -  998/ 998 MHz
     0% RC6;  2.46/ 4.69 W;      270 irqs/s

      IMC reads:   147645 MiB/s
     IMC writes:     3981 MiB/s

         ENGINES     BUSY                                 MI_SEMA MI_WAIT
       Render/3D   79.91% |███████████████████████▎     |      0%      0%
         Blitter   29.42% |████████▋                    |      0%      0%
           Video   46.93% |█████████████▋               |      0%      0%
    VideoEnhance    0.00% |                             |      0%      0%


The only error i can see, when the lag/shutter is happening:

0:00:01.028     video_buffering_state   {"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:04.029    pipeline_buffering_state        {"for_suspended_start":false,"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:06.138    video_buffering_state   {"state":"BUFFERING_HAVE_ENOUGH"}
00:00:06.364    video_buffering_state   {"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:09.365    pipeline_buffering_state        {"for_suspended_start":false,"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:10.715    video_buffering_state   {"state":"BUFFERING_HAVE_ENOUGH"}
00:00:10.910    video_buffering_state   {"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:13.910    pipeline_buffering_state        {"for_suspended_start":false,"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:15.508    video_buffering_state   {"state":"BUFFERING_HAVE_ENOUGH"}
00:00:15.763    video_buffering_state   {"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:18.763    pipeline_buffering_state        {"for_suspended_start":false,"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:20.645    video_buffering_state   {"state":"BUFFERING_HAVE_ENOUGH"}
00:00:20.915    video_buffering_state   {"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:23.916    pipeline_buffering_state        {"for_suspended_start":false,"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:25.787    video_buffering_state   {"state":"BUFFERING_HAVE_ENOUGH"}
00:00:26.014    video_buffering_state   {"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:29.014    pipeline_buffering_state        {"for_suspended_start":false,"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}
00:00:30.486    video_buffering_state   {"state":"BUFFERING_HAVE_ENOUGH"}
00:00:30.726    video_buffering_state   {"reason":"DECODER_UNDERFLOW","state":"BUFFERING_HAVE_NOTHING"}

But i could find anything what is causing this error or how i could increase any buffer size or like that.

Maybe @akarshanbiswas knows or sees something?
i mean you are a legend on this vaapi support anyway.

This is a potential major problem.
It appears your user is root and you seem to be running mpv with root privileges. That is first of all a major security risk since mpv is not intended to run as root, but only as a regular user. That also runs everything else that mpv uses for support as root which magnifies the risk dramatically.

I would first of all suggest that you try the same sequence of tests as a regular user and see what the results are then.
I would also recommend that you ALWAYS log in and function as a regular user except for those tasks that absolutely require you to have root privileges.

1 Like

hmm… Your GPU isn’t fast enough to decode 4k video ? Seems like something else.

Also I agree with the previous reply. Please do not run GUI apps on root.

p.s I stopped following chromium development…

@computersavvy
the F34 machine is a Testbox / Sandbox - everything runs on root - the login user is root.
This has many reasons for that test-enviroment.
Security is not a Problem in that circumstances.

Tested everything on my F35 machine (my workstation) as a non root user.
Same outcome.

@akarshanbiswas
i think its is - since mpv can handle it perfectly fine?
also sry for pinging you - thought you still in the chromium business.
Thanks for answering tho!