我可以从带有时间戳的图像创建VFR视频吗? [英] Can I create a VFR video from timestamped images?

查看:176
本文介绍了我可以从带有时间戳的图像创建VFR视频吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我从图像制作视频的经验几乎为零。

First, I have almost zero experience in making videos from images.

我所拥有的是一组BMP时间戳图像,我想根据这些图像生成视频。
因为时间戳记的间隔不相等,所以我不能简单地使用从图像创建恒定帧率视频的软件。

What I have is a set of BMP timestamped images from which I want to generate a video. Since the timestamps are not equally spaced, I cannot simply use software that create constant-frame-rate videos from images.

可能的解决方案是创建人造图像以固定的时间间隔进行,但是如果我无法制作VFR视频,我宁愿将其作为最后的选择。

A possible solution would be to create artificial images at fixed time intervals, but I prefer to leave that as a last resort if I fail to make a VFR video.

关于如何实现自己想要的任何建议?

Any suggestions on how to achieve what I want?

推荐答案

您可以使用两种工具的组合来做到这一点:ffmpeg和 mp4fpsmod

You can use a combination of two tools to do this: ffmpeg and mp4fpsmod

第1步是生成恒定帧率文件使用ffmpeg

Step 1 is to generate a constant frame rate file using ffmpeg

ffmpeg -i images%d.bmp -pix_fmt yuv420p ffmpeg-cfr.mp4

第2步是生成一个类似于以下内容的时间代码文件,每一行都包含一个文件的相对时间戳

Step 2 is to generate a timecode file like the one below, with each line containing the relative timestamp for a frame in milliseconds.

# timecode format v2

0
33
88
100
120
160
200
230
330
347

第3步是使用mp4fpsmod生成VFR文件

Step 3 is to use mp4fpsmod to generate the VFR file

mp4fpsmod -o vfr.mp4 -t timecodes.txt ffmpeg-cfr.mp4 

此文件播放符合 ffplay 的预期,但可能不适用于某些播放器,在这种情况下,可以运行

This file plays as expected with ffplay but may not with some players, in which case run

第4步使用FFmpeg从VFR生成CFR MP4

Step 4 Generate a CFR MP4 from the VFR using FFmpeg

ffmpeg -i vfr.mp4 final-cfr.mp4

这是一个CFR文件,但根据VFR保留了时间关系,但是如果有一些PTS调整的话,时间码间隔非常不规则。可以通过指定高帧速率 -r N

This is a CFR file but the temporal relations are preserved as per the VFR, although there will be some PTS adjustments, if the timecode intervals are very irregular. That can be remedied by specifying a high framerate -r N

这篇关于我可以从带有时间戳的图像创建VFR视频吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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