如何使用FFMPEG分割视频,以便每个块以关键帧开始? [英] How to split a video using FFMPEG so that each chunk starts with a key frame?

查看:1761
本文介绍了如何使用FFMPEG分割视频,以便每个块以关键帧开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要以大小相同的小块拆分大型实时WMV视频馈送。我们制作了一个很好的脚本,除了一件事情外,视频块不是以关键帧开始,所以当播放大多数视频块时,它们不会显示任何图像,直到原始视频的关键帧最终

We need to split a large live WMV video feed in small chunks all of the same size. We made a script that works fine doing this, except for one thing: the video chunks don't start with a key frame, so when playing most video chunks they don't display any image until a key frame from the original video is eventually reached.

有没有办法告诉ffmpeg使输出视频从关键帧开始?

Isn't there a way to tell ffmpeg to make the output video to start with a key frame?

以下是我们的命令行现在的样子:

Here is how our command lines look right now:

ffmpeg.exe -i "C:\test.wmv" -ss 00:00:00 -t 00:00:05 -acodec copy -vcodec copy -async 1 -y  "0000.wmv"
ffmpeg.exe -i "C:\test.wmv" -ss 00:00:05 -t 00:00:05 -acodec copy -vcodec copy -async 1 -y  "0001.wmv"

等等...

推荐答案

最新版本的FFMPEG包括一个新的选项 这完全符合我的想法。

The latest builds of FFMPEG include a new option "segment" which does exactly what I think you need.

ffmpeg -i INPUT.mp4 -acodec copy -f segment -vcodec copy -reset_timestamps 1 - map 0 OUTPUT%d.mp4

这产生了一系列编号的输出文件,它们根据关键帧分成段。在我自己的测试中,它运行良好,虽然我没有使用任何时间超过几分钟,只有MP4格式。

This produces a series of numbered output files which are split into segments based on Key Frames. In my own testing, it's worked well, although I haven't used it on anything longer than a few minutes and only in MP4 format.

这篇关于如何使用FFMPEG分割视频,以便每个块以关键帧开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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