fe80Grau / ytdlp2STRM

A little script to serve Youtube / Twitch / Crunchyroll videos without storage it. Uses yt-dlp HTTP data throught Flask and dynamic URLs. We can use this dynamic URLs to set STRM files.
https://github.com/fe80Grau/ytdlp2STRM
MIT License
173 stars 15 forks source link

Live Twitch streams fail to transcode #10

Closed dcflachs closed 8 months ago

dcflachs commented 11 months ago

I keep running into an issue with live Twitch streams. Many live streams that show an ad at the beginning fail to work. The streams start ok initially playing the "Commercial Break in progress" screen but after that there is only black. Grabbing the stream directly in VLC works fine but through jellyfin not so much. The ffmpeg transcode log for the session shows an error like this.

[mpegts @ 0x5628b2994540] Packet corrupt (stream = 1, dts = 6748380). [hls @ 0x5628b268a6c0] Packet corrupt (stream = 1, dts = 6745320). http://127.0.0.1:5000/twitch/direct/Mousie@40904378728: corrupt input packet in stream 1 frame= 449 fps= 32 q=11.0 size=N/A time=00:00:13.03 bitrate=N/A speed=0.926x More than 1000 frames duplicated

fe80Grau commented 11 months ago

Hello, I understand that it must be a small error in the redirection or ban issue, I have tried but I cannot find the scenario. If you can send me the Twitch channels that are giving you problems, it would help to find your same scenario, I will also work a little blindly adding in Twitch plugin the bridge mode where the video flow is preprocessed and it is the script itself that serves the data without redirect, this to solve the possible error in the redirection and the option to add proxy in case it is a ban case.

dcflachs commented 11 months ago

I have observed the issue on the following channels "PotasticP", "bouphe", "Mousie", "tarik", "xQc". So far as i can tell its actually any channel that begins with a commercial.

As I mentioned, tuning into the stream url (via ytdlp2STRM) with VLC plays the stream fine showing the commercial break screen and then eventually the stream. It is only the jellyfin transcoder that seems to have a problem with it, and only after the commercial break screen. I have tried various transcoder settings to see if that had something to do with it but they all behave the same.

fe80Grau commented 8 months ago

Jellyfin web issue. Maybe fixed in the last Jellyfin release. https://github.com/jellyfin/jellyfin/releases/tag/v10.8.11

dcflachs commented 7 months ago

@fe80Grau This issue still exists in the latest jellyfin release. Best I have been able to discern it is not a issue with Jellyfin Web but with the Jellyfin Server HLS handling. If i understand correctly jellyfin passes the m3u playlist decoding off to FFMPEG which is unable to correctly handle the #EXT-X-DISCONTINUITY tags used to embed ads into some Twitch Live streams.

https://github.com/jellyfin/jellyfin-ffmpeg/issues/57