FFmpeg "ass" filter not working

11,623

I had this problem too. I think it's because the static build I've got for windows doesn't include the fontconfig files.

I copied a default fonts.conf file from this discussion on Zeranoe FFmpeg into my a folder called "conf" that I put in my ffmpeg folder and I set the environmental variables thusly:

FC_CONFIG_DIR=C:\Program Files\ffmpeg\conf
FONTCONFIG_FILE=C:\Program Files\ffmpeg\conf\fonts.conf
FONTCONFIG_PATH=C:\Program Files\ffmpeg\conf

(The way that successfully changed the variables permanently for me was to type "environment" into the search field on the windows menu and choose "edit environmental variables for your account", or you can get there through the control panel).

Here's the contents of the fonts.conf file I'm using (I think the most important bit is the <dir> section at the start. More info about fontconfig at http://fontconfig.org ).

<?xml version="1.0"?>
<fontconfig>

<dir>C:\WINDOWS\Fonts</dir>

<match target="pattern">
<test qual="any" name="family"><string>mono</string></test>
<edit name="family" mode="assign"><string>monospace</string></edit>
</match>

<match target="pattern">
<test qual="all" name="family" compare="not_eq"><string>sans-serif</string></test>
<test qual="all" name="family" compare="not_eq"><string>serif</string></test>
<test qual="all" name="family" compare="not_eq"><string>monospace</string></test>
<edit name="family" mode="append_last"><string>sans-serif</string></edit>
</match>

<alias>
<family>Times</family>
<prefer><family>Times New Roman</family></prefer>
<default><family>serif</family></default>
</alias>
<alias>
<family>Helvetica</family>
<prefer><family>Arial</family></prefer>
<default><family>sans</family></default>
</alias>
<alias>
<family>Courier</family>
<prefer><family>Courier New</family></prefer>
<default><family>monospace</family></default>
</alias>
<alias>
<family>serif</family>
<prefer><family>Times New Roman</family></prefer>
</alias>
<alias>
<family>sans</family>
<prefer><family>Arial</family></prefer>
</alias>
<alias>
<family>monospace</family>
<prefer><family>Andale Mono</family></prefer>
</alias>
<match target="pattern">
<test name="family" compare="eq">
<string>Courier New</string>
</test>
<edit name="family" mode="prepend">
<string>monospace</string>
</edit>
</match>
<match target="pattern">
<test name="family" compare="eq">
<string>Courier</string>
</test>
<edit name="family" mode="prepend">
<string>monospace</string>
</edit>
</match>

</fontconfig>

Also I found that the filter didn't like windows style backslashes in the path. so when I typed vf ass="..\subtitles\subs.ass it gave me an error opening filters error, until I replaced the backslashes with forward slashes.

Share:
11,623

Related videos on Youtube

TUSF
Author by

TUSF

Updated on September 18, 2022

Comments

  • TUSF
    TUSF almost 2 years

    I'm haveing a bit of a problem when trying to use FFmpeg. I've mostly been using it to extract clips from videos and such. However, I've been trying to get some subtitles embedded (hardsubs) into the video.

    The FFMpeg documentation told me I should use the "ass" video filter, and I tried it as shown but to no avail. There's no change. The video doesn't have the subtitles on it; they don't even show up as a stream in the file. I may as well not have included the filter.

    This is the line I'm using, which isn't working. The file has no audio stream attached.

    ffmpeg -i input.webm -vf ass=subs.ass -b:v 1200K out.webm
    

    I know that the subtitles should work. When I manually load them from my video player, or even mux them together into the file, they display just fine. But for some reason ffmpeg refuses to burn the subtitles into the video itself.

    However, there is a bit of an error I'm getting, that doesn't normally appear, and I have NO idea what it's talking about.

    Fontconfig error: Cannot load default config file

    [Parsed_ass_0 @ 00000000042c33c0] No usable fontconfig configuration file found, using fallback.

    Fontconfig error: Cannot load default config file

    [Parsed_ass_0 @ 00000000042c33c0] Added subtitle file: 'subs.ass' (3 styles, 68 events)

    Any help regarding this would be greatly appreciated. (If it helps, I'm using the windows version of ffmpeg)

    Edit: Here's a MediaFire link of the ,ass file. (You'll notice the subtitles themselves are less than serious.)

    ffmpeg version N-65366-g1c59419 Copyright (c) 2000-2014 the FFmpeg developers
      built on Aug  6 2014 22:09:19 with gcc 4.8.3 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
    enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
    modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
    b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
    r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
    able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
     --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
    libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
      libavutil      52. 98.100 / 52. 98.100
      libavcodec     55. 73.100 / 55. 73.100
      libavformat    55. 51.101 / 55. 51.101
      libavdevice    55. 13.102 / 55. 13.102
      libavfilter     4. 11.102 /  4. 11.102
      libswscale      2.  6.100 /  2.  6.100
      libswresample   0. 19.100 /  0. 19.100
      libpostproc    52.  3.100 / 52.  3.100
    Input #0, matroska,webm, from 'input.webm':
      Metadata:
        encoder         : Lavf55.41.100
      Duration: 00:00:04.10, start: 0.000000, bitrate: 2465 kb/s
        Stream #0:0: Video: vp8, yuv420p, 620x924, SAR 1:1 DAR 155:231, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
    File 'out.webm' already exists. Overwrite ? [y/N] y
    Fontconfig error: Cannot load default config file
    [Parsed_ass_0 @ 00000000043933a0] No usable fontconfig configuration file found, using fallback.
    Fontconfig error: Cannot load default config file
    [Parsed_ass_0 @ 00000000043933a0] Added subtitle file: 'subs.ass' (3 styles, 68 events)
    [libvpx @ 00000000043ccf00] v1.3.0
    Output #0, webm, to 'out.webm':
      Metadata:
        encoder         : Lavf55.51.101
        Stream #0:0: Video: vp8 (libvpx), yuv420p, 620x924 [SAR 1:1 DAR 155:231], q=-1--1, 1200 kb/s, 29.97 fps, 1k tbn, 29.97 tbc (default)
        Metadata:
          encoder         : Lavc55.73.100 libvpx
    Stream mapping:
      Stream #0:0 -> #0:0 (vp8 (native) -> vp8 (libvpx))
    Press [q] to stop, [?] for help
    frame=    7 fps=0.0 q=0.0 size=      72kB time=00:00:00.23 bitrate=2512.2kbits/s
    frame=   13 fps= 10 q=0.0 size=      95kB time=00:00:00.43 bitrate=1799.3kbits/s
    frame=   19 fps=9.7 q=0.0 size=     128kB time=00:00:00.63 bitrate=1656.4kbits/s
    frame=   25 fps=9.9 q=0.0 size=     144kB time=00:00:00.83 bitrate=1415.2kbits/s
    frame=   30 fps=9.9 q=0.0 size=     165kB time=00:00:01.00 bitrate=1351.3kbits/s
    frame=   37 fps= 10 q=0.0 size=     193kB time=00:00:01.23 bitrate=1281.2kbits/s
    frame=   42 fps= 10 q=0.0 size=     208kB time=00:00:01.40 bitrate=1216.8kbits/s
    frame=   48 fps= 10 q=0.0 size=     237kB time=00:00:01.60 bitrate=1213.7kbits/s
    frame=   52 fps= 10 q=0.0 size=     253kB time=00:00:01.73 bitrate=1196.9kbits/s
    frame=   57 fps= 10 q=0.0 size=     281kB time=00:00:01.90 bitrate=1211.0kbits/s
    frame=   60 fps=9.7 q=0.0 size=     301kB time=00:00:02.00 bitrate=1232.0kbits/s
    frame=   66 fps=9.9 q=0.0 size=     326kB time=00:00:02.20 bitrate=1211.3kbits/s
    frame=   70 fps=9.7 q=0.0 size=     347kB time=00:00:02.33 bitrate=1218.0kbits/s
    frame=   73 fps=9.3 q=0.0 size=     386kB time=00:00:02.43 bitrate=1297.3kbits/s
    frame=   78 fps=9.3 q=0.0 size=     406kB time=00:00:02.60 bitrate=1276.3kbits/s
    frame=   81 fps=9.0 q=0.0 size=     418kB time=00:00:02.70 bitrate=1266.3kbits/s
    frame=   85 fps=8.9 q=0.0 size=     441kB time=00:00:02.83 bitrate=1274.6kbits/s
    frame=   90 fps=9.0 q=0.0 size=     456kB time=00:00:03.00 bitrate=1243.3kbits/s
    frame=   94 fps=8.9 q=0.0 size=     476kB time=00:00:03.13 bitrate=1244.1kbits/s
    frame=   99 fps=8.9 q=0.0 size=     502kB time=00:00:03.30 bitrate=1246.1kbits/s
    frame=  102 fps=8.8 q=0.0 size=     510kB time=00:00:03.40 bitrate=1228.5kbits/s
    frame=  107 fps=8.8 q=0.0 size=     533kB time=00:00:03.57 bitrate=1224.1kbits/s
    frame=  113 fps=8.9 q=0.0 size=     559kB time=00:00:03.77 bitrate=1215.0kbits/s
    frame=  118 fps=8.8 q=0.0 size=     578kB time=00:00:03.93 bitrate=1202.5kbits/s
    frame=  123 fps=8.9 q=0.0 size=     603kB time=00:00:04.10 bitrate=1204.6kbits/s
    frame=  123 fps=8.8 q=0.0 Lsize=     604kB time=00:00:04.10 bitrate=1204.7kbits/s
    video:602kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.224451%
    
    • Elisa Cha Cha
      Elisa Cha Cha almost 10 years
      Please provide the ass file and the complete ffmpeg console output.
    • Daniel B
      Daniel B almost 10 years
      Are you sure fontconfig is even installed? Where did you get ffmpeg from? What system are you on?
    • TUSF
      TUSF almost 10 years
      I actually have no idea what fontconfig is. I'm using Windows, and using the "Static" build of ffmpeg available on the main site. Does that have something to do with the problem?
    • TUSF
      TUSF almost 10 years
      I see. Well, the Read Me file claims the build was configured with "--enable-fontconfig". What sort of configuration am I missing exactly?
    • Elisa Cha Cha
      Elisa Cha Cha almost 10 years
      Works for me in Linux using ffmpeg version N-65350-g40a820d. I don't have --enable-fontconfig. I'm not sure what to recommend for Windows users. Perhaps Zeranoe FFmpeg Forum or ffmpeg-user mailing list may help. Might be worth trying the subtitles filter if that makes a difference.
    • TUSF
      TUSF almost 10 years
      Using both the "ass" and "subtitles" filter give me the same result; nothing.