[Commited] [Core] SSA burn-in support

Archive of historical development discussions
Discussions / Development has moved to GitHub
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
jamiemlaw
Veteran User
Posts: 536
Joined: Thu Sep 17, 2009 4:52 pm

Re: [Patch] [Core] SSA burn-in support

Post by jamiemlaw »

It works!

The update looks incredible. Awesome job, davidfstr. And thanks for the fix, John.
KabutoTX

Re: [Patch] [Core] SSA burn-in support

Post by KabutoTX »

I am testing 3557 Mac gui x86_64 and I have a problem with it hanging most of the way through but I am not getting any crash info in any of the logs. It just stops and Handbrake keeps taking ~5% CPU. Out of 5 tries on the same file it completed the whole thing once. The output was great on the one it finished. I will try 3558 when it builds to see if that fix changes anything.
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: [Patch] [Core] SSA burn-in support

Post by TedJ »

Try updating to svn3558, there was a bug fix earlier today. Updated nightly build should be up within a few hours.
HotDogWolf

Re: [Patch] [Core] SSA burn-in support

Post by HotDogWolf »

Great, the latest nightly works well. Fantastic work.
ios
Enlightened
Posts: 103
Joined: Sun Jun 06, 2010 1:48 am

Re: [Patch] [Core] SSA burn-in support

Post by ios »

davidfstr wrote:
LinBrake wrote:The patch works like a charm. SSA subtitles inside the MKV containers are made into perfect soft subtitles. I've tested this one dozens of files and not one problem.
That's actually thanks to an older patch of mine, but I'm glad you enjoy it. :D

This new patch is for burned-in SSA subtitles, with most of the styling information (lacking animated effects like karaoke, fade in/out).
@davidfstr

are you also planning to update the patch on softsubbing? because the softsubs of sources in mkv when softsubbed onto handbrake is not in SSA/ASS subs but rather in SRT

but this hardsubbing (burn-in) patch works great in preserving the SSA/ASS subs styles into the video so thanks a lot for this :D
Starhawk
Experienced
Posts: 90
Joined: Sun Feb 24, 2008 8:27 pm

Re: [Patch] [Core] SSA burn-in support

Post by Starhawk »

Hey David,

Thanks for your hard work on this. I ran into an issue today when multiple lines of subtitles are timed to appear at different times on screen. Not sure if the issue is with the patch, the source's subs, or my user error.

Here's a clip to show an example.

Code: Select all

[18:57:41] thread 11c035000 exited ("work")
[18:57:41] thread 11c035000 joined ("work")
[18:57:41] libhb: work result = 0
[19:00:52] macgui: Rip: Pending queue count is 0
[19:00:54] macgui: scanning specifically for title: 1
[19:00:54] hb_scan: path=/Volumes/Drobo/Video Encoding/Plex/Plex Anime/Bubblegum_Crisis_(1987)_[720p,,x264]_-_/Bubblegum_Crisis_Ep02_[720p,,x264]_-_.mkv, title_index=1
[19:00:54] thread 11c1bb000 started ("scan")
lib/bdnav/index_parse.c:157: indx_parse(): error opening /Volumes/Drobo/Video Encoding/Plex/Plex Anime/Bubblegum_Crisis_(1987)_[720p,,x264]_-_/Bubblegum_Crisis_Ep02_[720p,,x264]_-_.mkv/BDMV/index.bdmv
lib/.c:960: nav_get_title_list(/Volumes/Drobo/Video Encoding/Plex/Plex Anime/Bubblegum_Crisis_(1987)_[720p,,x264]_-_/Bubblegum_Crisis_Ep02_[720p,,x264]_-_.mkv) failed (0x102b68000)
[19:00:54] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[19:00:54] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from '/Volumes/Drobo/Video Encoding/Plex/Plex Anime/Bubblegum_Crisis_(1987)_[720p,,x264]_-_/Bubblegum_Crisis_Ep02_[720p,,x264]_-_.mkv':
  Metadata:
    title           : Bubblegum Crisis Ep.2
  Duration: 00:28:19.03, start: 0.000000, bitrate: 448 kb/s
    Stream #0.0(jpn): Video: h264, yuv420p, 956x720, PAR 1:1 DAR 239:180, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
    Stream #0.1(jpn): Audio: ac3, 48000 Hz, stereo, s16, 448 kb/s
    Stream #0.2(eng): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.3: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : BorisBlackBloxx.ttf
    Stream #0.4: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : exprswy_free.ttf
