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

mkv subtitles do not work since ffmpeg 5.1 merge #676

Closed
bennettpeter opened this issue Dec 4, 2022 · 11 comments
Closed

mkv subtitles do not work since ffmpeg 5.1 merge #676

bennettpeter opened this issue Dec 4, 2022 · 11 comments
Assignees

Comments

@bennettpeter
Copy link
Member

  • Platform:
    Ubuntu 22.04

  • MythTV version:
    v33-Pre-1003-gdc4d4f068d

  • Package version:

  • Component:
    Player

What steps will reproduce the bug?

Add a mkv format video with text subtitles to the videos storage group. While playing select the menu option to display subtitles. No subtitles appear.

How often does it reproduce? Is there a required condition?

Happens since commit a1868de. Before that it worked correctly.

What is the expected behaviour?

Subttles show

What do you see instead?

No subtitles

Additional information

Sample video: https://drive.google.com/file/d/1z53Zae3TbVXQfDgxIfv6dL2eycI4F1z-/view?usp=share_link
This bug is mentioned in #639 (comment)

@bennettpeter bennettpeter changed the title Subtitles do not work since ffmpeg 5.1 merge mkv subtitles do not work since ffmpeg 5.1 merge Dec 4, 2022
@bennettpeter bennettpeter self-assigned this Dec 14, 2022
@bshanteau
Copy link

@bennettpeter What makes a video recording have "mkv subtitles"? Are you referring to the file type, video format or codec? Could you please post a clip illustrating the issue?

The reason I ask is that video files with mkv subtitles seem to play fine in the video player on my v33 system, e.g. this mkv clip I made from an Xfinity Monterey ts type recording using Avidemuxer's MKV Muxer output format.
mtb.mkv.zip

$ mythffprobe mtb.mkv
ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
  configuration: --arch=x86 --sysinclude=/usr/include --cc='ccache gcc' --cxx='ccache g++' --ld=gcc --cpu=generic --target_os=linux --pkg_config=pkg-config --prefix=/usr --libdir=/usr/lib --as=gcc --objcc=gcc --dep_cc=gcc --host_cc=gcc --host_ld=gcc --ar=ar --nm='nm -g' --ranlib='ranlib -D' --disable-cross-compile --enable-libmp3lame --enable-libx264 --disable-libx265 --enable-libvpx --disable-libxvid --enable-vdpau --enable-libxml2 --enable-libass --disable-dxva2 --enable-libbluray --disable-libfontconfig --disable-libfreetype --disable-libiec61883 --disable-crystalhd --disable-sdl2 --disable-ffplay --enable-vaapi --enable-libdrm --enable-gnutls --extra-cflags=' -w' --extra-ldflags= --extra-libs= --enable-stripping --strip='echo skipping strip' --disable-manpages --disable-podpages --disable-doc --disable-nvenc --enable-shared --disable-static --enable-gpl --enable-pic --disable-demuxer=mpegtsraw --disable-indev=dshow
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[h264 @ 0x55dbc5de11c0] Increasing reorder buffer to 2
[h264 @ 0x55dbc5de11c0] Increasing reorder buffer to 3
Input #0, matroska,webm, from 'mtb.mkv':
  Metadata:
    ENCODER         : Lavf58.76.100
  Duration: 00:00:20.13, start: 0.005000, bitrate: 3821 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 59.94 fps, 59.94 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:00:20.120000000
  Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 128 kb/s (default)
    Metadata:
      DURATION        : 00:00:20.134000000
  Stream #0:2(spa): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      DURATION        : 00:00:20.133000000

@mspieth
Copy link
Contributor

mspieth commented Dec 15, 2022 via email

@bshanteau
Copy link

@mspieth Where?

Here is an example of one with subs. yes they currently dont work on HEAD android builds.

@mspieth
Copy link
Contributor

mspieth commented Dec 15, 2022 via email

@bennettpeter
Copy link
Member Author

@bshanteau I posted a sample video in my original posting. Look at the end of the first posting which created the issue. There is a link.

The video is created using HandBrakeCLI from a MythTV recording. Handbrake converts the CC captions into mkv text subtitles

The mythffprobe you posted shows a video that does not have subtitles, only 1 video and 2 audio streams, so I don't understand how you are seeing subtitles with it.

You should see something like this in your ffprobe
Stream #0:2(eng): Subtitle: subrip
Metadata:
BPS : 66
DURATION : 00:02:02.205000000
NUMBER_OF_FRAMES: 37
NUMBER_OF_BYTES : 1016
_STATISTICS_WRITING_APP: mkvmerge v65.0.0 ('Too Much') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-11-28 22:45:00
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

@bennettpeter
Copy link
Member Author

The problem is that ffmpeg 4.2 converts the text subtitles to libass format, then mythfrontend uses libass to display them. FFmpeg 5.1 has deprecated the code and now converts them to an ass format that is nowhere documented.

Example:
subtitle from ffmpeg 4
"Dialogue: 0,0:03:05.75,0:03:07.00,Default,,0,0,0,,- LISTEN TO ME.\NI HAVE A KNIFE.\r\n"

subtitle from ffmpeg 5.1
"1,0,Default,,0,0,0,,- LISTEN TO ME.\NI HAVE A KNIFE."

The ffmpeg 4 string corresponds to what is documented for ass subtitle format see http://www.tcax.org/docs/ass-specs.htm
The ffmpeg 5 string is not documented anywhere that I can find

ffmpeg docs have no information on this. Comments in the ffmpeg 4 code indicate it is converting to old deprecated format. ffmpeg 5 removes that conversion code.

@paul-h
Copy link
Contributor

paul-h commented Dec 15, 2022

This commit offers some hint at why they changed it?
FFmpeg/FFmpeg@2941282

Looks like the timing information is now in the AVSubtitles fields.

@bshanteau
Copy link

@bennettpeter wrote:

I posted a sample video in my original posting. Look at the end of the first posting which created the issue. There is a link.

I see it now. Thanks.

The mythffprobe you posted shows a video that does not have subtitles, only 1 video and 2 audio streams, so I don't understand how you are seeing subtitles with it.

Subtitles are mentioned in the video stream:
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 59.94 fps, 59.94 tbr, 1k tbn (default)

This is a screenshot of VLC displaying subtitles as "Sub Track: Closed Captions 1":
mtb

@paul-h
Copy link
Contributor

paul-h commented Dec 16, 2022

@bshanteau Not to confuse the issue at hand I think you have your closed caption data embedded in the video stream that ATSC broadcasts seem to use. I think it's the CTA-708 standard. Peter is probably expecting the subtitles in a separate data stream which is what we typically see at least here in the UK.

@mspieth
Copy link
Contributor

mspieth commented Dec 19, 2022 via email

@bennettpeter
Copy link
Member Author

On Linux I don't see the font as courier. Perhaps fonts are missing on Android?

Input #0, matroska,webm, from '/home/storage/Video/mythtv-local/Videos/coroner.mkv':
Metadata:
creation_time : 2020-10-15T09:31:53.000000Z
ENCODER : Lavf58.29.100
Duration: 01:00:28.21, start: 0.000000, bitrate: 3710 kb/s
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
DURATION : 01:00:28.207000000
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
Metadata:
title : Surround
DURATION : 01:00:27.200000000
Stream #0:2(eng): Subtitle: ass
Metadata:
DURATION : 01:00:27.889000000

Screenshot_2022-12-19_10-29-32

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

4 participants