-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fixing Simulcasts
Due to massive incompetence, time and resource constraints simulcasts often suffer from various quality degrading issues. This document gives a summary of frequent issues and how to fix some of those as best as possible during playback with mpv's means.
You will need VapourSynth for some of these fixes. On Linux you may or may not find VapourSynth and the needed filter-plugin, namely flash3kyuu_deband, in your package manager. For Mac OS X, see this gist as example on how to set VS and f3k_db up there. Remember to recompile mpv after installing VS and to make sure that configure actually picks up VS' libs. (This is also necessary on Archlinux as the package is built to be small, without dependency on vapoursynth)
Save the following scripts each to a file and feed it as needed to the VapourSynth video-filter. To load the filter with a script at startup, add --vf vapoursynth=path/to/script.vpy
.
Alternatively, you can add a keybinding to load a specific script during playback. Add b vf toggle vapoursynth=/path/to/script.vpy
to your input.conf to toggle the filter using the b
key.
When you need to use multiple fixes that require VS, try to combine the filters into a single VS script.
Since simulcast releases are always tight on bitrate and encoded with "quick" instead of "good" settings they suffer heavily from banding. See comparison 1 and comparison 2.
Use flash3kyuu_deband through VapourSynth to deband the video:
import vapoursynth as vs core = vs.get_core() clip = video_in clip = core.std.Trim(clip, first=0, length=500000) clip = core.f3kdb.Deband(clip, grainy=0, grainc=0, output_depth=16) clip.set_output()
Always use this.
Some simulcast encoders are so incompetent that they can't even get the frame-rate right and end up encoding a 24fps video at 30fps which will lead to annoying judder (Frame pattern: ABCDD).
Use this script to handle this:
import vapoursynth as vs core = vs.get_core() clip = video_in clip = core.std.Trim(clip, first=0, length=500000) clip = core.vivtc.VDecimate(clip) clip = core.std.AssumeFPS(clip, fpsnum=24000, fpsden=1001) clip.set_output()
If you want to watch this on a 24 Hz display, make sure to (only!) enable vo framedropping (--framedrop=vo
), otherwise you may get heavy desyncing.
Sometimes something seems to go wrong with the decimation mid-show and a show that is encoded at 24fps and playing smoothly at first suddenly starts to judder. For whatever reason, a frame that wasn't a dupe got removed, and the frame that actually is a dupe remains. This means a whole frame of motion is lost and pans get very jerky (Frame pattern: ABDD). Due to a frame actually getting lost, this is pretty much impossible to fix.
Rips from Funimation are encoded at full-range but are tagged as limited range. As a result the player will "cut off" a lot of important image information (see comparison).
Add the command-line option --colormatrix-input-range=full
to correct this at startup or add <key> cycle colormatrix-input-range
to your input.conf to toggle the setting during playback.
The subtitles of most series are timed one frame too late, causing scene bleeds all over the place. Use --sub-delay=-0.04
to apply the fix at startup or add <key> cycle_values sub-delay "-0.04" "0"
to your input.conf to toggle it during playback.
(Note: This was apparently a one-time issue only)
When "é" shows up as "é", or similar, the script's character-encoding is messed up (First spotted in SAO2 Ep 03 by "Daisuki"). This can sadly not be fixed during playback, here's what you need to do:
- Demux the script using:
mkvextract tracks <file.mkv> <sid>:<file.ass>
- Get an editor that can convert between character-encodings (Sublime Text)
- Open the script as UTF-8
- Save the script as "Windows 1252" or something like that
- Open it as UTF-8 again. It should now look correctly.
- If your movie is named
file.mkv
, save the fixed script asfile.ass
and put it in the same folder asfile.mkv
, mpv will pick it up and show it automatically. - (Optionally: Mux your fixed script back into the mkv file)