[19:00:54] Found ffmpeg 0 chapters, container=matroska,webm
[19:00:54] scan: decoding previews for title 1
[19:00:54] scan: preview 1
[19:00:54] fifo_close: trashing 0 buffer(s)
[19:00:54] scan: audio 0x1: AC-3, rate=48000Hz, bitrate=448000 Japanese (AC3) (2.0 ch)
[19:00:54] scan: preview 2
[19:00:54] scan: preview 3
[19:00:56] scan: preview 4
[19:00:58] scan: preview 5
[19:01:00] scan: preview 6
[19:01:02] Title's mostly NTSC Film, setting fps to 23.976
[19:01:02] scan: preview 7
[19:01:04] scan: preview 8
[19:01:05] scan: preview 9
[19:01:08] scan: preview 10
[19:01:08] scan: preview 11
[19:01:09] scan: preview 12
[19:01:09] scan: preview 13
[19:01:10] scan: preview 14
[19:01:12] scan: preview 15
[19:01:14] scan: 15 previews, 956x720, 23.976 fps, autocrop = 0/0/0/0, aspect 1.33:1, PAR 1:1
[19:01:14] scan: title (0) job->width:960, job->height:720
[19:01:14] thread 11c1bb000 exited ("scan")
[19:01:14] thread 11c1bb000 joined ("scan")
[19:01:14] libhb: scan thread found 1 valid title(s)
[19:01:14] macgui: ScanDone state received from fQueueEncodeLibhb
[19:01:14] macgui: Preset: Custom
[19:01:14] macgui: processNewQueueEncode number of passes expected is: 1
[19:01:14] macgui: Start / Stop set to chapters
[19:01:14] macgui: prepareJob exiting
[19:01:14] thread 11c035000 started ("work")
[19:01:14] 1 job(s) to process
[19:01:14] starting job
[19:01:14] sync: expecting 40759 video frames
[19:01:14] job configuration:
[19:01:14]  * source
[19:01:14]    + /Volumes/Drobo/Video Encoding/Plex/Plex Anime/Bubblegum_Crisis_(1987)_[720p,,x264]_-_/Bubblegum_Crisis_Ep02_[720p,,x264]_-_.mkv
[19:01:14]    + title 1, chapter(s) 1 to 1
[19:01:14]    + container: matroska,webm
[19:01:14]    + data rate: 448 kbps
[19:01:14]  * destination
[19:01:14]    + /Volumes/Drobo/Video Encoding/Handbrake Encodes/Bubblegum_Crisis_Ep02test from start.m4v
[19:01:14]    + container: MPEG-4 (.mp4 and .m4v)
[19:01:14]  * video track
[19:01:14]    + decoder: h264
[19:01:14]    + frame rate: same as source (around 23.976 fps)
[19:01:14]    + strict anamorphic
[19:01:14]      + storage dimensions: 956 * 720 -> 956 * 720, crop 0/0/0/0, mod 16
[19:01:14]      + pixel aspect ratio: 1 / 1
[19:01:14]      + display dimensions: 956 * 720
[19:01:14]    + encoder: x264
[19:01:14]      + options: bframes=5:me=umh:b-adapt=2:direct=auto:analyse=all:deblock=-2,-2:ref=5:psy-rd=1.0,0.2:no-dct-decimate=1:subq=8:merange=24
[19:01:14]      + quality: 21.00 (RF)
[19:01:14]  * subtitle track 0, English (id 2) Text [SSA] -> Render/Burn in
[19:01:14]  * audio track 0
[19:01:14]    + decoder: Japanese (AC3) (2.0 ch) (track 1, id 1)
[19:01:14]      + bitrate: 448 kbps, samplerate: 48000 Hz
[19:01:14]    + mixdown: Stereo
[19:01:14]    + encoder: ca_aac
[19:01:14]      + bitrate: 160 kbps, samplerate: 48000 Hz
[19:01:14] thread 11c138000 started ("reader")
[19:01:14] thread 11c1bb000 started ("AudioSynchronization")
[19:01:14] thread 11c377000 started ("Video decoder (ffmpeg streams)")
[19:01:14] thread 11d2b2000 started ("Renderer")
[19:01:14] encx264: min-keyint: 24, keyint: 240
[19:01:14] encx264: encoding with stored aspect 1/1
[19:01:14] encx264: Encoding at constant RF 21.000000
[19:01:14] encx264: opening libx264 (pass 0)
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 3.1
[19:01:14] thread 11f004000 started ("H.264/AVC encoder (libx264)")
Fontconfig error: Cannot load default config file
[19:01:14] [ass] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[19:01:14] thread 11f4e3000 started ("SSA Subtitle Decoder")
No accelerated IMDCT transform found
[19:01:14] thread 11f566000 started ("AC3 decoder")
[19:01:14] thread 11f5e9000 started ("AAC encoder (Apple)")
[19:01:14] thread 11f66c000 started ("Video Synchronization")
[19:01:14] muxmp4: track 0, chunk duration 15015
[19:01:14] muxmp4: track 1, chunk duration 8008
[19:01:14] thread 11f6ef000 started ("Muxer")
[19:01:14] Seeking to chapter 1: starts 0, ends 152912790, AV pos 0
[19:01:15] reader: first SCR 0 id 0 DTS 0
[19:14:02] macgui: Rip: Pending queue count is 0
[19:14:03] work: average encoding speed for job is 6.179242 fps
[19:14:03] thread 11c1bb000 exited ("AudioSynchronization")
[19:14:03] thread 11f004000 exited ("H.264/AVC encoder (libx264)")
[19:14:04] thread 11c377000 exited ("Video decoder (ffmpeg streams)")
[19:14:04] thread 11f6ef000 exited ("Muxer")
[19:14:04] reader: done. 1 scr changes
[19:14:04] thread 11c138000 exited ("reader")
[19:14:04] thread 11f4e3000 exited ("SSA Subtitle Decoder")
[19:14:04] thread 11f5e9000 exited ("AAC encoder (Apple)")
[19:14:04] thread 11f66c000 exited ("Video Synchronization")
[19:14:04] thread 11f66c000 joined ("Video Synchronization")
[19:14:04] sync: got 4747 frames, 40759 expected
[19:14:04] thread 11c1bb000 joined ("AudioSynchronization")
[19:14:04] thread 11c377000 joined ("Video decoder (ffmpeg streams)")
[19:14:04] h264-decoder done: 4771 frames, 0 decoder errors, 0 drops
[19:14:04] macgui: cancelling current job and stopping the queue
[19:14:04] thread 11f566000 exited ("AC3 decoder")
[19:14:04] thread 11d2b2000 exited ("Renderer")
[19:14:04] thread 11d2b2000 joined ("Renderer")
[19:14:04] render: lost time: 0 (0 frames)
[19:14:04] render: gained time: 0 (0 frames) (0 not accounted for)
[19:14:04] fifo_close: trashing 0 buffer(s)
[19:14:04] fifo_close: trashing 3 buffer(s)
[19:14:04] thread 11f004000 joined ("H.264/AVC encoder (libx264)")
x264 [info]: frame I:38    Avg QP:18.24  size: 94826  PSNR Mean Y:46.41 U:51.83 V:52.50 Avg:47.53 Global:47.42
x264 [info]: frame P:1090  Avg QP:20.57  size: 19117  PSNR Mean Y:44.54 U:49.97 V:50.40 Avg:45.71 Global:45.57
x264 [info]: frame B:3534  Avg QP:22.30  size:  4700  PSNR Mean Y:44.09 U:49.60 V:49.96 Avg:45.26 Global:45.10
x264 [info]: consecutive B-frames:  1.0%  2.2% 10.8% 34.8% 19.3% 31.8%
x264 [info]: mb I  I16..4:  3.4% 83.2% 13.3%
x264 [info]: mb P  I16..4:  1.1%  5.5%  1.1%  P16..4: 65.3% 13.5%  3.1%  0.1%  0.1%    skip:10.3%
x264 [info]: mb B  I16..4:  0.0%  0.3%  0.0%  B16..8: 45.2%  2.5%  0.4%  direct: 2.7%  skip:48.8%  L0:45.2% L1:51.6% BI: 3.1%
x264 [info]: 8x8 transform intra:76.0% inter:70.9%
x264 [info]: direct mvs  spatial:99.9% temporal:0.1%
x264 [info]: coded y,uvDC,uvAC intra: 87.7% 81.7% 50.9% inter: 19.2% 31.0% 5.0%
x264 [info]: i16 v,h,dc,p: 25% 20% 22% 32%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7%  6%  8% 13% 15% 13% 13% 12% 13%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10%  7%  3% 12% 15% 14% 13% 12% 13%
x264 [info]: i8c dc,h,v,p: 53% 22% 18%  7%
x264 [info]: Weighted P-Frames: Y:5.0%
x264 [info]: ref P L0: 41.6%  9.6% 25.2% 10.7% 10.7%  2.0%  0.0%
x264 [info]: ref B L0: 73.1% 18.9%  5.9%  2.1%
x264 [info]: ref B L1: 93.6%  6.4%
x264 [info]: SSIM Mean Y:0.9738476 (15.825db)
x264 [info]: PSNR Mean Y:44.212 U:49.708 V:50.080 Avg:45.387 Global:45.217 kb/s:1671.74
[19:14:07] thread 11f4e3000 joined ("SSA Subtitle Decoder")
[19:14:07] thread 11f566000 joined ("AC3 decoder")
[19:14:07] thread 11f5e9000 joined ("AAC encoder (Apple)")
[19:14:07] thread 11f6ef000 joined ("Muxer")
[19:14:07] mux: file size, 45180898 bytes
[19:14:07] mux: track 0, 4659 frames, 41029879 bytes, 1687.00 kbps, fifo 8
[19:14:07] mux: video bitrate error, +41029879 bytes
[19:14:07] mux: track 1, 9119 frames, 4019562 bytes, 165.27 kbps, fifo 512
[19:14:07] mux: overhead, 9.54 bytes per frame
[19:14:07] thread 11c138000 joined ("reader")
[19:14:07] fifo_close: trashing 29 buffer(s)
[19:14:07] fifo_close: trashing 14 buffer(s)
[19:14:07] fifo_close: trashing 16 buffer(s)
[19:14:07] fifo_close: trashing 16 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] fifo_close: trashing 1 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] fifo_close: trashing 0 buffer(s)
[19:14:07] Freed 32 buffers of size 2048
[19:14:07] Freed 1 buffers of size 4096
[19:14:07] Freed 32 buffers of size 8192
[19:14:07] Freed 32 buffers of size 16384
[19:14:07] Freed 10 buffers of size 65536
[19:14:07] Freed 32 buffers of size 131072
[19:14:07] Freed 32 buffers of size 262144
[19:14:07] Freed 32 buffers of size 1048576
[19:14:07] Allocated 81846272 bytes of buffers on this pass and Freed 47648768 bytes, 34197504 bytes leaked
[19:14:07] thread 11c035000 exited ("work")
[19:14:07] thread 11c035000 joined ("work")
[19:14:07] libhb: work result = 0
HotDogWolf

