You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
moviepy crashes when parsing FFmpeg metadata if a field continuation attempts to concatenate a string and a float. This happens when _last_metadata_field_added refers to a value in metadata that is a float, and the parser assumes all metadata values are strings.
TypeError: can only concatenate str (not "float") to str
...
value = str(self._current_stream["metadata"][field]) + "\n" + value
This happens in FFmpegInfosParser.parse() when handling metadata field continuation lines where field == "".
Problematic Code (line 550 in video/io/ffmpeg_reader.py)
if field == "":
field = self._last_metadata_field_added
value = self._current_stream["metadata"][field] + "\n" + value
If self._current_stream["metadata"][field] is a float, this crashes.
Proposed Fix
if field == "":
field = self._last_metadata_field_added
value = str(self._current_stream["metadata"][field]) + "\n" + value
Environment
• OS: macOS
• Python: 3.12
• moviepy: 1.0.3
• ffmpeg: 6.1
• Video: .mov and .mp4 files with metadata fields like vendor_id, duration, etc.
This complements PR #2311, which fixed crashes due to colon-less metadata lines. However, this bug is still possible even after that patch, especially when the previous metadata field contains a float.
The text was updated successfully, but these errors were encountered:
moviepy crashes when parsing FFmpeg metadata if a field continuation attempts to concatenate a string and a float. This happens when _last_metadata_field_added refers to a value in metadata that is a float, and the parser assumes all metadata values are strings.
TypeError: can only concatenate str (not "float") to str
...
value = str(self._current_stream["metadata"][field]) + "\n" + value
This happens in FFmpegInfosParser.parse() when handling metadata field continuation lines where field == "".
Problematic Code (line 550 in video/io/ffmpeg_reader.py)
if field == "":
field = self._last_metadata_field_added
value = self._current_stream["metadata"][field] + "\n" + value
If self._current_stream["metadata"][field] is a float, this crashes.
Proposed Fix
if field == "":
field = self._last_metadata_field_added
value = str(self._current_stream["metadata"][field]) + "\n" + value
Environment
• OS: macOS
• Python: 3.12
• moviepy: 1.0.3
• ffmpeg: 6.1
• Video: .mov and .mp4 files with metadata fields like vendor_id, duration, etc.
This complements PR #2311, which fixed crashes due to colon-less metadata lines. However, this bug is still possible even after that patch, especially when the previous metadata field contains a float.
The text was updated successfully, but these errors were encountered: