Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write_videofile results in 1930x1080 even when I force clip.resize(width=1920,height=1080) before write_videofile #547

Closed
evanthemann opened this issue Apr 14, 2017 · 5 comments
Labels
question Questions regarding functionality, usage video Related to VideoClip and related classes, or handling of video in general.

Comments

@evanthemann
Copy link

I have a script that transforms Vertical video into horizontal video. Right now these source files are all from mobile devices, and sometimes from Snapchat. I think there is something weird about the pixel aspect ratio because some of my clips come out as 1930x1080 or other resolutions that are almost 16x9. Any idea what the problem could be?

    clip = VideoFileClip(path)
    clip2 = clip.crop(x_center=202, y_center=360, width=404, height=227)
    clip3 = clip2.resize(width=1920,height=1080)
    clip3.write_videofile(output, codec='libx264', audio_codec='aac', temp_audiofile='temp-audio.m4a', remove_temp=True)
@tburrows13
Copy link
Collaborator

You're not supposed to use both height= and width=. You use one of them, and it automatically works out the other keeping the same aspect ratio. You don't want this to happen, so use newsize=(1920,1080).
See resize docs.

@evanthemann
Copy link
Author

Thank you! That was exactly what I needed.

@kallimadhavareddy
Copy link

newsize=(1920,1920)
clip_resized = clip.resize(newsize)
clip_resized.write_videofile("C:\TEST\NEW_4.mp4")

@keikoro keikoro added video Related to VideoClip and related classes, or handling of video in general. question Questions regarding functionality, usage labels Feb 5, 2021
@keikoro
Copy link
Collaborator

keikoro commented Feb 5, 2021

@kallimadhavareddy It's not clear to me why you added your comment to this closed issue. I'd ask you to open a new issue if you are experiencing problems and fill in the issue template as best as you can.

@vaccarieli
Copy link

vaccarieli commented Mar 10, 2022

hi, I am trying to resize a video and force the aspect ratio, I got a video 1280720 and want to resize to 12801596, so the video keeps the same aspect ration but in the process the spaces for the height(Bottom&Top) are filled out with black frames instead. So my final result is the original video in the center on that dimention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions regarding functionality, usage video Related to VideoClip and related classes, or handling of video in general.
Projects
None yet
Development

No branches or pull requests

5 participants