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)
- commas in filterchain are always escaped by a backslash
- Operation on closed image
- AudioClip.iter_chunks(160) is chunking into [159, 160, 160, ..., 160]
- The position of subclip cutting is different from the parameters HOT 1
- Output resolution wrong. HOT 1
- Workflows need updating
- No longer encoding subtitles HOT 2
- AttributeError: 'NoneType' object has no attribute 'get_frame', reported by AudioFileClip.to_soundarray() HOT 1
- Test suite fails for most Windows, Linux tests HOT 2
- Test suite fails for macOS due to missing Conda install
- support latest decorator
- Unable to run moviepy on debian 10 HOT 8
- No sound HOT 2
- how to keep the aspect ratio for my vertical video? HOT 5
- I cut 1800 seconds of audio, but the result is 1846 seconds. Why is this happening? How can I solve this problem?
- Resizable rounded rectangle
- Getting `AttributeError: 'NoneType' object has no attribute 'get_frame'` when trying to save a `CompositeVideoClip`
- Error When Generating a Long video and not getting the error when generating a shorter video HOT 1
- AttributeError: 'NoneType' object has no attribute 'get_frame' when calling write_videofile HOT 1
- Vertical MOV video to MP4 HOT 3
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.