Re: [Patch] [Core] SSA burn-in support

Post by HotDogWolf »

Timing is always an issue i find the playing them in VLC Mplayer Plex XBMC all result in different timing when multiple lines need to be displayed.
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

ios wrote:@davidfstr

are you also planning to update the patch on softsubbing? because the softsubs of sources in mkv when softsubbed onto handbrake is not in SSA/ASS subs but rather in SRT

but this hardsubbing (burn-in) patch works great in preserving the SSA/ASS subs styles into the video so thanks a lot for this :D
I'm hesitant to enable SSA->SSA softsubs, because I imagine that a large percent of our users will complain that it doesn't work in XYZ player, since SSA subs generally enjoy very poor player support off-computer. Would this functionality be particularly useful to you? (And if so, for what scenario?)
Starhawk wrote:Hey David,

Thanks for your hard work on this. I ran into an issue today when multiple lines of subtitles are timed to appear at different times on screen. Not sure if the issue is with the patch, the source's subs, or my user error.
Try the original video in VLC to see if the issue appears there. HandBrake basically uses the same code as VLC to render SSA.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [Patch] [Core] SSA burn-in support

Post by s55 »

Found a problem. SSA Seemed to work, but 1 track that I selected burn-in for didn't.
Fontconfig error: Cannot load default config file
[15:47:34] [ass] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
Next:
Input #0, matroska,webm, from 'S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv':
Duration: 00:00:58.18, start: 0.000000, bitrate: N/A
Stream #0.0(eng): Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc
Stream #0.1(jpn): Audio: vorbis, 48000 Hz, stereo, s16
Stream #0.2(eng): Subtitle: [0][0][0][0] / 0x0000
Stream #0.3(dut): Subtitle: [0][0][0][0] / 0x0000
Stream #0.4(eng): Subtitle: [0][0][0][0] / 0x0000
Stream #0.5(fin): Subtitle: [0][0][0][0] / 0x0000
Stream #0.6(fre): Subtitle: [0][0][0][0] / 0x0000
Stream #0.7(ger): Subtitle: [0][0][0][0] / 0x0000
Stream #0.8(heb): Subtitle: [0][0][0][0] / 0x0000
Stream #0.9(hun): Subtitle: [0][0][0][0] / 0x0000
Stream #0.10(ita): Subtitle: [0][0][0][0] / 0x0000
Stream #0.11(jpn): Subtitle: [0][0][0][0] / 0x0000
Stream #0.12(nor): Subtitle: [0][0][0][0] / 0x0000
Stream #0.13(pol): Subtitle: [0][0][0][0] / 0x0000
Stream #0.14(por): Subtitle: [0][0][0][0] / 0x0000
Stream #0.15(rus): Subtitle: [0][0][0][0] / 0x0000
Stream #0.16(spa): Subtitle: [0][0][0][0] / 0x0000
Stream #0.17(swe): Subtitle: [0][0][0][0] / 0x0000
What's with the number blocks here? Any chance we could clean this up?

