how do I extract SSA/ASS subtitles

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
jalexander
Posts: 5
Joined: Fri Dec 08, 2017 10:42 am

how do I extract SSA/ASS subtitles

Post by jalexander »

So I used Handbrake to create an MKV file from a DVD.

Usually I can then use MKVextract to rip out the SUP/IDX subtitle files.

However in this case the subtitles in the MKV are in ASS/SSA format:

Johns-MacBook-Pro:pp 1 john$ mkvmerge -i pp1.mkv
File 'pp1.mkv': container: Matroska
Track ID 0: video (MPEG-4p10/AVC/h.264)
Track ID 1: audio (AAC)
Track ID 2: audio (AAC)
Track ID 3: subtitles (SubStationAlpha)

And when I extract them I get a file containing this and not the subtitles:

Code: Select all

[Script Info]
ScriptType: v4.00+
Collisions: Normal
PlayResX: 720
PlayResY: 480
Timer: 100.0
WrapStyle: 0

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,monospace,30,&H00FFFFFF,&H00FFFFFF,&H000F0F0F,&H000F0F0F,0,0,0,0,100,100,0,0.00,1,2,3,2,20,20,20,0

[Events]
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
Can anyone direct me how to get the actual subtitle files here?
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: how do I extract SSA/ASS subtitles

Post by Woodstock »

DVDs generally will not have SSA subtitles; they use VOBSUB graphic subtitles. And handbrake won't convert subtitle types.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: how do I extract SSA/ASS subtitles

Post by JohnAStebbins »

To clarify Woodstock's comment, DVD (and BD PGS) subtitles are images. SSA is text. To convert from the images to text requires optical character recognition which HandBrake does not do.

We require an activity log of your encode to help you further. Your description of your problem makes no sense because DVDs do not have SSA subtitles.
jalexander
Posts: 5
Joined: Fri Dec 08, 2017 10:42 am

Re: how do I extract SSA/ASS subtitles

Post by jalexander »

Thanks - not sure how to get the activity log. And yes it's the image subtitles I want, I can OCR them fine.

But I think I may have accidentally burned the subtitles into the video. See below, even if I have subtitles disabled they are still shown.

Image

https://imgur.com/a/plNgOiP
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: how do I extract SSA/ASS subtitles

Post by rollin_eng »

Could you please post your HB logs, instructions can be found here:

https://handbrake.fr/docs/en/latest/hel ... y-log.html
jalexander
Posts: 5
Joined: Fri Dec 08, 2017 10:42 am

Re: how do I extract SSA/ASS subtitles

Post by jalexander »

here it is. thanks.

Code: Select all

HandBrake Activity Log for Session: 2018-09-02 21:21:16 +0800
Handbrake Version: 1.1.1 (2018061800)
PEPPA_PIG_6_1.mkv
Preset: Fast 1080p30 (Modified)
[21:21:16] macgui: QueueCore scanning specifically for title: 2
[21:21:16] CPU: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
[21:21:16]  - Intel microarchitecture Skylake
[21:21:16]  - logical processor count: 8
[21:21:16] hb_scan: path=/Volumes/PEPPA_PIG_6_1, title_index=2
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
[21:21:16] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.3
libdvdread: Attempting to use device /dev/rdisk2 mounted on /Volumes/PEPPA_PIG_6_1 for CSS authentication
libdvdnav: Can't read name block. Probably not a DVD-ROM device.
libdvdnav: vm: dvd_read_name failed
libdvdnav: DVD disk reports itself with Region mask 0x00fb0000. Regions: 3
libdvdread: Attempting to use device /dev/rdisk2 mounted on /Volumes/PEPPA_PIG_6_1 for CSS authentication
[21:21:16] scan: DVD has 2 title(s)
[21:21:16] scan: scanning title 2
[21:21:16] scan: opening IFO for VTS 2
[21:21:16] scan: duration is 00:40:46 (2446600 ms)
[21:21:16] pgc_id: 1, pgn: 1: pgc: 0x7fc690fa0f30
[21:21:16] scan: vts=2, ttn=1, cells=0->8, blocks=0->968448, 968449 blocks
[21:21:16] scan: checking audio 1
[21:21:16] scan: id=0x80bd, lang=中文 (AC3), 3cc=zho ext=0
[21:21:16] scan: checking audio 2
[21:21:16] scan: id=0x81bd, lang=English (AC3), 3cc=eng ext=0
[21:21:16] scan: title 2 has 9 chapters
[21:21:16] scan: chap 1 c=0->0, b=0->104594 (104595), 304367 ms
[21:21:16] scan: chap 2 c=1->1, b=104595->226751 (122157), 304834 ms
[21:21:16] scan: chap 3 c=2->2, b=226752->319781 (93030), 304367 ms
[21:21:16] scan: chap 4 c=3->3, b=319782->457693 (137912), 304300 ms
[21:21:16] scan: chap 5 c=4->4, b=457694->589561 (131868), 306266 ms
[21:21:16] scan: chap 6 c=5->5, b=589562->735174 (145613), 304567 ms
[21:21:16] scan: chap 7 c=6->6, b=735175->844458 (109284), 305166 ms
[21:21:16] scan: chap 8 c=7->7, b=844459->963921 (119463), 304200 ms
[21:21:16] scan: chap 9 c=8->8, b=963922->968448 (4527), 8533 ms
[21:21:16] scan: aspect = 16:9
[21:21:16] scan: decoding previews for title 2
libdvdnav: DVD disk reports itself with Region mask 0x00fb0000. Regions: 3
[21:21:17] scan: title angle(s) 1

libdvdread: Attempting to retrieve all CSS keys
libdvdread: This can take a _long_ time, please be patient

libdvdread: Get key for /VIDEO_TS/VTS_01_0.VOB at 0x0000013d
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_01_1.VOB at 0x00003fc5
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_02_0.VOB at 0x00007f3e
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_02_1.VOB at 0x00007f77
libdvdread: Elapsed time 0
libdvdread: Found 2 VTS's
libdvdread: Elapsed time 0
[ac3 @ 0x7fc69214fa00] frame sync error
[21:21:17] scan: audio 0x80bd: ac3, rate=48000Hz, bitrate=256000 中文 (AC3) (2.0 ch) (Dolby Surround)
[ac3 @ 0x7fc69210e600] frame sync error
[21:21:17] scan: audio 0x81bd: ac3, rate=48000Hz, bitrate=256000 English (AC3) (2.0 ch) (Dolby Surround)
[21:21:18] scan: 10 previews, 720x480, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 32:27
[21:21:18] libhb: scan thread found 1 valid title(s)
[21:21:19] macgui: QueueCore scan done
[21:21:19] macgui: QueueCore started encoding PEPPA_PIG_6_1.mkv
[21:21:19] macgui: QueueCore with preset Fast 1080p30 (Modified)
[21:21:19] 1 job(s) to process
[21:21:19] Skipping subtitle scan.  No suitable subtitle tracks.
[21:21:19] starting job
[21:21:19] decomb filter thread started for segment 0
[21:21:19] decomb filter thread started for segment 1
[21:21:19] decomb filter thread started for segment 2
[21:21:19] decomb filter thread started for segment 3
[21:21:19] decomb filter thread started for segment 4
[21:21:19] decomb filter thread started for segment 5
[21:21:19] decomb filter thread started for segment 6
[21:21:19] decomb filter thread started for segment 7
[21:21:19] decomb check thread started for segment 0
[21:21:19] decomb check thread started for segment 1
[21:21:19] decomb check thread started for segment 2
[21:21:19] decomb check thread started for segment 3
[21:21:19] decomb check thread started for segment 4
[21:21:19] decomb check thread started for segment 5
[21:21:19] decomb check thread started for segment 6
[21:21:19] decomb check thread started for segment 7
[21:21:19] mask filter thread started for segment 0
[21:21:19] mask filter thread started for segment 1
[21:21:19] mask filter thread started for segment 2
[21:21:19] mask filter thread started for segment 3
[21:21:19] mask filter thread started for segment 4
[21:21:19] mask filter thread started for segment 5
[21:21:19] mask filter thread started for segment 6
[21:21:19] mask filter thread started for segment 7
[21:21:19] mask erode thread started for segment 0
[21:21:19] mask erode thread started for segment 1
[21:21:19] mask erode thread started for segment 2
[21:21:19] mask erode thread started for segment 3
[21:21:19] mask erode thread started for segment 4
[21:21:19] mask erode thread started for segment 5
[21:21:19] mask erode thread started for segment 6
[21:21:19] mask erode thread started for segment 7
[21:21:19] mask dilate thread started for segment 0
[21:21:19] mask dilate thread started for segment 1
[21:21:19] mask dilate thread started for segment 2
[21:21:19] mask dilate thread started for segment 3
[21:21:19] mask dilate thread started for segment 4
[21:21:19] mask dilate thread started for segment 5
[21:21:19] mask dilate thread started for segment 6
[21:21:19] mask dilate thread started for segment 7
[21:21:19] yadif thread started for segment 0
[21:21:19] yadif thread started for segment 1
[21:21:19] yadif thread started for segment 2
[21:21:19] yadif thread started for segment 3
[21:21:19] yadif thread started for segment 4
[21:21:19] yadif thread started for segment 5
[21:21:19] yadif thread started for segment 6
[21:21:19] yadif thread started for segment 7
[21:21:19] job configuration:
[21:21:19]  * source
[21:21:19]    + /Volumes/PEPPA_PIG_6_1
[21:21:19]    + title 2, chapter(s) 1 to 9
[21:21:19]  * destination
[21:21:19]    + /Users/john/Movies/PEPPA_PIG_6_1.mkv
[21:21:19]    + container: Matroska (libavformat)
[21:21:19]      + chapter markers
[21:21:19]  * video track
[21:21:19]    + decoder: mpeg2video
[21:21:19]      + bitrate 9000 kbps
[21:21:19]    + filters
[21:21:19]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[21:21:19]      + Decomb (mode=39)
[21:21:19]      + Framerate Shaper (mode=2:rate=27000000/900000)
[21:21:19]        + frame rate: 29.970 fps -> peak rate limited to 30.000 fps
[21:21:19]      + Crop and Scale (width=720:height=480:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[21:21:19]        + source: 720 * 480, crop (0/0/0/0): 720 * 480, scale: 720 * 480
[21:21:19]    + Output geometry
[21:21:19]      + storage dimensions: 720 x 480
[21:21:19]      + pixel aspect ratio: 32 : 27
[21:21:19]      + display dimensions: 853 x 480
[21:21:19]    + encoder: H.264 (libx264)
[21:21:19]      + preset:  fast
[21:21:19]      + profile: main
[21:21:19]      + level:   4.0
[21:21:19]      + quality: 22.00 (RF)
[21:21:19]  * subtitle track 1, 中文, Closed Caption [CC608] (track 0, id 0x0, Text) -> Passthrough
[21:21:19]  * audio track 1
[21:21:19]    + decoder: 中文 (AC3) (2.0 ch) (Dolby Surround) (track 1, id 0x80bd)
[21:21:19]      + bitrate: 256 kbps, samplerate: 48000 Hz
[21:21:19]    + mixdown: Dolby Surround
[21:21:19]    + encoder: AAC (Apple AudioToolbox)
[21:21:19]      + bitrate: 160 kbps, samplerate: 48000 Hz
[21:21:19]  * audio track 2
[21:21:19]    + decoder: English (AC3) (2.0 ch) (Dolby Surround) (track 2, id 0x81bd)
[21:21:19]      + bitrate: 256 kbps, samplerate: 48000 Hz
[21:21:19]    + mixdown: Dolby Surround
[21:21:19]    + encoder: AAC (Apple AudioToolbox)
[21:21:19]      + bitrate: 160 kbps, samplerate: 48000 Hz
libdvdnav: Using dvdnav version 5.0.3
libdvdread: Attempting to use device /dev/rdisk2 mounted on /Volumes/PEPPA_PIG_6_1 for CSS authentication
libdvdnav: Can't read name block. Probably not a DVD-ROM device.
libdvdnav: vm: dvd_read_name failed
libdvdnav: DVD disk reports itself with Region mask 0x00fb0000. Regions: 3
libdvdread: Attempting to use device /dev/rdisk2 mounted on /Volumes/PEPPA_PIG_6_1 for CSS authentication
libdvdnav: DVD disk reports itself with Region mask 0x00fb0000. Regions: 3
[21:21:19] sync: expecting 73324 video frames
[21:21:19] encx264: min-keyint: 30, keyint: 300
[21:21:19] encx264: encoding at constant RF 22.000000
[21:21:19] encx264: unparsed options: level=4.0:ref=2:8x8dct=0:weightp=1:subme=6:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=30
x264 [info]: using SAR=32/27
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Main, level 4.0

libdvdread: Attempting to retrieve all CSS keys
libdvdread: This can take a _long_ time, please be patient

libdvdread: Get key for /VIDEO_TS/VTS_01_0.VOB at 0x0000013d
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_01_1.VOB at 0x00003fc5
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_02_0.VOB at 0x00007f3e
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_02_1.VOB at 0x00007f77
libdvdread: Elapsed time 0
libdvdread: Found 2 VTS's
libdvdread: Elapsed time 0
[21:21:19] sync: first pts video is 0
[21:21:19] sync: "Chapter 1" (1) at frame 1 time 0
[21:21:19] sync: first pts audio 0x80bd is 0
[21:21:19] sync: first pts audio 0x81bd is 0
[21:22:14] sync: "Chapter 2" (2) at frame 9132 time 27420393
[21:23:13] sync: "Chapter 3" (3) at frame 18277 time 54882828
[21:23:54] sync: "Chapter 4" (4) at frame 27408 time 82303221
[21:24:51] sync: "Chapter 5" (5) at frame 36537 time 109717608
[21:25:42] sync: "Chapter 6" (6) at frame 45725 time 137309172
[21:26:35] sync: "Chapter 7" (7) at frame 54862 time 164747583
[21:27:13] sync: "Chapter 8" (8) at frame 64017 time 192240048
[21:27:53] sync: "Chapter 9" (9) at frame 73142 time 219645426
[21:27:55] reader: done. 1 scr changes
[21:27:55] work: average encoding speed for job is 185.591583 fps
[21:27:55] comb detect: heavy 1038 | light 2596 | uncombed 69763 | total 73397
[21:27:55] decomb: deinterlaced 1038 | blended 2596 | unfiltered 69763 | total 73397
[21:27:55] vfr: 73397 frames output, 0 dropped and 0 duped for CFR/PFR
[21:27:55] vfr: lost time: 0 (0 frames)
[21:27:55] vfr: gained time: 0 (0 frames) (0 not accounted for)
[21:27:55] ac3-decoder done: 76532 frames, 0 decoder errors
[21:27:55] ac3-decoder done: 76532 frames, 0 decoder errors
[21:27:55] mpeg2video-decoder done: 73397 frames, 0 decoder errors
[21:27:55] sync: got 73397 frames, 73324 expected
[21:27:55] sync: framerate min 14.985 fps, max 29.970 fps, avg 29.970 fps
x264 [info]: frame I:376   Avg QP:13.66  size: 27057
x264 [info]: frame P:20452 Avg QP:19.83  size:  3165
x264 [info]: frame B:52569 Avg QP:21.90  size:   803
x264 [info]: consecutive B-frames:  1.8%  5.0%  9.3% 83.9%
x264 [info]: mb I  I16..4: 56.2%  0.0% 43.8%
x264 [info]: mb P  I16..4:  2.7%  0.0%  2.8%  P16..4: 10.4%  4.1%  2.3%  0.0%  0.0%    skip:77.7%
x264 [info]: mb B  I16..4:  0.6%  0.0%  0.5%  B16..8:  5.8%  1.7%  0.2%  direct: 1.8%  skip:89.4%  L0:44.9% L1:42.8% BI:12.3%
x264 [info]: coded y,uvDC,uvAC intra: 36.9% 56.9% 44.7% inter: 2.4% 4.6% 2.0%
x264 [info]: i16 v,h,dc,p: 68% 25%  7%  1%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 21%  5%  6%  6%  6%  5%  4%
x264 [info]: i8c dc,h,v,p: 48% 24% 23%  5%
x264 [info]: Weighted P-Frames: Y:2.7% UV:1.9%
x264 [info]: ref P L0: 62.5% 37.5%
x264 [info]: ref B L0: 82.2% 17.8%
x264 [info]: ref B L1: 93.7%  6.3%
x264 [info]: kb/s:382.49
[21:27:55] mux: track 0, 73397 frames, 117075201 bytes, 382.43 kbps, fifo 8192
[21:27:55] mux: track 1, 114801 frames, 49096578 bytes, 160.38 kbps, fifo 8192
[21:27:55] mux: track 2, 114801 frames, 49613909 bytes, 162.07 kbps, fifo 8192
[21:27:55] mux: track 3, 0 frames, 0 bytes, 0.00 kbps, fifo 8
[21:27:55] libhb: work result = 0
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: how do I extract SSA/ASS subtitles

Post by Woodstock »

Code: Select all

[21:21:19] Skipping subtitle scan.  No suitable subtitle tracks.
followed by:

Code: Select all

[21:21:19]  * subtitle track 1, 中文, Closed Caption [CC608] (track 0, id 0x0, Text) -> Passthrough
The source in question does not seem to have any subtitle tracks, just a closed-caption track, which is already text. So, for this particular source, you really can't pull out the subtitles.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: how do I extract SSA/ASS subtitles

Post by JohnAStebbins »

Ahh, that explains it. DVDs can have CC "tracks". CC are special in that they are not really separate tracks at all but are embedded in the the video track. HandBrake detects their presence and presents them in the UI as a subtitle "track" and labels the track "Closed Caption". CC are text and HandBrake converts these to SSA when encoding if you have selected them.

As Woodstock said, the DVD has no regular subtitles (which would have been the SUB/IDX you were looking for).
jalexander
Posts: 5
Joined: Fri Dec 08, 2017 10:42 am

Re: how do I extract SSA/ASS subtitles

Post by jalexander »

Sorted. thanks a lot.
Post Reply