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

Consider supporting MPEG-TS streams that start/end with an incomplete TS packet #1332

Closed
stari4ek opened this issue Mar 2, 2016 · 6 comments
Assignees

Comments

@stari4ek
Copy link

stari4ek commented Mar 2, 2016

E/OggVorbisExtractor: expected OggS capture pattern at begin of page
E/ExoPlayerImplInternal: Internal track renderer error.
                         com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.extractor.ExtractorSampleSource$UnrecognizedInputFormatException: None of the available extractors (WebmExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, TsExtractor, FlvExtractor, OggVorbisExtractor, PsExtractor) could read the stream.
                             at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:263)
                             at com.google.android.exoplayer.SampleSourceTrackRenderer.maybeThrowError(SampleSourceTrackRenderer.java:149)
                             at com.google.android.exoplayer.ExoPlayerImplInternal.incrementalPrepareInternal(ExoPlayerImplInternal.java:283)
                             at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:205)
                             at android.os.Handler.dispatchMessage(Handler.java:98)
                             at android.os.Looper.loop(Looper.java:148)
                             at android.os.HandlerThread.run(HandlerThread.java:61)
                             at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)
                          Caused by: com.google.android.exoplayer.extractor.ExtractorSampleSource$UnrecognizedInputFormatException: None of the available extractors (WebmExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, TsExtractor, FlvExtractor, OggVorbisExtractor, PsExtractor) could read the stream.
                             at com.google.android.exoplayer.extractor.ExtractorSampleSource$ExtractorHolder.selectExtractor(ExtractorSampleSource.java:801)
                             at com.google.android.exoplayer.extractor.ExtractorSampleSource$ExtractingLoadable.load(ExtractorSampleSource.java:732)
                             at com.google.android.exoplayer.upstream.Loader$LoadTask.run(Loader.java:209)
                             at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
                             at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                             at java.lang.Thread.run(Thread.java:818)

Stream info

$ ffprobe -v debug ~/dev/ExoPlayer/demo/src/main/assets/no_extractor.ts
ffprobe version 2.7.6-0ubuntu0.15.10.1 Copyright (c) 2007-2016 the FFmpeg developers
[mpegts @ 0x229a5e0] Format mpegts probed with size=2048 and score=100
[mpegts @ 0x229a5e0] stream=0 stream_type=3 pid=44 prog_reg_desc=
[mpegts @ 0x229a5e0] stream=1 stream_type=2 pid=45 prog_reg_desc=
[mpegts @ 0x229a5e0] Before avformat_find_stream_info() pos: 0 bytes read:98304 seeks:1
[mpeg2video @ 0x229eec0] Invalid frame dimensions 0x0.
  Last message repeated 14 times
[mpegts @ 0x229a5e0] max_analyze_duration 5000000 reached at 5016000 microseconds
[mpegts @ 0x229a5e0] rfps: 24.916667 0.014187
[mpegts @ 0x229a5e0] rfps: 25.000000 0.000000
  Last message repeated 1 times
[mpegts @ 0x229a5e0] rfps: 25.083333 0.014286
[mpegts @ 0x229a5e0] rfps: 50.000000 0.000001
  Last message repeated 1 times
[mpegts @ 0x229a5e0] PES packet size mismatch
  Last message repeated 1 times
[mpegts @ 0x229a5e0] After avformat_find_stream_info() pos: 0 bytes read:2052240 seeks:3 frames:336
Input #0, mpegts, from '~/dev/ExoPlayer/demo/src/main/assets/no_extractor.ts':
Duration: 00:00:23.29, start: 40827.534611, bitrate: 2783 kb/s
Program 1 
  Stream #0:0[0x44](rus), 211, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
  Stream #0:1[0x45], 125, 1/90000: Video: mpeg2video (Main), 1 reference frame ([2][0][0][0] / 0x0002), yuv420p(tv, left), 720x576 [SAR 64:45 DAR 16:9], 1/50, max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
detected 8 logical cores
[AVIOContext @ 0x2296c40] Statistics: 2052240 bytes read, 3 seeks
@ojw28
Copy link
Contributor

ojw28 commented Mar 7, 2016

The sample isn't supported because it doesn't start at a TS packet boundary, which we currently require.

Note that even if we were to support starting at an arbitrary point in a TS packet, this stream wouldn't play on most Android devices, since decoder support is not required for either mp2 audio or h262 video, as are contained in this stream. See here.

It's an open question whether we should support starting (and ending) at an arbitrary point in a TS packet.

@ojw28 ojw28 changed the title ExoPlayer fails to identify MPEG-TS stream Consider supporting MPEG-TS streams that start/end with an incomplete TS packet Mar 7, 2016
@ojw28
Copy link
Contributor

ojw28 commented Mar 7, 2016

Updated the issue title to reflect the possible enhancement.

@stari4ek
Copy link
Author

stari4ek commented Mar 7, 2016

Talking about decoders I think that this isn't a big problem, since this kind of streams (mpeg-ts/mpeg2/mp2) are mostly used in live TV streaming. And the main target devices (shield, sony, nexus) usually have decoders.

Please correct me, if I'm wrong but to handle this situation It's possible to use pro-active "filter" which will try to sniff data forward to find the bound and drop all trailing bytes?

@ojw28
Copy link
Contributor

ojw28 commented Mar 7, 2016

@erdemguven - Maybe I imagined it, but I seem to remember we talked about this (or something similar) a while back. In any case, perhaps we should add support at this point (I guess it's just a relatively simple change in TsExtractor?).

@jersteth
Copy link

I'm also interested in this fix. mpeg2 video plays from mkv container but not from mpeg-ts. It's not really clear to me what you mean with 'TS boundary' and 'incomplete TS packet'.

ojw28 pushed a commit that referenced this issue Jul 8, 2016
…r lost sync.

Issue: #1332
Issue: #1101
Issue: #1083
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125659191
@stari4ek
Copy link
Author

I'd like to confirm that adc7ece (applied to dev-v1) fixes the issue.
Checked with 2 different streams from different providers - looks good.

Thank You

@ojw28 ojw28 closed this as completed Sep 9, 2016
@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants