streamlink / streamlink

Streamlink is a CLI utility which pipes video streams from various services into a video player
https://streamlink.github.io/
BSD 2-Clause "Simplified" License
10.02k stars 1.11k forks source link

[Twitch live stream] file doesn't have proper metadata and audio is pitched up + contains short cut-offs #5042

Closed krawieck closed 1 year ago

krawieck commented 1 year ago

Checklist

Streamlink version

Latest stable release

Description

This error exists only for one streamer as far as I and it happens only with live video, not VODs. I have reproduced this issue on macOS 13 and Windows 10.

How to reproduce:

How the problem manifests:

Opening this file in VLC will show the following problems:

Opening this file in MPV will only have the first problem

Video editing software (tested on DaVinci Resolve and Final Cut Pro) will not recognize the file, but running it through ffmpeg with -c copy makes it readable, and that shows a neat visualization of what's going on. Here's a screenshot from what it looks like in Final Cut Pro

image

But it doesn't behave the same everywhere, the silences are not present in DaVinci Resolve

image

Here is the file that I tested it on:

https://user-images.githubusercontent.com/10037914/208775430-da4c4cb1-69f3-43f1-ab41-c253f235bd9f.mp4

Debug log

>streamlink https://twitch.tv/moistcr1tikal best -o stream.mp4 --loglevel=debug
[cli][debug] OS:         macOS 13.0.1
[cli][debug] Python:     3.11.0
[cli][debug] Streamlink: 5.0.1
[cli][debug] Dependencies:
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.1
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.15.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.28.1
[cli][debug]  websocket-client: 1.4.2
[cli][debug] Arguments:
[cli][debug]  url=https://twitch.tv/moistcr1tikal
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --output=stream.mp4
[cli][info] Found matching plugin twitch for URL https://twitch.tv/moistcr1tikal
[plugins.twitch][debug] Getting live HLS streams for moistcr1tikal
[plugins.twitch][debug] {'adblock': False, 'geoblock_reason': '', 'hide_ads': False, 'server_ads': True, 'show_ads': True}
[utils.l10n][debug] Language code: en_US
[cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p60, 1080p60 (best)
[cli][info] Opening stream: 1080p60 (hls)
[cli][info] Writing output to
/Users/krawieck/Desktop/stream.mp4
[cli][debug] Checking file output
[stream.hls][debug] Reloading playlist
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] First Sequence: 0; Last Sequence: 3
[stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 1; End Sequence: None
[stream.hls][debug] Adding segment 1 to queue
[stream.hls][debug] Adding segment 2 to queue
[stream.hls][debug] Adding segment 3 to queue
[stream.hls][debug] Segment 1 complete
[cli][debug] Writing stream to output
[stream.hls][debug] Segment 2 complete
[stream.hls][debug] Segment 3 complete
[download] Written 3.79 MiB to stream.mp4 (4s @ 847.14 KiB/s)                                                                                                                        [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 4 to queue
[stream.hls][debug] Adding segment 5 to queue
[stream.hls][debug] Adding segment 6 to queue
[stream.hls][debug] Segment 4 complete
[stream.hls][debug] Segment 5 complete
[download] Written 6.39 MiB to stream.mp4 (5s @ 1.32 MiB/s)                                                                                                                          [stream.hls][debug] Segment 6 complete
[download] Written 7.66 MiB to stream.mp4 (9s @ 811.37 KiB/s)                                                                                                                        [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 7 to queue
[stream.hls][debug] Segment 7 complete
[download] Written 8.32 MiB to stream.mp4 (14s @ 587.38 KiB/s)                                                                                                                       [stream.hls][debug] Reloading playlist
[download] Written 8.32 MiB to stream.mp4 (15s @ 577.28 KiB/s)                                                                                                                       [stream.hls][debug] Adding segment 8 to queue
[stream.hls][debug] Adding segment 9 to queue
[stream.hls][debug] Segment 8 complete
[stream.hls][debug] Segment 9 complete
[download] Written 11.48 MiB to stream.mp4 (19s @ 600.15 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[download] Written 11.48 MiB to stream.mp4 (20s @ 592.56 KiB/s)                                                                                                                      [stream.hls][debug] Adding segment 10 to queue
[stream.hls][debug] Adding segment 11 to queue
[stream.hls][debug] Adding segment 12 to queue
[stream.hls][debug] Segment 10 complete
[stream.hls][debug] Segment 11 complete
[stream.hls][debug] Segment 12 complete
[download] Written 15.97 MiB to stream.mp4 (24s @ 619.99 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 13 to queue
[stream.hls][debug] Adding segment 14 to queue
[stream.hls][debug] Segment 13 complete
[download] Written 16.88 MiB to stream.mp4 (25s @ 666.43 KiB/s)                                                                                                                      [stream.hls][debug] Segment 14 complete
[download] Written 19.00 MiB to stream.mp4 (30s @ 577.55 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 15 to queue
[stream.hls][debug] Adding segment 16 to queue
[stream.hls][debug] Adding segment 17 to queue
[stream.hls][debug] Segment 15 complete
[download] Written 20.61 MiB to stream.mp4 (30s @ 659.67 KiB/s)                                                                                                                      [stream.hls][debug] Segment 16 complete
[stream.hls][debug] Segment 17 complete
[download] Written 23.57 MiB to stream.mp4 (35s @ 777.17 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 18 to queue
[stream.hls][debug] Adding segment 19 to queue
[stream.hls][debug] Segment 18 complete
[stream.hls][debug] Segment 19 complete
[download] Written 26.65 MiB to stream.mp4 (40s @ 772.46 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 20 to queue
[stream.hls][debug] Adding segment 21 to queue
[stream.hls][debug] Adding segment 22 to queue
[stream.hls][debug] Segment 20 complete
[stream.hls][debug] Segment 21 complete
[stream.hls][debug] Segment 22 complete
[download] Written 31.15 MiB to stream.mp4 (45s @ 774.51 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 23 to queue
[stream.hls][debug] Adding segment 24 to queue
[stream.hls][debug] Segment 23 complete
[stream.hls][debug] Segment 24 complete
[download] Written 34.20 MiB to stream.mp4 (50s @ 775.12 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 25 to queue
[stream.hls][debug] Adding segment 26 to queue
[stream.hls][debug] Adding segment 27 to queue
[stream.hls][debug] Segment 25 complete
[stream.hls][debug] Segment 26 complete
[stream.hls][debug] Segment 27 complete
[download] Written 38.89 MiB to stream.mp4 (55s @ 781.08 KiB/s)                                                                                                                      [stream.hls][debug] Reloading playlist
[stream.hls][debug] Adding segment 28 to queue
[stream.hls][debug] Adding segment 29 to queue
[stream.hls][debug] Segment 28 complete
[stream.hls][debug] Segment 29 complete
[download] Written 41.84 MiB to stream.mp4 (1m00s @ 774.65 KiB/s)                                                                                                                    [stream.hls][debug] Reloading playlist
[download] Written 41.84 MiB to stream.mp4 (1m00s @ 774.71 KiB/s)                                                                                                                    [stream.hls][debug] Adding segment 30 to queue
[stream.hls][debug] Adding segment 31 to queue
[stream.hls][debug] Adding segment 32 to queue
[stream.hls][debug] Segment 30 complete
[stream.hls][debug] Segment 31 complete
[stream.hls][debug] Segment 32 complete
[download] Written 46.53 MiB to stream.mp4 (1m02s @ 784.20 KiB/s)                                                                                                                    ^C[stream.segmented][debug] Closing worker thread

[stream.segmented][debug] Closing writer thread
[cli][info] Stream ended
Interrupted! Exiting...
[cli][info] Closing currently open stream...
bastimeyer commented 1 year ago

file doesn't have proper metadata wait for ... to start streaming

Duplicate of #4786. This is an issue with Twitch's GQL API, and we're not going to implement a workaround for that.

audio is pitched up + contains short cut-offs

Embedded ads cause stream discontinuities.