dburckh / ExoPlayer

Deprecated. See https://github.com/dburckh/Media3Avi
Apache License 2.0
3 stars 2 forks source link

AviExtractor: Unknown Track Type: 00db #5

Closed moneytoo closed 2 years ago

moneytoo commented 2 years ago

Some files give me errors like these. I'm not fully able to reproduce it with their cut samples. I will try providing the sources later.

01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 7Fxx
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
01-23 21:00:10.235  9443 24045 W AviExtractor: Unknown Track Type: 00db
...
01-23 21:00:10.307  9443 24054 D CCodec  : [c2.sec.mp3.decoder] buffers are bound to CCodec for this session
01-23 21:00:10.307  9443 24054 I CCodec  : appPid(9443) width(0) height(0)
01-23 21:00:10.307  9443 24054 D CCodecConfig: no c2 equivalents for flags
01-23 21:00:10.308  9443 24054 W Codec2Client: query -- param skipped: index = 1107298332.
01-23 21:00:10.308  9443 24054 D CCodec  : setup formats input: AMessage(what = 0x00000000) = {
01-23 21:00:10.308  9443 24054 D CCodec  :   int32_t bitrate = 64000
01-23 21:00:10.308  9443 24054 D CCodec  :   int32_t channel-count = 2
01-23 21:00:10.308  9443 24054 D CCodec  :   int32_t max-input-size = 8192
01-23 21:00:10.308  9443 24054 D CCodec  :   string mime = "audio/mpeg"
01-23 21:00:10.308  9443 24054 D CCodec  :   int32_t sample-rate = 44100
01-23 21:00:10.308  9443 24054 D CCodec  : }
01-23 21:00:10.308  9443 24054 D CCodec  : setup formats output: AMessage(what = 0x00000000) = {
01-23 21:00:10.308  9443 24054 D CCodec  :   int32_t channel-count = 2
01-23 21:00:10.308  9443 24054 D CCodec  :   string mime = "audio/raw"
01-23 21:00:10.308  9443 24054 D CCodec  :   int32_t sample-rate = 44100
01-23 21:00:10.308  9443 24054 D CCodec  : }
01-23 21:00:10.308  9443 24054 I CCodecConfig: query failed after returning 7 values (BAD_INDEX)
...
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer: Audio codec error
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:   com.google.android.exoplayer2.decoder.DecoderInputBuffer$InsufficientCapacityException: Buffer too small (8192 < 16000)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.decoder.DecoderInputBuffer.createReplacementByteBuffer(DecoderInputBuffer.java:234)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.decoder.DecoderInputBuffer.ensureSpaceForWrite(DecoderInputBuffer.java:185)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.source.SampleDataQueue.readSampleData(SampleDataQueue.java:292)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.source.SampleDataQueue.readToBuffer(SampleDataQueue.java:130)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.source.SampleQueue.read(SampleQueue.java:435)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.source.ProgressiveMediaPeriod.readData(ProgressiveMediaPeriod.java:487)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$SampleStreamImpl.readData(ProgressiveMediaPeriod.java:947)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.BaseRenderer.readSource(BaseRenderer.java:424)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1209)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:783)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:996)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:497)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at android.os.Handler.dispatchMessage(Handler.java:102)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at android.os.Looper.loopOnce(Looper.java:226)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at android.os.Looper.loop(Looper.java:313)
01-23 21:00:10.327  9443 24044 E MediaCodecAudioRenderer:       at android.os.HandlerThread.run(HandlerThread.java:67)
...
dburckh commented 2 years ago

You have an impressive collection of AVI files! I'm glad we found each other. Lots of stuff here:

The other one is a codec buffer overrun. It looks like the codec can only handle 8192 bytes, but the muxer muxed them as 16000. There is a slim chance that setting the Format.MaxInputSize, will fix it, but if not, it will probably have to be fixed in ExoPlayer. I've pushed a commit setting the MaxInputSize. Fingers crossed!

moneytoo commented 2 years ago

These are mostly some random files I happened to download recently. But I still have a few files lying around. ;-)

Here's the source: https://brouken.com/tmp/kb.avi I haven't tested your recent changes yet (will do that later).

moneytoo commented 2 years ago

With the latest changes, it generates ArrayIndexOutOfBoundsException:

E/LoadTask: Unexpected exception loading stream
      java.lang.ArrayIndexOutOfBoundsException: length=2; index=76
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.getAviTrack(AviExtractor.java:424)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.readIdx1(AviExtractor.java:355)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.read(AviExtractor.java:502)
        at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1042)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:920)
E/EventLogger: internalError [eventTime=0.12, mediaPos=0.00, window=0, period=0, loadError
      com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected ArrayIndexOutOfBoundsException: length=2; index=76
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:430)
        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:920)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2; index=76
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.getAviTrack(AviExtractor.java:424)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.readIdx1(AviExtractor.java:355)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.read(AviExtractor.java:502)
        at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1042)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:920) 
    ]
E/ExoPlayerImplInternal: Playback error
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:639)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:615)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected ArrayIndexOutOfBoundsException: length=2; index=76
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:430)
        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:920)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2; index=76
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.getAviTrack(AviExtractor.java:424)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.readIdx1(AviExtractor.java:355)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.read(AviExtractor.java:502)
        at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1042)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:920) 
