Home computickets How to trim the image in ffmpeg?

How to trim the image in ffmpeg?

Author

Date

Category

How do I crop the image in ffmpeg?
It is necessary that, at the edges, he cut off unnecessary and left only the central part 600×600

I used the following code, but it is not what I need.
It squeezes it ..

set a = "your_files \ *.png"
SET B = "RESULT \ %% ~ NA.PNG"
SET C = FFMPEG
SET F = -S 600x600
For %% a in (% A%) DO (% C% --y -i "%% A"% f%% b%)

p.s. I will ask you not to offer me “ImageMagick” and so on ..
Thanks.


Answer 1, Authority 100%

I used several filters to achieve this effect.

  1. Change the size of the image with the aspect ratio so that its height is 600 pixels.
  2. cut out the middle part of the image with the aspect ratio from lev and from the right 1 to 1.
@ rem fitting any image to a height of 600 pixels
@Rem Customize any image under the height of 600 pixels
SET A = "Your_Files \ *.png"
SET B = "RESULT \ TEMP-1.PNG"
SET C = FFMPEG
SET F = -VF scale = -1: 600
For %% a in (% A%) DO (% C% --y -i "%% A"% f%% b%)
@Rem Cut Out The Desired Piece From The Image
@Rem cut the desired piece from the image
SET A = "RESULT \ TEMP-1.PNG"
SET B = "RESULT \ TEMP-2.PNG"
SET C = FFMPEG
SET F = -FILTER: V "CROP = 600/1: 600/1"
For %% a in (% A%) DO (% C% --y -i "%% A"% f%% b%)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions