Skip to content

[bug] QSV tone-mapped transcodes corrupt frames when a VAAPI filter reads the OpenCL output #2446

Closed

Description

@neurekadev

What happened

HDR-to-SDR transcodes on the QSV executor show corrupted frames during motion: rectangular blocks of the picture shifted against their neighbours, often in a staircase. It shows up constantly in the web player on a Dolby Vision Profile 8.1 episode, and only when the title is transcoded. Direct play of the same file is clean.

The corruption is in the encoded H.264 itself, not the player. I ran the video part of Silo's logged command for that session on the same host and compared the output frame by frame with a software reference. On two runs, 23 and 28 of the first 148 frames were corrupted. Over the first 30 seconds, 27 frames were, not counting the last two frames of the clip, which differ in every run including the clean ones.

Steps to reproduce

  1. Set playback.hw_accel=qsv on an Intel Arrow Lake host (Arc 130T/140T iGPU) with tone mapping enabled.
  2. Play a 4K HDR title in the web player at a quality that transcodes to 1080p, so Silo builds the QSV tonemap_opencl graph.
  3. Watch a scene with motion. To check without a player, run the logged ffmpeg command with -t 6 -f mpegts - and compare its frames against a software tone map of the same span.

Silo's graph, from the session log:

setparams=range=tv:color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,scale_vaapi=format=p010,hwmap=derive_device=opencl:mode=read,tonemap_opencl=format=nv12:p=bt709:t=bt709:m=bt709:tonemap=bt2390:peak=100:desat=0,hwmap=derive_device=vaapi:mode=write:reverse=1:extra_hw_frames=16,format=vaapi,scale_vaapi=w=-2:h=1080:format=nv12,hwmap=derive_device=qsv:mode=read+write,format=qsv,sidedata=...

Expected behavior

The transcode shows the same picture as the source, as the software executor and the VAAPI path without OpenCL do.

Silo version / commit

build-1382 · fee3df3 (ghcr.io/silo-server/silo-server:latest)

Deployment

Docker Compose

Area

Playback and transcoding

Clients affected

  • Web UI
  • Android
  • iOS/tvOS/macOS
  • Jellyfin-compat client (Infuse, Findroid, ...)
  • Other/not client-specific

Client app and device

Web player; the defect is in the server's encoded output, so every client that receives the transcode would show it.

Media and playback details

4K HEVC Main 10, Dolby Vision Profile 8.1 (HDR10 base, compatibility id 1), 24 fps, transcoded to 1080p H.264 with h264_qsv on a host whose GPU uses the i915 kernel driver, iHD 26.3.5, the image's Intel OpenCL runtime (compute-runtime 26.18.38308.1), and jellyfin-ffmpeg 8.1.3. A non-Dolby Vision release of another episode showed no visible corruption in the web player. The variant tests below show the fault is in the GPU graph, not in this source.

Relevant logs

time=2026-10-14T06:41:42.002Z level=INFO msg="playback: ffmpeg cmd: /usr/lib/jellyfin-ffmpeg/ffmpeg -hide_banner -loglevel error -init_hw_device vaapi=va:/dev/dri/renderD128,driver=iHD,kernel_driver=i915,vendor_id=0x8086 -init_hw_device qsv=qs@va -init_hw_device opencl=ocl@va -filter_hw_device va -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -fflags +genpts+fastseek -analyzeduration 3000000 -probesize 5000000 -i [REDACTED media path] -map_metadata -1 -map_chapters -1 -map 0:v:0 -map 0:a:0? -sn -dn -copyts -avoid_negative_ts disabled -c:v h264_qsv -preset veryfast -b:v 5400k -maxrate 6000k -bufsize 12000k -color_range tv -color_primaries bt709 -color_trc bt709 -c:a aac -b:a 384k -ac 6 -af aresample=async=1 -vf setparams=range=tv:color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,scale_vaapi=format=p010,hwmap=derive_device=opencl:mode=read,tonemap_opencl=format=nv12:p=bt709:t=bt709:m=bt709:tonemap=bt2390:peak=100:desat=0,hwmap=derive_device=vaapi:mode=write:reverse=1:extra_hw_frames=16,format=vaapi,scale_vaapi=w=-2:h=1080:format=nv12,hwmap=derive_device=qsv:mode=read+write,format=qsv,sidedata=mode=delete:type=MASTERING_DISPLAY_METADATA,sidedata=mode=delete:type=CONTENT_LIGHT_LEVEL,sidedata=mode=delete:type=DYNAMIC_HDR_PLUS,sidedata=mode=delete:type=DOVI_RPU_BUFFER,sidedata=mode=delete:type=DOVI_METADATA -sc_threshold 0 -force_key_frames expr:gte(t,n_forced*2) -g 60 -keyint_min 60 -forced_idr 1 -max_muxing_queue_size 2048 -max_delay 5000000 -f hls -hls_time 2 -hls_list_size 50000 -hls_segment_type mpegts -hls_flags independent_segments+temp_file -hls_segment_filename [REDACTED transcode dir]/seg_%05d.ts [REDACTED transcode dir]/stream.m3u8"

ffmpeg logged no errors or warnings for the graph, and the output decodes without errors.

Technical notes

Each variant below ran on the same host and the same 6-second span. The count is corrupted frames (SSIM below 0.95 against a software tone map of the same frames, aligned by frame index) out of 148.

Variant Corrupted frames
Silo's graph, h264_qsv (2 runs) 23, 28
Same graph, h264_vaapi instead of the QSV map 21
Same graph, extra_hw_frames=64 on the reverse map (likely no effect: the pools grow on demand) 29
Same graph without the first scale_vaapi=format=p010 26
hwdownload,format=nv12,hwupload=derive_device=qsv copy before h264_qsv 0
hwdownload then libx264 0
No resize after OpenCL (4K output, scale_vaapi=format=nv12 only) 0
Resize with scale_vaapi=w=-2:h=1080:format=p010 before OpenCL, nothing after (4 runs, plus 30 seconds) 0
Bitmap-subtitle graph with a transparent synthetic overlay: overlay_vaapi reading the OpenCL output 4

Hardware and software HEVC decode of the span (and of a span 10 minutes in) are bit-identical, so the source decode is not involved.

Suspected cause: a VAAPI video-processing filter that reads the tonemap_opencl output (scale_vaapi resizing it, or overlay_vaapi) submits the job and releases the input frame without waiting for the GPU. The surface goes back to the reverse-map pool and the tone mapper writes the next frame into it, so blocks of the next frame land in the frame being processed. FFmpeg's buffer pool hands back the most recently freed surface first, so pool size would not delay the reuse. A copy (hwdownload) or giving the surface straight to the encoder (which holds it until the encode finishes) avoids it. FFmpeg creates the OpenCL context with CL_CONTEXT_INTEROP_USER_SYNC set to CL_FALSE, so cl_intel_va_api_media_sharing says the driver should order these operations itself. The underlying fault therefore looks like a driver ordering problem, which Silo can avoid by graph order.

  • Fix for the plain transcode path: resize before tonemap_opencl and send its output to the encoder with no resize in between. Jellyfin's Intel VAAPI graph orders it the same way (GetIntelVaapiFullVidFiltersPrefered), and the tone mapper then processes a 1080p frame instead of a 4K one.
  • The bitmap-subtitle path (appendToneMappedBitmapSubtitleArgs) composites with overlay_vaapi after the tone mapper and is affected too; that is tracked in [bug] QSV tone-mapped transcodes with burned-in bitmap subtitles corrupt frames #2447.
  • The text-subtitle path downloads the frame right after the tone mapper, so it is not affected.
  • Only tested on Arrow Lake. Other Intel generations may or may not show it.

AI harness

Claude Code in T3 Code

AI tool(s)

Claude Code, GitHub CLI, jellyfin-ffmpeg 8.1.3, PoCL

AI model(s)

claude-opus-5-5

AI involvement

Fully AI-generated at the reporter's direction. The reporter saw the corruption in playback. The agent ran the measurements on the reporter's server with their permission, and the reporter has not repeated them.

Independent or adversarial review

n/a

Confirmations

  • I searched open and recently closed issues and pull requests, and this is not already reported
  • I reproduced this myself on a real deployment
  • Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above

Activity

  1. added
    bug
    impact: playback
    priority: P2
    on Oct 14, 2026
  2. added 2 commits that reference this issue on Oct 14, 2026
    009b47d
    bbef279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimpact: playbackpriority: P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions