Python Forum
TypeError: 'float' object is not callable #1
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: 'float' object is not callable #1
#1
Good evening, can you help me and tell me what I am doing wrong because it tells me that it is not callable. reggards

# Import Pmw from this directory tree.
#!/usr/local/bin/python
# -*- coding: UTF-8 -*-
from moviepy.editor import CompositeVideoClip, VideoFileClip, TextClip, concatenate_videoclips,vfx
import time
import math

clip2 = VideoFileClip("F:/ave-maria-mosca.mp4")

tiem=0.0
print ("eee")
tiempo_ralentizado=4   #4 segundos
lugar_ralentizado=5   #En el segundo 5
Framerate=50
arco_ralen=tiempo_ralentizado*Framerate


def tiempo(tiem,tiempo_ralentizado,lugar_ralentizado,Framerate,arco_ralen):
    gek=tiem
    punto_entrada=lugar_ralentizado -( tiempo_ralentizado /2 )
    print (gek, abs(math.sin(gek/arco_ralen)), punto_entrada)
    donde=[2]
    calcular=abs(math.sin(gek/4)*2)
    return gek+1- calcular

clip2 = clip2.fl_time( tiempo(tiem,tiempo_ralentizado,lugar_ralentizado,Framerate,arco_ralen) ).set_duration(40)
give me this error

Error:
File "F:\post-produccion.py", line 35, in <module> clip2 = clip2.fl_time( tiempo(tiem,tiempo_ralentizado,lugar_ralentizado,Framerate,arco_ralen) ).set_duration(40) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\moviepy\Clip.py", line 190, in fl_time return self.fl(lambda gf, t: gf(t_func(t)), apply_to, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\moviepy\Clip.py", line 138, in fl newclip = self.set_make_frame(lambda t: fun(self.get_frame, t)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<decorator-gen-57>", line 2, in set_make_frame File "C:\Python311\Lib\site-packages\moviepy\decorators.py", line 14, in outplace f(newclip, *a, **k) File "C:\Python311\Lib\site-packages\moviepy\video\VideoClip.py", line 666, in set_make_frame self.size = self.get_frame(0).shape[:2][::-1] ^^^^^^^^^^^^^^^^^ File "<decorator-gen-10>", line 2, in get_frame File "C:\Python311\Lib\site-packages\moviepy\decorators.py", line 89, in wrapper return f(*new_a, **new_kw) ^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\moviepy\Clip.py", line 95, in get_frame return self.make_frame(t) ^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\moviepy\Clip.py", line 138, in <lambda> newclip = self.set_make_frame(lambda t: fun(self.get_frame, t)) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\moviepy\Clip.py", line 190, in <lambda> return self.fl(lambda gf, t: gf(t_func(t)), apply_to,
Reply
#2
https://zulko.github.io/moviepy/ref/Vide...ip.fl_time Wrote:fl_time(self, t_func, apply_to=None, keep_duration=False)
Returns a Clip instance playing the content of the current clip but with a modified timeline, time t being replaced by another time t_func(t).

Parameters
t_func:
A function t-> new_t
The method fl_time of VideoFileClip states that the parameter it receives is a function.
your line
clip2 = clip2.fl_time( tiempo(tiem,tiempo_ralentizado,lugar_ralentizado,Framerate,arco_ralen) ).set_duration(40)
is passing the result of a function, not an actual function itself.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: cannot pickle ‘_asyncio.Future’ object Abdul_Rafey 1 270 Mar-07-2024, 03:40 PM
Last Post: deanhystad
  error in class: TypeError: 'str' object is not callable akbarza 2 446 Dec-30-2023, 04:35 PM
Last Post: deanhystad
Bug TypeError: 'NoneType' object is not subscriptable TheLummen 4 679 Nov-27-2023, 11:34 AM
Last Post: TheLummen
  TypeError: 'NoneType' object is not callable akbarza 4 920 Aug-24-2023, 05:14 PM
Last Post: snippsat
  [NEW CODER] TypeError: Object is not callable iwantyoursec 5 1,261 Aug-23-2023, 06:21 PM
Last Post: deanhystad
  Need help with 'str' object is not callable error. Fare 4 777 Jul-23-2023, 02:25 PM
Last Post: Fare
  TypeError: a bytes-like object is required ZeroX 13 3,838 Jan-07-2023, 07:02 PM
Last Post: deanhystad
  'SSHClient' object is not callable 3lnyn0 1 1,125 Dec-15-2022, 03:40 AM
Last Post: deanhystad
  TypeError: 'float' object is not callable TimofeyKolpakov 3 1,373 Dec-04-2022, 04:58 PM
Last Post: TimofeyKolpakov
  API Post issue "TypeError: 'str' object is not callable" makeeley 2 1,834 Oct-30-2022, 12:53 PM
Last Post: makeeley

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020