Thanks.

Full Log:

Code: Select all

# CLI Query:  -i "S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv" -t 1 -c 1 -o "C:\Users\Scott\Desktop\Ssa 15subtitles-1.m4v"  -f mp4 --strict-anamorphic  -e x264 -q 20 -a 1 -E faac -6 dpl2 -R Auto -B 160 -D 0.0 --subtitle 1,6,12 --subtitle-forced=1,2,3 --subtitle-burn=2 --subtitle-default=3 -v 1 --no-dvdnav
# User Query: True
-------------------------------------------

[15:47:34] hb_init: checking cpu count
[15:47:34] hb_init: starting libhb thread
HandBrake svn3563 (2010100201) - MinGW i386 - http://handbrake.fr
8 CPUs detected
Opening S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv...
[15:47:34] hb_scan: path=S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv, title_index=1
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv/BDMV/index.bdmv
libbluray/bluray.c:960: nav_get_title_list(S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv) failed (0x19fafd0)
[15:47:34] bd: not a bd - trying as a stream/file instead
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
ERROR: dvd: ifoOpen failed
Input #0, matroska,webm, from 'S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv':
  Duration: 00:00:58.18, start: 0.000000, bitrate: N/A
    Stream #0.0(eng): Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc
    Stream #0.1(jpn): Audio: vorbis, 48000 Hz, stereo, s16
    Stream #0.2(eng): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.3(dut): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.4(eng): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.5(fin): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.6(fre): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.7(ger): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.8(heb): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.9(hun): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.10(ita): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.11(jpn): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.12(nor): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.13(pol): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.14(por): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.15(rus): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.16(spa): Subtitle: [0][0][0][0] / 0x0000
    Stream #0.17(swe): Subtitle: [0][0][0][0] / 0x0000
[15:47:34] scan: decoding previews for title 1
[15:47:34] scan: 10 previews, 640x480, 23.976 fps, autocrop = 0/0/0/0, aspect 4:3, PAR 1:1
[15:47:34] scan: title (0) job->width:640, job->height:480
[15:47:34] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv
  + duration: 00:00:58
  + size: 640x480, pixel aspect: 1/1, display aspect: 1.33, 23.976 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:58
  + audio tracks:
    + 1, Japanese (VORBIS) (2.0 ch) (iso639-2: jpn)
  + subtitle tracks:
    + 1, English (iso639-2: eng) (Text)(SSA)
    + 2, Dutch (iso639-2: nld) (Text)(SSA)
    + 3, English (iso639-2: eng) (Text)(SSA)
    + 4, Finnish (iso639-2: fin) (Text)(SSA)
    + 5, French (iso639-2: fra) (Text)(SSA)
    + 6, German (iso639-2: deu) (Text)(SSA)
    + 7, Hebrew (iso639-2: heb) (Text)(SSA)
    + 8, Hungarian (iso639-2: hun) (Text)(SSA)
    + 9, Italian (iso639-2: ita) (Text)(SSA)
    + 10, Japanese (iso639-2: jpn) (Text)(SSA)
    + 11, Norwegian (iso639-2: nor) (Text)(SSA)
    + 12, Polish (iso639-2: pol) (Text)(SSA)
    + 13, Portuguese (iso639-2: por) (Text)(SSA)
    + 14, Russian (iso639-2: rus) (Text)(SSA)
    + 15, Spanish (iso639-2: spa) (Text)(SSA)
    + 16, Swedish (iso639-2: swe) (Text)(SSA)
