  from threading import Event, Thread
  from queue import Queue
  import numpy as np
  
  from PIL import Image, ImageTk
  
  from lib.Serializer import JSONSerializer
  from .tooltip import Tooltip
  
  logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
 
</s> remove from ffmpy import FFmpeg
 </s> add from ffmpy import FFmpeg, FFRuntimeError </s> remove             img.thumbnail((thumbnail_size, thumbnail_size))
 </s> add             width, height = img.size
            scaling = thumbnail_size / max(width, height)
            logger.debug("image width: %s, height: %s, scaling: %s", width, height, scaling)
            img = img.resize((int(width * scaling), int(height * scaling))) </s> remove         ffm.run()
 </s> add         # Sometimes ffmpy exits for no discernible reason, but then works on a later attempt,
        # so take 5 shots at this
        attempts = 5
        for attempt in range(attempts):
            logger.debug("Muxing attempt: %s", attempt + 1)
            try:
                ffm.run()
            except FFRuntimeError as err:
                logger.debug("ffmpy runtime error: %s", str(err))
                if attempt != attempts - 1:
                    continue
                logger.error("There was a problem muxing audio. The output video has been "
                             "created but you will need to mux audio yourself either with the "
                             "EFFMpeg tool or an external application.")
                os.rename(self.video_tmp_file, self.video_file)
            break </s> remove         print(right, left, bottom, top)
 </s> add 
from PIL import Image, ImageDraw, ImageTk
  from threading import Event, Thread
  from queue import Queue
  import numpy as np
  
from PIL import Image, ImageDraw, ImageTk
  
  from lib.Serializer import JSONSerializer
  from .tooltip import Tooltip
  
  logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
keep keep keep keep replace keep keep keep keep keep
 Fixups

GUI: Fix thumbnail calculation + add borders
cv2-dnn aligner: Remove debug code
Convert: FFMpeg plugin - retry muxing audio on failure and properly error handle 
lib/gui/utils.py