question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: 'float' object cannot be interpreted as an integer - CompositeVideoClip

See original GitHub issue

I am trying to composite a ‘.mp4’ video and ‘text’ using VideoFileClip and TextClip respectively by appending them to a variable ‘clip_list’.

If I try to print ‘clip_list’ on console it logs:

[<moviepy.video.io.VideoFileClip.VideoFileClip object at 0x7f3d1da98208>,
 <moviepy.video.VideoClip.TextClip object at 0x7f3d20699a20>]

Now using CompositeVideoClip on clip_list gives me following error.

Traceback (most recent call last): File "test.py", line 155, in <module> scene_composition = CompositeVideoClip(clip_list).set_duration(scenes[i].get('duration')).on_color(size=screensize, color=(0, 0, 0)) File "/usr/local/lib/python3.7/site-packages/moviepy/video/VideoClip.py", line 616, in on_color colorclip = ColorClip(size, color=color) File "/usr/local/lib/python3.7/site-packages/moviepy/video/VideoClip.py", line 1014, in __init__ ImageClip.__init__(self, np.tile(color, w * h).reshape(shape), File "<__array_function__ internals>", line 6, in tile File "/usr/local/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 1258, in tile return c.reshape(shape_out) TypeError: 'float' object cannot be interpreted as an integer

Any help here? I am using:

Python 3.7.3 moviepy==1.0.2 numpy==1.18.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
sahils2410commented, Apr 28, 2020

Very well. That just fixed my problem 😃

Thanks 👍

1reaction
tburrows13commented, Apr 28, 2020

I’ve fixed the bug that I was getting: you need to set scene_bg_color to (255, 255, 255), not "#ffffff". MoviePy only accepts colours in the format I just described.

If that doesn’t solve your problem, then send the full traceback for the crash that you’re getting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Moviepy return error on CompositeVideoClip = TypeError
Moviepy return error on CompositeVideoClip = TypeError: 'float' object cannot be interpreted as an integer ... I am trying to composite a '.mp4' ......
Read more >
TypeError: float object cannot be interpreted as an integer
The Python TypeError: 'float' object cannot be interpreted as an integer occurs when we pass a float to a function that expects an...
Read more >
TypeError: 'float' object cannot be interpreted as an integer
TypeError : 'float' object cannot be interpreted as an integer. Floating-point numbers are values that can contain a decimal point.
Read more >
TypeError: 'numpy.float64' object cannot be interpreted as an ...
The problem with your code might be that np.nan is a float64 type value but the np.r_[] expects comma separated integers within its...
Read more >
TypeError float object cannot be interpreted as an integer
TypeError : 'float' object cannot be interpreted as an integer. Floating-point numbers are values that can contain a decimal point. Integers ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found