Log in

View Full Version : Muxing fonts only present in .ass file


Tschizzey
5th December 2022, 20:32
Hi all,

I have some .ass subtitles, each using different fonts.
I want to mux each subtitle and the matching fonts into different video files (mkv container).
I want to do this without adding all the fonts into the container, instead adding only those that are actually listed in the .ass file.
Since there are a lot of subtitles and I don't want to open them one by one and pick the fonts that are alike, I'm searching for a different method.
For example if there was a method where the same fonts could be copied into separate folders using a script or batch file, that would be the best.
I have no coding experience sadly. Also I'm on Win 10.

Can you help me?

Tschizzey
22nd January 2023, 20:47
If anyone reads this in the future, I managed to solve my problem with a Linux command a friend gave me.

for x in *ass; do cat "$x" | grep 'Style:' | awk -F, '{ print $2 }' | sed '/^$/d' | sort -u > "$x".txt; done

I'm using a Ubuntu VM.

Ninelpienel
2nd February 2023, 13:17
There is an easier way:

https://github.com/moi15moi/FontCollector


fontCollector -i "subtitle_episode_01.ass" -o "C:\fonts_for_episode_01" --additional-fonts "C:\all_fonts"


You can loop through the folder with commands like this (batch file):


SET attachments=
FOR /F "delims=" %%f IN ('DIR /B /S "fonts_for_episode_01\*.ttf"') DO (
SET attachments=%attachments% --attach-file "%%f"
)
FOR /F "delims=" %%f IN ('DIR /B /S "fonts_for_episode_01\*.otf"') DO (
SET attachments=%attachments% --attach-file "%%f"
)


and using the variable %attachments% in your muxing script.