3

This question pertains only to Linux and FreeBSD.

I have several soft subbed anime mkv files that I need to hardsub. they are all using .ass subtitles with embedded fonts. for example mkvinfo on one of them gives me:

+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ EBML maximum ID length: 4
|+ (Unknown element: EBMLMaxSizeLength; ID: 0x42f3 size: 4)
|+ Doc type: matroska
|+ Doc type version: 2
|+ Doc type read version: 2
+ Segment, size 622344259
|+ Seek head (subentries will be skipped)
|+ EbmlVoid (size: 4013)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v1.0.0 + libmatroska v1.0.0
| + Writing application: mkvmerge v4.4.0 ('Die Wiederkehr') built on Oct 31 2010 21:52:48
| + Duration: 1384.853s (00:23:04.853)
| + Date: Sat Jun 18 05:53:42 2011 UTC
| + Segment UID: 0xb4 0x1e 0xa7 0x16 0x2e 0xe2 0x35 0x46 0x9b 0xb6 0x7c 0x35 0x18 0x69 0x84 0xc6
|+ Segment tracks
| + A track
|  + Track number: 1
|  + Track UID: 1
|  + Track type: video
|  + Lacing flag: 0
|  + MinCache: 1
|  + Codec ID: V_MPEG4/ISO/AVC
|  + CodecPrivate, length 42
|  + Default duration: 41.708ms (23.976 fps for a video track)
|  + Language: jpn
|  + Name: Cee - 10
|  + Video track
|   + Pixel width: 1280
|   + Pixel height: 720
|   + Display width: 1280
|   + Display height: 720
| + A track
|  + Track number: 2
|  + Track UID: 952275621
|  + Track type: audio
|  + Codec ID: A_AAC
|  + CodecPrivate, length 2
|  + Default duration: 21.333ms (46.875 fps for a video track)
|  + Language: jpn
|  + Name: AAC 2.0
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 2
| + A track
|  + Track number: 3
|  + Track UID: 608595611
|  + Track type: subtitles
|  + Lacing flag: 0
|  + Codec ID: S_TEXT/ASS
|  + CodecPrivate, length 2214
|  + Name: ass
|+ EbmlVoid (size: 1120)
|+ Attachments
| + Attached
|  + File name: Helvetica CE Regular.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 52412
|  + File UID: 3055405240
| + Attached
|  + File name: l_10646.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 325400
|  + File UID: 1366813323
| + Attached
|  + File name: PURIB10.TTF
|  + Mime type: application/x-truetype-font
|  + File data, size: 23232
|  + File UID: 1837754524
| + Attached
|  + File name: TIMESS_.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 253852
|  + File UID: 1030865051
| + Attached
|  + File name: aeaswfte.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 46900
|  + File UID: 3926331521
| + Attached
|  + File name: arialbd.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 751104
|  + File UID: 2840438428
| + Attached
|  + File name: GaramondPremrPro.otf
|  + Mime type: application/x-truetype-font
|  + File data, size: 359040
|  + File UID: 2335914165
| + Attached
|  + File name: l_10646.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 325400
|  + File UID: 3148854668
| + Attached
|  + File name: arial.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 772192
|  + File UID: 488371860
| + Attached
|  + File name: PURIB10.TTF
|  + Mime type: application/x-truetype-font
|  + File data, size: 23232
|  + File UID: 1014572700
| + Attached
|  + File name: PURIBI10.TTF
|  + Mime type: application/x-truetype-font
|  + File data, size: 24696
|  + File UID: 400339132
| + Attached
|  + File name: subpear.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 75704
|  + File UID: 3123006086
| + Attached
|  + File name: Syntax.otf
|  + Mime type: application/x-truetype-font
|  + File data, size: 21700
|  + File UID: 3519688351
| + Attached
|  + File name: TIMESS__.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 253852
|  + File UID: 2672448677
| + Attached
|  + File name: aeaswfte.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 46900
|  + File UID: 3495655056
| + Attached
|  + File name: curswfte.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 50696
|  + File UID: 2317778051
| + Attached
|  + File name: PURI10.TTF
|  + Mime type: application/x-truetype-font
|  + File data, size: 23492
|  + File UID: 239740086
|+ Chapters
| + EditionEntry
|  + EditionFlagHidden: 0
|  + EditionFlagDefault: 0
|  + EditionUID: 721729707
|  + ChapterAtom
|   + ChapterUID: 3979152268
|   + ChapterTimeStart: 00:00:00.000000000
|   + ChapterFlagHidden: 0
|   + ChapterFlagEnabled: 1
|   + ChapterDisplay
|    + ChapterString: EVERYONE IS GETTING HACKED
|    + ChapterLanguage: eng
|  + ChapterAtom
|   + ChapterUID: 540927916
|   + ChapterTimeStart: 00:01:11.071000000
|   + ChapterFlagHidden: 0
|   + ChapterFlagEnabled: 1
|   + ChapterDisplay
|    + ChapterString: then again
|    + ChapterLanguage: eng
|  + ChapterAtom
|   + ChapterUID: 68503466
|   + ChapterTimeStart: 00:02:40.994000000
|   + ChapterFlagHidden: 0
|   + ChapterFlagEnabled: 1
|   + ChapterDisplay
|    + ChapterString: it can't be helped.
|    + ChapterLanguage: eng
|  + ChapterAtom
|   + ChapterUID: 1400111522
|   + ChapterTimeStart: 00:14:31.954000000
|   + ChapterFlagHidden: 0
|   + ChapterFlagEnabled: 1
|   + ChapterDisplay
|    + ChapterString: ICE CREAM
|    + ChapterLanguage: eng
|  + ChapterAtom
|   + ChapterUID: 1320654241
|   + ChapterTimeStart: 00:14:46.969000000
|   + ChapterFlagHidden: 0
|   + ChapterFlagEnabled: 1
|   + ChapterDisplay
|    + ChapterString: animu
|    + ChapterLanguage: eng
|  + ChapterAtom
|   + ChapterUID: 1532255160
|   + ChapterTimeStart: 00:21:35.502000000
|   + ChapterFlagHidden: 0
|   + ChapterFlagEnabled: 1
|   + ChapterDisplay
|    + ChapterString: money never sleeps, kid!
|    + ChapterLanguage: eng
|+ EbmlVoid (size: 101)
|+ Cluster

as you can see there are a lot of embedded fonts which are used in this mkv. I have spent 8 hours so far tring to find out how to get mencoder to properly encode this file to an avi that has the embedded fonts used in the video stream. Even though I have extracted the fonts using mkvextract, copied them to my ~/.fonts directory, and fc-cache -v ~/.fonts for fontconfig, the best I can get is for mencoder to create a file using mencoder's default sub font.

I know that there must be a way to do this.

I would prefer an answer that makes use of only cli tools. Also I would prefer to avoid avidemux like the plague since it likes to crash when dealing with .ass subs [though any suggestions are welcome].

2 Answers 2

0

I'm surprised you havne't tried VirtualDub, which would be the strongest alternative. It works fine under WINE.

2
  • 1
    i need a command line tool b/c my high horsepower machine runs freebsd. i would prefer it if people actually read the whole question as opposed to replying as fast as possible: "run avisynth or virtualdub under wine"
    – Jeff
    Jul 2, 2011 at 5:28
  • Ummm, it has quite the cli. I feed it scripts all the time to join files and subtitles. Avisynth also has an extensive cli that you can automate with scripts. But whatever. Try it. Don't try it.
    – surfasb
    Jul 2, 2011 at 20:22
0

You can use ffmpeg to attach files to an mkv file. An example from the ffmpeg manual:

ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv

IMO, ffmpeg (I'm currently version 2.0.1 on FreeBSD from /usr/ports/multimedia/ffmpeg2/) is a good replacement for mencoder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .