Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'utf-8' codec can't decode byte 0xc1 in position 2079: invalid start byte #19

Closed
ChristianMalazarte opened this issue Aug 3, 2023 · 1 comment

Comments

@ChristianMalazarte
Copy link

ChristianMalazarte commented Aug 3, 2023

I was getting this error on a few of my files. So I did some digging and read that if you add 'ignore' onto the decode part, it fixes this problem: Zulko/moviepy#959

So if anyone comes across this problem, just change err.decode('utf-8') to err.decode('utf-8', 'ignore') on both instances. I'm still not sure if this breaks anything, but apparently, it just tells it to ignore the extra byte.

    if proc.returncode != 0:
        err_lines = err.decode('utf-8', 'ignore').split('\n')[-5:]
        logger.error(err_lines)
        raise Exception('Problem trying to ffmpeg images for {}'.format(video_file))

    # Speed
    end = time.time()
    seconds = round(end - start, 1)
    speed = re.findall('speed= ?([0-9]+\.?[0-9]*|\.[0-9]+)x', err.decode('utf-8', 'ignore'))
    if speed:
        speed = speed[-1]
    logger.info('Generated Video Preview for {} HW={} TIME={}seconds SPEED={}x '.format(video_file, hw, seconds, speed))

@stevezau
Copy link
Owner

stevezau commented Aug 3, 2023

@ChristianMalazarte do you mind openig a PR so i can merge it in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants