我是 ffmpeg 的新手,听说它有一个黑色过滤器。我想删除视频顶部和底部的黑条,以便将视频裁剪为没有黑条的剩余视频。谢谢:)
llo*_*gan 60
cropdetect可用于为裁剪过滤器提供参数。在此示例中,跳过前 90 秒并处理 10 帧:
$ ffmpeg -ss 90 -i input.mp4 -vframes 10 -vf cropdetect -f null -
...
[Parsed_cropdetect_0 @ 0x220cdc0] x1:0 x2:1279 y1:0 y2:719 w:1280 h:720 x:0 y:0 pts:215 t:0.215000 crop=1280:720:0:0
[Parsed_cropdetect_0 @ 0x220cdc0] x1:0 x2:1279 y1:0 y2:719 w:1280 h:720 x:0 y:0 pts:257 t:0.257000 crop=1280:720:0:0
[Parsed_cropdetect_0 @ 0x220cdc0] x1:0 x2:1279 y1:0 y2:719 w:1280 h:720 x:0 y:0 pts:299 t:0.299000 crop=1280:720:0:0
Run Code Online (Sandbox Code Playgroud)
在每一行的末尾,你可以看到它说crop=1280:720:0:0
。所以根据cropdetect,我们可以使用crop=1280:720:0:0
.
ffplay
$ ffplay -vf crop=1280:720:0:0 input.mp4
Run Code Online (Sandbox Code Playgroud)
$ ffmpeg -i input.mp4 -vf crop=1280:720:0:0 -c:a copy output.mp4
Run Code Online (Sandbox Code Playgroud)
在此示例中,音频只是流复制(重新混合),因为您可能不需要重新编码它。
正如您在上面的ffplay
示例中看到的,一些播放器允许您在播放时进行裁剪。这样做的好处是:
归档时间: |
|
查看次数: |
25475 次 |
最近记录: |