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

查看:634
本文介绍了FFMPEG:最后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?

感谢您的帮助

Greets

推荐答案

使用 -sseof 选项。从文档


-sseof position(输入/输出)

喜欢 -ss 选项,但相对于文件结尾。这是负值在文件中较早,0在EOF。

-sseof position (input/output)
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

请注意,在流复制模式(通过使用 -c copy 或等效),剪切将发生在最近的关键帧上,因此可能会削减您确切的所需时间。如果需要更多的准确性,您将不得不重新编码而不是流拷贝。

Note that in stream copy mode (by using -c copy 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天全站免登陆