Skip to content

plugins.twitcasting: filter preroll segments #6601

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

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

Hakkin
Copy link
Contributor

@Hakkin Hakkin commented Jul 4, 2025

Twitcasting serves preroll segments if you request an HLS playlist before enough video data has been sent to the server, typically within ~0-10 seconds of a stream starting. Since they're using fMP4 now, it breaks the output with a discontinutiy, so they need to be filtered.

Fixes #6600

Before
[05:47:13.811937][MainThread][cli][debug] OS:         Linux-6.12.35-1-lts-x86_64-with-glibc2.41
[05:47:13.812288][MainThread][cli][debug] Python:     3.13.5
[05:47:13.812580][MainThread][cli][debug] OpenSSL:    OpenSSL 3.5.1 1 Jul 2025
[05:47:13.812747][MainThread][cli][debug] Streamlink: 7.4.0+37.g6ea1bb4d.dirty
[05:47:13.812903][MainThread][cli][debug] Dependencies:
[05:47:13.816492][MainThread][cli][debug]  certifi: 2025.6.15
[05:47:13.819253][MainThread][cli][debug]  isodate: 0.7.2
[05:47:13.821096][MainThread][cli][debug]  lxml: 6.0.0
[05:47:13.823442][MainThread][cli][debug]  pycountry: 24.6.1
[05:47:13.824765][MainThread][cli][debug]  pycryptodome: 3.23.0
[05:47:13.826417][MainThread][cli][debug]  PySocks: 1.7.1
[05:47:13.827937][MainThread][cli][debug]  requests: 2.32.4
[05:47:13.829460][MainThread][cli][debug]  trio: 0.30.0
[05:47:13.830858][MainThread][cli][debug]  trio-websocket: 0.12.2
[05:47:13.832262][MainThread][cli][debug]  urllib3: 2.5.0
[05:47:13.833738][MainThread][cli][debug]  websocket-client: 1.8.0
[05:47:13.834236][MainThread][cli][debug] Arguments:
[05:47:13.834431][MainThread][cli][debug]  url=https://twitcasting.tv/leolu_croix
[05:47:13.834605][MainThread][cli][debug]  stream=['best']
[05:47:13.834790][MainThread][cli][debug]  --loglevel=all
[05:47:13.834978][MainThread][cli][debug]  --logfile=leolu_croix_1751546832.log
[05:47:13.835207][MainThread][cli][debug]  --output=leolu_croix_1751546832.mp4
[05:47:13.835381][MainThread][cli][debug]  --stream-types=['hls']
[05:47:13.835553][MainThread][cli][debug]  --hls-segment-queue-threshold=0.0
[05:47:13.835726][MainThread][cli][debug]  --hls-live-restart=True
[05:47:13.836093][MainThread][cli][info] Found matching plugin twitcasting for URL https://twitcasting.tv/leolu_croix
[05:47:13.836413][MainThread][cache][trace] Loading cache file: /home/hakkin/.cache/streamlink/plugin-cache.json
[05:47:14.317216][MainThread][cli][info] Available streams: hls_low (worst), hls_medium, hls_high (best)
[05:47:14.317744][MainThread][cli][info] Opening stream: hls_high (hls)
[05:47:14.318311][MainThread][cli][info] Writing output to
/home/hakkin/Documents/twitcast/leolu_croix_1751546832.mp4
[05:47:14.318577][MainThread][cli][debug] Checking file output
[05:47:14.319636][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[05:47:14.319979][MainThread][cli][debug] Pre-buffering 8192 bytes
[05:47:15.918474][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-VERSION:6
[05:47:15.918741][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-TARGETDURATION:9
[05:47:15.918954][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MEDIA-SEQUENCE:2
[05:47:15.919130][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MAP:URI="/tc.livehls/v1/streams/819154156/hls/preroll-init.2.mp4"
[05:47:15.919408][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:2.000,
[05:47:15.919582][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819154156/hls/preroll-media.2.mp4
[05:47:15.919794][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-DISCONTINUITY
[05:47:15.919942][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MAP:URI="/tc.livehls/v1/streams/819154156/hls/672.96/init.3.mp4"
[05:47:15.920160][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:8.332,
[05:47:15.920341][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819154156/hls/672.96/media.0.mp4
[05:47:15.920560][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:8.334,
[05:47:15.920760][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819154156/hls/672.96/media.1.mp4
[05:47:15.921020][HLSStreamWorker-0][stream.hls][debug] First Sequence: 2; Last Sequence: 4
[05:47:15.921180][HLSStreamWorker-0][stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 2; End Sequence: None
[05:47:15.921434][HLSStreamWorker-0][stream.hls][debug] Adding segment 2 to queue
[05:47:15.923767][HLSStreamWorker-0][stream.hls][debug] Adding segment 3 to queue
[05:47:15.924288][HLSStreamWorker-0][stream.hls][debug] Adding segment 4 to queue
[05:47:16.074423][HLSStreamWriter-0][stream.hls][debug] Writing segment 2 to output
[05:47:16.074924][HLSStreamWriter-0][stream.hls][debug] Segment initialization 2 complete
[05:47:16.075534][MainThread][cli][debug] Writing stream to output
[05:47:16.385314][HLSStreamWriter-0][stream.hls][debug] Writing segment 2 to output
[05:47:16.385842][HLSStreamWriter-0][stream.hls][debug] Segment 2 complete
[05:47:16.533729][HLSStreamWriter-0][stream.hls][debug] Writing segment 3 to output
[05:47:16.534356][HLSStreamWriter-0][stream.hls][debug] Segment initialization 3 complete
[05:47:16.535012][HLSStreamWriter-0][stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[05:47:19.224187][HLSStreamWriter-0][stream.hls][debug] Writing segment 3 to output
[05:47:19.230657][HLSStreamWriter-0][stream.hls][debug] Segment 3 complete
[05:47:19.231529][HLSStreamWriter-0][stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[05:47:20.662758][HLSStreamWriter-0][stream.hls][debug] Writing segment 4 to output
[05:47:20.667582][HLSStreamWriter-0][stream.hls][debug] Segment 4 complete
[05:47:23.319789][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[05:47:23.425405][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-VERSION:6
[05:47:23.425781][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-TARGETDURATION:9
[05:47:23.426085][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MEDIA-SEQUENCE:3
[05:47:23.426302][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MAP:URI="/tc.livehls/v1/streams/819154156/hls/672.96/init.3.mp4"
[05:47:23.426579][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:8.332,
[05:47:23.426790][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819154156/hls/672.96/media.0.mp4
[05:47:23.427125][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:8.334,
[05:47:23.427344][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819154156/hls/672.96/media.1.mp4
[05:47:23.427706][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:8.333,
[05:47:23.427964][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819154156/hls/672.96/media.2.mp4
[05:47:23.428306][HLSStreamWorker-0][stream.hls][debug] Adding segment 5 to queue
[05:47:26.203494][HLSStreamWriter-0][stream.hls][debug] Writing segment 5 to output
[05:47:26.207850][HLSStreamWriter-0][stream.hls][debug] Segment 5 complete
[05:47:27.212829][MainThread][stream.segmented][debug] Closing worker thread
[05:47:27.213162][MainThread][stream.segmented][debug] Closing writer thread
[05:47:27.214371][MainThread][cli][info] Stream ended
Interrupted! Exiting...
[05:47:27.214875][MainThread][cli][info] Closing currently open stream...

Results in broken output file
ffmpeg version n7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 15.1.1 (GCC) 20250425
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enab>
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5967edb10680] Found duplicated MOOV Atom. Skipped it
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5967edb10680] could not find corresponding trex (id 256)
    Last message repeated 2 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'leolu_croix_1751546832.mp4':
  Metadata:
    major_brand     : iso6
    minor_version   : 0
    compatible_brands: iso6
  Duration: 00:00:06.02, start: 3.968000, bitrate: 7101 kb/s
  Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 8104 kb/s, 377.36 fps, 30 tbr, 15360 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 0 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : iso6
    minor_version   : 0
    compatible_brands: iso6
    encoder         : Lavf61.7.100
  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 8104 kb/s, 377.36 fps, 30 tbr, 15360 tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 0 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
Press [q] to stop, [?] for help
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555405311 > 378).
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 382
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555405311 > 404).
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 408
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60882
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60861
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555405309 > 412).
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 416
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555405307 > 430).
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 434
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60840
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60818
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555404287 > 415).
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 419
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555405311 > 408).
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 412
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60797
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555405311 > 408).
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60776
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 412
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555404287 > 410).
[h264 @ 0x5967edbe9b00] missing picture in access unit with size 414
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60754
[null @ 0x5967edb4bd00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 29365 >= -60733
[h264 @ 0x5967edbe9b00] Invalid NAL unit size (555404767 > 453).
...
After
[06:52:53.716295][MainThread][cli][debug] OS:         Linux-6.12.35-1-lts-x86_64-with-glibc2.41
[06:52:53.716521][MainThread][cli][debug] Python:     3.13.5
[06:52:53.716669][MainThread][cli][debug] OpenSSL:    OpenSSL 3.5.1 1 Jul 2025
[06:52:53.716836][MainThread][cli][debug] Streamlink: 7.4.0+37.g6ea1bb4d.dirty
[06:52:53.717049][MainThread][cli][debug] Dependencies:
[06:52:53.719352][MainThread][cli][debug]  certifi: 2025.6.15
[06:52:53.722182][MainThread][cli][debug]  isodate: 0.7.2
[06:52:53.724495][MainThread][cli][debug]  lxml: 6.0.0
[06:52:53.726599][MainThread][cli][debug]  pycountry: 24.6.1
[06:52:53.727806][MainThread][cli][debug]  pycryptodome: 3.23.0
[06:52:53.729286][MainThread][cli][debug]  PySocks: 1.7.1
[06:52:53.730920][MainThread][cli][debug]  requests: 2.32.4
[06:52:53.732408][MainThread][cli][debug]  trio: 0.30.0
[06:52:53.733696][MainThread][cli][debug]  trio-websocket: 0.12.2
[06:52:53.735234][MainThread][cli][debug]  urllib3: 2.5.0
[06:52:53.736981][MainThread][cli][debug]  websocket-client: 1.8.0
[06:52:53.737503][MainThread][cli][debug] Arguments:
[06:52:53.737708][MainThread][cli][debug]  url=https://twitcasting.tv/cloverz3
[06:52:53.737877][MainThread][cli][debug]  stream=['best']
[06:52:53.738111][MainThread][cli][debug]  --loglevel=all
[06:52:53.738282][MainThread][cli][debug]  --logfile=cloverz3_1751550772.log
[06:52:53.738554][MainThread][cli][debug]  --output=cloverz3_1751550772.mp4
[06:52:53.738748][MainThread][cli][debug]  --stream-types=['hls']
[06:52:53.738984][MainThread][cli][debug]  --hls-segment-queue-threshold=0.0
[06:52:53.739172][MainThread][cli][debug]  --hls-live-restart=True
[06:52:53.739506][MainThread][cli][info] Found matching plugin twitcasting for URL https://twitcasting.tv/cloverz3
[06:52:53.739813][MainThread][cache][trace] Loading cache file: /home/hakkin/.cache/streamlink/plugin-cache.json
[06:52:54.175378][MainThread][cli][info] Available streams: hls_low (worst, best)
[06:52:54.175725][MainThread][cli][info] Opening stream: hls_low (hls)
[06:52:54.176151][MainThread][cli][info] Writing output to
/home/hakkin/Documents/twitcast/cloverz3_1751550772.mp4
[06:52:54.176339][MainThread][cli][debug] Checking file output
[06:52:54.177522][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[06:52:54.177756][MainThread][cli][debug] Pre-buffering 8192 bytes
[06:52:55.637812][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-VERSION:6
[06:52:55.638111][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-TARGETDURATION:6
[06:52:55.638319][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MEDIA-SEQUENCE:2
[06:52:55.638499][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MAP:URI="/tc.livehls/v1/streams/819159329/hls/preroll-init.2.mp4"
[06:52:55.638743][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:2.000,
[06:52:55.638908][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/preroll-media.2.mp4
[06:52:55.639166][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-DISCONTINUITY
[06:52:55.639432][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MAP:URI="/tc.livehls/v1/streams/819159329/hls/132.68/init.2.mp4"
[06:52:55.639730][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.009,
[06:52:55.639908][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.0.mp4
[06:52:55.640148][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.070,
[06:52:55.640502][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.1.mp4
[06:52:55.640787][HLSStreamWorker-0][stream.hls][debug] First Sequence: 2; Last Sequence: 4
[06:52:55.640955][HLSStreamWorker-0][stream.hls][debug] Start offset: 0; Duration: None; Start Sequence: 2; End Sequence: None
[06:52:55.641102][HLSStreamWorker-0][stream.hls][debug] Adding segment 2 to queue
[06:52:55.643985][HLSStreamWorker-0][stream.hls][debug] Adding segment 3 to queue
[06:52:55.644359][HLSStreamWorker-0][stream.hls][debug] Adding segment 4 to queue
[06:52:55.792519][TwitCastingHLSStreamWriter-0][stream.hls][debug] Discarding segment 2
[06:52:55.794411][TwitCastingHLSStreamWriter-0][stream.hls][info] Filtering out segments and pausing stream output
[06:52:56.110573][TwitCastingHLSStreamWriter-0][stream.hls][debug] Discarding segment 2
[06:52:56.214749][TwitCastingHLSStreamWriter-0][stream.hls][debug] Writing segment 3 to output
[06:52:56.215161][TwitCastingHLSStreamWriter-0][stream.hls][debug] Segment initialization 3 complete
[06:52:56.215355][TwitCastingHLSStreamWriter-0][stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[06:52:56.215569][TwitCastingHLSStreamWriter-0][stream.hls][info] Resuming stream output
[06:52:56.216173][MainThread][cli][debug] Writing stream to output
[06:52:56.836259][TwitCastingHLSStreamWriter-0][stream.hls][debug] Writing segment 3 to output
[06:52:56.839016][TwitCastingHLSStreamWriter-0][stream.hls][debug] Segment 3 complete
[06:52:56.847655][TwitCastingHLSStreamWriter-0][stream.hls][warning] Encountered a stream discontinuity. This is unsupported and will result in incoherent output data.
[06:52:57.247992][TwitCastingHLSStreamWriter-0][stream.hls][debug] Writing segment 4 to output
[06:52:57.248837][TwitCastingHLSStreamWriter-0][stream.hls][debug] Segment 4 complete
[06:53:00.178191][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[06:53:00.289214][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-VERSION:6
[06:53:00.289646][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-TARGETDURATION:6
[06:53:00.289891][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MEDIA-SEQUENCE:3
[06:53:00.290089][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MAP:URI="/tc.livehls/v1/streams/819159329/hls/132.68/init.2.mp4"
[06:53:00.291339][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.009,
[06:53:00.291797][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.0.mp4
[06:53:00.292069][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.070,
[06:53:00.292289][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.1.mp4
[06:53:00.292688][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.040,
[06:53:00.292924][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.2.mp4
[06:53:00.293313][HLSStreamWorker-0][stream.hls][debug] Adding segment 5 to queue
[06:53:00.907772][TwitCastingHLSStreamWriter-0][stream.hls][debug] Writing segment 5 to output
[06:53:00.908805][TwitCastingHLSStreamWriter-0][stream.hls][debug] Segment 5 complete
[06:53:06.177814][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[06:53:06.286677][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-VERSION:6
[06:53:06.286954][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-TARGETDURATION:6
[06:53:06.287652][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MEDIA-SEQUENCE:3
[06:53:06.287883][HLSStreamWorker-0][stream.hls.m3u8][all] #EXT-X-MAP:URI="/tc.livehls/v1/streams/819159329/hls/132.68/init.2.mp4"
[06:53:06.288152][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.009,
[06:53:06.288448][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.0.mp4
[06:53:06.288754][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.070,
[06:53:06.289009][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.1.mp4
[06:53:06.289311][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.040,
[06:53:06.289607][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.2.mp4
[06:53:06.289906][HLSStreamWorker-0][stream.hls.m3u8][all] #EXTINF:5.010,
[06:53:06.290152][HLSStreamWorker-0][stream.hls.m3u8][all] /tc.livehls/v1/streams/819159329/hls/132.68/media.3.mp4
[06:53:06.290710][HLSStreamWorker-0][stream.hls][debug] Adding segment 6 to queue
[06:53:06.873075][MainThread][stream.segmented][debug] Closing worker thread
[06:53:06.873569][MainThread][stream.segmented][debug] Closing writer thread
[06:53:06.911326][TwitCastingHLSStreamWriter-0][stream.hls][debug] Writing segment 6 to output
[06:53:06.911965][TwitCastingHLSStreamWriter-0][stream.hls][debug] Segment 6 complete
[06:53:06.915078][MainThread][cli][info] Stream ended
Interrupted! Exiting...
[06:53:06.916706][MainThread][cli][info] Closing currently open stream...

ffmpeg output
ffmpeg version n7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 15.1.1 (GCC) 20250425
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enab>
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cloverz3_1751550772.mp4':
  Metadata:
    major_brand     : iso6
    minor_version   : 0
    compatible_brands: iso6
  Duration: 00:00:15.19, start: 0.000000, bitrate: 153 kb/s
  Stream #0:0[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x300](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x360, 23 kb/s, 15.27 fps, 1k tbr, 1k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : iso6
    minor_version   : 0
    compatible_brands: iso6
    encoder         : Lavf61.7.100
  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x360, q=2-31, 23 kb/s, 15.27 fps, 1k tbr, 1k tbn (default)
      Metadata:
        handler_name    : VideoHandler
        vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
        vendor_id       : [0][0][0][0]
Press [q] to stop, [?] for help
[out#0/null @ 0x5e37eaf632c0] video:44KiB audio:233KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=  227 fps=0.0 q=-1.0 Lsize=N/A time=00:00:14.81 bitrate=N/A speed= 890x    

@helpimnotdrowning
Copy link

hi, i know this might be out-of-scope, but would you know how to potentially fix these broken files?

@Hakkin
Copy link
Contributor Author

Hakkin commented Jul 4, 2025

hi, i know this might be out-of-scope, but would you know how to potentially fix these broken files?

If you have the original output files written by streamlink, you should be able to separate the discontinuities by splitting the file on the byte sequence ....ftyp, where . represents any byte value. If the output files have been processed in any way, they will likely be corrupt beyond repair.

@bastimeyer bastimeyer merged commit bb3c571 into streamlink:master Jul 4, 2025
27 checks passed
@bastimeyer
Copy link
Member

Thanks, @Hakkin

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Jul 4, 2025
@Hakkin Hakkin deleted the twitcasting-filter-preroll branch July 4, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins.twitcasting: preroll breaks recording
3 participants