0

嘿伙计们,我试图使用 ffmpeg-python 向视频添加文本,但它在

[Parsed_drawtext_0 @ 0000012ea115ee80] Setting 'text' to value 'hi'

而且我不确定我能做些什么来解决这个问题。我尝试了纯 FFmpeg 命令行样式,但仍然遇到同样的问题,它Setting text to value在崩溃后只是输出一个 0byte mp4。

我的代码:

os.environ['FONTCONFIG_FILE'] = r'C:\Users\NOP\NOP\NOP\NOP\binaries\fonts\fonts.conf'
    os.environ['FONTCONFIG_PATH'] = r'C:\Users\NOP\NOP\NOP\NOP\binaries\fonts'
    os.environ['FC_CONFIG_DIR'] = r'C:\Users\NOP\NOP\NOP\NOP\binaries\fonts'
    in_ = ffmpeg.input(output_video_logo)
    in_ = in_.drawtext(text='hi')
    ffmpeg.output(in_, output_video).global_args('-loglevel', 'debug').run(cmd=FFMPEG_PATH)

字体配置文件:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>

<!--
    DO NOT EDIT THIS FILE.
    IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
    LOCAL CHANGES BELONG IN 'local.conf'.

    The intent of this standard configuration file is to be adequate for
    most environments.  If you have a reasonably normal environment and
    have found problems with this configuration, they are probably
    things that others will also want fixed.  Please submit any
    problems to the fontconfig bugzilla system located at fontconfig.org

    Note that the normal 'make install' procedure for fontconfig is to
    replace any existing fonts.conf file with the new version.  Place
    any local customizations in local.conf which this file references.

    Keith Packard
-->

<!-- Font directory list -->

    <dir>WINDOWSFONTDIR</dir>
    <dir>~/fonts</dir>
    <dir prefix="cwd">.</dir>
    <dir>~/.fonts</dir>

<!--
  Accept deprecated 'mono' alias, replacing it with 'monospace'
-->
    <match target="pattern">
        <test qual="any" name="family">
            <string>mono</string>
        </test>
        <edit name="family" mode="assign">
            <string>monospace</string>
        </edit>
    </match>

<!--
  Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
-->
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans serif</string>
        </test>
        <edit name="family" mode="assign">
            <string>sans-serif</string>
        </edit>
    </match>

<!--
  Accept deprecated 'sans' alias, replacing it with 'sans-serif'
-->
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans</string>
        </test>
        <edit name="family" mode="assign">
            <string>sans-serif</string>
        </edit>
    </match>

<!--
  Load local system customization file
-->
    <include ignore_missing="yes">conf.d</include>

<!-- Font cache directory list -->

    <cachedir>WINDOWSTEMPDIR_FONTCONFIG_CACHE</cachedir>
    <cachedir>~/.fontconfig</cachedir>

    <config>

<!--
  Rescan configuration every 30 seconds when FcFontSetList is called
 -->
        <rescan>
            <int>30</int>
        </rescan>
    </config>

</fontconfig>

这是我的任何字体配置或脚本的问题吗?我真的很想解决这个问题。

根据Rotem的要求,尝试向drawtext添加新输入,这是崩溃前的输出,没有错误消息:成功打开文件。

[Parsed_drawtext_0 @ 00000171a2f0f900] Setting 'box' to value '1'
[Parsed_drawtext_0 @ 00000171a2f0f900] Setting 'boxcolor' to value 'yellow'
[Parsed_drawtext_0 @ 00000171a2f0f900] Setting 'fontcolor' to value 'blue'
[Parsed_drawtext_0 @ 00000171a2f0f900] Setting 'fontsize' to value '72'
[Parsed_drawtext_0 @ 00000171a2f0f900] Setting 'text' to value 'hi'
[Parsed_drawtext_0 @ 00000171a2f0f900] Setting 'x' to value '10'
[Parsed_drawtext_0 @ 00000171a2f0f900] Setting 'y' to value '10'

完整日志: https ://pastebin.com/E6sHvwUz

4

0 回答 0