Comments (8)
I am not sure that I understand exactly what you want, but you can change the timeline of a clip very freely with clip.fl_time(some_time_warping_function)
. Here is an example in which the timeline is replaced by t+sin(t)
, so that the clip will gradually be sped up and slowed down, with a period of 2Pi seconds (this applies to the audio and the video):
clip = VideoFileClip("my_video.mp4")
clip2 = clip.fl_time( lambda t: t+ sin(t) )
clip2.to_videofile("my_time_warped_video.mp4")
To slow down a clip progressively a clip of N seconds you would write something like
clip.fl_time(lambda t: N*t/(N+t)).set_duration(2*N)
Now if you have a profile of the speed over time, you could integrate this profile to get the profile of a timeline, which you can tranform into a function timeline(t)
and then clip.fl_time(timeline)
would do the trick.
I don't know if there is a proper Bezier curve library in Python. That would certainly be a job for Scipy.
from moviepy.
That sounds like what I'm after. I'll give it a shot.
Thanks!
from moviepy.
Cool. Note that 'going back in time' (i.e. negative speed) is possible for the video but not fully tested with the audio (you might run into a bug).
from moviepy.
Hi Zulko,
I tried this and it seems that the speed of the video clip changes, whereas the accompanying audio doesn't speed up. The file format is mp4. Can you please help?
from moviepy.
Try this, with apply_to=['audio'] in fl_time:
clip = VideoFileClip("my_video.mp4")
clip2 = clip.fl_time( lambda t: t+ sin(t), apply_to=['audio'] )
# maybe indicate a new duration for the clip:
clip2 = clip2.set_duration(some_new_duration)
clip2.write_videofile("my_time_warped_video.mp4")
from moviepy.
Thanks Zulko for your quick response. It worked like a charm. But, I have one more concern. On changing the playback rate of the video the voice of the person in it also changes. That is, if I double or halve the speed of video, the dialogues are clear, but the voice becomes annoyingly unpleasant. This doesn't happen if I play the original video in a video player with 2x or 0.5x speed. Is there any way to avoid that?
from moviepy.
hello,
I'm looking for a way to slow down a point in the video but then x time later it returns to normal speed.
Imagine recording it at 50 fps or 100 fps per second while its playback is constant at 1/25, when the car is close then use those frames. Typical of after effects programs is a retime curve.
Slow down a point of the video and then continue normal
any help please
from moviepy.
Please note that you are commenting on old, closed issues meaning only very few people will see your comments.
from moviepy.
Related Issues (20)
- Release 0.2.4.0 missing
- video.preview() has a bug after concatenate_videoclips in version 1.0.3
- TypeError: '<' not supported between instances of 'str' and 'int' HOT 1
- Audio out of sync for combined DASH video
- Inconsistent duration for composite output HOT 1
- Trying to hide the Logger Bar in the console
- Text For Stroke/Outline Doesn't Align properly
- Unable to set FPS in GIFs
- Can I run 'write_videofile' function with GPU ? HOT 2
- I have a doubt, as shown in the picture, I get a 403 from my program, but from the browser it works!
- Saving the same video clip twice will yield different results
- Decorator not working correctly fps remains to be None and cause TypeError
- Sound doubling / looping when merging clips. HOT 1
- ffmpeg interpets video title as a command line argument when it begins with "-"
- Audio out of sync when I grab window bar.
- Bug in CompositeVideoClip
- Efficiency Disparity Between MoviePy and FFmpeg
- A household appliances company in the Netherlands and all of Europe, King Import Export, announces the theft of a container of household appliances and warns customers to beware of purchasing the product without invoices. The invoice must bear the company seal, King Import Export, so as not to be exposed to problems.
- ImageMagick Binary Not Found HOT 3
- King1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moviepy.