Invalid sample rate 0, using input rate 48000
[15:47:34] 1 job(s) to process
[15:47:34] starting job
[15:47:34] work: sanitizing track 0 mixdown Dolby Pro Logic II to Stereo
[15:47:34] sync: expecting 1418 video frames
[15:47:34] job configuration:
[15:47:34]  * source
[15:47:34]    + S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv
[15:47:34]    + title 1, chapter(s) 1 to 1
[15:47:34]    + container: matroska,webm
[15:47:34]  * destination
[15:47:34]    + C:\Users\Scott\Desktop\Ssa 15subtitles-1.m4v
[15:47:34]    + container: MPEG-4 (.mp4 and .m4v)
[15:47:34]  * video track
[15:47:34]    + decoder: mpeg4
[15:47:34]    + frame rate: same as source (around 23.976 fps)
[15:47:34]    + strict anamorphic
[15:47:34]      + storage dimensions: 640 * 480 -> 640 * 480, crop 0/0/0/0, mod 0
[15:47:34]      + pixel aspect ratio: 1 / 1
[15:47:34]      + display dimensions: 640 * 480
[15:47:34]    + encoder: x264
[15:47:34]      + quality: 20.00 (RF)
[15:47:34]  * subtitle track 0, English (id 2) Text [SSA] -> Pass-Through, Forced Only
[15:47:34]  * subtitle track 0, German (id 7) Text [SSA] -> Render/Burn in, Forced Only
[15:47:34]  * subtitle track 0, Polish (id d) Text [SSA] -> Pass-Through, Forced Only, Default
[15:47:34]  * audio track 0
[15:47:34]    + decoder: Japanese (VORBIS) (2.0 ch) (track 1, id 1)
[15:47:34]    + mixdown: Stereo
[15:47:34]    + encoder: faac
[15:47:34]      + bitrate: 160 kbps, samplerate: 48000 Hz
[15:47:34] encx264: min-keyint: 24, keyint: 240
[15:47:34] encx264: encoding with stored aspect 1/1
[15:47:34] encx264: Encoding at constant RF 20.000000
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[15:47:34] reader: first SCR 0 id 0 DTS 0
x264 [info]: profile High, level 3.0
Fontconfig error: Cannot load default config file
[15:47:34] [ass] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[15:47:44] reader: done. 1 scr changes
[15:47:44] sync: adding 104 ms of silence to audio 1  start 5245380, next 5235960
[15:47:45] work: average encoding speed for job is 141.045151 fps
[15:47:45] sync: got 1395 frames, 1418 expected
[15:47:45] mpeg4-decoder done: 1395 frames, 0 decoder errors, 0 drops
[15:47:45] render: lost time: 0 (0 frames)
[15:47:45] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:15    Avg QP:15.61  size: 42653  PSNR Mean Y:49.31 U:51.74 V:51.38 Avg:49.83 Global:48.00
x264 [info]: frame P:864   Avg QP:19.46  size:  8256  PSNR Mean Y:44.32 U:47.33 V:47.12 Avg:45.06 Global:44.08
x264 [info]: frame B:516   Avg QP:20.71  size:   562  PSNR Mean Y:47.08 U:49.86 V:49.50 Avg:47.70 Global:46.65
x264 [info]: consecutive B-frames: 48.0%  5.9%  1.7% 44.3%
x264 [info]: mb I  I16..4: 15.8% 69.9% 14.2%
x264 [info]: mb P  I16..4:  1.5%  5.1%  0.8%  P16..4: 33.5%  9.8%  8.5%  0.0%  0.0%    skip:40.7%
x264 [info]: mb B  I16..4:  0.5%  0.5%  0.0%  B16..8: 18.2%  0.7%  0.2%  direct: 1.6%  skip:78.3%  L0:48.1% L1:48.7% BI: 3.2%
x264 [info]: 8x8 transform intra:67.4% inter:80.2%
x264 [info]: coded y,uvDC,uvAC intra: 56.5% 81.9% 57.3% inter: 12.7% 20.7% 5.4%
x264 [info]: i16 v,h,dc,p: 49% 28% 15%  9%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 20% 32%  4%  4%  4%  4%  5%  5%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 15% 17%  6%  7%  9%  6%  8%  5%
x264 [info]: i8c dc,h,v,p: 42% 24% 25%  9%
x264 [info]: Weighted P-Frames: Y:3.5%
x264 [info]: ref P L0: 79.5%  9.4%  8.3%  2.8%  0.0%
x264 [info]: ref B L0: 88.9%  9.5%  1.5%
x264 [info]: ref B L1: 94.4%  5.6%
x264 [info]: SSIM Mean Y:0.9916839 (20.801db)
x264 [info]: PSNR Mean Y:45.397 U:48.313 V:48.048 Avg:46.085 Global:44.901 kb/s:1108.63
[15:47:45] vorbis-decoder done: 0 frames, 0 decoder errors, 0 drops
[15:47:45] mux: track 0, 1395 frames, 8062393 bytes, 1106.18 kbps, fifo 8
[15:47:45] mux: track 1, 2733 frames, 1162724 bytes, 159.53 kbps, fifo 512
[15:47:45] mux: track 2, 5 frames, 634 bytes, 0.09 kbps, fifo 8
[15:47:45] mux: track 3, 19 frames, 585 bytes, 0.08 kbps, fifo 8
[15:47:45] libhb: work result = 0
Rip done!
HandBrake has exited.
Starhawk
Experienced
Posts: 90
Joined: Sun Feb 24, 2008 8:27 pm

Re: [Patch] [Core] SSA burn-in support

Post by Starhawk »

Try the original video in VLC to see if the issue appears there. HandBrake basically uses the same code as VLC to render SSA.
I forgot to mention that the video on the left of the example clip is being played through VLC. It plays fine there without the timing issues seen in the video from handbrake (on the right). This is mainly seen at 0:16 and 0:28.
ios
Enlightened
Posts: 103
Joined: Sun Jun 06, 2010 1:48 am

Re: [Patch] [Core] SSA burn-in support

Post by ios »

davidfstr wrote:
ios wrote:@davidfstr

are you also planning to update the patch on softsubbing? because the softsubs of sources in mkv when softsubbed onto handbrake is not in SSA/ASS subs but rather in SRT

but this hardsubbing (burn-in) patch works great in preserving the SSA/ASS subs styles into the video so thanks a lot for this :D
I'm hesitant to enable SSA->SSA softsubs, because I imagine that a large percent of our users will complain that it doesn't work in XYZ player, since SSA subs generally enjoy very poor player support off-computer. Would this functionality be particularly useful to you? (And if so, for what scenario?)
i dont have player devices i encode and watch only on computers (desktop, laptops, etc)
but i get what you mean so its alright if your not gonna add it now
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

s55 wrote:Found a problem. SSA Seemed to work, but 1 track that I selected burn-in for didn't.
Fontconfig error: Cannot load default config file
[15:47:34] [ass] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
Hmm... I'll try to look at this later this week.
s55 wrote:
Input #0, matroska,webm, from 'S:\Data\Development\C# HandBrake\Test Files\SSA_15subtitles.mkv':
Duration: 00:00:58.18, start: 0.000000, bitrate: N/A
Stream #0.0(eng): Video: mpeg4, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc
Stream #0.1(jpn): Audio: vorbis, 48000 Hz, stereo, s16
Stream #0.2(eng): Subtitle: [0][0][0][0] / 0x0000
Stream #0.3(dut): Subtitle: [0][0][0][0] / 0x0000
...
What's with the number blocks here? Any chance we could clean this up?
The nulls are being output by avcodec_string (called by dump_stream_format) inside ffmpeg. I could investigate this more, but any remedy would involve patching ffmpeg. It seems to be having trouble determining the correct codec name for the SSA decoder, and is falling back to output the first 4 bytes of the "codec tag string" (which in this case are all \0).
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

Starhawk wrote:Hey David,

Thanks for your hard work on this. I ran into an issue today when multiple lines of subtitles are timed to appear at different times on screen. Not sure if the issue is with the patch, the source's subs, or my user error.

Here's a clip to show an example.
Yes I can see there seems to be a slight timing issue there.

Would you mind posting the actual video you're encoding or tell me what sub group you're using so I can acquire it myself (assuming that is episode 1 of Bubblegum Crisis).
KabutoTX

Re: [Patch] [Core] SSA burn-in support

Post by KabutoTX »

I am having a problem where one encode stalls at ~43% mark. The mkv file is from http://utw.me/2010/10/08/amagami-ss-14/ I tried the Mac GUI build 3558 and the latest and it happens the same on both. I am trying to encode to iphone preset. Attached is the log. It just pauses at the last line and the CPU goes to about 5% until I hit stop.

Code: Select all

HandBrake Activity Log for /Users/rgdavis-tx/Movies/Amagami_SS_-_14.m4v: 2010-10-10 10:05:23 -0500
Handbrake Version: svn3586 x86_64 (2010100901)

[10:05:23] macgui: scanning specifically for title: 1
[10:05:23] hb_scan: path=/Users/rgdavis-tx/Movies/[UTW]_Amagami_SS_-_14_[h264-720p][900255E1].mkv, title_index=1
[10:05:23] thread 11a85f000 started ("scan")
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening /Users/rgdavis-tx/Movies/[UTW]_Amagami_SS_-_14_[h264-720p][900255E1].mkv/BDMV/index.bdmv
libbluray/bluray.c:960: nav_get_title_list(/Users/rgdavis-tx/Movies/[UTW]_Amagami_SS_-_14_[h264-720p][900255E1].mkv) failed (0x102958800)
[10:05:23] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[10:05:23] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from '/Users/rgdavis-tx/Movies/[UTW]_Amagami_SS_-_14_[h264-720p][900255E1].mkv':
  Metadata:
    title           : Amagami SS - Ai Nanasaki Arc - Chapter 02: Heartbeat
  Duration: 00:24:19.79, start: 0.000000, bitrate: N/A
    Chapter #0.0: start 0.000000, end 100.017000
    Metadata:
      title           : Prologue
    Chapter #0.1: start 100.017000, end 199.950000
    Metadata:
      title           : Opening
    Chapter #0.2: start 199.950000, end 691.941000
    Metadata:
      title           : Part A
    Chapter #0.3: start 691.941000, end 1339.880000
    Metadata:
      title           : Part B
    Chapter #0.4: start 1339.880000, end 1429.887000
    Metadata:
      title           : Ending
    Chapter #0.5: start 1429.887000, end 1459.797000
    Metadata:
      title           : Preview
    Stream #0.0(jpn): Video: h264, yuvj420p, 1280x720 [PAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
    Metadata:
      title           : H.264 720p HDTV
    Stream #0.1(jpn): Audio: aac, 48000 Hz, stereo, s16
    Metadata:
      title           : AAC 2.0 128Kbps
    Stream #0.2(eng): Subtitle: [0][0][0][0] / 0x0000
    Metadata:
      title           : Styled Subtitles
    Stream #0.3: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : arial.ttf
    Stream #0.4: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : AUBREY1.TTF
    Stream #0.5: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : AUBREY1_.TTF
    Stream #0.6: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : BAARS__.TTF
    Stream #0.7: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : Bienetresocial.ttf
    Stream #0.8: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : calibri.ttf
    Stream #0.9: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : chinacat.ttf
    Stream #0.10: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : FranKleinBold.ttf
    Stream #0.11: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : JohnsHand-Regular.ttf
    Stream #0.12: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : Sharpie.ttf
    Stream #0.13: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : times.ttf
    Stream #0.14: Attachment: [0][0][0][0] / 0x0000
    Metadata:
      filename        : Aller_Rg.ttf
