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.75k stars 6.03k forks source link

Enhance PS container parsing to detect more formats in private streams (e.g. PCM / DTS) #10662

Open liangqiujuan opened 2 years ago

liangqiujuan commented 2 years ago

ExoPlayer Version

2.18.0

Devices that reproduce the issue

Amlogic T982 running Android R

Devices that do not reproduce the issue

none

Reproducible in the demo app?

Yes

Reproduction steps

1.adb install demo apk

  1. push file to sdcard/Music/test.mpg

  2. play with cmd: adb shell am start -a com.google.android.exoplayer.demo.action.VIEW -d file:///storage/emulated/0/Music/test.mpg

  3. then can see playback failed tip;

Expected result

the media plays successfully

Actual result

The test file's audio track is pcm(dvd-video), not the ac3. The error parse of mime type of audio track cause the error. It can be played with VLC apk. We can see it is parse to lpcm in VLC. some log of exoplayer when playback failed:

2022-09-30 17:30:20.053 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.26, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/eac3, channels=4, sample_rate=48000]
2022-09-30 17:30:20.058 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: droppedFrames [eventTime=4.27, mediaPos=14.67, window=0, period=0, 24]
2022-09-30 17:30:20.060 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: state [eventTime=4.27, mediaPos=14.67, window=0, period=0, BUFFERING]
2022-09-30 17:30:20.063 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: isPlaying [eventTime=4.27, mediaPos=14.67, window=0, period=0, false]
2022-09-30 17:30:20.222 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.43, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/eac3, channels=5, sample_rate=48000]
2022-09-30 17:30:20.302 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.51, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/ac3, channels=5, sample_rate=48000]
2022-09-30 17:30:20.356 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.57, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/eac3, channels=1, sample_rate=48000]
2022-09-30 17:30:20.448 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.66, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/eac3, channels=3, sample_rate=48000]
2022-09-30 17:30:20.451 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.66, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/ac3, channels=6, sample_rate=48000]
2022-09-30 17:30:20.651 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.86, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/eac3, channels=2, sample_rate=48000]
2022-09-30 17:30:20.767 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.98, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/ac3, channels=4, sample_rate=48000]
2022-09-30 17:30:20.769 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=4.98, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/eac3, channels=2, sample_rate=48000]
2022-09-30 17:30:20.835 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioInputFormat [eventTime=5.05, mediaPos=14.67, window=0, period=0, id=189, mimeType=audio/eac3, channels=3, sample_rate=48000]
2022-09-30 17:30:21.089 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: videoDisabled [eventTime=5.30, mediaPos=14.67, window=0, period=0]
2022-09-30 17:30:21.090 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: audioDisabled [eventTime=5.30, mediaPos=14.67, window=0, period=0]
2022-09-30 17:30:21.103 3171-3171/com.google.android.exoplayer2.demo D/EventLogger: videoDecoderReleased [eventTime=5.31, mediaPos=14.67, window=0, period=0, OMX.amlogic.mpeg2.decoder.awesome2]
2022-09-30 17:30:21.106 3171-3171/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [eventTime=5.32, mediaPos=14.67, window=0, period=0, errorCode=ERROR_CODE_DECODING_FORMAT_UNSUPPORTED
      com.google.android.exoplayer2.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(189, null, null, null, null, -1, null, [-1, -1, -1.0], [5, -1]), format_supported=NO
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:566)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:223)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: java.lang.IllegalArgumentException
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1435)
        at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.onInputFormatChanged(MediaCodecAudioRenderer.java:495)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.bypassRead(MediaCodecRenderer.java:2249)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.bypassRender(MediaCodecRenderer.java:2229)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:787)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:989)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:490)
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:223) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 

Media

media-info

Bug Report

liangqiujuan commented 2 years ago

The test file is 757M. I will find a way to upload it.

liangqiujuan commented 2 years ago

the download addr: https://cowtransfer.com/s/2eccb975bdcd4c after enter the net, you can click "下载“,then the file will be download. The picture is a screenshot. download

tonihei commented 2 years ago

The format isn't supported by the device you are trying to play it with. There is not much we can do about it I'm afraid. The video is MPEG2 and the audio AC3, both are not widely available on mobile devices.

liangqiujuan commented 2 years ago

Hi tonihei, I think the fail reason is exoplayer parse the lpcm audio mime to ac3 or eac3. please check it, thanks.

tonihei commented 2 years ago

The audio stream is marked as a private stream in the PS container. The only format we currently assume to be in a private stream is AC3 (see this note here). I can mark it as a low-priority enhancement to support more advanced parsing, but it's unlikely we get around to this soon.