Skip to content

Parse Subtitles During Extraction BUG #2052

Closed
@FongMi

Description

@FongMi

Version

Media3 1.5.1

More version details

This video file can't not play after 1.4.0-alpha02
1.4.0-alpha01 can play well even if have error.
https://drive.google.com/file/d/18fYNCarTAbN84679hBS_KKobqRDWKlir/view?usp=drive_link

textTrackTranscodingEnabled need to set false
parseSubtitlesDuringExtraction need to set false
legacyDecodingEnabled need to set true

The above settings can be made to play in 1.5.1

Devices that reproduce the issue

Xiaomi 13

Devices that do not reproduce the issue

None

Reproducible in the demo app?

Yes

Reproduction steps

  1. add file path to media.exolist.json

Expected result

Play well

Actual result

See error

Media

https://drive.google.com/file/d/18fYNCarTAbN84679hBS_KKobqRDWKlir/view?usp=drive_link

Bug Report

  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Activity

icbaker

icbaker commented on Jan 17, 2025

@icbaker
Collaborator

Actual result

See error

What is the error?

self-assigned this
on Jan 17, 2025
FongMi

FongMi commented on Jan 17, 2025

@FongMi
Author

Image

1.4.0-alpha01 can see the error too, but can play video.
1.4.0-alpha02~1.5.1 can see the error and stop play.

icbaker

icbaker commented on Jan 17, 2025

@icbaker
Collaborator

This looks like a duplicate of #1722

Can you please try with 1.6.0-alpha01?

FongMi

FongMi commented on Jan 17, 2025

@FongMi
Author

1.6.0-alpha01 is same. not play continued

Image

icbaker

icbaker commented on Jan 17, 2025

@icbaker
Collaborator

Thanks - the changes in #1722 don't work here because the exception takes down the whole MatroskaExtractor and its Loadable, not just a Loadable being used only for subtitle playback.

Playback of your broken video can be permitted by adding try / catch (RuntimeException) around the call to parse here:

currentSubtitleParser.parse(
sampleData,
sampleStart,
size,
SubtitleParser.OutputOptions.allCues(),
cuesWithTiming -> outputSample(cuesWithTiming, timeUs, flags));

But I'm not sure the best way to signal that error out of the player in a programmatically visible, non-fatal way (rather than just logging it and continuing) - for consistency with the way we handle other subtitle parsing errors.

icbaker

icbaker commented on Jan 22, 2025

@icbaker
Collaborator

Digging a bit further into the provided file, it has a cue that starts like this (i.e. has duration zero):

Dialogue: 0:00:00:00,0:00:00:00

The cue looks like it contains some conversion metadata, and is not intended to be displayed.

This currently trips up some fiddly logic in SsaParser that's designed to support overlapping subtitles (see google/ExoPlayer#6595), and results in it creating a single, empty, cue list - which then violates the assumption that every SSA cue line results in at least two lists of cues, one containing the text and another containing no cues (to signal the end), which ends up throwing the exception you're seeing.

I've got a change in review which fixes playback for your file by just ignoring cues where startTimeUs >= endTimeUs as invalid.

I'm also looking at submitting a change that suppresses+logs all parsing errors that bubble out as far as SubtitleTranscodingTrackOutput as described above - in order to maintain parity with 'legacy' subtitle decoding (where errors that bubble out this far are suppressed and logged in TextRenderer).

FongMi

FongMi commented on Jan 22, 2025

@FongMi
Author

Thank you for your hard testing.

locked and limited conversation to collaborators on Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @icbaker@FongMi@google-oss-bot@tonihei

      Issue actions

        Parse Subtitles During Extraction BUG · Issue #2052 · androidx/media