FFMPEG:获取最后 10 秒 [英] FFMPEG: get last 10 seconds

查看:25
本文介绍了FFMPEG:获取最后 10 秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取我不知道长度的视频的最后 10 秒,然后将这 10 秒保存为新视频.这可以使用 ffmpeg 命令提示符吗?如果是这样,如何?

I'm trying to get the 10 last seconds of a video of which I dont know the length and then save those 10 seconds as a new video. Is this do able with the ffmpeg command prompt? And if so, how?

感谢您的帮助

问候

推荐答案

使用 -sseof 输入选项.来自文档:

Use the -sseof input option. From the documentation:

-sseof 位置(输入)
类似于 -ss 选项,但相对于文件结尾".也就是说负值在文件中较早,0 在 EOF.

-sseof position (input)
Like the -ss option but relative to the "end of file". That is negative values are earlier in the file, 0 is at EOF.

示例:

ffmpeg -sseof -10 -i input.mp4 output.mp4

注意在流复制模式下(通过使用-ccopy 输出选项或等效项)剪切将发生在最近的关键帧上,因此它可能会在您想要的确切时间进行剪切.如果需要更高的准确性,您将不得不重新编码而不是流复制.

Note that in stream copy mode (by using the -c copy output option or equivalent) the cut will occur on the nearest keyframe, so it may cut on your exact desired time. If more accuracy is needed you will have to re-encode instead of stream copy.

这篇关于FFMPEG:获取最后 10 秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