[10:05:23] Found ffmpeg 6 chapters, container=matroska,webm
[10:05:23] Added chapter 1, name='Prologue', dur=9001530, (00:01:40)
[10:05:23] Added chapter 2, name='Opening', dur=8993970, (00:01:39)
[10:05:23] Added chapter 3, name='Part A', dur=44279190, (00:08:11)
[10:05:23] Added chapter 4, name='Part B', dur=58314510, (00:10:47)
[10:05:23] Added chapter 5, name='Ending', dur=8100630, (00:01:30)
[10:05:23] Added chapter 6, name='Preview', dur=2691900, (00:00:29)
[10:05:23] scan: decoding previews for title 1
[10:05:23] scan: preview 1
[10:05:23] scan: preview 2
[10:05:23] scan: preview 3
[10:05:23] scan: preview 4
[10:05:23] scan: preview 5
[10:05:24] scan: preview 6
[10:05:24] Title's mostly NTSC Film, setting fps to 23.976
[10:05:24] scan: preview 7
[10:05:24] scan: preview 8
[10:05:24] scan: preview 9
[10:05:24] scan: preview 10
[10:05:24] scan: 10 previews, 1280x720, 23.976 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[10:05:24] scan: title (0) job->width:1280, job->height:720
[10:05:24] thread 11a85f000 exited ("scan")
[10:05:24] thread 11a85f000 joined ("scan")
[10:05:24] libhb: scan thread found 1 valid title(s)
[10:05:24] macgui: ScanDone state received from fQueueEncodeLibhb
[10:05:24] macgui: Preset: iPhone & iPod Touch
[10:05:24] macgui: processNewQueueEncode number of passes expected is: 1
[10:05:24] macgui: Start / Stop set to chapters
[10:05:24] macgui: prepareJob exiting
[10:05:24] thread 11963b000 started ("work")
[10:05:24] 1 job(s) to process
[10:05:24] starting job
[10:05:24] sync: expecting 35024 video frames
[10:05:24] job configuration:
[10:05:24]  * source
[10:05:24]    + /Users/rgdavis-tx/Movies/[UTW]_Amagami_SS_-_14_[h264-720p][900255E1].mkv
[10:05:24]    + title 1, chapter(s) 1 to 6
[10:05:24]    + container: matroska,webm
[10:05:24]  * destination
[10:05:24]    + /Users/rgdavis-tx/Movies/Amagami_SS_-_14.m4v
[10:05:24]    + container: MPEG-4 (.mp4 and .m4v)
[10:05:24]      + chapter markers
[10:05:24]  * video track
[10:05:24]    + decoder: h264
[10:05:24]    + frame rate: same as source (around 23.976 fps)
[10:05:24]    + dimensions: 1280 * 720 -> 480 * 272, crop 0/0/0/0
[10:05:24]    + encoder: x264
[10:05:24]      + options: cabac=0:ref=2:me=umh:bframes=0:subq=6:8x8dct=0:trellis=0
[10:05:24]      + quality: 20.00 (RF)
[10:05:24]  * subtitle track 0, English (id 2) Text [SSA] -> Render/Burn in
[10:05:24]  * audio track 0
[10:05:24]    + decoder: Japanese (AAC) (2.0 ch) (track 1, id 1)
[10:05:24]    + mixdown: Stereo
[10:05:24]    + encoder: ca_aac
[10:05:24]      + bitrate: 128 kbps, samplerate: 48000 Hz
[10:05:24] thread 1196be000 started ("reader")
[10:05:24] thread 119741000 started ("AudioSynchronization")
[10:05:24] thread 1197c4000 started ("Video decoder (ffmpeg streams)")
[10:05:24] thread 119b8f000 started ("Renderer")
[10:05:24] encx264: no bframes, disabling weight-p unless told otherwise
[10:05:24] encx264: min-keyint: 24, keyint: 240
[10:05:24] encx264: Encoding at constant RF 20.000000
[10:05:24] encx264: opening libx264 (pass 0)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[10:05:24] Seeking to chapter 1: starts 0, ends 9001530, AV pos 0
[10:05:24] reader: first SCR 0 id 0 DTS 0
x264 [info]: profile Baseline, level 2.1
[10:05:24] thread 11a44a000 started ("H.264/AVC encoder (libx264)")
Fontconfig error: Cannot load default config file
[10:05:24] [ass] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[10:05:24] thread 11a8e0000 started ("SSA Subtitle Decoder")
[10:05:24] thread 11a963000 started ("Audio decoder (ffmpeg streams)")
[10:05:25] thread 11c625000 started ("AAC encoder (Apple)")
[10:05:25] thread 11c6a8000 started ("Video Synchronization")
[10:05:25] muxmp4: track 0, chunk duration 15015
[10:05:25] muxmp4: track 1, chunk duration 8008
[10:05:25] thread 11d441000 started ("Muxer")
[10:06:11] ffmpeg_read starting chapter 2 at 9005220
[10:06:12] h264: "Opening" (2) at frame 2407 time 9005220
[10:07:15] ffmpeg_read starting chapter 3 at 17995500
[10:07:15] h264: "Part A" (3) at frame 4802 time 17995500
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

Thanks Starhawk and KabutoTX,

I'll try to investigate these files in the coming week. Also have another major life project going on this week, so some delay is to be expected.
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

Hey Starhawk,

