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

ExoPlayer can't play mpeg-ts dump #9859

Closed
apptrash opened this issue Jan 13, 2022 · 5 comments
Closed

ExoPlayer can't play mpeg-ts dump #9859

apptrash opened this issue Jan 13, 2022 · 5 comments
Assignees
Labels

Comments

@apptrash
Copy link

apptrash commented Jan 13, 2022

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.

@icbaker
Copy link
Collaborator

icbaker commented Jan 13, 2022

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?

@icbaker icbaker added question and removed bug labels Jan 13, 2022
@icbaker icbaker assigned kim-vde and unassigned icbaker Jan 13, 2022
@kim-vde
Copy link
Contributor

kim-vde commented Jan 14, 2022

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.

@apptrash
Copy link
Author

Thank you!

@Qhashan
Copy link

Qhashan commented Jan 20, 2022

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).

@apptrash
Copy link
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()

@google google locked and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants