Most probably the min_tallestBox() and min_highesBoxes() were the main issues. You can try fiddling with it by removing the refresh from the document.ready and check if the issue reoccurs.
It's no harm if you're adding it multiple times most probably the method already verifies if start / end position has truly changed or not so is up to you.
As a word of advice I would refactor the top code like this :
// Add bottom padding to blocks before
$(document).ready(function() {
$(".expanding-video").prev().addClass("bottom-excess-video");
$(".expanding-image").prev().addClass("bottom-excess-image");
$(".expanding-video").next().addClass("top-excess-video");
$(".expanding-image").next().addClass("top-excess-image");
// try to remove this ScrollTrigger.refresh() and see if the issue appears.
ScrollTrigger.refresh()
});