#2563·moviepy

Video with improperly encoded tag causes UnicodeDecodeError

Author: mattbillensteinCreated Apr 30, 2026Updated Apr 30, 2026
Labelsbug
$ ffprobe -hide_banner -show_format -show_streams ПрыжокАтака_03.mov
...
TAG:creation_time=2025-07-24T19:50:20.000000Z
[default @ 0x5e7187b64d00] 15 invalid UTF-8 sequence(s) found in string '  Apple', replaced with '�'
TAG:handler_name=���������� ����� Apple
TAG:vendor_id=[0][0][0][0]
...

Then from moviepy/video/io/ffmpeg_reader.py

257     proc = sp.Popen(cmd, **popen_params)
258     (output, error) = proc.communicate()
259     print(error[2400:2600])
260     infos = error.decode('utf8')
$ cat foo.py
#!/usr/bin/env python3

import sys

from moviepy.editor import VideoFileClip

with VideoFileClip(sys.argv[1]) as clip:
    clip.write_videofile(
        'out.mp4',
        codec='libx264',
        audio=False,
        preset="fast",
        ffmpeg_params=["-crf", "18", "-pix_fmt", "yuv420p", "-movflags", "+faststart"],
        logger=None,
    )
(uve)mattb@u3:~ $ ./foo.py ПрыжокАтака_03.mov
b'efault)\n    Metadata:\n      creation_time   : 2025-07-24T19:50:20.000000Z\n      handler_name    : \xce\xe1\xf0\xe0\xe1\xee\xf2\xf7\xe8\xea \xe2\xe8\xe4\xe5\xee Apple\n    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 3'
Traceback (most recent call last):
  File "/home/mattb/./foo.py", line 7, in <module>
    with VideoFileClip(sys.argv[1]) as clip:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/uve/lib/python3.11/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__
    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/uve/lib/python3.11/site-packages/moviepy/video/io/ffmpeg_reader.py", line 35, in __init__
    infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/uve/lib/python3.11/site-packages/moviepy/video/io/ffmpeg_reader.py", line 260, in ffmpeg_parse_infos
    infos = error.decode('utf8')
            ^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position 2498: invalid continuation byte

Suggest using infos = error.decode('utf8', errors='replace') here and in other places to avoid raising here.