streamlink: PlutoTV stops streaming when switching to a commercial

Bug Report

  • [x ] This is a bug report and I have read the contribution guidelines.
  • I am using the latest development version from the master branch.

Description

Streaming stops whenever plutoTV switches to a local commercial. I have seen this on various pluto news channels such as NEWSY and Newsmax. After a news segment, the channel will switch to local commercial and a message from pluto states that they will be right back - but the stream hangs at that point, never to return unless, the stream is restarted.

Expected / Actual behavior

I expect that if the channel switches segments that the stream will continue to play as normal, but it does not do this, the stream stops

Reproduction steps / Explicit stream URLs to test

  1. …Tune to plutotv- Newsy and watch for 5-10 minutes until the segment changes
  2. …for me at the change, streaming stops

Log output

REPLACE THIS TEXT WITH THE LOG OUTPUT

Additional comments, etc.

Love Streamlink? Please consider supporting our collective. Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 28 (14 by maintainers)

Most upvoted comments

Thank you @mkbloke for improving the handling of adverts by the plugin. Sending the output to a file results in a good “recording” but it is still necessary to run ffmpeg -c copy over that file in order to fix the timestamps.

so far, i have not found another candidate for filtering segments. VoD i am not using. So, i am of no help here.

mainly i want you to know, that i wanted to donate some money. unfortunately i was ask to full fill a captcha(s). i guess it’s because my notebook, i am currently writing from, goes per default to VPN Frankfurt Germany.

i wrote support support@opencollective.com that i find it annoying and that i am not doing it. also, going into my FW and disabling some rules i don’t like, but may you guys find a provider without this obstacles.

Thanks for the feedback, @emveepee. I don’t know much about NextPVR. It looks to be closed source. I think the issue you’re having will need to be resolved by them though.

This was more a general comment, since any application using this strategy for Live TV playback from PlutoTV vs recording playback will probably have a difficult time dealing with potential long periods of no video.

I’ve pushed further changes, so if anybody would like to try the plugin as it is now, it’s the same URL as above, just reload in your browser to make sure you have the latest version.

I have been trying the latest changes on https://pluto.tv/live-tv/mtv-spankin-new and all seems to be well for me so far.

I posted about MTV Spankin’ New earlier and see noticeable improvements in the test release with streamlink cli and with recordings and when the logo comes up which was sudden death before things get better. For Live TV in NextPVR the long pause is still an issue.

Unrelated to this be aware there is a v4 VOD format that has been used for a few months for series and AFAIK streamlink doesn’t support it.

thx @mkbloke,

with your patch applied i zapped through the pluto.tv channels.

content coming from pluto.tv cdn show no DTS discontinuities. Players like vlc, totem or mpv stop playback on streamlink output halt/pause. tvheadend reconnects and resumes.

with $>streamlink -o “filename” recorded/saved streams play the content without the ads.

CBSN channels are different. The content is from cbsn cdn, the ads are from dai.google.com. i.e. CBSN New York:

