0

I need to scale and crop a video from Python.

Scale is made to to match a target height while the vertical dimension scales accordingly in order not to distort the images. Finally, a crop is made to end up with the video in the desired spatial resolution. The ffmpeg command to do that in the shellis:

ffmpeg -i in.mp4 -vf "scale=-2:400,crop=600:400" out.mp4

I need to run this command from Python. Of course, Subprocess would be an option but I am not a fan of this solution. I would rather prefer to use ffmpeg-python bindings but I could not manage to write the equivalent command.

halfer
  • 19,824
  • 17
  • 99
  • 186
Mauro Gentile
  • 1,463
  • 6
  • 26
  • 37

0 Answers0