Skip to content

ExoPlayer can't play mpeg-ts dump #9859

Closed

Description

@apptrash

Hello! There is a dump that cannot be played by ExoPlayer (even with demo application). But VLC for Android, VLC for Linux and ffplay are able to play it. MediaPlayer can play at least video track.

ExoPlayer stops with following exception:

2022-01-13 16:07:38.397 4276-4276/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [eventTime=281.36, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_FAILED_RUNTIME_CHECK
      com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:612)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:154)
        at android.os.HandlerThread.run(HandlerThread.java:61)
     Caused by: java.lang.IllegalStateException: Playback stuck buffering and not loading
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1050)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:486)
        at android.os.Handler.dispatchMessage(Handler.java:98) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.os.HandlerThread.run(HandlerThread.java:61) 
    ]

I know for sure that after transmuxing via ffmpeg, ExoPlayer starts playing the dump normally.

Tested on:

  1. Google Pixel 4
  2. Samsung Galaxy S21+
  3. Huwaei Honor 9
  4. Samsung Galaxy S8+

Can you, please, help me with this dump?
I will provide any information you need.

Activity

  1. self-assigned this
    on Jan 13, 2022
  2. icbaker commented on Jan 13, 2022

    @icbaker
    Collaborator

    I can reproduce the problem using the provided TS file. I also see this logged repeatedly before the failure exception:

    2022-01-13 16:19:25.282 11206-12000/androidx.media3.demo.main W/DefaultLoadControl: Target buffer size reached with less than 500ms of buffered media data.
    

    @kim-vde could you take a look at this TS file to understand why ExoPlayer is not able to start playback?

  3. assigned and unassigned on Jan 13, 2022
  4. kim-vde commented on Jan 14, 2022

    @kim-vde
    Contributor

    You need to set Flag FLAG_DETECT_ACCESS_UNITS in the extractors factory. See https://exoplayer.dev/troubleshooting.html#why-do-some-mpeg-ts-files-fail-to-play for details.

    We have an improvement tracked by #7560 to avoid the need for this flag.

  5. apptrash commented on Jan 17, 2022

    @apptrash
    Author

    Thank you!

  6. Qhashan commented on Jan 20, 2022

    @Qhashan

    You need to set Flag FLAG_DETECT_ACCESS_UNITS in the extractors factory. See https://exoplayer.dev/troubleshooting.html#why-do-some-mpeg-ts-files-fail-to-play for details.

    We have an improvement tracked by #7560 to avoid the need for this flag.

    Sir, please help i have zero knowledge but I'm trying to understand, sir can you give step by step tutorial to understand where I have to set FLAG_DETECT_ACCESS_UNITS and FLAG_ALLOW_NON_IDR_KEYFRAMES
    set on a DefaultExtractorsFactory (where I can find).

  7. apptrash commented on Jan 21, 2022

    @apptrash
    Author

    @Qhashan, for example

    val extractorsFactory = DefaultExtractorsFactory()
    extractorsFactory.setTsExtractorFlags(DefaultTsPayloadReaderFactory.FLAG_ALLOW_NON_IDR_KEYFRAMES or DefaultTsPayloadReaderFactory.FLAG_DETECT_ACCESS_UNITS)
    val mediaSourceFactory = DefaultMediaSourceFactory(this, extractorsFactory)
    val player = ExoPlayer.Builder(this)
         .setMediaSourceFactory(mediaSourceFactory)
         .build()
    
  8. locked and limited conversation to collaborators on Mar 19, 2022
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