728x90
반응형
command
ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" -c:a copy output.mp4
- -i
- input.mp4 specifies the input video (input.mp4 being the input / original video in this case)
- -filter:v (can be abbreviated to -vf)
- specifies we're using a video filter
- "crop=W:H:X:Y"
- means we're using the "crop" video filter, with 4 values:
- w the width of the output video (so the width of the cropped region), which defaults to the input video width (input video width = iw, which is the same as in_w); out_w may also be used instead of w
- h the height of the output video (the height of the cropped region), which defaults to the input video height (input video height = ih, with in_h being another notation for the same thing); out_h may also be used instead of h
- x the horizontal position from where to begin cropping, starting from the left (with the absolute left margin being 0)
- y the vertical position from where to begin cropping, starting from the top of the video (the absolute top being 0)
- means we're using the "crop" video filter, with 4 values:
- output.mp4
- is the new, cropped video file
A few notes:
The filter will automatically center the crop if x and y are omitted, so x defaults to (iw-w)/2, and y to (ih-h)/2
- There is also an optional keep_aspect option that you can set to 1 to force the output display aspect ratio to be the same of the input (example usage: "crop=100:100:0:0:keep_aspect=1"). This won't work with images, that's why you don't see a separate example with screenshot here
- FFmpeg gets the original input video width (iw) and height (ih) values automatically, so you can perform mathematical operations using those values (e.g. iw/2 for half the input video width, or ih-100 to subtract 100 pixels from the input video height).
참고자료 1 : https://video.stackexchange.com/questions/4563/how-can-i-crop-a-video-with-ffmpeg
참고자료 2 : https://www.linuxuprising.com/2020/01/ffmpeg-how-to-crop-videos-with-examples.html
728x90
반응형
'Programming > Etc.' 카테고리의 다른 글
[OpenGL] How to write PYopenGL in to JPG image (0) | 2022.09.19 |
---|---|
[Ubuntu] 우분투 하드디스크 이름 변경 (0) | 2022.06.27 |
[FFmpeg] usb cam 이용하여 실시간 영상 저장하기 (0) | 2022.01.13 |
[LaTex] 기호 모음 (2) | 2021.08.09 |
[LaTex] Overleaf 에서 Latex 로 문서 편집하기 (0) | 2021.08.09 |