Here a script that uses only two images to process input-output for waifu2x, and can easily be modified for any program (gimp, waifu2x, ImageMagick, ESRGAN, python, etc.)
And it has a simple duplicate frame detector.
https://forum.doom9.org/showthread.php?t=177058
Sample:
https://youtu.be/kdbhFVZ4vIM