[https @ 0x807128000] Opening 'https://cbsn-ny.cbsnstream.cbsnews.com/out/v1/ec3897d58a9b45129a77d67aa247d136/master_7_11828623.ts?m=1558539690' for reading
[https @ 0x806da9000] Opening 'https://cbsn-ny.cbsnstream.cbsnews.com/out/v1/ec3897d58a9b45129a77d67aa247d136/master_7_11828624.ts?m=1558539690' for reading
[https @ 0x806da9000] Opening 'https://cbsn-ny.cbsnstream.cbsnews.com/out/v1/ec3897d58a9b45129a77d67aa247d136/master_7_11828625.ts?m=1558539690' for reading
[hls @ 0x8060f7000] keepalive request failed for 'https://dai.google.com/linear/pods/v1/p/jeTDC610T-OSPdiWhcl0Pg/ca6b5ce9-5447-4c5f-9694-35f421dfabf1:MRN2/30872/0/0/51e8e3fe4ca3e1c91f55abe3391415ad/0.ts' with error: 'Invalid argument' when opening url, retrying with new connection
[hls @ 0x8060f7000] Opening 'https://dai.google.com/linear/pods/v1/p/jeTDC610T-OSPdiWhcl0Pg/ca6b5ce9-5447-4c5f-9694-35f421dfabf1:MRN2/30872/0/0/51e8e3fe4ca3e1c91f55abe3391415ad/0.ts' for reading
[hls @ 0x8060f7000] keepalive request failed for 'https://dai.google.com/linear/pods/v1/p/jeTDC610T-OSPdiWhcl0Pg/ca6b5ce9-5447-4c5f-9694-35f421dfabf1:MRN2/30872/0/0/51e8e3fe4ca3e1c91f55abe3391415ad/1.ts' with error: 'Invalid argument' when opening url, retrying with new connection
[hls @ 0x8060f7000] Opening 'https://dai.google.com/linear/pods/v1/p/jeTDC610T-OSPdiWhcl0Pg/ca6b5ce9-5447-4c5f-9694-35f421dfabf1:MRN2/30872/0/0/51e8e3fe4ca3e1c91f55abe3391415ad/1.ts' for reading
[hls @ 0x8060f7000] keepalive request failed for 'https://dai.google.com/linear/pods/v1/p/jeTDC610T-OSPdiWhcl0Pg/ca6b5ce9-5447-4c5f-9694-35f421dfabf1:MRN2/30872/0/0/51e8e3fe4ca3e1c91f55abe3391415ad/2.ts' with error: 'Invalid argument' when opening url, retrying with new connection
[hls @ 0x8060f7000] Opening 'https://dai.google.com/linear/pods/v1/p/jeTDC610T-OSPdiWhcl0Pg/ca6b5ce9-5447-4c5f-9694-35f421dfabf1:MRN2/30872/0/0/51e8e3fe4ca3e1c91f55abe3391415ad/2.ts' for reading
...
[https @ 0x806da9000] Opening 'https://cbsn-ny.cbsnstream.cbsnews.com/out/v1/ec3897d58a9b45129a77d67aa247d136/master_7_11828649.ts?m=1558539690' for reading
[https @ 0x806da9000] Opening 'https://cbsn-ny.cbsnstream.cbsnews.com/out/v1/ec3897d58a9b45129a77d67aa247d136/master_7_11828650.ts?m=1558539690' for reading
[https @ 0x807128000] Opening 'https://cbsn-ny.cbsnstream.cbsnews.com/out/v1/ec3897d58a9b45129a77d67aa247d136/master_7_11828651.ts?m=1558539690' for reading

the ads play in tvheadend with stutter audio and no/black video and finally tvh reconnets.

vlc, totem and mpv while playing back such recorded stream jump over this part. i saw the video playback progress bar jumping.

when the ads end tvheadend reports:

2021-12-01 17:43:26.571 spawn: [mpegts @ 0x80f455000] New audio stream 0:5 at pos:484064656 and DTS:0s
2021-12-01 17:43:26.571 spawn: [mpegts @ 0x80f455000] New video stream 0:6 at pos:484065032 and DTS:0s

overall, playback over tvheadend does not come into complete disorder as before!

that are my findings so far. i keep on zapping and let you know 😃

Since I haven’t commented on this thread yet, let just quickly say that HLS discontinuities are not supported by Streamlink. The only workaround is filtering out segments from the other stream(s) after a discontinuity (eg. advertisements), similar to what other plugins are doing, but that will still leave a gap in the output. The discontinuities are a bigger problem in the plugin here compared to other plugins, because the output is a MuxedStream and not an HLSStream, so FFmpeg will complain when the unfiltered output gets read and a discontinuity occurs.

Why does the PlutoTV plugin even output MuxedStreams instead of HLSStreams? It even sets ffmpeg-fout to mpegts, which doesn’t have any effect if the HLS stream is already an mpegts stream, which is the case because fragmented mp4 HLS streams were only implemented by me a few months ago (the second type of HLS stream formats), more than half a year later compared to when the plugin was added, so only mpegts streams were supported at that time anyway. https://github.com/streamlink/streamlink/pull/3363#issue-751038758 https://github.com/streamlink/streamlink/blob/3.0.3/src/streamlink/plugins/pluto.py#L94-L96


@mkbloke, HLS segments should not be filtered out via the HLSStreamWriter.ignore_names regex. This is the old “hacky” way that was implemented before I’ve implemented an actual filtering mechanic and it is only kept for backwards compatiblity or usage via CLI parameters. The entire init method should also not be re-implemented, because otherwise it will introduce bugs later one when the parent class gets updated.

If you want to filter out HLS segments properly, then use the HLSStreamWriter.should_filter_sequence() method. Take a look at the Twitch plugin on how to do this. There are also lots of tests for this.