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.71k stars 6.02k forks source link

MP4 Videos Unable to Play - UnrecognizedInputFormatException: None of the available extractors #7584

Closed amoizesmail closed 4 years ago

amoizesmail commented 4 years ago

Issue description

We are integrating Exoplayer to our application and one of the features is to play an mp4 video stored in an S3 bucket. S3 bucket's permissions is already set to public to make our videos publicly available to the app without authentications. The videos are not playing the due the this exception UnrecognizedInputFormatException

Reproduction steps

I used the ExoPlayer demo and add our videos in the media.exolist.json, specifically in the Misc section. Other Mp4 available on the internet are working fine like this video

Other media like audio and youtube videos are working fine in the app using the ExoPlayer.

Link to test content

The videos are available here. I cannot share full link of the video from S3 due to security reasons

A full bug report captured from the device

2020-07-03 11:47:28.941 18514-18514/com.google.android.exoplayer2.demo E/EventLogger: internalError [eventTime=2.14, mediaPos=0.00, window=0, period=0, loadError
      com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor, Ac4Extractor, FlacExtractor) could read the stream.
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractorHolder.selectExtractor(ProgressiveMediaPeriod.java:1096)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:975)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:415)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
    ]

2020-07-03 11:47:28.943 18514-18748/com.google.android.exoplayer2.demo E/ExoPlayerImplInternal: Source error
      com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor, Ac4Extractor, FlacExtractor) could read the stream.
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractorHolder.selectExtractor(ProgressiveMediaPeriod.java:1096)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:975)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:415)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

Version of ExoPlayer being used

Version No: 2.11.7 and 2.10.1

We support Android OS versions from 5.0 up to the latest

Test Device: Samsung Galaxy S8 - OS: Android 9

kim-vde commented 4 years ago

The problem is that the major and compatible brands (in this case isml and piff) specified in the ftyp box are not listed as being supported in the code. If I bypass the brand check, the videos play properly.

I will investigate what these brands are and whether they can be added to the list of supported brands.

In the mean time, a possible workaround would be to use an ExtractorsFactory containing only the FragmentedMp4Extractor.

amoizesmail commented 4 years ago

Hi @kim-vde , what are the accepted brands? How can I bypass the brand check? Looking forward to hear you soon on the adding of our videos' brand on the list of supported brands.

amoizesmail commented 4 years ago

Hi @kim-vde,

We tried the suggested workaround, the using of ExtractorsFactory that contains FragmentedMp4Extractor only and the issue still persist.

private fun getMediaSource(type: Int, dataSourceFactory: DefaultDataSourceFactory, uri: Uri): BaseMediaSource? {
        return when (type) {
            TYPE_DASH -> {
                DashMediaSource.Factory(dataSourceFactory).createMediaSource(uri)
            }
            TYPE_SS -> {
                SsMediaSource.Factory(dataSourceFactory).createMediaSource(uri)
            }
            TYPE_HLS -> {
                HlsMediaSource.Factory(dataSourceFactory).createMediaSource(uri)
            }
            TYPE_OTHER -> {
                ProgressiveMediaSource.Factory(dataSourceFactory, CustomMediaExtractor()).createMediaSource(uri)
            }
            else -> {
                throw IllegalStateException("Unsupported type: $type")
            }
        }
    }

    class CustomMediaExtractor : ExtractorsFactory {
        override fun createExtractors(): Array<Extractor> {
            return arrayOf(FragmentedMp4Extractor())
        }
    }

Logcat

internalError [2.81, 0.00, window=0, period=0, loadError]
    com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (FragmentedMp4Extractor) could read the stream.
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractorHolder.selectExtractor(ProgressiveMediaPeriod.java:1059)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:947)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
playerFailed [2.82, 0.00, window=0, period=0]
    com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (FragmentedMp4Extractor) could read the stream.
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:386)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:214)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (FragmentedMp4Extractor) could read the stream.
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractorHolder.selectExtractor(ProgressiveMediaPeriod.java:1059)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:947)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
kim-vde commented 4 years ago

Have you tried using the latest version of ExoPlayer (2.11.7)? The condition here should be true and the error message should not be printed.