봄 여름 가을 겨울 스포츠 막걸리

ffmpeg 본문

개발/linux

ffmpeg

앵두나무 우물가 2020. 3. 24. 15:19
728x90
반응형

crop

 

720x720으로 자르기

ffmpeg -i {input.file} -filter:v "crop=720:720" {out.file}

720x720으로 and time 자르기

ffmpeg -i {input.file} -ss 00:00:02 -t 00:00:10 -filter:v "crop=720:720" {out.file}

resize

720x720으로 줄이기(비율 유지)

ffmpeg -i {input.file} -s 720x720 -c:a copy {out.file}

 

trim

시작 : 1초

기간 :3초

 

-c copy : 스트림 복사를 통해서 트리밍 하는 방식으로 매우 빠름(resize나 crop와는 사용되지 않을 듯..)

ffmpeg -i {input.file}  -ss 00:00:01 -t 00:00:03 -c copy {out.file}

 

total

수정 필요

ffmpeg -i {input.file} -filter:v "crop=720:720" -ss 00:00:01 -t 00:00:03 -s 720x720 -c:a copy {out.file}
ffmpeg -i {input.file} -vf "scale=720:-1, crop=720:720" -ss 00:00:01 -t 00:00:03 -c copy {out.file}

reference

 

I am trying to do three tasks with FFMPEG

Crop a video without losing quality

Resize (upscale) the cropped video with good quality

Cut specific part of a the upscaled vided without losing quality

Here are the command line I use:

to crop: video og.mp4 to video og1.mp4

ffmpeg -i og.mp4 -vf "crop=1330:615:22:120" -c:v libx264 -crf 1 -preset veryslow -c:a copy og1.mp4

to resize: video og1.mp4 (converted above) to video og2.mp4

ffmpeg -i og1.mp4 -vf scale=1920:-1 -c:v libx264 -crf 1 -preset veryslow -c:a copy og2.mp4

to cut: video og2.mp4 (converted above) to og3.mp4

ffmpeg -i og2.mp4 -ss 00:00:08.190 -t 00:00:11.680 -c:v libx264 -crf 1 -preset veryslow -c:a copy og3.mp4

I want to achieve highest quality of 1920 width video (irrespective of height and size of the file)

Is there a way to get the above tasks in one command or shorter time with best quality?

Also advice if there is a better command or parameters to be used.

Thanks

 

 

You can combine all commands by using a single filterchain, and adding the trim as well

ffmpeg -ss 8.190 -t 11.680 -i og.mp4 -vf "crop=1330:615:22:120,scale=1920:-2" -c:v libx264 -crf 1 -c:a copy og1.mp4

728x90
반응형

'개발 > linux' 카테고리의 다른 글

gitlab push and build  (0) 2020.06.15
image size 조절하기  (0) 2019.07.18
대량의 파일 이름 바꾸기  (0) 2019.07.02
Comments