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

Center the crop automatically #11

Open
mrzool opened this issue May 19, 2021 · 1 comment
Open

Center the crop automatically #11

mrzool opened this issue May 19, 2021 · 1 comment

Comments

@mrzool
Copy link

mrzool commented May 19, 2021

vdx starts cropping from x=0 by default. I have a bunch of letterboxed videos that I need to get back to their original ratio by cropping away the two black bars at the sides. Is there a smart way for centering the crop automatically, without having to calculate the x/y coordinates manually? Kind of like the -gravity center flag in imagemagick.

@mrzool
Copy link
Author

mrzool commented May 21, 2021

I was able to get ffmpeg to detect the crop coordinates automatically through cropdetect:

ffmpeg -i input.mp4 -vframes 10 -vf cropdetect -f null -

Sample output:

[Parsed_cropdetect_0 @ 0x7fcce1c04940] x1:246 x2:1681 y1:0 y2:1079 w:1424 h:1072 x:252 y:4 pts:2000 t:0.083333 crop=1424:1072:252:4

I then used the detected coordinates with vdx --crop, in this case:

vdx input.mp4 --crop 252,4,1424,1072

Maybe an idea for a built-in feature? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant