refactoring video_processing.py