Comments (3)
Idea to fix problems like this:
ffmpeg_reader
should be very forgiving for out of bounds reads.
- for video, reads before the start get the first frame, reads after the end get the last frame
- for audio, out-of-bounds reads get 0-samples
The enforcement of duration
should be in subclip()
. subclip()
could take a parameter elasticity
with the following values:
-
elasticity=='infinite'
:
ignores whether it's in bounds of the original duration.
result:new_clip.duration == end_time - start_time
-
elasticity=='strict'
:
assertoriginal_clip.duration >= end_time - start_time
, plus a small epsilon to take floating-point error into account.
result:new_clip.duration == end_time - start_time
-
elasticity=='truncate'
:
truncate the ends so it fits in the old clip.
result:new_clip.duration <= end_time - start_time
-
elasticity=='truncatewarn'
:
same astruncate
, but does awarn()
if it truncates more than an epsilon.
The default should be truncatewarn
from moviepy.
Something along these lines would work well for my purposes.
Just one minor issue: in the truncate
case, the new_clip.duration == min(original_clip.duration, end_time - start_time)
comparison doesn't seem correct. If my [start_time, end_time]
range overlaps the end of the data, then I'd expect new_clip.duration
to be original_clip.duration - start_time
which may be shorter than either of the arguments to min()
.
from moviepy.
Something along these lines would work well for my purposes.
Just one minor issue: in the
truncate
case, thenew_clip.duration == min(original_clip.duration, end_time - start_time)
comparison doesn't seem correct. If my[start_time, end_time]
range overlaps the end of the data, then I'd expectnew_clip.duration
to beoriginal_clip.duration - start_time
which may be shorter than either of the arguments tomin()
.
Thanks, my formulation was wrong. corrected
from moviepy.
Related Issues (20)
- Calibrate nchunks of iter_chunks function
- Certain decorators perform extremely slow function inspection every call
- Can't apply transition 'crossfadein' to a clip HOT 1
- AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' HOT 3
- An error occurred in calculating the duration of multiple videos in one folder using VideoFileClip HOT 1
- After do 'concatenate_videoclips', most of added movie does not displayed that seems no keyframe for added clips. HOT 2
- AttributeError: 'numpy.ndarray' object has no attribute 'point' HOT 1
- AttributeError: 'numpy.ndarray' object has no attribute 'read' HOT 1
- ArgumentError: argument 2: TypeError: wrong type HOT 2
- error: OpenCV(4.9.0) :-1: error: (-5:Bad argument) in function 'putText' HOT 2
- TypeError: cannot unpack non-iterable NoneType object HOT 1
- VideoFileClip.write_videofile stops with an error message HOT 1
- Any Unicode Font For TextClip
- Difficulty Achieving Transparent Background in .webm Files with CompositeVideoClip
- Concatenate result not looking good
- crop missing from moviepy.video.fx.all HOT 1
- Seeking by frame is inexact and inconsistent
- Insert video in green screen
- Assigning an ImageClip as the mask to a VideoFileClip inverts colors of unmasked area HOT 2
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.