E/EventLogger: playerFailed [eventTime=0.13, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_IO_UNSPECIFIED
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:639)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:615)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected ArrayIndexOutOfBoundsException: length=2; index=76
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:430)
        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:920)
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2; index=76
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.getAviTrack(AviExtractor.java:424)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.readIdx1(AviExtractor.java:355)
        at com.google.android.exoplayer2.extractor.avi.AviExtractor.read(AviExtractor.java:502)
        at com.google.android.exoplayer2.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:127)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1042)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:920) 
    ]
D/EventLogger: loading [eventTime=0.13, mediaPos=0.00, window=0, period=0, false]
    state [eventTime=0.13, mediaPos=0.00, window=0, period=0, IDLE]
D/BufferPoolAccessor2.0: bufferpool2 0x717d530cf8 : 0(0 size) total buffers - 0(0 size) used buffers - 194/204 (recycle/alloc) - 5/396 (fetch/transfer)
    bufferpool2 0x717d5485e8 : 0(0 size) total buffers - 0(0 size) used buffers - 110/119 (recycle/alloc) - 5/230 (fetch/transfer)
    evictor expired: 2, evicted: 2
dburckh commented 2 years ago

Sorry about the crash. As I'm writing tests, I'm making changes to make the code more modular and testable. Unfortunately, it means sometimes I create new issues. I've pushed a fix for the crash.

The file will play on my S20, but it gives me a lot of errors. I'll try to remux it to a different container and see if it's the video or my software.

moneytoo commented 2 years ago

The file now plays, but I'm getting an crash after jumping to the middle of the time line:

2022-01-26 00:19:48.783 15846-18621/com.google.android.exoplayer2.demo W/AviExtractor: Unknown tag=;Þe™ pos=773517466 size=-1503974498 moviEnd=1031014180
2022-01-26 00:19:48.783 15846-18621/com.google.android.exoplayer2.demo E/LoadTask: Unexpected exception loading stream
      java.lang.IllegalArgumentException
        at com.google.android.exoplayer2.util.Assertions.checkArgument(Assertions.java:39)
        at com.google.android.exoplayer2.upstream.DataSpec.<init>(DataSpec.java:643)
        at com.google.android.exoplayer2.upstream.DataSpec.<init>(DataSpec.java:32)
        at com.google.android.exoplayer2.upstream.DataSpec$Builder.build(DataSpec.java:214)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.buildDataSpec(ProgressiveMediaPeriod.java:1088)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1008)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:920)
2022-01-26 00:19:48.785 15846-15846/com.google.android.exoplayer2.demo E/EventLogger: internalError [eventTime=2.66, mediaPos=2389.97, window=0, period=0, loadError
      com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalArgumentException: null
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:430)
        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:920)
     Caused by: java.lang.IllegalArgumentException
        at com.google.android.exoplayer2.util.Assertions.checkArgument(Assertions.java:39)
        at com.google.android.exoplayer2.upstream.DataSpec.<init>(DataSpec.java:643)
        at com.google.android.exoplayer2.upstream.DataSpec.<init>(DataSpec.java:32)
        at com.google.android.exoplayer2.upstream.DataSpec$Builder.build(DataSpec.java:214)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.buildDataSpec(ProgressiveMediaPeriod.java:1088)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1008)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:920) 
    ]
2022-01-26 00:19:48.790 15846-18620/com.google.android.exoplayer2.demo E/ExoPlayerImplInternal: Playback error
      com.google.android.exoplayer2.ExoPlaybackException: Source error
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:639)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:615)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.os.HandlerThread.run(HandlerThread.java:67)
     Caused by: com.google.android.exoplayer2.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalArgumentException: null
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:430)
        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:920)
     Caused by: java.lang.IllegalArgumentException
        at com.google.android.exoplayer2.util.Assertions.checkArgument(Assertions.java:39)
        at com.google.android.exoplayer2.upstream.DataSpec.<init>(DataSpec.java:643)
        at com.google.android.exoplayer2.upstream.DataSpec.<init>(DataSpec.java:32)
        at com.google.android.exoplayer2.upstream.DataSpec$Builder.build(DataSpec.java:214)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.buildDataSpec(ProgressiveMediaPeriod.java:1088)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1008)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:409)
        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:920) 

I see similar error with one other file I have (out of total 15 files I tested with your extractor). All other (13) videos play fine (but as you already mentioned, some would really use better timestamp sync).

dburckh commented 2 years ago

The seek logic is very meh. I plan on re-writing the seek logic at some point. I even wrote a bug for myself. :)

I pushed the current code before I really wanted to in order to fix the crash. Hopefully, things will be stabilized by the end of the week.

moneytoo commented 2 years ago

I tested another 50 videos and only 3 had some playback issues related to the extractor (not counting 1 OpenDML and 2 videos which failed to play even after remuxing). So I will retest these after the rewrite. It's looking really good. 👍

dburckh commented 2 years ago

That's great! I was actually nervous about the last round of changes. Serendipitously, the release contains a bug that works-around a bug in AviMuxer. I cleaned up my bug, but I'll keep behavior that works-around the issue.

I still have issues with this file on my lower end devices. I assume it's because this file has very large audio packets. Remuxing fixes it.

dburckh commented 2 years ago

Spent some more time on this file. Both the video and audio are muxed wrong. If you remux it should work fine. I'm calling this one done.