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

TypeError in ffmpeg_reader.py: Metadata concatenation fails when field value is a float #2390

Open
melyux opened this issue Mar 8, 2025 · 0 comments · May be fixed by #2391
Open

TypeError in ffmpeg_reader.py: Metadata concatenation fails when field value is a float #2390

melyux opened this issue Mar 8, 2025 · 0 comments · May be fixed by #2391
Labels
bug Issues that report (apparent) bugs.

Comments

@melyux
Copy link

melyux commented Mar 8, 2025

Expected Behavior

MoviePy should correctly parse and concatenate metadata fields from ffmpeg output by converting all values to strings when necessary. Even if a metadata value is numeric, it should be handled gracefully without throwing an error.

Changing this line in ffmpeg_reader.py from this:

value = self._current_stream["metadata"][field] + "\n" + value

to this:

value = str(self._current_stream["metadata"][field]) + "\n" + value

seems to solve the issue.

Actual Behavior

When parsing metadata from a video file, MoviePy raises a TypeError because it attempts to concatenate a float (e.g., 3.088510 from com.apple.quicktime.location.accuracy.horizontal) with a string. The error message is:

TypeError: unsupported operand type(s) for +: 'float' and 'str'

Steps and code to Reproduce the Problem

  1. Use a video file (for example, a .mov file) that includes metadata fields with numeric values.
  2. Run the following code:
from moviepy.editor import VideoFileClip

path = "/path/to/your/video/IMG_2056.mov"
video = VideoFileClip(path)
  1. The script will fail during metadata parsing with the above TypeError.

Used medias

I'd rather not put it here, can send privately

Specifications

  • Python Version: 3.11
  • MoviePy Version: latest master (as of 3/8/25)
  • Platform Name: macOS
  • Platform Version: latest
@melyux melyux added the bug Issues that report (apparent) bugs. label Mar 8, 2025
@melyux melyux linked a pull request Mar 8, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant