通过 Vapoursynth
令 Adobe Premiere
使用 ffmpeg
作为编码器导出媒体
Adobe Premiere
自带的视频编码器一直以来都为人所诟病。若想 Pr
使用 ffmpeg
作为编码器导出媒体,通常的方法是使用帧服务器( Frameserver
)。然而,帧服务器所输出的数据不能直接送给 ffmpeg
使用。
解决这个问题的方法有很多。在中文网络上,笔者找到了两篇文章,均是使用 Avisynth
或改版 Avisynth+
接受 Frameserver
的输出并传递给 ffmpeg
进行处理的。下文将介绍如何使用 Vapoursynth
代替 Avisynth
。
PR使用FFmpeg作为编码器 · IceSandwich
https://icesandwich.github.io/2021/02/15/PR%E4%BD%BF%E7%94%A8FFMpeg%E4%BD%9C%E4%B8%BA%E7%BC%96%E7%A0%81%E5%99%A8/
在premiere中调用ffmpeg进行压制的经验 - 知乎
https://zhuanlan.zhihu.com/p/91852363
软件版本
操作系统为 Microsoft Windows 11 Professional 21H2
。
软件 | 版本 |
---|---|
Adobe Premiere | Pro 2022 |
Debugmode Frameserver | 3.1 |
Vapoursynth | R59 |
ffmpeg | 2022-07-14-git-882aac99d2-full_build-www.gyan.dev |
注: 3.1
版本的 Debugmode Frameserver
支持 64
位操作。也可选用 Advanced Frameserver
或收费的 Cumincode Frameserver
。
CuminCode
https://www.cumincode.com/frameserver/
操作流程
Premiere
在导出媒体时使用 Frameserver
及之前的操作不再赘述,可以参照上述两篇使用 Avisynth
的文章。操作到该步骤时,帧服务器已经启动,正在等待其它软件读取它的输出流。
此时我们应该使用 vspipe
读取 Frameserver
的输出流,并传递给 ffmpeg
进行处理。在此之前,一些无需重复进行的准备工作需要做好。 Vapoursynth
的安装及基本使用不再赘述。
为 Vapoursynth
安装 Avisource
插件
VapourSynth(VS) 视频处理压制入门教程 - 哔哩哔哩
https://www.bilibili.com/read/cv11955002/
执行命令
vsrepo.py install avisource
编写 Vapoursynth
脚本
新建脚本文件 test.vpy
(位置容后详述),代码如下。
from vapoursynth import core
core.avisource.AVISource('temp.avi').set_output()
其中 temp.avi
与 Premiere
中设置输出的视频文件要一致。具体也在上述两篇教程提及,不再赘述。脚本文件的位置要与 temp.avi
的位置一致,否则在代码中需要准确定位 temp.avi
的位置,较为繁琐。
执行命令
vspipe -c y4m test.vpy - | ffmpeg -i - -r 15 output.gif
上述命令是使用 Vapoursynth
的附带工具 vspipe
执行 test.vpy
脚本,通过管道将结果送给 ffmpeg
进行处理。处理完成后就能得到输出文件。