v1.2.8 — Actual fix for 'mpv exited with code 2'
Root cause (finally found)
AllAnime stream URLs (tools.fast4speed.rsvp) return:
content-type: application/octet-stream
and the URL has no .mp4 extension either (ends with /sub/1?Authorization=...).
mpv uses content-type + file extension to auto-detect the demuxer. With application/octet-stream and no extension, mpv can't figure out the format and exits with code 2 (failed to recognize file format).
The stream URL itself is perfectly fine — curl returns HTTP 200 with content-length: 309MB. mpv just needed to be told it's an MP4.
The fix
When the stream URL matches AllAnime patterns (tools.fast4speed.rsvp, /media, fast4speed, allanime, allmanga), SNI now adds:
--demuxer-lavf-format=mp4 (force MP4 demuxer)
--demuxer-lavf-probesize=32000 (probe 32KB to detect streams)
--demuxer-lavf-analyzeduration=2000000 (2s analysis timeout)
The mpv command now built for a real AllAnime stream
mpv https://tools.fast4speed.rsvp/.../sub/1?Authorization=...
--ytdl=no
--force-seekable=yes
--demuxer-lavf-format=mp4 <- THE FIX
--demuxer-lavf-probesize=32000
--demuxer-lavf-analyzeduration=2000000
--http-header-fields=Authorization: ...
--http-header-fields=Referer: https://youtu-chan.com
--http-header-fields=Origin: https://youtu-chan.com
Install
pip install --upgrade sni-cli
sni play "one piece"Playback should now work — mpv will know the stream is MP4 and play it correctly.
Verified
ruff check sni/→ All checks passedpytest -q→ 44 passed (3.23s)- Stream URL confirmed reachable:
curl -Ireturns HTTP 200, content-length 309MB - Command-building verified:
--demuxer-lavf-format=mp4IS present for AllAnime URLs python -m build→ sdist + wheel both passtwine check
Full changelog: v1.2.7...v1.2.8