ffmpeg - Crop, Resize and Cut all in one command - FFMPEG
问题描述
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
解决方案
您可以使用单个过滤器链组合所有命令,并添加修剪
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
,不需要慢速预设。
推荐阅读
- hive - 查找用户花费最多时间的邮政编码
- r - 使用 R 重命名数据框中的列
- excel - 如果每个工作表中的字符串匹配,则修复删除行
- c++ - How to Save and Restore a Neural Network (ClientSession) with a purly C++ API?
- sql - Insert records into Spark SQL table
- ms-access - 通过另一个表单上的子表单从表中删除记录
- haskell - 使用正则表达式捕获组名
- react-native - 在本机反应中样式化自定义组件
- azure - 代表使用 msal 从 Web 应用程序调用 azure 函数
- c# - ASP.NET Core WebAPI 2019 年进行地理编码和反向地理编码的最新和最佳方法