You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a video file with frame size width: 4480 height: 3096, and i am doing a resize of (224, None)
The expected resized frame would be (224, 324)
Actual Behavior
The actual frame i get back is (223, 324), and it is caused by the integer conversion on this line
The ratio calculation resolves to 0.07235142118863049 which when multiplied with 3096 gives 223.99999999999997 and is thus rounded down to 223 by the integer conversion.
It would be lovely if the shape calculation forced the given axis to be the same as the requested shape, instead of recalculating it using the ratio calculation which is prone to error.
Steps to Reproduce the Problem
from moviepy import *
path = "test.mp4" #test.mp4 is a video with shape (3096, 4480, 3)
video = VideoFileClip(path, target_resolution=(224, None))
frame = video.get_frame(0)
frame.shape #frame.shape = (223, 324, 3)
Specifications
Python Version: 3.9
MoviePy Version: 1.0.3
Platform Name: Windows 10
Platform Version: 22H3
The text was updated successfully, but these errors were encountered:
I added a little change to fix but it raises a few questions on how should we cater to this case.
Should we:
leave as is - because if you want a specific resolution, you should specify it completely.
use the target dimension as specified, calculate the other. and/or
use proper rounding functions? perhaps use ceil or at the very least round even?
One could argue that if a result comes to " 12.2 pixels" (or in the example case 223.9999) then it should be ceil'd so that we have a pixel to cover that extra little bit that should be there.
But on the whole, I would expect that if i said "I want target height to be 100" it should come out as 100.
keikoro
added
the
video
Related to VideoClip and related classes, or handling of video in general.
label
Feb 10, 2024
Expected Behavior
I have a video file with frame size width: 4480 height: 3096, and i am doing a resize of (224, None)
The expected resized frame would be (224, 324)
Actual Behavior
The actual frame i get back is (223, 324), and it is caused by the integer conversion on this line
The ratio calculation resolves to 0.07235142118863049 which when multiplied with 3096 gives 223.99999999999997 and is thus rounded down to 223 by the integer conversion.
It would be lovely if the shape calculation forced the given axis to be the same as the requested shape, instead of recalculating it using the ratio calculation which is prone to error.
Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: