我正在尝试使用 FFMPEG 修剪/切断视频的最后 3 秒,但这确实令人头疼。
以下代码修剪但仅保留最后 3 秒。我不想保留 3 秒,我不需要那个,我想保留已删除的部分。
ffmpeg -sseof -3 -i input.mp4 output.mp4
有人可以帮我提供正确的代码吗?我还想请求一个批处理代码,该代码将自动修剪我文件夹中所有最后 3 秒的视频。谢谢您的帮助。
I don't think ffmpeg allows a "from end" spec for duration. You'll have to detect the video's duration yourself and subtract 3 seconds.
ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0"
You can do this in a script. For example in bash:
dur=$(ffprobe -i input.mp4 -show_entries format=duration -v quiet -of csv="p=0")
trim=$((dur - 3))
ffmpeg -t $trim -i input.mp4 output.mp4
用
ffmpeg -i input.mp4 -ss 3 -i input.mp4 -c copy -map 1:0 -map 0 -shortest -f nut - | ffmpeg -f nut -i - -map 0 -map -0:0 -c copy out.mp4
| 归档时间: | 
 | 
| 查看次数: | 8772 次 | 
| 最近记录: |