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

Pluto.TV Live #3156

Closed
1 task done
RedPenguin2 opened this issue Sep 8, 2020 · 12 comments · Fixed by #3363
Closed
1 task done

Pluto.TV Live #3156

RedPenguin2 opened this issue Sep 8, 2020 · 12 comments · Fixed by #3363
Assignees

Comments

@RedPenguin2
Copy link

RedPenguin2 commented Sep 8, 2020

Plugin Request

  • This is a plugin request and I have read the contribution guidelines and plugin request requirements.

Description

Pluto.TV has really changed since it was suggested back in 2017.

Originally they just basically threw a bunch of YouTube and similar VoD into a linear playing m3u8.

Yet they have since changed to regular live streams that aren’t just mushed together VoDs so I figured maybe streamlink can look at it again.

Pluto has a decent library of VOD as well but it would be mainly nice to at least see the Live Streams better supported.

Example stream URLs

  1. ... https://pluto.tv/live-tv/court-tv-1
  2. ... https://pluto.tv/live-tv/tyt-network
  3. ...

Additional comments, screenshots, etc.

Love Streamlink? Please consider supporting our collective. Thanks!

@RedPenguin2
Copy link
Author

RedPenguin2 commented Sep 8, 2020

Well, maybe Pluto won’t be as easy as I thought.

I did a test recording of Court TV and I don’t know what happened.

It’s the correct size of 1GB for 60 min as expected compared to Court TV’s own feed.

Yet when I try to play it, all I can get out of it the Pluto TV Logo Screen and injected commercials, I can’t even see the actual program that Court TV had on at the time.

Even ffmpeg won’t fix it, when it always fixes the CTV official stream.

ffmpeg -i file.ts -c copy fixed.ts just spit out an 18 min file of Pluto Commercials only....

Tried avconv and it still is 18 min, so I have no idea what happened to the recordede ts file.

Oddly the stream plays fine in VLC.

@mkbloke
Copy link
Member

mkbloke commented Sep 8, 2020

I don't know if you're already aware of it and I certainly don't know if it'll be of any use to you at all, but there's already a plugin for Pluto (seemingly abandoned) in PR #2747. That PR seems to have failed some checks under Py 3.8 by the look of it, although unfortunately the full results data is no longer available.

@RedPenguin2
Copy link
Author

Yes, I did see that and I tried it somewhat and it mostly worked but not completely.

I seems like it grabs the url from an old api of Pluto's and results in a "Bad Request".

I think the issue with the TS file is was shown by ffplay.

It seems to do a lot EXT-X-DISCONTINUITY and ffplay says it's trying to switch hosts even which ffplay errored out saying "cannot switch hosts".

@mkbloke
Copy link
Member

mkbloke commented Sep 9, 2020

Is the above URL causing problems for you or is that working OK? I can play it directly through streamlink with no obvious problems. It seemed to play, the first few times, but then I started getting the Pluto logo you mentioned after that... and now it's playing OK again. Strange.

streamlink 'hls://https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5dae0b4841a7d0000938ddbd/master.m3u8?deviceType=web&deviceMake=Chrome&deviceModel=Chrome&sid=0c9d9262-bcd4-4b33-a78f-afea1ee4a67e&deviceId=781d4c79-fb21-4162-97a4-9f543683f22a&deviceVersion=74.0.3729.131&appVersion=2.5.1-f9a6096b469cfe5e4f1cc92cc697e8500e57891c&deviceDNT=0&userId=&advertisingId=&deviceLat=38.8177&deviceLon=-77.1527&app_name=&appName=&appStoreUrl=&architecture=&serverSideAds=true' 480p
[cli][info] Found matching plugin hls for URL hls://https://service-stitcher.clusters.pluto.tv/stitch/hls/channel/5dae0b4841a7d0000938ddbd/master.m3u8?deviceType=web&deviceMake=Chrome&deviceModel=Chrome&sid=0c9d9262-bcd4-4b33-a78f-afea1ee4a67e&deviceId=781d4c79-fb21-4162-97a4-9f543683f22a&deviceVersion=74.0.3729.131&appVersion=2.5.1-f9a6096b469cfe5e4f1cc92cc697e8500e57891c&deviceDNT=0&userId=&advertisingId=&deviceLat=38.8177&deviceLon=-77.1527&app_name=&appName=&appStoreUrl=&architecture=&serverSideAds=true
[cli][info] Available streams: 240p (worst), 480p, 720p_alt, 720p (best)
[cli][info] Opening stream: 480p (hls)
[cli][info] Starting player: mpv

@RedPenguin2
Copy link
Author

It plays but then once it goes to commercial break it seems to get wonky.

Also the file recorded by streamlink after using -o file.ts seems severly broken.

@whittinghamj
Copy link

I was writing a script for Pluto for another platform of mine and ran into the same issue.

Once the commercial break hits - it all goes tits up. They are messing with the streams and cutting stuff together in a way that breaks the timestamps and ffmpeg ends up throwing a wobler - its really annoying !!!

@mkbloke
Copy link
Member

mkbloke commented Sep 9, 2020

I see one of the streamlink devs has committed some changes to the existing PR for Pluto. Might be worth seeing if that also exhibits the same problem.

[Edit] I checked with https://pluto.tv/live-tv/court-tv-1 via the streamlink plugin and in browser, side by side. With mpv as a player, the video freezes very early into the ad break, then returns when the ad break is over. (@back-to)

@RedPenguin2
Copy link
Author

Wow, this actually is getting more progress than I could have hoped for.

I wasn't sure the way around Pluto's weird ad breaks but I know they have some really good channels now worth watching if it's possible to straighten out their cut jobs.

@RedPenguin2
Copy link
Author

Well, I tried the code already in the pull request to rather surprising results.

Trying out the “Laughing Out Loud Network”, it actually worked great as long as you “ffmpeg -c copy” the file to fix all the timestamps.

The only weird part is that Pluto seems to break at strange times, not at what would be a natural break.

@back-to back-to self-assigned this Nov 22, 2020
back-to added a commit to back-to/streamlink that referenced this issue Nov 25, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>
back-to added a commit to back-to/streamlink that referenced this issue Nov 25, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>
back-to added a commit that referenced this issue Nov 27, 2020
- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes #854
closes #2747
closes #3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this issue Dec 15, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>

streamlink#3363

added to plugin matrix

added test
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this issue Dec 15, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>

streamlink#3363

added to plugin matrix

added test
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this issue Dec 17, 2020
https://pluto.tv/live-tv/

- Livestreams will break during commercials,
  without the `self.session.set_option('ffmpeg-fout', 'mpegts')` option enabled.
- VODs might work without it, but I did not test it.

closes streamlink#854
closes streamlink#2747
closes streamlink#3156

Co-authored-by: calculon-jr <54852718+calculon-jr@users.noreply.github.com>

streamlink#3363

added to plugin matrix

added test
@Leatherface75
Copy link

Leatherface75 commented Apr 27, 2021

Anyone working for working solution also for services like Stirr and the new Samsung Plus?
Many channels there have same problem as Pluto.
Or better maybe a more generic solution in streamlink to handle this.
Had some success with some of the problematic streams with youtube-dl.

@pcolmer
Copy link

pcolmer commented Nov 27, 2021

Trying out the “Laughing Out Loud Network”, it actually worked great as long as you “ffmpeg -c copy” the file to fix all the timestamps.

This certainly fixes the duration of the file as far as various player applications are concerned. However, what I'm finding is that if the stream is programme, adverts, programme then the video playback stops at some point in the adverts although the audio continues. Do I need to use any other flags with ffmpeg to fix the created file?

This is the output I got when using ffmpeg -c copy on a Pluto recording:

$ ffmpeg -i 2021-11-26-streamlink.mp4 -c copy foo.mp4
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[mpegts @ 0x56254a838280] PES packet size mismatch
Input #0, mpegts, from '2021-11-26-streamlink.mp4':
  Duration: 03:00:35.86, start: 1.466667, bitrate: 194 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 97 kb/s
Output #0, mp4, to 'foo.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 30 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 97 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x56254aa41880] Non-monotonous DTS in output stream 0:1; previous: 17361472, current: 17360000; changing to 17361473. This may result in incorrect timestamps in the output file.
[mp4 @ 0x56254aa41880] Non-monotonous DTS in output stream 0:1; previous: 17361473, current: 17361024; changing to 17361474. This may result in incorrect timestamps in the output file.
[mp4 @ 0x56254aa41880] Non-monotonous DTS in output stream 0:1; previous: 17605760, current: 17604493; changing to 17605761. This may result in incorrect timestamps in the output file.
[mp4 @ 0x56254aa41880] Non-monotonous DTS in output stream 0:1; previous: 17605761, current: 17605517; changing to 17605762. This may result in incorrect timestamps in the output file.
[mpegts @ 0x56254a838280] PES packet size mismatch2:22:02.21 bitrate= 194.2kbits/s speed=5.68e+03x
frame=11898 fps=6344 q=-1.0 Lsize=  230955kB time=03:00:35.94 bitrate= 174.6kbits/s speed=5.78e+03x
video:105003kB audio:127083kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants