首页 > 解决方案 > Crop, Resize and Cut all in one command - FFMPEG

问题描述

I am trying to do three tasks with FFMPEG

  1. Crop a video without losing quality

  2. Resize (upscale) the cropped video with good quality

  3. 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

标签: ffmpeglossless-compression

解决方案


您可以使用单个过滤器链组合所有命令,并添加修剪

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

使用 crf 1,不需要慢速预设。


推荐阅读