Tips for `ass’

doc

https://ffmpeg.org/ffmpeg-filters.html#subtitles-1, https://ffmpeg.org/ffmpeg-filters.html#ass, https://en.wikipedia.org/wiki/SubStation_Alpha, http://moodub.free.fr/video/ass-specs.doc

General

Don’t expect too much to it.

Certainly it can do more than “SubRip”, but what can be done by explaining the specifications is quite limited, moreover, IMO, the implementation of the built-in ass engine in ffmpeg is incomplete.

For portability, give up.

Some media players such as “VLC media player” can read this and overlay it, but the ffmpeg’s ass engine and those players’ engines are different, and the compatibility seems to be quite incomplete.

For example, “Media Player Classic” rejects “ass” handled with ffmpeg without problems. For example, using “Drawing commands” described in the specification, results are quite different from those of ffmpeg and those of “Media Player Classic”. (It is probably ffmpeg that does not behave as described in the specification.)

Because using “ass” in ffmpeg is to embed as an image, if you do not intend to distribute the “ass file” alone, don’t think deeply about this fact, in other words, don’t think about distributing the “ass file” created for ffmpeg.

Features that don’t work I found

I think the followings don’t work.

I can not deny the possibility that I misunderstood because the explanation of the specification is unclear. However, for all listed here, it is a conclusion that has been drawn after at least one hour of trial and error.

`Synch Point’ in [Script Info] section

According to the explanation, I think it is the following usage:

[Script Info]
PlayResX: 1280
PlayResY: 720
Synch Point: 0:00:05.00

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, Alignment, Encoding
Style: Expl, Arial,60,&HFFB0B0,5,0

[Events]
Format: Layer, Start, End, Style, Text
Dialogue: 0,00:00:00.00,00:00:25.00,Expl,{\pos(640,640)}Start is 00:00:00, "Synch Point" is 00:00:05.
#! /bin/sh
pref="`basename $0 .sh`"
pygmentize -g -o ${pref}.png -O "hl_lines=4 12,line_numbers=False" ${pref}.ass
#
ffmpeg -y -i ${pref}.png -filter_complex "
color=black:s=1280x720:d=30[bg];
[0:v]scale=1024:-1,pad='1280:720:abs(iw-ow)/2:abs(ih-oh)/2',loop=-1:size=2[fg];
[bg][fg]overlay=shortest=1
,drawtext='fontsize=80:fontcolor=white:x=340:y=50:text=%{pts\:hms}'
,subtitles=${pref}.ass
" ${pref}.mp4

However, “Synch Point” seems to have no effect at all.

All events except but Dialogue seems not to be implemented

As far as I read an explanation that is extremely difficult to read, perhaps the usage of the “Picture” event looks like this:

[Script Info]
PlayResX: 1280
PlayResY: 720
WrapStyle: 1

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, OutlineColour, BackColour, BorderStyle, Outline, Shadow, Alignment, Encoding
Style: Expl, Arial,44,&H00FFB0B0,&H00CC7070,&H00333333,1,1,1,7,0

[Graphics]
filename: energymass.jpg
M_]C_X  02D9)1@ ! @   0 !  #__@ 03&%V8S4W+C@Y+C$P, #_VP!#  @&M!@<&!P@(" @(" D)"0
H*"@D)"0D*"@H*"@H,# P*"@H*"@H*# P,# T.#0T-M# T.#@\/#Q(2$1$5%149&1__Q &B   !!0$!
0$! 0           0(#! 4&M!P@)"@L!  ,! 0$! 0$! 0$        ! @,$!08'" D*"Q   @$# P($
 P4%M! 0   %] 0(#  01!1(A,4$&$U%A!R)Q%#*!D:$((T*QP152T? D,V)R@@D*M%A<8&1HE)B<H*2
HT-38W.#DZ0T1%1D=(24I35%565UA96F-D969G:&EJ<W1UM=G=X>7J#A(6&AXB)BI*3E)66EYB9FJ*CI
*6FIZBIJK*SM+6VM[BYNL+#Q,7&MQ\C)RM+3U-76U]C9VN'BX^3EYN?HZ>KQ\O/T]?;W^/GZ$0 " 0($
! ,$!P4$M!  ! G<  0(#$00%(3$&$D%1!V%Q$R(R@0@40I&AL<$)(S-2\!5B<M$*%B0TMX27Q%Q@9&B
8G*"DJ-38W.#DZ0T1%1D=(24I35%565UA96F-D969G:&EJ<W1UM=G=X>7J"@X2%AH>(B8J2DY25EI>8F
9JBHZ2EIJ>HJ:JRL[2UMK>XN;K"P\3%MQL?(R<K2T]35UM?8V=KBX^3EYN?HZ>KR\_3U]O?X^?K_P  1
"  + "D# 1( M A(  Q( _]H # ,!  (1 Q$ /P#V/2?%^AZ[<_9M/NI+ABES)'*+2]2UN([.M=+>XDM
+V2!+.Z2*:1$9K>60?,".*\?\ A#,UC\1?$VA6PC@TW3TUB."WBBC1MBL.LP)";F<*+B[>%&=(7NY)GB
1W5" QR  'L$_C/PM:S2P3^(=#AFA=HY8I=M3LDDCD1BKQR(TP975@0RL 01@T3^$].N9I9GN-<#2NTC
"+Q%X@AC#.Q8B.&'M44BC3)^5(U5%'"@"@  DO?%6A:?HSZ[+J%N^E1[<WML3=PG=.+<;#:"8O^^/MEG
8#M.<XP:S_ !;9Q:?X'\16T37#I'H>K8:YNKF[F.ZTG8[[B[EFN'Y/&]SMM&%&  *   M?B%X<O'@2*;
4#]H^Q&)WT76XH2NI3>392&>6P2%(KJ7Y(97=8WM(.&X->0?%NRM]'T_6;W3T^PW$?C'0[>*2U9X?)AT
_P )Q26B0+&52'[.\\ACM,2JPR.<*N   [_QW?Z=XNTZ?2--TJXU[5K:>YFL8)H9;*SBO-.E:RFO3<:B
EMOIU]%8SS>7+;*URDSLJ/'L+,O)_"?5;Z'QYKOAB.XD71-%378]/L 1Y<"_VWL!@L^/-G=0S!'N'D=
S!2 QR  'FG_"DOB'_T O\ RHZ3_P#)M?7]  !__]D

[Events]
Format: Layer, Start, End, Style, Text
Dialogue: 0,00:00:00.00,00:30:00.00,Expl,{\pos(10,10)}Is this correct?
Picture: 0,00:00:00.00,00:30:00.00,Expl,energymass.jpg

However, my trial and error have not been successful. It has not been implemented at this time (4.2dev), I think.

How-to

How can I use superscripts and subscripts?

See “Is there a way to render math only with ffmpeg?”. The story is probably the same for “ruby”, which expresses Kanji reading.

Citating programming code snippet

See Showing the source code of programming launguage as video.