Hey guys so im trying to use ffmpeg-python to add text to a video but its crashing at
[Parsed_drawtext_0 @ 0000012ea115ee80] Setting 'text' to value 'hi'
and I'm not sure what I can do to fix this problem. I tried pure FFmpeg command-line style and still the same issue where it gets stuck at Setting text to value
and it simply outputs a 0byte mp4 after crashing.
My code:
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)
Font config file:
<?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>
Is this a issue with any of my fontconfig or script? I'm really lost on fixing this.
As requested by Rotem tried adding new input to drawtext and this was the output before crashing with no error message: Successfully opened the file.
[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'
Full log: https://pastebin.com/E6sHvwUz