user3730954
user3730954

Reputation: 67

FFMPEG crop ratio?

I've been trying to figure out how FFMPEG decides it's dimensions after cropping a video. After cropping width 400 by 3 (133.3), it becomes 132. 640 by 3 (213.3) becomes 212. 426 by 2 (213) becomes 212. I thought it might be int((dimension+1)/crop) - 1 (such as (400-1/3) -1 becomes 132 which is correct) but this fails on 720/2 which becomes 359, but it should be 360. Any ideas?

Upvotes: 0

Views: 1199

Answers (1)

Andrey Turkin
Andrey Turkin

Reputation: 2509

Crop rounds down width/height values so that they can fit whole number of chroma components. So for common case of yuv420p pixel format that means rounding down to even numbers.

UPDATE: FFmpeg v3.2 and newer will support exact=1 option for crop filter which disables this behaviour.

Upvotes: 3

Related Questions