Skip to content

Flickering subtitles in DASH/H264 with B-frames present #288

Closed

Description

@AGasztold

Media3 Version

ExoPlayer 2.18.3

Devices that reproduce the issue

All Android devices.

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

  1. Run attached media in Demo app
  2. Turn on subtitles
  3. Observe the flicker effect

Expected result

No flickering effect should be observed.

Actual result

Due to the presence of B frames in text chunks and the time offset of text segment relative to video segments:

SegmentTimeline for text: <S t="19" d="2000" r="283" />
SegmentTimeline for video: <S t="0" d="2000" r="89" />

there is an effect of flickering subtitles. When I applied the following workaround inside SubtitleOutputBuffer:

  public void setContent(long timeUs, Subtitle subtitle, long subsampleOffsetUs) {
    this.timeUs = (timeUs/1000000L) * 1000000L;
    this.subtitle = subtitle;
    this.subsampleOffsetUs =
        subsampleOffsetUs == Format.OFFSET_SAMPLE_RELATIVE ? this.timeUs : subsampleOffsetUs;
  }

which cancels this offset, flickering effect does not occur. Anyaway, this is not long term solution for me. I will appreciate your help.

Media

https://r.dcs.redlabs.pl/dash/o2/ATM-Lab/zos/vod-test/glitch/dash_b_frames/playlist.smil

Bug Report

Activity

  1. icbaker commented on Apr 5, 2023

    @icbaker
    Collaborator

    Thanks for reporting, and for including a repro stream. I'm able to see the same issue.

    I've added some debug logging and it looks like this happens when we transition between Subtitle objects inside TextRenderer while a cue is meant to be shown on screen. The implementation details of this means we currently end up 'finishing' one Subtitle object with an empty list of cues at the same presentation timestamp of the first event of the next Subtitle (which contains the same cue text that should be on screen). This transition through an empty cue list is then propagated through TextOutput and ultimately to the SubtitleView and results in the flickering. We end up seeing
    cues emitted roughly as follows (the timestamps are from your example media, the text I swapped out for this example):

    positionUs=1000037010972  presentationTimeUs=37000000  cues=["foo bar"]  subtitle_1
    positionUs=1000038002287  presentationTimeUs=38000000  cues=[]  subtitle_1
    positionUs=1000038022400  presentationTimeUs=38000000	cues=["foo bar"]  subtitle_2
    

    I'm still investigating exactly how the media results in this output.

  2. AGasztold commented on Apr 27, 2023

    @AGasztold
    Author

    Hello, thanks for your reply. Are the any news regarding this issue? I will appreciate your help.

  3. 07steven01 commented on Jul 17, 2023

    @07steven01

    I'm facing the same issue. Is there a fix yet?

  4. icbaker commented on Jul 19, 2023

    @icbaker
    Collaborator

    I'm currently making some fairly major changes to TextRenderer that should resolve the problem I described above - I hope this will be part of 1.2.0.

  5. 07steven01 commented on Sep 13, 2023

    @07steven01

    I can see 1.2.0-alpha01 is out. No mention of TextRenderer in the changelog. Are the changes still planned for 1.2.0 or rather some further release?

  6. icbaker commented on Sep 13, 2023

    @icbaker
    Collaborator

    I'm working on the TextRenderer changes (they are not submitted yet) - at the moment i'm not sure if they will be complete in time for 1.2.0.

  7. icbaker commented on Oct 17, 2023

    @icbaker
    Collaborator

    I've added experimental support for the new approach to subtitle parsing in DASH. This will be included in 1.2.0-rc01. You can try it out with DashMediaSource.Factory.experimentalParseSubtitlesDuringExtraction.

  8. locked and limited conversation to collaborators on Dec 27, 2023
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

    Issue actions