Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medusa does not recognize embedded subtitles (mov_text) in mp4 containers #11902

Open
jmarcet opened this issue Dec 26, 2024 · 0 comments
Open

Comments

@jmarcet
Copy link

jmarcet commented Dec 26, 2024

Describe the bug
Medusa recognizes mov_text subs, at least they are included in the knowit database, however they are not recognized in mp4 containers.

My initial attempt to fix it does not seem to work:

diff --git a/medusa/subtitles.py b/medusa/subtitles.py
index c255f98a7..bbe5cfdfd 100644
--- a/medusa/subtitles.py
+++ b/medusa/subtitles.py
@@ -722,7 +722,6 @@ def get_video(tv_episode, video_path, subtitles_dir=None, subtitles=True, embedd
         logger.debug(u'Found cached video information under key %s', key)
         return cached_payload['video']

-    video_is_mkv = video_path.endswith('.mkv')
     subtitles_dir = subtitles_dir or get_subtitles_dir(video_path)

     logger.debug(u'Scanning video %s...', video_path)
@@ -737,7 +736,7 @@ def get_video(tv_episode, video_path, subtitles_dir=None, subtitles=True, embedd
             video.subtitle_languages |= set(search_external_subtitles(video_path, directory=subtitles_dir).values())

         if embedded_subtitles is None:
-            embedded_subtitles = bool(not app.IGNORE_EMBEDDED_SUBS and video_is_mkv)
+            embedded_subtitles = bool(not app.IGNORE_EMBEDDED_SUBS and video_path.endswith(('.mkv', '.mp4')))

         refine(video, episode_refiners=episode_refiners, embedded_subtitles=embedded_subtitles,
                release_name=release_name, tv_episode=tv_episode)
@@ -937,7 +936,7 @@ class SubtitlesFinder(object):
                                  tv_episode.release_name, new_release_name)
                     tv_episode.subtitles = []
                     tv_episode.release_name = new_release_name
-                embedded_subtitles = bool(not app.IGNORE_EMBEDDED_SUBS and video_path.endswith('.mkv'))
+                embedded_subtitles = bool(not app.IGNORE_EMBEDDED_SUBS and video_path.endswith(('.mkv', '.mp4')))
                 downloaded_languages = download_subtitles(tv_episode, video_path=video_path,
                                                           subtitles=False, embedded_subtitles=embedded_subtitles)

I've been remuxing all my DoVi HDR mkvs to mp4 to avoid the remux when played on a LG OLED C4 as per jellyfin-webos/issues/109 and now Medusa fails to recognize the embedded subs.

Medusa (please complete the following information):

  • OS: docker
  • Branch: master
  • Version: 1.0.22
  • Commit: d996387
  • Python version: 3.10.8
  • Database version: 44.19

A sample ffprobe of such a .mp4 video:

❯ docker exec -it jellyfin /usr/lib/jellyfin-ffmpeg/ffprobe -i video.mp4
ffprobe version 7.0.2-Jellyfin Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto=auto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libxml2 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libharfbuzz --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomdby1iso2mp41
    encoder         : Lavf61.1.100
  Duration: 00:58:22.00, start: 0.000000, bitrate: 13871 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 3396.450000
      Metadata:
        title           : Part 01
    Chapter #0:1: start 3396.450000, end 3502.000000
      Metadata:
        title           : Credits
  Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 9241 kb/s, 24 fps, 24 tbr, 16k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
      Side data:
        DOVI configuration record: version: 1.0, profile: 8, level: 6, rpu flag: 1, el flag: 0, bl flag: 1, compatibility id: 1
  Stream #0:1[0x2](eng): Audio: eac3 (Dolby Digital Plus + Dolby Atmos) (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 768 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
      Side data:
        audio service type: main
  Stream #0:2[0x3](fre): Audio: eac3 (Dolby Digital Plus + Dolby Atmos) (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 768 kb/s
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
      Side data:
        audio service type: main
  Stream #0:3[0x4](ger): Audio: eac3 (Dolby Digital Plus + Dolby Atmos) (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 768 kb/s
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
      Side data:
        audio service type: main
  Stream #0:4[0x5](ita): Audio: eac3 (Dolby Digital Plus + Dolby Atmos) (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 768 kb/s
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
      Side data:
        audio service type: main
  Stream #0:5[0x6](por): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 256 kb/s
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
      Side data:
        audio service type: main
  Stream #0:6[0x7](spa): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 640 kb/s
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
      Side data:
        audio service type: main
  Stream #0:7[0x8](spa): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 640 kb/s
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
      Side data:
        audio service type: main
  Stream #0:8[0x9](eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:9[0xa](eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default) (forced)
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:10[0xb](fre): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:11[0xc](fre): Subtitle: mov_text (tx3g / 0x67337874)
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:12[0xd](ger): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:13[0xe](ger): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:14[0xf](ger): Subtitle: mov_text (tx3g / 0x67337874)
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:15[0x10](ita): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:16[0x11](ita): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:17[0x12](por): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:18[0x13](por): Subtitle: mov_text (tx3g / 0x67337874)
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:19[0x14](spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:20[0x15](spa): Subtitle: mov_text (tx3g / 0x67337874)
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:21[0x16](spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:22[0x17](spa): Subtitle: mov_text (tx3g / 0x67337874)
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:23[0x18](ara): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:24[0x19](chi): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:25[0x1a](chi): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:26[0x1b](hrv): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:27[0x1c](cze): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:28[0x1d](dan): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:29[0x1e](dut): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:30[0x1f](fil): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:31[0x20](fin): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:32[0x21](gre): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:33[0x22](heb): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:34[0x23](hun): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:35[0x24](ind): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:36[0x25](jpn): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:37[0x26](kor): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:38[0x27](may): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:39[0x28](nor): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:40[0x29](pol): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:41[0x2a](por): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:42[0x2b](rum): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:43[0x2c](rus): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:44[0x2d](swe): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:45[0x2e](tha): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:46[0x2f](tur): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:47[0x30](ukr): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:48[0x31](vie): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
      Metadata:
        handler_name    : SubtitleHandler
  Stream #0:49[0x32](eng): Data: bin_data (text / 0x74786574)
      Metadata:
        handler_name    : SubtitleHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant