Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.55k stars 1.57k forks source link

Width and height of VideoFileClip are inconsistently swapped #2235

Open alecaceres opened 3 days ago

alecaceres commented 3 days ago

I'm having troubles with this (and other) videos. For some reason, the width and the height are swapped but this is not consistent, as I have many videos for which the dimensions are the right ones

from moviepy.editor import VideoFileClip
import requests

submission = "https://github.com/user-attachments/assets/819b3cdc-12db-4187-af80-036d526ce04b" 
local_filename = "test_video"
with open(local_filename, "wb") as f:
    response = requests.get(submission)
    f.write(response.content)

video_clip = VideoFileClip(local_filename)
print(f"Width: {video_clip.w}\tHeight: {video_clip.h}")

Expected Behavior

Should print Width: 720 Height: 1280

Actual Behavior

Prints Width: 1280 Height: 720

Specifications

ThermodynamicBeta commented 2 days ago

Are some of the videos taken on phone and some aren't?

alecaceres commented 2 days ago

Are some of the videos taken on phone and some aren't?

They are all from the phone. Either Samsung S21 Ultra or iPhone 14 Pro Max.

ThermodynamicBeta commented 2 days ago

If you open the details tab on a computer, does it report the correct width and height, or flipped?

alecaceres commented 2 days ago

If you open the details tab on a computer, does it report the correct width and height, or flipped?

The correct width and height

ThermodynamicBeta commented 2 days ago

Ok interesting, for me it is already flipped on the OS side. Lots of unanswered aspect ratio questions on this repo :(

alecaceres commented 2 days ago

Ok interesting, for me it is already flipped on the OS side. Lots of unanswered aspect ratio questions on this repo :(

I can see. I ended up switching to OpenCV. Thank you!