Gallery video player ignores subtitle tracks (QT_GSTREAMER_PLAYBIN_FLAGS=0) — fix + subtitle switch button

REPRODUCIBILITY: 100%
OS VERSION: 5.2.0.22
HARDWARE: Jolla Phone (2026)
UI LANGUAGE: French
REGRESSION: unknown

DESCRIPTION:

The built-in video player (Gallery, jolla-gallery) never shows subtitles, even when the file has a subtitle track flagged default (and even forced). Tested with an MKV: h264 + AC3 + ASS French subtitles (default=1, forced=1).

Root cause: the Gallery plays through Qt Multimedia 5.6 + GStreamer (playbin3). Qt only sets the VIDEO and AUDIO playbin flags, and adds whatever QT_GSTREAMER_PLAYBIN_FLAGS contains. The device config sets it to 0:

/var/lib/environment/nemo/60-multimedia.conf   (package droid-config-jp2601)
QT_GSTREAMER_PLAYBIN_FLAGS=0

So the TEXT flag (0x4) is never set and GStreamer drops every subtitle stream. The plugins are all there (subparse, pango, matroska), and the hardware (droid) decoding path renders the overlay fine.

WORKAROUND 1 — subtitles on (one file, no package):

devel-su
echo 'QT_GSTREAMER_PLAYBIN_FLAGS=4' > /var/lib/environment/nemo/61-subtitles.conf

then reboot (or restart the user session). user@.service reads /var/lib/environment/nemo/*.conf in alphabetical order, so 61- overrides 60- without touching the packaged file. The default subtitle track is then rendered. Downside: the Gallery has no way to pick another track or turn them off.

WORKAROUND 2 — a subtitle button in the Gallery:

Qt 5.6 can switch streams in C++, but nothing is exposed to QML, so a QML-only patch can’t do it. I wrote:

  • a small QML module (bigbob.fun.mediastreams, C++, ~300 lines) that hooks onto the GStreamer bus of a QML MediaPlayer, finds the playbin and lists/switches the text streams during playback;
  • a Patchmanager patch for Sailfish/Gallery/GalleryOverlay.qml: a speech-bubble button next to the ±10 s buttons. Each tap goes to the next subtitle track, then “None”, then back to the first one. A label shows the current track for 2.5 s. Playback is never interrupted.


Two traps I hit, in case someone else tries:

  • toggling the TEXT flag during playback makes playsink rebuild the video chain: dropped buffers, then a frozen video;
  • sending several select-streams events in a row to playbin3 freezes it too.
    What works: “None” sets the silent property on the subtitle overlay elements (instant, nothing rebuilt), and a real stream selection is only sent to switch between two subtitle tracks, one at a time (waiting for STREAMS_SELECTED). Switching between two real subtitle tracks isn’t tested yet (my test file has only one).

Happy to share the module and the patch if anyone is interested.

Jolla, could you:

  1. include the TEXT flag in QT_GSTREAMER_PLAYBIN_FLAGS (i.e. 4), so the default subtitle track is shown out of the box;
  2. add a subtitle track selector (with “None”) to the Gallery video player?

AI disclosure: prepared interactively with Claude Code (Anthropic’s AI coding assistant). Every action was requested, reviewed and approved by me; nothing was decided or published autonomously.

Jolla Gallery is Open Source and published here:

Should be trivial to add the environment file at least. Please propose a PR.

Update: switching between two real subtitle tracks is now tested and works (English → Hungarian on a file with 8 subtitle tracks, confirmed by STREAMS_SELECTED in a few ms, no freeze).

The same module now also switches audio tracks (multi-language films, commentary tracks), with a speaker button next to the subtitle button. Details in a separate topic: Gallery video player can’t switch audio tracks (multi-language files): audio track button

Thanks for the pointers, done:

The file that sets the flag to 0 comes from the device adaptation (droid-config-jp2601), and I couldn’t find its sources, so I set the flag in the Gallery itself.

Oh, that was quick. LLM in full swing :).