我最近遇到了同样的问题,TJ Rana 让我朝着正确的方向前进,但这是在 MacOS 上安装 flite 的整个过程(此处为原始文章):
Flitevox 或 Flitelib 是一个开源的小型运行时语音引擎。将文本传递给它并创建一个带有机器人说它的音频文件。对于某些项目来说真的很酷而且很有用。
Flitelib 不是 FFmpeg 构建中或源内部可用的本机过滤器。虽然文档说明配置需要–enable-libflite,但在安装FFmpeg 之前需要安装flitelib。如果您尝试启用过滤器,您将收到此错误:
$ ./configure --disable-indevs --enable-libflite --enable-cross-compile
ERROR: libflite not found
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
在这篇文章中,我将向您展示如何安装 flite 并使其与 FFmpeg 一起使用
首先从源代码下载 flitevox 并安装:
$ git clone https://github.com/festvox/flite.git
$ cd flite/
$ ./configure
$ make
$ sudo make install
如果您正在运行 linux,则此安装可以完美运行。如果你运行的是 MacOS,你会得到这个错误:
$ sudo make install
Password:
Installing
mkdir -p /usr/local/bin
mkdir -p /usr/local/lib
mkdir -p /usr/local/include/flite
/usr/bin/install -c -m 644 include/*.h /usr/local/include/flite
/usr/bin/install -c -m 755 ../bin/flite_time /usr/local/bin
cp -pd ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_kal.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_time_awb.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_kal16.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_awb.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_rms.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_us_slt.a ../build/x86_64-darwin19.0.0/lib/libflite_usenglish.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_indic_lang.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_grapheme_lang.a ../build/x86_64-darwin19.0.0/lib/libflite_cmulex.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_indic_lex.a ../build/x86_64-darwin19.0.0/lib/libflite_cmu_grapheme_lex.a ../build/x86_64-darwin19.0.0/lib/libflite.a /usr/local/lib
cp: illegal option -- d
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make[1]: *** [install] Error 64
make: *** [install] Error 2
那是因为 MacOS 使用与 linux 不同的“cp”变量。我在解决方案中找到了这个 Stack Overflow 答案:https ://stackoverflow.com/a/29075638/525576但这里是修复它的步骤。
在“flite/main”文件夹中,您需要使用 MacOS 版本的命令编辑 Makefile:
$ cd main/
$ vim Makefile
替换以下内容(来自 TJ Rana):
# The libraries: static and shared (if built)
cp -pd $(flite_LIBS_deps) $(INSTALLLIBDIR)
ifdef SHFLAGS
cp -pd $(SHAREDLIBS) $(VERSIONSHAREDLIBS) $(INSTALLLIBDIR)
endif
到(-pd 到 -pR):
# The libraries: static and shared (if built)
cp -pR $(flite_LIBS_deps) $(INSTALLLIBDIR)
ifdef SHFLAGS
cp -pR $(SHAREDLIBS) $(VERSIONSHAREDLIBS) $(INSTALLLIBDIR)
endif
我们如何尝试再次安装 flite:
$ sudo make install
flite 不应该显示任何错误并且安装应该完成。
现在回到 ffmpeg 源过滤器:
$ ./configure --enable-libflite --enable-cross-compile
$ make install
安装将完成。要测试 flite 是否正常工作,请打开一个新终端并输入:
$ ffplay -f lavfi -i flite=text='Hello World!'
你好世界会说话!