MPEG2+VAAPI+AMDGPU+VobSub/SPU+full screen = intermittent video corruption
I have a video corruption issue in a very specific scenario:
- VLC version is 3.0.16.
- Mesa version is 21.3.4.
- The video codec is MPEG-2 (mpeg2video).
- The video is being decoded using VAAPI on an AMDGPU Radeon R7 Bonaire.
- DVD Subtitles are being displayed.
- The playback is maximized or full-screen. (My display resolution is 2560×1600.)
The particular corruption artifacts are unique each time but always occur at the same points during playback.
An example of one such corruption is seen here:
These corruptions do not occur if any of the following are true:
- Video hardware-accelerated decoding is disabled.
- Video is played back in a non-maximized window (at 100% or 200% zoom).
- Subtitles are hidden/disabled.
Click to expand VLC debug log
main debug: processing request item: bug.mkv, node: Playlist, skip: 0
main debug: resyncing on bug.mkv
main debug: bug.mkv is at 0
main debug: starting playback of new item
main debug: resyncing on bug.mkv
main debug: bug.mkv is at 0
main debug: creating new input thread
main debug: Creating an input for 'bug.mkv'
main debug: selected audio language[0] en
main debug: selected sub language[0] en
main debug: requesting art for new input thread
main debug: using timeshift granularity of 50 MiB
main debug: using default timeshift path
main debug: `file:///tmp/bug.mkv' gives access `file' demux `any' path `/tmp/bug.mkv'
main debug: creating demux: access='file' demux='any' location='/tmp/bug.mkv' file='/tmp/bug.mkv'
main debug: looking for access_demux module matching "file": 13 candidates
main debug: no access_demux modules matched
main debug: creating access: file:///tmp/bug.mkv
main debug: (path: /tmp/bug.mkv)
main debug: looking for access module matching "file": 23 candidates
main debug: using access module "filesystem"
main debug: looking for stream_filter module matching "prefetch,cache_read": 25 candidates
cache_read debug: Using stream method for AStream*
cache_read debug: starting pre-buffering
cache_read debug: received first data after 0 ms
cache_read debug: pre-buffering done 1024 bytes in 0s - 33333 KiB/s
main debug: using stream_filter module "cache_read"
main debug: looking for stream_filter module matching "any": 25 candidates
main debug: no stream_filter modules matched
main debug: looking for stream_directory module matching "any": 0 candidates
main debug: no stream_directory modules
main debug: attachment of directory-extractor failed for file:///tmp/bug.mkv
main debug: looking for stream_filter module matching "record": 25 candidates
main debug: using stream_filter module "record"
main debug: creating demux: access='file' demux='any' location='/tmp/bug.mkv' file='/tmp/bug.mkv'
main debug: looking for demux module matching "mkv": 49 candidates
mkv debug: | + Seek head
mkv debug: | - info at 4151
mkv debug: | + Information
mkv debug: | | + TimecodeScale=1000000
mkv debug: | | + Muxing Application=libebml v1.4.2 + libmatroska v1.6.3
mkv debug: | | + Writing Application=mkvmerge v64.0.0 ('Willows') 64-bit
mkv debug: | | + Duration=9096
mkv debug: | | + Date=Mon Jan 24 06:06:37 2022
mkv debug: | | + UID=575554506
mkv debug: | - tracks at 4276
mkv debug: | + Tracks
mkv debug: | | + Track Entry
mkv debug: | | | + Track Number=1
mkv debug: | | | + Track UID=1
mkv debug: | | | + Track Type=video
mkv debug: | | | + Track Default=0
mkv debug: | | | + Track Lacing=0
mkv debug: | | | + Track CodecId=V_MPEG2
mkv debug: | | | + Track CodecPrivate size=150
mkv debug: | | | + Track Default Duration=33366666
mkv debug: | | | + Unknown (N11libmatroska15KaxLanguageIETFE)
mkv debug: | | | + Track Video
mkv debug: | | | | + width=720
mkv debug: | | | | + height=480
mkv debug: | | | | + display width=853
mkv debug: | | | | + display height=480
mkv debug: | | + Track Entry
mkv debug: | | | + Track Number=2
mkv debug: | | | + Track UID=3
mkv debug: | | | + Track Type=audio
mkv debug: | | | + Track Default=0
mkv debug: | | | + Track CodecId=A_AC3
mkv debug: | | | + Track Default Duration=32000000
mkv debug: | | | + Unknown (N11libmatroska15KaxLanguageIETFE)
mkv debug: | | | + Track Name=Stereo
mkv debug: | | | + Track Audio
mkv debug: | | | | + afreq=48000
mkv debug: | | | | + achan=2
mkv debug: | | + Track Entry
mkv debug: | | | + Track Number=3
mkv debug: | | | + Track UID=4
mkv debug: | | | + Track Type=subtitle
mkv debug: | | | + Track Lacing=0
mkv debug: | | | + Track CodecId=S_VOBSUB
mkv debug: | | | + Track CodecPrivate size=511
mkv debug: | | | + Unknown (N11libmatroska15KaxLanguageIETFE)
mkv debug: | | | + Content Encodings
mkv debug: | | | | + Content Encoding
mkv debug: | | | | | + Content Compression
mkv debug: original frame size vobsubs: 720x480
mkv debug: vobsub palette read
mkv debug: | | + Track Entry
mkv debug: | | | + Track Number=4
mkv debug: | | | + Track UID=5
mkv debug: | | | + Track Type=subtitle
dbus debug: Getting property CanSeek
mkv debug: | | | + Track Default=0
mkv debug: | | | + Track Lacing=0
mkv debug: | | | + Track CodecId=S_TEXT/UTF8
mkv debug: | | | + Unknown (N11libmatroska15KaxLanguageIETFE)
mkv debug: | - cues at 5852086
mkv debug: | + Cues
mkv debug: | - loading cues done.
mkv debug: | - tags at 5852582
mkv debug: | + Tags
mkv debug: + Tag
mkv debug: | + Targets
mkv debug: | | + TargetTypeValue: 50
mkv debug: | | + LoadTag Unknown (N11libmatroska21KaxTagTargetTypeValueE)
mkv debug: | | + TrackUID: 1
mkv debug: | | + LoadTag Unknown (N11libmatroska14KaxTagTrackUIDE)
mkv debug: | + Simple Tag
mkv debug: | | + Meta BPS: 4994102
mkv debug: | + Simple Tag
mkv debug: | | + Meta DURATION: 00:00:09.009000000
dbus debug: Getting property Position
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_FRAMES: 216
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_BYTES: 5623984
mkv debug: | + Simple Tag
mkv debug: | | + Meta SOURCE_ID: 0100E0
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_APP: mkvmerge v64.0.0 ('Willows') 64-bit
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_DATE_UTC: 2022-01-24 06:06:37
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
mkv debug: + Tag
mkv debug: | + Targets
mkv debug: | | + TargetTypeValue: 50
mkv debug: | | + LoadTag Unknown (N11libmatroska21KaxTagTargetTypeValueE)
mkv debug: | | + TrackUID: 3
mkv debug: | | + LoadTag Unknown (N11libmatroska14KaxTagTrackUIDE)
mkv debug: | + Simple Tag
mkv debug: | | + Meta BPS: 192000
mkv debug: | + Simple Tag
mkv debug: | | + Meta DURATION: 00:00:08.992000000
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_FRAMES: 281
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_BYTES: 215808
mkv debug: | + Simple Tag
mkv debug: | | + Meta SOURCE_ID: 0181BD
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_APP: mkvmerge v64.0.0 ('Willows') 64-bit
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_DATE_UTC: 2022-01-24 06:06:37
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
mkv debug: + Tag
mkv debug: | + Targets
mkv debug: | | + TargetTypeValue: 50
mkv debug: | | + LoadTag Unknown (N11libmatroska21KaxTagTargetTypeValueE)
mkv debug: | | + TrackUID: 4
mkv debug: | | + LoadTag Unknown (N11libmatroska14KaxTagTrackUIDE)
mkv debug: | + Simple Tag
mkv debug: | | + Meta BPS: 6307
mkv debug: | + Simple Tag
mkv debug: | | + Meta DURATION: 00:00:08.137000000
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_FRAMES: 3
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_BYTES: 6416
mkv debug: | + Simple Tag
mkv debug: | | + Meta SOURCE_ID: 0120BD
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_APP: mkvmerge v64.0.0 ('Willows') 64-bit
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_DATE_UTC: 2022-01-24 06:06:37
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
mkv debug: + Tag
mkv debug: | + Targets
mkv debug: | | + TargetTypeValue: 50
mkv debug: | | + LoadTag Unknown (N11libmatroska21KaxTagTargetTypeValueE)
mkv debug: | | + TrackUID: 5
mkv debug: | | + LoadTag Unknown (N11libmatroska14KaxTagTrackUIDE)
mkv debug: | + Simple Tag
mkv debug: | | + Meta BPS: 134
mkv debug: | + Simple Tag
mkv debug: | | + Meta DURATION: 00:00:08.073000000
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_FRAMES: 3
mkv debug: | + Simple Tag
mkv debug: | | + Meta NUMBER_OF_BYTES: 136
mkv debug: | + Simple Tag
mkv debug: | | + Meta SOURCE_ID: 0100E0
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_APP: mkvmerge v64.0.0 ('Willows') 64-bit
mkv debug: | + Simple Tag
mkv debug: | | + Meta _STATISTICS_WRITING_DATE_UTC: 2022-01-24 06:06:37
mkv debug: | + Simple Tag
mkv debug: MKV/Ebml Parser: m_el[mi_level] == NULL
mkv debug: | | + Meta _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
mkv debug: MKV/Ebml Parser: m_el[mi_level] == NULL
mkv debug: loading tags done.
mkv debug: | + Information
mkv debug: | + Tracks
mkv debug: | + Cluster
mkv debug: NEW START CHAPTER uid=0
mkv debug: found 4 es
main debug: selecting program id=0
mkv debug: seek: preroll{ track: 1, pts: 0, fpos: 6354 skip: 6354}
mkv debug: seek: preroll{ req: 1, start-pts: 1, start-fpos: 6354}
mkv debug: Starting the UI Hook
main debug: using demux module "mkv"
main debug: looking for a subtitle file in /tmp/
main debug: looking for video decoder module matching "any": 14 candidates
avcodec debug: using ffmpeg Lavc58.134.100
avcodec debug: CPU flags: 0x040010db
avcodec debug: allowing 5 thread(s) for decoding
avcodec debug: codec (mpeg2video) started
main debug: using video decoder module "avcodec"
main debug: looking for packetizer module matching "any": 24 candidates
main debug: using packetizer module "a52"
main debug: looking for audio decoder module matching "any": 18 candidates
main debug: reusing audio output
main error: too low audio sample frequency (0)
main debug: keeping audio output
main error: failed to create audio output
avcodec debug: using ffmpeg Lavc58.134.100
avcodec debug: CPU flags: 0x040010db
avcodec debug: codec (ac3) started
main debug: using audio decoder module "avcodec"
main debug: looking for spu decoder module matching "any": 20 candidates
main debug: using spu decoder module "spudec"
main debug: looking for meta reader module matching "any": 1 candidates
main debug: no meta reader modules matched
main debug: `file:///tmp/bug.mkv' successfully opened
main debug: Buffering 0%
main debug: Buffering 3%
main debug: Buffering 8%
main debug: Buffering 11%
main debug: Buffering 16%
main debug: Buffering 20%
main debug: Buffering 23%
main debug: Buffering 28%
main debug: Buffering 33%
main debug: Buffering 46%
main debug: Buffering 48%
main debug: Buffering 53%
main debug: Buffering 58%
main debug: Buffering 61%
main debug: Buffering 66%
main debug: Buffering 70%
avcodec debug: available hardware decoder output format 153 (xvmc)
avcodec debug: available hardware decoder output format 100 (vdpau)
avcodec debug: available hardware decoder output format 46 (vaapi_vld)
avcodec debug: available software decoder output format 0 (yuv420p)
avcodec debug: trying format vaapi_vld
main debug: looking for text renderer module matching "any": 3 candidates
main debug: Buffering 73%
freetype debug: Building font databases.
main debug: Buffering 78%
main debug: Buffering 83%
main debug: Buffering 98%
main debug: Stream buffering done (1034 ms in 1 ms)
main debug: looking for meta fetcher module matching "any": 0 candidates
main debug: no meta fetcher modules
main debug: looking for art finder module matching "any": 1 candidates
main debug: no art finder modules matched
a52 debug: A/52 channels:2 samplerate:48000 bitrate:192000
main debug: restarting module due to input format change
main debug: removing module "avcodec"
main debug: looking for audio decoder module matching "any": 18 candidates
main debug: reusing audio output
alsa debug: using ALSA device: iec958:AES0=0x2,AES1=0x82,AES2=0x0,AES3=0x2
alsa debug: Hooks PCM Slave: Hardware PCM card 0 'HDA Intel' device 1 subdevice 0
alsa debug: device name : STAC9274D Digital
alsa debug: device ID : STAC9274D Digital
alsa debug: subdevice name: subdevice #0
alsa debug: initial hardware setup: ACCESS: MMAP_INTERLEAVED RW_INTERLEAVED FORMAT: S16_LE S32_LE SUBFORMAT: STD SAMPLE_BITS: [16 32] FRAME_BITS: [32 64] CHANNELS: 2 RATE: [44100 192000] PERIOD_TIME: (83 11888617) PERIOD_SIZE: [16 524288] PERIOD_BYTES: [128 2097152] PERIODS: [2 32] BUFFER_TIME: (166 23777234) BUFFER_SIZE: [32 1048576] BUFFER_BYTES: [128 4194304] TICK_TIME: ALL
alsa debug: final HW setup: ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 32 CHANNELS: 2 RATE: 48000 PERIOD_TIME: 40000 PERIOD_SIZE: 1920 PERIOD_BYTES: 7680 PERIODS: 32 BUFFER_TIME: 1280000 BUFFER_SIZE: 61440 BUFFER_BYTES: 245760 TICK_TIME: 0
alsa debug: initial software parameters: tstamp_mode: NONE tstamp_type: MONOTONIC period_step: 1 avail_min: 1920 start_threshold: 1 stop_threshold: 61440 silence_threshold: 0 silence_size: 0 boundary: 8646911284551352320
alsa debug: final software parameters: tstamp_mode: NONE tstamp_type: MONOTONIC period_step: 1 avail_min: 1920 start_threshold: 1 stop_threshold: 61440 silence_threshold: 0 silence_size: 0 boundary: 8646911284551352320
main debug: output 'spdi' 48000 Hz Dolby frame=1536 samples/6144 bytes
main debug: looking for audio volume module matching "any": 2 candidates
main debug: no audio volume modules matched
main debug: input 'a52 ' 48000 Hz Dolby frame=1536 samples/768 bytes
main debug: pass-through: 'a52 '->'spdi' 48000 Hz->48000 Hz Dolby->Dolby
main debug: looking for audio converter module matching "any": 7 candidates
main debug: using audio converter module "tospdif"
main debug: using audio decoder module "spdif"
qt debug: IM: Setting an input
freetype debug: Took -8820 microseconds
main debug: using text renderer module "freetype"
main debug: looking for video converter module matching "any": 23 candidates
swscale debug: 32x32 (32x32) chroma: YUVA -> 16x16 (16x16) chroma: RGBA with scaling using Bicubic (good quality)
main debug: using video converter module "swscale"
main debug: looking for video converter module matching "any": 23 candidates
yuvp debug: YUVP to YUVA converter
main debug: using video converter module "yuvp"
main debug: Deinterlacing available
main debug: deinterlace -1, mode auto, is_needed 0
main debug: looking for vout window module matching "qt,any": 3 candidates
qt debug: requesting video window...
dbus debug: Getting property CanSeek
dbus debug: Getting property Position
dbus debug: Getting property Position
main debug: using vout window module "qt"
main debug: looking for inhibit module matching "any": 2 candidates
dbus_screensaver debug: found service org.freedesktop.ScreenSaver
main debug: using inhibit module "dbus_screensaver"
main debug: Opening vout display wrapper
main debug: looking for vout display module matching "any": 10 candidates
main debug: VoutDisplayEvent 'resize' 720x480
main debug: looking for opengl module matching "any": 2 candidates
egl_x11 debug: EGL version 1.5 by Mesa Project
egl_x11 debug: extensions: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_CHROMIUM_sync_control EGL_EXT_buffer_age EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_swap_buffers_with_damage EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_KHR_swap_buffers_with_damage EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_NOK_texture_from_pixmap EGL_WL_bind_wayland_display
main debug: using opengl module "egl_x11"
main debug: looking for glconv module matching "any": 3 candidates
main debug: using glconv module "glconv_vaapi_x11"
main debug: using vout display module "gl"
main debug: original format sz 720x480, of (0,0), vsz 720x480, 4cc VAOP, sar 853:720, msk r0x0 g0x0 b0x0
main debug: removing module "freetype"
main debug: looking for text renderer module matching "any": 3 candidates
freetype debug: Building font databases.
freetype debug: Took -8419 microseconds
main debug: resized to 720x480
main debug: VoutDisplayEvent 'resize' 720x480
main debug: using text renderer module "freetype"
main debug: looking for hw decoder module matching "any": 3 candidates
main debug: using hw decoder module "vaapi"
avcodec info: Using Mesa Gallium driver 21.3.4 for AMD Radeon R7 300 Series (BONAIRE, DRM 3.42.0, 5.15.11-gentoo, LLVM 13.0.0) for hardware decoding
main debug: Received first picture
main debug: Decoder wait done in 440 ms
main debug: inserting 1210 zeroes
qt debug: Qt: Entering Fullscreen
main debug: resized to 2560x1600
main debug: VoutDisplayEvent 'resize' 2560x1600
main debug: auto hiding mouse cursor
mkv warning: find KaxCues FIXME
mkv debug: Unknown (N11libmatroska7KaxTagsE)
mkv debug: MKV/Ebml Parser: m_el[mi_level] == NULL
mkv warning: EOF
mkv warning: cannot get block EOF?
main debug: EOF reached
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: waiting decoder fifos to empty
main debug: killing decoder fourcc `mpgv'
main debug: removing module "avcodec"
main debug: saving a free vout
main debug: reusing provided vout
dbus debug: Getting property CanSeek
main debug: killing decoder fourcc `a52 '
main debug: removing module "spdif"
main debug: removing module "tospdif"
dbus debug: Getting property Position
main debug: keeping audio output
main debug: removing module "a52"
main debug: killing decoder fourcc `spu '
main debug: removing module "spudec"
main debug: removing module "mkv"
main debug: Program doesn't contain anymore ES
mkv debug: Stopping the UI Hook
main debug: removing module "record"
main debug: removing module "cache_read"
main debug: removing module "filesystem"
main debug: dead input
main debug: changing item without a request (current 0/1)
main debug: nothing to play
main debug: destroying useless vout
main debug: removing module "gl"
main debug: removing module "glconv_vaapi_x11"
main debug: removing module "egl_x11"
qt debug: Qt: Quitting Fullscreen
dbus_screensaver debug: got cookie 14816
main debug: removing module "dbus_screensaver"
qt debug: releasing video...
qt debug: IM: Deleting the input
qt debug: Video is not needed anymore
qt warning: orphaned video window
main debug: removing module "freetype"
main debug: removing module "yuvp"
main debug: removing module "swscale"
dbus debug: Getting property Position
dbus debug: Getting property CanSeek
Here is a minimal test file to reproduce the corruption: bug.mkv. Play it in full-screen, and make sure the subtitles are on.
Edited by Matt Whitlock