media icon indicating copy to clipboard operation
media copied to clipboard

In V1.4.0 DVB subtitles not working, also supportsFormat API returns wrong value

Open bennettpeter opened this issue 6 months ago • 6 comments

Version

Media3 1.4.0

More version details

No response

Devices that reproduce the issue

Amazon Fire stick, onn 4K streaming box

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

  1. Api error: Playing a video that has text subtitles and selecting a subtitle.
  2. DVB subtitle problem: Playing a video that has DVB subtitles and selecting a subtitle.

Expected result

  1. Plays with subtitles
  2. Plays with subtitles

Actual result

  1. Error "Subtitle type application/x-media3-cues is not supported.
  2. java.lang.IllegalStateException: Legacy decoding is disabled, can't handle application/dvbsubs samples (expected application/x-media3-cues).

This was working fine in prior versions.

  1. Error in supportsFormat API

The methods DefaultSubtitleParserFactory.supportsFormat() and SubtitleDecoderFactory.DEFAULT.supportsFormat() are inconsistent with the new methodology of decoding subtitles in the extractor. The Format objects returned by TrackGroup.getFormat(ixTrack) have application/x-media3-cues in the sampleMimeType and the actual subtitle type (e.g. text/x-ssa) in the codecs field. However, the two supportsFormat() methods are still checking the sampleMimeType and returning false for subtitle support when the sampleMimeType is application/x-media3-cues.

My work-around is to check for hardcoded application/x-media3-cues or application/cea-608

  1. Unable to use DVB subtitles

My streams are all progressive, based on video files (ts, mkv, mp4, etc) served with http.

I am able to enable subtitles for most types, except for dvbsubs. In the case of dvbsubs, TrackGroup.getFormat(ixTrack) returns a Format object with sampleMimeType of application/dvbsubs and codecs of null. Upon enabling the subtitle, there is an exception java.lang.IllegalStateException: Legacy decoding is disabled, can't handle application/dvbsubs samples (expected application/x-media3-cues).

I attempted to fix this by changing /androidx/media3/extractor/ts/DvbSubtitleReader.java commented out .setSampleMimeType(MimeTypes.APPLICATION_DVBSUBS) replaced with
.setSampleMimeType(MimeTypes.APPLICATION_MEDIA3_CUES) .setCodecs(MimeTypes.APPLICATION_DVBSUBS) This was unsuccessful, java.lang.IllegalStateException: Bundle length is not aligned by 4: 33559567

I prefer not to enable legacy decoding, I can stay on the prior version of exoplayer until it is fixed.

The source code for my application with V1.4.0 is in the media-upgrade branch at https://github.com/bennettpeter/android-MythTV-Leanfront/tree/media-upgrade

I have tried the changes suggested in https://github.com/androidx/media/issues/1644 and others. I originally was using ProgressiveMediaSource.Factory, and I changed to use DefaultMediaSourceFactory as suggested. The subtitles other than dvbsubs were already playing correctly with ProgressiveMediaSource.Factory. The change to DefaultMediaSourceFactory made no difference.

I have tested the following subtitle types:

Text: OK DVB: Fail: java.lang.IllegalStateException: Legacy decoding is disabled, can't handle application/dvbsubs samples (expected application/x-media3-cues). PGS: OK ASS: OK CEA-608: OK: note this works in spite of the fact that in this case sampleMimeType is application/cea-608 and codecs is null

Media

  1. Any video with text, PGS, or ass subtitles
  2. Any video with DVB subtitles

Bug Report

  • [X] You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

bennettpeter avatar Aug 26 '24 19:08 bennettpeter