Newpipe: Some streams are not loading

Created on 18 Aug 2018  Â·  11Comments  Â·  Source: TeamNewPipe/NewPipe

For some streams some resolution is never loading.
Take this one here for example:
https://www.youtube.com/watch?v=00Q4SUnVQK4
If you select 480p you will see the Loading cycle cycle forever.

This is the coresponding logcat output:

08-18 13:02:10.122 21561-21561/org.schabi.newpipe.debug D/SerializedCache: put() called with: key = [1e67ab85-b83a-4ce0-9209-faebf74146c1], item = [org.schabi.newpipe.player.playqueue.SinglePlayQueue@6efad41]

    --------- beginning of system
08-18 13:02:10.137 21561-21561/org.schabi.newpipe.debug D/.MainVideoPlayer: onCreate() called with: savedInstanceState = [null]
    hideSystemUi() called
08-18 13:02:10.167 21561-21561/org.schabi.newpipe.debug D/BasePlayer: initPlayer() called with: context = [org.schabi.newpipe.player.MainVideoPlayer@52748be]
08-18 13:02:10.168 21561-21561/org.schabi.newpipe.debug I/ExoPlayerImpl: Init b3246d2 [ExoPlayerLib/2.8.2] [generic_x86, Android SDK built for x86, Google, 27]
08-18 13:02:10.168 21561-21561/org.schabi.newpipe.debug D/BasePlayer: ExoPlayer - onPlayerStateChanged() called with: playWhenReady = [true], playbackState = [1]
08-18 13:02:10.171 21561-21561/org.schabi.newpipe.debug D/BasePlayer: handleIntent() called with: intent = [Intent { flg=0x10000000 cmp=org.schabi.newpipe.debug/org.schabi.newpipe.player.MainVideoPlayer (has extras) }]
08-18 13:02:10.171 21561-21561/org.schabi.newpipe.debug D/SerializedCache: take() called with: key = [1e67ab85-b83a-4ce0-9209-faebf74146c1]
08-18 13:02:10.171 21561-21561/org.schabi.newpipe.debug D/BasePlayer: destroyPlayer() called
08-18 13:02:10.172 21561-21561/org.schabi.newpipe.debug I/ExoPlayerImpl: Release b3246d2 [ExoPlayerLib/2.8.2] [generic_x86, Android SDK built for x86, Google, 27] [goog.exo.core, goog.exo.mediasession]
08-18 13:02:10.173 21561-21561/org.schabi.newpipe.debug D/BasePlayer: initPlayer() called with: context = [org.schabi.newpipe.player.MainVideoPlayer@52748be]
08-18 13:02:10.173 21561-21561/org.schabi.newpipe.debug I/ExoPlayerImpl: Init 21c7259 [ExoPlayerLib/2.8.2] [generic_x86, Android SDK built for x86, Google, 27]
08-18 13:02:10.174 21561-21561/org.schabi.newpipe.debug D/BasePlayer: ExoPlayer - onPlayerStateChanged() called with: playWhenReady = [true], playbackState = [1]
08-18 13:02:10.176 21561-21561/org.schabi.newpipe.debug D/PlayQueue@6efad41: Received broadcast: INIT. Current index: 0, play queue length: 1.
08-18 13:02:10.179 21561-21561/org.schabi.newpipe.debug D/.MainVideoPlayer: onResume() called
08-18 13:02:10.192 21561-21561/org.schabi.newpipe.debug E/RecyclerView: No adapter attached; skipping layout
08-18 13:02:10.207 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: maybeBlock() called.
08-18 13:02:10.207 21561-21561/org.schabi.newpipe.debug D/BasePlayer: Playback - onPlaybackBlock() called
08-18 13:02:10.208 21561-21561/org.schabi.newpipe.debug D/BasePlayer: changeState() called with: state = [123]
    onBlocked() called
