网站如何以编程方式呈现自定义视频?

How do websites render custom videos programatically?

我注意到许多网站(例如 https://biteable.com, https://animoto.com/apps/online-video-maker 等)本质上是在线视频编辑器,允许用户应用效果、添加自定义文本等并最终呈现视频。

我做了一些研究,但找不到关于这些网站如何以编程方式创建视频的任何高级答案。我看到提到“FFmpeg”,但这似乎只能完成基本任务,例如将一系列图像转换为视频(我错了吗?)。

我对视频渲染知之甚少,希望有人有想法让我开始研究。是否存在可以帮助完成这些网站正在做的事情的库?还是这些网站是从头开始使用低级语言来实现这一目标的?

basic tasks such as converting a series of images into a video

首先,是的,你错了。 Ffmpeg 可以做的更多。

其次,视频只是一系列帧。要制作程序化视频,您每秒制作一个程序化帧 30 次,然后将这些“图像”编码成视频。

I've seen mention of "FFmpeg", but this seems like it would only be able to accomplish basic tasks such as converting a series of images into a video (am I wrong?).

FFmpeg(ffmpeg 命令行工具或其 libav* 库的使用)可以完成示例视频中显示的很多内容,但如果您没有使用 FFmpeg 的经验,某些效果会很困难。会写算术表达式,对某些滤镜效果的操作会有帮助。

其次,ffmpeg不是编辑。它可以用于具有一些挑战的简单编辑,但这当然是可能的。

Are there libraries that exist that can aid to accomplish what these websites are doing?

MLT 框架 (melt) 是另一个示例。

Or are these websites starting from the ground up with lower-level languages to accomplish this?

未知。我认为我们无法回答这个问题。据我所知,他们没有透露任何流程细节,如果这里有人知道他们可能签署了保密协议。

他们的例子告诉我们什么

查看其中一个示例视频,我可以看出他们至少使用 FFmpeg 和 x264 进行编码:

$ ffmpeg -i Promo-video-created-with-Animoto-online-video-maker-bf8660fd0c.mp4
…
    encoder         : Lavf57.56.100

Lavf 是 libavformat 的别名,FFmpeg muxing/demuxing 库。 57.56.100 是 major.minor.micro 版本号。这个特定版本表明他们可能正在为该视频使用 FFmpeg 3.2 发布分支。

$ strings Promo-video-created-with-Animoto-online-video-maker-bf8660fd0c.mp4 | grep x264
x264 - core 123 r0+5540M 04d6470 - H.264/MPEG-4 AVC codec - Copyright 2003-2012 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0x1:0x111 me=umh subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=8 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=120 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=120 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 vbv_maxrate=5000 vbv_bufsize=10000 crf_max=0.0 nal_hrd=none ip_ratio=1.41 aq=1:1.00

使用过时的 x264 创建此示例,但该示例可能同样古老。他们使用 -crf 18 -maxrate 5000k -bufsize 10000k