The issue you found is related to the encoding pipeline not supporting multiple subtitles displaying at the same time (even though the SSA decoder can generate such overlapping subtitles). I've modified the 'sync' work-object locally for this support and am currently looking at updating the much more complex 'render' work-object, which can do things like delay and drop frames.

Looks like John has some significant changes to the 'render' work-object in the queue as well, so it might take a few more days to get everything working in a full prototype.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [Patch] [Core] SSA burn-in support

Post by JohnAStebbins »

Looks like John has some significant changes to the 'render' work-object in the queue as well, so it might take a few more days to get everything working in a full prototype.
Please don't delay your effort for this. I'll merge any changes into my patch after the fact. The filter changes may not get in for a while since they require significant testing.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [Patch] [Core] SSA burn-in support

Post by JohnAStebbins »

davidfstr, it looks like somebody is in the process of adding SSA/ASS encoding/decoding to ffmpeg.
http://lists.mplayerhq.hu/pipermail/ffm ... 99075.html

If/when it gets applied and stabilizes, it would be worth investigating to see if we can eliminate some libraries.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [Patch] [Core] SSA burn-in support

Post by s55 »

Just out of curiosity did you get a chance to look at that fontconfig issue?
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

@Starhawk: Got a patch for overlapping subtitles. It's not perfect though, since now I can still see other issues related to timing - in particular temporally distinct subtitles that are somehow getting drawn as visually overlapping. There's a new thread tracking that patch:
http://forum.handbrake.fr/viewtopic.php ... 79&start=0

@KabutoTX, bogo_lode: Will probably investigate your encode-stall issue next.

@s55: Haven't gotten to the fontconfig issue yet. Based on the error message, it's looking for a configuration file that isn't there. This probably only affects the usage of system fonts in subtitles. However embedded fonts are usually used over system fonts.
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

Update on the stalling issue:

I've determined that:
* the stall is happening somewhere outside of the SSA decoder
* the stall doesn't happen at the exact same place - it just gets close.

So it's a nondeterministic bug in (or interacting with) unfamiliar code. Might take some time to track down.
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

Subtitle stall is due to a deadlock. Here's the fix:
http://paste.handbrake.fr/pastebin.php?show=1770
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [Patch] [Core] SSA burn-in support

Post by JohnAStebbins »

david, could you describe the deadlock in more detail? Usually, streams are interleaved in such a way that what you describe would never happen. What you seem to be saying is that a huge batch of subtitles is read that are to be applied to some video frames that have not been read yet. Does each of these subtitles have a different start time?
davidfstr
Enlightened
Posts: 149
Joined: Sun Apr 12, 2009 7:41 pm

Re: [Patch] [Core] SSA burn-in support

Post by davidfstr »

When the deadlock occurs, the thread states are:

* 1,2,3: Main threads
* 4: decFOOvideo work-object is waiting for an input packet from its in-FIFO.
* 5: decssasub work-object trying to push an output packet onto subtitle->fifo_raw, but can't because there's no room.
* 6,7,8,9,11,12,13: Work-object is waiting for an input packet from its in-FIFO.
* 14,15: Mux-object is waiting for an input packet from its in-FIFO.

This is what I think is happening in the pipeline:

Code: Select all

* Input stream has an arrangement like {sub packet A, sub packet B, sub packet C, video packet D}.
* Both sub packets, when decoded from subtitle->fifo_in, expand to a large number of subtitle lines (about 6 lines per input packet in practice) which are passed to subtitle->fifo_raw.
* Sub packet A generates a large number of output subtitle lines (say 18) that are pushed onto subtitle->fifo_raw, filling its capacity.
* Sub packet B generates some subtitle lines as well, but they can't be pushed onto subtitle->fifo_raw because there's no room left. (Normally the sync work-object would get around to popping these off, but keep reading.)
* Meanwhile subtitle->fifo_in has filled up, so the reader thread is blocking trying to push sub packet C onto subtitle->fifo_in, which won't empty because the work-object processing sub packet B is blocking.
* When the reader thread is blocked, it can't read and send video packet D down the video pipeline, eventually to be consumed by the sync work-object.
* Now the sync work-object is blocking waiting for video packet D, which it's not going to get because the reader is blocked.
* Since the sync work-object is blocked, no subtitle packets will get removed from subtitle->fifo_raw.

Ultimately:
* sync work-object is blocked waiting for a video packet.
* Reader can't provide a video packet because it's waiting for its subtitle packet to be processed.
* Subtitle packet can't be processed because there a huge backlog of unprocessed packets further down the pipeline.
* The unprocessed packets in the pipeline are waiting for the sync work-object to consume them (which it won't do because its blocked).
Right around the 45% mark on the test video I have, there are a large number of subtitle packets that generate a large number of lines per packet. In my attached debug output:
* "PACKET" indicates when a subtitle packet is being read.
* "OK" indicates when control exits the decssa work-object. These can be disregarded.
* "-->" for packets past the 45% mark or so indicate individual lines just prior to decoding. These can be disregarded.

The pattern to notice is that a whole ton of subtitle lines get thrown at the pipeline simultaneously around the 45% mark in the test file.
Last edited by davidfstr on Fri Oct 22, 2010 3:44 am, edited 1 time in total.
Reason: putting verbosity in code block
Drifter
Posts: 7
Joined: Fri Sep 24, 2010 9:21 am

Re: [Patch] [Core] SSA burn-in support

Post by Drifter »

At first I thought this might be the subers mistake, but then it happened on 2 different anime and different subers.

It has something to do with the letters like y,p,q,j ect that hang down. Makes it difficult to enjoy the anime.
Image
Post Reply