08-18 13:02:10.208 21561-21561/org.schabi.newpipe.debug D/AnimationUtils: animateView()   false →  [RelativeLayout:playbackControlRoot] [ALPHA 300:0] execOnEnd=null
    animateView() view was already gone > view = [android.widget.RelativeLayout{8391391 G.E...... ......I. 0,0-0,0 #7f09017f app:id/playbackControlRoot}]
08-18 13:02:10.209 21561-21561/org.schabi.newpipe.debug D/AnimationUtils: animateView()    true →  [RelativeLayout:loading_panel] [ALPHA 0:0] execOnEnd=null
    animateView() view was already visible > view = [android.widget.RelativeLayout{769b2f6 V.E...... ......ID 0,0-1080,1920 #7f09011d app:id/loading_panel}]
08-18 13:02:10.210 21561-21561/org.schabi.newpipe.debug D/AnimationUtils: animateView()    true →  [View:surfaceForeground] [ALPHA 100:0] execOnEnd=null
    animateView() view was already visible > view = [android.view.View{ccc56f7 V.ED..... ......ID 0,0-1080,1920 #7f0901eb app:id/surfaceForeground}]
    animateView()   false →  [AppCompatImageButton:playPauseButton] [SCALE_AND_ALPHA 100:0] execOnEnd=null
08-18 13:02:10.211 21561-21561/org.schabi.newpipe.debug D/AnimationUtils: animateView()   false →  [AppCompatImageButton:playPreviousButton] [SCALE_AND_ALPHA 100:0] execOnEnd=null
    animateView()   false →  [AppCompatImageButton:playNextButton] [SCALE_AND_ALPHA 100:0] execOnEnd=null
08-18 13:02:10.211 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: resetSources() called.
08-18 13:02:10.212 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: populateSources() called.
    MediaSource - loadImmediate() called
    MediaSource - maybeClearLoaders() called.
    maybeLoadItem() called.
    MediaSource - Loading=[Hitze extrem - Windhose in TBB] with url=[https://www.youtube.com/watch?v=00Q4SUnVQK4]
08-18 13:02:10.212 21561-21618/org.schabi.newpipe.debug D/InfoCache: getFromKey() called with: serviceId = [0], url = [https://www.youtube.com/watch?v=00Q4SUnVQK4]
08-18 13:02:10.212 21561-21618/org.schabi.newpipe.debug D/ExtractorHelper: loadFromCache() called, info > StreamInfo[url="https://www.youtube.com/watch?v=00Q4SUnVQK4", name="Hitze extrem - Windhose in TBB"]
08-18 13:02:10.218 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:10.227 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:10.229 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:10.236 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:10.236 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - Loaded=[Hitze extrem - Windhose in TBB] with url=[https://www.youtube.com/watch?v=00Q4SUnVQK4]
    MediaSource - Updating index=[0] with title=[Hitze extrem - Windhose in TBB] at url=[https://www.youtube.com/watch?v=00Q4SUnVQK4]
08-18 13:02:10.237 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: maybeUnblock() called.
08-18 13:02:10.237 21561-21561/org.schabi.newpipe.debug D/BasePlayer: Playback - onPlaybackUnblock() called
    changeState() called with: state = [125]
08-18 13:02:10.237 21561-21561/org.schabi.newpipe.debug D/VideoPlayerImpl.MainVideoPlayer: onBuffering() called
08-18 13:02:10.237 21561-21561/org.schabi.newpipe.debug D/BasePlayer: ExoPlayer - onPlayerStateChanged() called with: playWhenReady = [true], playbackState = [2]
08-18 13:02:10.237 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: maybeSync() called.
08-18 13:02:10.237 21561-21561/org.schabi.newpipe.debug D/BasePlayer: Playback - onPlaybackSynchronize() called with item=[Hitze extrem - Windhose in TBB], url=[https://www.youtube.com/watch?v=00Q4SUnVQK4]
    Playback - Rewinding to correct index=[0], from=[0], size=[0].
08-18 13:02:10.238 21561-21561/org.schabi.newpipe.debug D/BasePlayer: ExoPlayer - onPositionDiscontinuity() called with reason = [1]
08-18 13:02:10.242 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:10.244 21561-21592/org.schabi.newpipe.debug I/chatty: uid=10080(org.schabi.newpipe.debug) RenderThread identical 1 line
08-18 13:02:10.247 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:10.247 21561-21592/org.schabi.newpipe.debug D/OpenGLRenderer: endAllActiveAnimators on 0x9813be00 (FrameLayout) with handle 0x95b7f150
08-18 13:02:10.249 21561-21645/org.schabi.newpipe.debug D/CacheFactory: initExoPlayerCache: cacheDir = /storage/emulated/0/Android/data/org.schabi.newpipe.debug/cache/exoplayer
    initExoPlayerCache: cacheDir = /storage/emulated/0/Android/data/org.schabi.newpipe.debug/cache/exoplayer
08-18 13:02:10.252 21561-21561/org.schabi.newpipe.debug D/BasePlayer: ExoPlayer - onTimelineChanged() called with no manifest, timeline size = [1], reason = [0]
    Playback - onMetadataChanged() called, playing: Hitze extrem - Windhose in TBB
    Thumbnail - initThumbnail() called
    Thumbnail - onLoadingStarted() called on: imageUri = [https://i.ytimg.com/vi/00Q4SUnVQK4/hqdefault.jpg], view = [null]
    Thumbnail - onLoadingComplete() called with: imageUri = [https://i.ytimg.com/vi/00Q4SUnVQK4/hqdefault.jpg], view = [null], loadedImage = [android.graphics.Bitmap@68c5d3b]
08-18 13:02:10.258 21561-21561/org.schabi.newpipe.debug D/BasePlayer: ExoPlayer - onSeekProcessed() called
08-18 13:02:10.259 21561-21561/org.schabi.newpipe.debug D/BasePlayer: ExoPlayer - onLoadingChanged() called with: isLoading = [true]
08-18 13:02:10.261 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:10.579 21561-21561/org.schabi.newpipe.debug E/RecyclerView: No adapter attached; skipping layout
08-18 13:02:10.622 21561-21566/org.schabi.newpipe.debug I/zygote: Do full code cache collection, code=498KB, data=310KB
08-18 13:02:10.624 21561-21566/org.schabi.newpipe.debug I/zygote: After code cache collection, code=497KB, data=266KB
08-18 13:02:12.578 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - loadImmediate() called
08-18 13:02:12.579 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - maybeClearLoaders() called.
    maybeLoadItem() called.
08-18 13:02:14.578 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - loadImmediate() called
    MediaSource - maybeClearLoaders() called.
    maybeLoadItem() called.
08-18 13:02:16.572 21561-21566/org.schabi.newpipe.debug I/zygote: Do partial code cache collection, code=497KB, data=268KB
    After code cache collection, code=497KB, data=268KB
    Increasing code cache capacity to 2MB
08-18 13:02:16.578 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - loadImmediate() called
08-18 13:02:16.579 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - maybeClearLoaders() called.
    maybeLoadItem() called.
08-18 13:02:18.578 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - loadImmediate() called
    MediaSource - maybeClearLoaders() called.
    maybeLoadItem() called.
08-18 13:02:20.578 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - loadImmediate() called
    MediaSource - maybeClearLoaders() called.
    maybeLoadItem() called.
08-18 13:02:22.526 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:22.548 21561-21592/org.schabi.newpipe.debug I/chatty: uid=10080(org.schabi.newpipe.debug) RenderThread identical 2 lines
08-18 13:02:22.575 21561-21592/org.schabi.newpipe.debug D/EGL_emulation: eglMakeCurrent: 0x97fff9a0: ver 2 0 (tinfo 0xa62bff80)
08-18 13:02:22.579 21561-21561/org.schabi.newpipe.debug D/MediaSourceManager@181009950: MediaSource - loadImmediate() called
    MediaSource - maybeClearLoaders() called.
    maybeLoadItem() called.

@karyogamy || @mauriciocolli could you please take a look at it. I will provide you with more information as I try to debug this.

bug

Most helpful comment

What's stranger is the web browser player only goes up to 240p for the sample video.

It's a vertical video and I think YouTube returns the Itag's id based on format and the height, while in their UI, it takes the smallest side instead and round it to the nearest common resolution abbreviation.


The issue is that YouTube returns a segmented stream:

<Representation id="135" codecs="avc1.4d400b" width="270" height="480" startWithSAP="1"
                maxPlayoutRate="1" bandwidth="1155000" frameRate="30">
    <BaseURL>[...]googlevideo.com[...]/key/dg_yt0/</BaseURL>
    <SegmentList>
        <Initialization sourceURL="sq/0"/>
        <SegmentURL media="sq/1/dur/5.000"/>
        [...]
        <SegmentURL media="sq/12/dur/5.000"/>
        <SegmentURL media="sq/13/dur/2.700"/>
    </SegmentList>
</Representation>

While a player would parse it correctly, the extractor is blindly taking the BaseUrl and returning it as an accessible one, which is not true, as it's only used to build others.

However, if the segment list uses another delivery format (that uses range), the BaseUrl works fine (it points to the "whole" stream, without range):

<Representation id="134" codecs="avc1.4d400d" width="202" height="360" startWithSAP="1"
                maxPlayoutRate="1" bandwidth="324904" frameRate="30">
    <BaseURL>[...]googlevideo.com[...]/key/dg_yt0/</BaseURL>
    <SegmentList>
        <Initialization sourceURL="range/0-708"/>
        <SegmentURL media="range/897-183954"/>
        [...]
        <SegmentURL media="range/1761656-1913747"/>
        <SegmentURL media="range/1913748-2022062"/>
    </SegmentList>
</Representation>

The data source from the ExoPlayer receives a 404, but it just keeps retrying because of this. I'm not really familiar with the implementation anymore, so I don't really know why is set to the maximum.

But even though the retry is set to that value, it seems strange that a 404 is not assumed as a fatal error, maybe there's more implementation details to it?

All 11 comments

I think this is again caused by the player trying to access a quality that is not available and the issue has been documented in #1328 and in the extractor. If I remember correctly, the extractor started providing unusable qualities since the 0.9 refactor, so maybe we can start looking there.

Hm we could give it a try. However what i found out is when you try to pull out the url to the DASH MPD file, and feed it to VLC you will see that VLC player indeed uses a 480p resolution.

... I'll check this once more.

What's stranger is the web browser player only goes up to 240p for the sample video.

Also, I think dash manifest is only available for older videos, so we probably can't reliably use it for parsing stream urls. Perhaps instead of parsing the manifest ourselves, maybe we can later implement a quality selector for live/dash/hls streams in the player and use dash instead of fmp4 for those videos providing manifests. You can experiment with it by removing this check.

What's stranger is the web browser player only goes up to 240p for the sample video.

It's a vertical video and I think YouTube returns the Itag's id based on format and the height, while in their UI, it takes the smallest side instead and round it to the nearest common resolution abbreviation.


The issue is that YouTube returns a segmented stream:

<Representation id="135" codecs="avc1.4d400b" width="270" height="480" startWithSAP="1"
                maxPlayoutRate="1" bandwidth="1155000" frameRate="30">
    <BaseURL>[...]googlevideo.com[...]/key/dg_yt0/</BaseURL>
    <SegmentList>
        <Initialization sourceURL="sq/0"/>
        <SegmentURL media="sq/1/dur/5.000"/>
        [...]
        <SegmentURL media="sq/12/dur/5.000"/>
        <SegmentURL media="sq/13/dur/2.700"/>
    </SegmentList>
</Representation>

While a player would parse it correctly, the extractor is blindly taking the BaseUrl and returning it as an accessible one, which is not true, as it's only used to build others.

However, if the segment list uses another delivery format (that uses range), the BaseUrl works fine (it points to the "whole" stream, without range):

<Representation id="134" codecs="avc1.4d400d" width="202" height="360" startWithSAP="1"
                maxPlayoutRate="1" bandwidth="324904" frameRate="30">
    <BaseURL>[...]googlevideo.com[...]/key/dg_yt0/</BaseURL>
    <SegmentList>
        <Initialization sourceURL="range/0-708"/>
        <SegmentURL media="range/897-183954"/>
        [...]
        <SegmentURL media="range/1761656-1913747"/>
        <SegmentURL media="range/1913748-2022062"/>
    </SegmentList>
</Representation>

The data source from the ExoPlayer receives a 404, but it just keeps retrying because of this. I'm not really familiar with the implementation anymore, so I don't really know why is set to the maximum.

But even though the retry is set to that value, it seems strange that a 404 is not assumed as a fatal error, maybe there's more implementation details to it?

Hm so we need to change the way the back end is handling DASH files.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Knowbody42 picture Knowbody42  Â·  3Comments

probonopd picture probonopd  Â·  3Comments

cool-student picture cool-student  Â·  3Comments

B0pol picture B0pol  Â·  3Comments

mouarfff picture mouarfff  Â·  3Comments