google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.74k stars 6.03k forks source link

Automatically detect when FLAG_ALLOW_NON_IDR_KEYFRAMES and FLAG_DETECT_ACCESS_UNITS are needed in the TS extractor #7560

Open LSDsl opened 4 years ago

LSDsl commented 4 years ago

Demo app show buffering progress, length of video and show progress during play. But all this with black screen.

test file http://212.237.34.148/test.ts test hls http://212.237.34.148/test2.m3u8

kim-vde commented 4 years ago

It seems the problem comes from the TS file. This file has an H.264 video stream and an MP2 audio stream.

The video stream should be supported. I will investigate why this specific video is not played.

To play the audio stream, you should use the FFMEG ExoPlayer extension (see Supported formats page).

AquilesCanta commented 4 years ago

You should check out the FAQ: Why do some MPEG-TS files fail to play?.

kim-vde commented 4 years ago

This content has AUD NAL units but doesn't have IDR frames. Setting the flag FLAG_ALLOW_NON_IDR_KEYFRAMES fixes the issue (see HlsMediaSource.Factory.setExtractorFactory() and DefaultHlsExtractorsFactory).

LSDsl commented 4 years ago

Not it work (with FLAG_ALLOW_NON_IDR_KEYFRAMES ). But may be better add some help info in logs in this situation? Ty

ojw28 commented 4 years ago

@kim-vde @AquilesCanta - The flags might remain useful to force certain behaviours on, but would it be possible to do something more intelligent by default so that specifying the flags is required for fewer cases?

For example, I suspect that we could have a default behaviour where we start off detecting access units the expensive way, and switch to the cheap way as soon as we see an AUD in the stream. This would make FLAG_DETECT_ACCESS_UNITS unnecessary, except in weird edge cases where there are some AUDs, but they're not everywhere they should be, which I doubt this ever happens. It might be possible to do something similar for FLAG_ALLOW_NON_IDR_KEYFRAMES as well.

kim-vde commented 4 years ago

I think it should indeed be feasible. I'll mark the issue as an enhancement to keep track of this improvement.

AquilesCanta commented 4 years ago

I think the DETECT_ACCESS_UNITS flag can be removed using the following rules:

Re allowing non-idr sync frames, the number of reported issues decreased (I think) with the introduction of the detection of the random access indicator. But after some research I haven't found a way of avoiding the allowing of non-IDR key frames for the provided stream, which doesn't seem to include any TS-level information about sync frames.

devathul commented 4 years ago

Hello , Do you have an ETA for enhancement to reduce the usage of FLAG_ALLOW_NON_IDR_KEYFRAMES and FLAG_DETECT_ACCESS_UNITS? Thanks

kim-vde commented 3 years ago

I am afraid not. All I can say is that we haven't planned to work on that in the following months.

devathul commented 3 years ago

@kim-vde Just checking if it's possible to add this feature request?

kim-vde commented 3 years ago

I am afraid we still don't have plans to work on this in the near future. What you can do is implement the fix in a pull request and we will look at it.

wazerstar commented 2 years ago

An update to this? This seems to effect tuners like https://www.silicondust.com are using for mpeg-ts, I have finally figured out that its exoplayer being the root cause!

Worth note that its randomly whenever it keeps getting in endless buffering state with black screen.

If any dev's need samle let us know :)