Lua script for auto-skipping anime OP and ED based on chapter lengths. Focused on working in mpv when used as an external player for Stremio on Android.
Auto-skips OP and ED in anime by skipping any chapters that are 88-92 seconds long or that are named "OP", "Opening", "ED", or "Credits". This requires that the chapters be labelled in the video. For anime, based on a small sample, the primary Stremio link (eg, NyaaSi Multi Subs 1080p) had chapters labelled about half the time, so this approach may work about half the time.
We later added additional strings (e.g., "logo", "commercial", "previously"), which may help with skipping chapters in non-anime content.
- Install mpv from Play Store
- Launch mpv
- Tap Advanced
- Tap "Edit mpv.conf"
- Enter
script=/storage/emulated/0/Android/media/is.xyz.mpv/scripts/auto_skip_anime_intro.lua
- Tap Save
- Install a file manager, such as File Manager
- Launch File Manager and give it all necessary permissions
- Go to Main Storage
- Browse to Android > media
- Tap on the top-right corner (3 dots) > New > Folder and name it
is.xyz.mpv
- Go into
is.xyz.mpv
- Add new folder within it and name it
scripts
- Tap on the top-right corner (3 dots) > New > File and name it
auto_skip_anime_intro.lua
- Copy all the contents of this script
- Open File Manager and browse to Main Storage > Android > media > is.xyz.mpv > scripts
- Tap on
auto_skip_anime_intro.lua
to open it - Paste the text you copied earlier
- Tap on the Save icon at the top-right corner
- Tap on the back button
- Launch Stremio
- Go to Settings
- Put a checkmark next to: Always start video in external player. You'll get a Warning message. Tap on OK. Tap on Restart.
- Go through steps to start streaming an anime preferrably selecting the primary link (usually NyaaSi Multi Subs 1080p)
- When about to start streaming, you'll be asked to select an app. Choose mpv. You may want to tap on Always if you mainly watch anime.
- Wait to see if the intro gets skipped. If they don't, this is probably because the anime doesn't have chapters labelled. Tap on the gear at the top-right. If chapters are labelled, you'll be able to tap on Chapters.
- Try a few anime. At least with recent anime, the auto-skipping should work about half the time because about have of the primary links have chapters labelled.
More or less the same process applies as for Android. However, you'll need to sideload mpv onto your Google TV device.
You can find the APKs here.
You should try to install the v8a-release
APK first. If that doesn't work, try the v7a-release
APK.
Unfortunately, mpv may be hit and miss with how well it works on different devices. For instance, on Xiaomi Mi Box S (2nd gen), for it to play smoothly, you may need to disable Hardware decoding and possibly enable Reduced quality settings.