jellyfin / jellyfin-androidtv

Android TV Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
2.62k stars 452 forks source link

Subtitles out-of-sync in beta 0.17.X #3725

Open tsiktsiris opened 1 month ago

tsiktsiris commented 1 month ago

Describe the bug

Subtitles get out of sync on certain video formats on 0.17.1 and 0.17.2 (previous versions work fine). So far reproduced on HEVC encoded SDR videos with AAC 5.1 audio.

  1. Play a HEVC AAC 5.1 video
  2. After 5 seconds subtitles get out of sync

Logs

No response

FFmpeg logs

No response

Media info of the file

ffprobe version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[matroska,webm @ 0x63784329dec0] Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'video.mkv':
  Metadata:
    title           : video
    encoder         : libebml v1.4.2 + libmatroska v1.6.4
    creation_time   : 2023-01-11T06:06:39.000000Z
  Duration: 00:41:34.93, start: 0.000000, bitrate: 3372 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 586.252333
      Metadata:
        title           : Chapter 01
    Chapter #0:1: start 586.252333, end 1057.806733
      Metadata:
        title           : Chapter 02
    Chapter #0:2: start 1057.806733, end 1731.521444
      Metadata:
        title           : Chapter 03
    Chapter #0:3: start 1731.521444, end 2117.365244
      Metadata:
        title           : Chapter 04
    Chapter #0:4: start 2117.365244, end 2465.546400
      Metadata:
        title           : Chapter 05
    Chapter #0:5: start 2465.546400, end 2494.932000
      Metadata:
        title           : Chapter 06
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
    Metadata:
      BPS             : 2946597
      DURATION        : 00:41:34.909000000
      NUMBER_OF_FRAMES: 59818
      NUMBER_OF_BYTES : 918936634
      _STATISTICS_WRITING_APP: mkvmerge v59.0.0 ('Shining Star') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2023-01-11 06:06:39
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:1(eng): Audio: aac (LC), 48000 Hz, 5.1, fltp (default) (forced)
    Metadata:
      title           : Main Audio
      BPS             : 400486
      DURATION        : 00:41:34.912000000
      NUMBER_OF_FRAMES: 116949
      NUMBER_OF_BYTES : 124897198
      _STATISTICS_WRITING_APP: mkvmerge v59.0.0 ('Shining Star') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2023-01-11 06:06:39
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
  Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle
    Metadata:
      title           : English (SDH)
      BPS             : 48755
      DURATION        : 00:40:51.824000000
      NUMBER_OF_FRAMES: 1452
      NUMBER_OF_BYTES : 14942357
      _STATISTICS_WRITING_APP: mkvmerge v59.0.0 ('Shining Star') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2023-01-11 06:06:39
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

Application version

0.17.2

Device information

Nokia Streaming Box 8010

Android version

Android 12

Jellyfin server version

10.9.7

VampiricAlien commented 1 month ago

I am not sure why it worked for me but not for you. I also found media that has PGS subtitles and fast-forward but still wasn't able to have the same issue.

1.     Play a HEVC AAC 5.1 video
2.     After 5 seconds subtitles get out of sync

Is it just the PGS subtitles? Any transcoding? check the settings under playback in the web client for a setting called Allow subtitle extraction on the flyand other settings. Does your jellyfin logs say anything when this starts to happen? https://www.palotec.ch/media/pdf/Nokia_Streaming_Box_8010_LL_EN_02112021.pdf (supports HEVC)

tsiktsiris commented 1 month ago

Thanks, no transcoding. I also checked option about the extraction on the fly didn't help. The box definitely supports HEVC and everything works well with previous versions.

Seems to be an audio-related issue (device-related?) because when I enable "Downmix to stereo" instead of "Direct play", the subtitles are in-sync.

Device logcat: https://pastebin.com/raw/w90GDCtH

VampiricAlien commented 1 month ago

You have just helped my error https://github.com/jellyfin/jellyfin-androidtv/issues/3726, I've been testing a few things and forgot to check that. I have an audio issue with 5.1 sound not playing directly.

Retesting your issue and for me, pgs subs don't go out of sync.

Could have something too do with https://github.com/jellyfin/jellyfin-androidtv/pull/3564

tsiktsiris commented 1 month ago

I agree there is definitely something wrong with the audio.

UPDATE: I have tested 0.17.2 on a Chromecast 4K with GoogleTV and a Sony Bravia X90J using the same video file.

  1. Chromecast 4K with GoogleTV with transcoding: Video plays with subtitle issues (only the first subtitle is rendered) https://pastebin.com/raw/7G8pTSh1
  2. X90J: Video plays with subtitles working correctly when using "Downmix to stereo" (just like the Nokia 8010). "Direct audio" causes repeated playback errors: https://pastebin.com/raw/jUZ6uUyi
viown commented 3 weeks ago

@tsiktsiris Did the latest beta fix this issue for you?