Wrong placement and size of burned subtitles

Archive of historical bug reports.
Please use the GitHub link above to report issues.
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.

*******************************
Post Reply
Deleted User 23485

Wrong placement and size of burned subtitles

Post by Deleted User 23485 »

I encode a ripped DVD where I burn in a "forced" subtitle track. The subtitles were not placed or sized correctly versus playing back the original ripped DVD. I do "not" crop the video (720x480) so on playback I see black bars on the top and bottom. Long ago I remember HandBrake burned in the subtitles so on playback they were in the same position and size of the subtitles as when playing back the ripped DVD. I would like the burned subtitles to be in the same position and size. The html link below is an image that shows the the playback of the ripped DVD on the left and the HandBrake encoded video on the right (sorry I couldn't get the embed image link to work, but I tried). The videos look the same when playing back on MPC-HC or VLC. I would like the location of the burned subtitles to at least be closer to the bottom edge. Thanks for your help.

https://1drv.ms/i/s!AFfE2po5LtK6m0I

Code: Select all

HandBrake Nightly 20160929182728-d398531-master (2016093001) - 64bit Version
OS: Microsoft Windows NT 6.1.7601 Service Pack 1 - 64bit
CPU: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
Ram: 3797 MB, 
GPU Information:
  Intel(R) HD Graphics 4000 - 10.18.10.4425
Screen: 1920x1080
Temp Dir: C:\Temp\
Install Dir: D:\Video\HandBrake
Data Dir: C:\Users\foobar\AppData\Roaming\HandBrake Team\HandBrake\0.0.0.0

-------------------------------------------


# Starting Encode ...

[09:58:43] hb_init: starting libhb thread
[09:58:43] 1 job(s) to process
[09:58:43] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": 1073743872,
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      1073807360,
      1073743872,
      1074003968,
      1073750016,
      1090519040,
      1074790400,
      1074266112,
      1107296256
    ],
    "FallbackEncoder": 2048
  },
  "Destination": {
    "ChapterList": [
      {
        "Name": "Chapter 1"
      },
      {
        "Name": "Chapter 2"
      },
      {
        "Name": "Chapter 3"
      },
      {
        "Name": "Chapter 4"
      },
      {
        "Name": "Chapter 5"
      },
      {
        "Name": "Chapter 6"
      },
      {
        "Name": "Chapter 7"
      },
      {
        "Name": "Chapter 8"
      },
      {
        "Name": "Chapter 9"
      },
      {
        "Name": "Chapter 10"
      },
      {
        "Name": "Chapter 11"
      },
      {
        "Name": "Chapter 12"
      },
      {
        "Name": "Chapter 13"
      },
      {
        "Name": "Chapter 14"
      },
      {
        "Name": "Chapter 15"
      },
      {
        "Name": "Chapter 16"
      },
      {
        "Name": "Chapter 17"
      },
      {
        "Name": "Chapter 18"
      },
      {
        "Name": "Chapter 19"
      },
      {
        "Name": "Chapter 20"
      },
      {
        "Name": "Chapter 21"
      },
      {
        "Name": "Chapter 22"
      },
      {
        "Name": "Chapter 23"
      },
      {
        "Name": "Chapter 24"
      },
      {
        "Name": "Chapter 25"
      }
    ],
    "ChapterMarkers": true,
    "File": "D:\\Tmp\\The Revenant-2.mkv",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": 2097152
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 11,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "480",
          "width": "720"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "0"
        }
      }
    ]
  },
  "PAR": {
    "Num": 32,
    "Den": 27
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 25
    },
    "Title": 2,
    "Path": "\\\\BOBO\\Movies\\THE_REVENANT"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": [
      {
        "Burn": true,
        "Default": false,
        "Forced": false,
        "ID": 1,
        "Offset": 0,
        "Track": 0
      },
      {
        "Burn": false,
        "Default": false,
        "Forced": false,
        "ID": 2,
        "Offset": 0,
        "Track": 1
      }
    ]
  },
  "Video": {
    "Encoder": 65536,
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "medium",
    "Profile": "high",
    "Quality": 19.5,
    "Tune": "film",
    "OpenCL": false,
    "HWDecode": false,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[09:58:43] CPU: Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz
[09:58:43]  - Intel microarchitecture Ivy Bridge
[09:58:43]  - logical processor count: 4
[09:58:43] OpenCL device #1: Intel(R) Corporation Intel(R) HD Graphics 4000
[09:58:43]  - OpenCL version: 1.2
[09:58:43]  - driver version: 10.18.10.4425
[09:58:43]  - device type:    GPU
[09:58:43]  - supported:      no
[09:58:43] Intel Quick Sync Video support: yes
[09:58:43]  - Intel Media SDK hardware: API 1.11 (minimum: 1.3)
[09:58:43]  - H.264 encoder: yes
[09:58:43]     - preferred implementation: hardware (any)
[09:58:43]     - capabilities (hardware):  vsinfo opt1 opt2+extbrc+ib_adapt+nmpslice
[09:58:43]  - H.265 encoder: no
[09:58:43] hb_scan: path=\\BOBO\Movies\THE_REVENANT, title_index=2
src/libbluray/disc/disc.c:352: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:352: error opening file BDMV\BACKUP\index.bdmv
[09:58:43] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't open \\BOBO\Movies\THE_REVENANT for reading
libdvdread: Device \\BOBO\Movies\THE_REVENANT inaccessible, CSS authentication not available.
libdvdnav: Unable to open device file \\BOBO\Movies\THE_REVENANT.
libdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't open \\BOBO\Movies\THE_REVENANT for reading
libdvdread: Device \\BOBO\Movies\THE_REVENANT inaccessible, CSS authentication not available.
[09:58:43] scan: DVD has 40 title(s)
[09:58:43] scan: scanning title 2
[09:58:43] scan: opening IFO for VTS 2
[09:58:43] scan: duration is 02:36:11 (9371967 ms)
[09:58:43] pgc_id: 1, pgn: 1: pgc: 0000000020CD0160
[09:58:43] scan: vts=2, ttn=1, cells=0->25, blocks=0->3758972, 3758973 blocks
[09:58:43] scan: checking audio 1
[09:58:43] scan: id=0x80bd, lang=English (AC3), 3cc=eng ext=0
[09:58:43] scan: checking audio 2
[09:58:43] scan: id=0x81bd, lang=English (AC3), 3cc=eng ext=2
[09:58:43] scan: checking audio 3
[09:58:43] scan: id=0x82bd, lang=español (AC3), 3cc=spa ext=0
[09:58:43] scan: checking audio 4
[09:58:43] scan: id=0x83bd, lang=Francais (AC3), 3cc=fra ext=0
[09:58:43] scan: checking subtitle 1
[09:58:43] scan: id=0x21bd, lang=English (Forced Caption), 3cc=eng ext=9
[09:58:43] scan: checking subtitle 2
[09:58:43] scan: id=0x23bd, lang=English (Closed Caption), 3cc=eng ext=5
[09:58:43] scan: checking subtitle 3
[09:58:43] scan: id=0x25bd, lang=español, 3cc=spa ext=1
[09:58:43] scan: checking subtitle 4
[09:58:43] scan: id=0x27bd, lang=español (Forced Caption), 3cc=spa ext=9
[09:58:43] scan: checking subtitle 5
[09:58:43] scan: id=0x29bd, lang=Francais, 3cc=fra ext=1
[09:58:43] scan: checking subtitle 6
[09:58:43] scan: id=0x2bbd, lang=Francais (Forced Caption), 3cc=fra ext=9
[09:58:43] scan: title 2 has 25 chapters
[09:58:43] scan: chap 1 c=0->0, b=0->129482 (129483), 304533 ms
[09:58:43] scan: chap 2 c=1->1, b=129483->206402 (76920), 173300 ms
[09:58:43] scan: chap 3 c=2->2, b=206403->343018 (136616), 320333 ms
[09:58:43] scan: chap 4 c=3->3, b=343019->534789 (191771), 471367 ms
[09:58:43] scan: chap 5 c=4->4, b=534790->728835 (194046), 430500 ms
[09:58:43] scan: chap 6 c=5->5, b=728836->953156 (224321), 525500 ms
[09:58:43] scan: chap 7 c=6->6, b=953157->1115564 (162408), 412166 ms
[09:58:43] scan: chap 8 c=7->7, b=1115565->1215997 (100433), 254500 ms
[09:58:43] scan: chap 9 c=8->8, b=1215998->1296873 (80876), 206967 ms
[09:58:43] scan: chap 10 c=9->9, b=1296874->1412767 (115894), 308533 ms
[09:58:43] scan: chap 11 c=10->10, b=1412768->1482145 (69378), 179467 ms
[09:58:43] scan: chap 12 c=11->11, b=1482146->1570111 (87966), 220867 ms
[09:58:43] scan: chap 13 c=12->12, b=1570112->1777742 (207631), 500166 ms
[09:58:43] scan: chap 14 c=13->13, b=1777743->1894390 (116648), 283333 ms
[09:58:43] scan: chap 15 c=14->15, b=1894391->1999953 (105563), 285967 ms
[09:58:43] scan: chap 16 c=16->16, b=1999954->2162555 (162602), 428333 ms
[09:58:43] scan: chap 17 c=17->17, b=2162556->2354858 (192303), 538367 ms
[09:58:43] scan: chap 18 c=18->18, b=2354859->2648011 (293153), 674000 ms
[09:58:43] scan: chap 19 c=19->19, b=2648012->2773574 (125563), 263800 ms
[09:58:43] scan: chap 20 c=20->20, b=2773575->2912691 (139117), 356834 ms
[09:58:43] scan: chap 21 c=21->21, b=2912692->3012473 (99782), 230500 ms
[09:58:43] scan: chap 22 c=22->22, b=3012474->3335429 (322956), 767834 ms
[09:58:43] scan: chap 23 c=23->23, b=3335430->3541503 (206074), 425333 ms
[09:58:43] scan: chap 24 c=24->24, b=3541504->3758830 (217327), 808967 ms
[09:58:43] scan: chap 25 c=25->25, b=3758831->3758972 (142), 500 ms
[09:58:43] scan: aspect = 16:9
[09:58:43] scan: decoding previews for title 2
libdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
[09:58:43] scan: title angle(s) 1
[ac3 @ 00000000008ed560] frame sync error
[ac3 @ 00000000008ed560] frame sync error
[09:58:44] scan: audio 0x80bd: ac3, rate=48000Hz, bitrate=448000 English (AC3) (5.1 ch)
[ac3 @ 00000000008ed560] frame sync error
[ac3 @ 00000000008ed560] frame sync error
[09:58:44] scan: audio 0x82bd: ac3, rate=48000Hz, bitrate=192000 español (AC3) (2.0 ch) (Dolby Surround)
[ac3 @ 00000000008ed560] frame sync error
[09:58:44] scan: audio 0x83bd: ac3, rate=48000Hz, bitrate=192000 Francais (AC3) (2.0 ch) (Dolby Surround)
[ac3 @ 00000000008ed560] frame sync error
[09:58:44] scan: audio 0x81bd: ac3, rate=48000Hz, bitrate=384000 English (AC3) (Visually Impaired) (5.1 ch)
[09:58:45] scan: 10 previews, 720x480, 23.976 fps, autocrop = 58/60/0/0, aspect 16:9, PAR 32:27
[09:58:45] libhb: scan thread found 1 valid title(s)
[09:58:45] starting job
[09:58:45] yadif thread started for segment 0
[09:58:45] yadif thread started for segment 1
[09:58:45] yadif thread started for segment 2
[09:58:45] job configuration:
[09:58:45]  * source
[09:58:45]    + \\BOBO\Movies\THE_REVENANT
[09:58:45]    + title 2, chapter(s) 1 to 25
[09:58:45]  * destination
[09:58:45]    + D:\Tmp\The Revenant-2.mkv
[09:58:45] yadif thread started for segment 3
[09:58:45]    + container: Matroska (libavformat)
[09:58:45]      + chapter markers
[09:58:45]  * video track
[09:58:45]    + decoder: mpeg2video
[09:58:45]      + bitrate 9800 kbps
[09:58:45]    + filters
[09:58:45]      + Decomb (mode=7)
[09:58:45]      + Framerate Shaper (mode=0)
[09:58:45]        + frame rate: same as source (around 23.976 fps)
[09:58:45]      + Subtitle renderer ()
[09:58:45]      + Crop and Scale (width=720:height=480:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[09:58:45]        + source: 720 * 480, crop (0/0/0/0): 720 * 480, scale: 720 * 480
[09:58:45]    + Output geometry
[09:58:45]      + storage dimensions: 720 x 480
[09:58:45]      + pixel aspect ratio: 32 : 27
[09:58:45]      + display dimensions: 853 x 480
[09:58:45]    + encoder: H.264 (libx264)
[09:58:45]      + preset:  medium
[09:58:45]      + tune:    film
[09:58:45]      + profile: high
[09:58:45]      + level:   auto
[09:58:45]      + quality: 19.50 (RF)
[09:58:45]  * subtitle track 1, English (Forced Caption) (track 0, id 0x21bd) Picture [VOBSUB] -> Render/Burn-in
[09:58:45]  * subtitle track 2, English (Closed Caption) (track 1, id 0x23bd) Picture [VOBSUB] -> Passthrough
[09:58:45]  * audio track 1
[09:58:45]    + decoder: English (AC3) (5.1 ch) (track 1, id 0x80bd)
[09:58:45]      + bitrate: 448 kbps, samplerate: 48000 Hz
[09:58:45]    + AC3 Passthru
libdvdnav: Using dvdnav version 5.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't open \\BOBO\Movies\THE_REVENANT for reading
libdvdread: Device \\BOBO\Movies\THE_REVENANT inaccessible, CSS authentication not available.
libdvdnav: Unable to open device file \\BOBO\Movies\THE_REVENANT.
libdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
libdvdread: Encrypted DVD support unavailable.
libdvdread: Can't open \\BOBO\Movies\THE_REVENANT for reading
libdvdread: Device \\BOBO\Movies\THE_REVENANT inaccessible, CSS authentication not available.
libdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
[09:58:45] sync: expecting 224702 video frames
[09:58:45] encx264: min-keyint: 24, keyint: 240
[09:58:45] encx264: encoding at constant RF 19.500000
[09:58:45] encx264: unparsed options: deblock=-1,-1:psy-rd=1,0.15
x264 [info]: using SAR=32/27
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile High, level 3.0
[09:58:46] sync: first pts video is 0
[09:58:46] sync: "Chapter 1" (1) at frame 1 time 0
[09:58:46] sync: first pts audio 0x80bd is 0
[09:59:07] sync: first pts subtitle 0x23bd is 5624619
[09:59:08] sync: first pts subtitle 0x21bd is 5798793
[10:01:36] sync: "Chapter 2" (2) at frame 7310 time 27436159
[10:03:24] sync: "Chapter 3" (3) at frame 11469 time 43048004
[10:06:42] sync: "Chapter 4" (4) at frame 19157 time 71906834
[10:10:43] sync: "Chapter 5" (5) at frame 30470 time 114373009
[10:14:41] sync: "Chapter 6" (6) at frame 40802 time 153156754
[10:19:20] sync: "Chapter 7" (7) at frame 53414 time 200499048
[10:22:38] sync: "Chapter 8" (8) at frame 63306 time 237631143
[10:24:56] sync: "Chapter 9" (9) at frame 69414 time 260559048
[10:26:38] sync: "Chapter 10" (10) at frame 74381 time 279203925
[10:29:17] sync: "Chapter 11" (11) at frame 81786 time 307000444
[10:30:56] sync: "Chapter 12" (12) at frame 86093 time 323167845
[10:32:50] sync: "Chapter 13" (13) at frame 91394 time 343066474
[10:37:32] sync: "Chapter 14" (14) at frame 103398 time 388126489
[10:40:12] sync: "Chapter 15" (15) at frame 110198 time 413651989
[10:42:31] sync: "Chapter 16" (16) at frame 117061 time 439413975
[10:46:09] sync: "Chapter 17" (17) at frame 127341 time 478002524
[10:50:27] sync: "Chapter 18" (18) at frame 140262 time 526504728
[10:56:06] sync: "Chapter 19" (19) at frame 156438 time 587225388
[10:58:30] sync: "Chapter 20" (20) at frame 162769 time 610990379
[11:01:10] sync: "Chapter 21" (21) at frame 171333 time 643137494
[11:03:13] sync: "Chapter 22" (22) at frame 176865 time 663903239
[11:09:52] sync: "Chapter 23" (23) at frame 195293 time 733077344
[11:14:07] sync: "Chapter 24" (24) at frame 205501 time 771395625
[11:18:26] reader: done. 1 scr changes
[11:18:27] work: average encoding speed for job is 47.027088 fps
[11:18:27] decomb: deinterlaced 224916 | blended 0 | unfiltered 0 | total 224916
[11:18:27] vfr: lost time: 0 (0 frames)
[11:18:27] vfr: gained time: 0 (0 frames) (0 not accounted for)
[11:18:27] ac3-decoder done: 293151 frames, 0 decoder errors
[11:18:27] mpeg2video-decoder done: 224916 frames, 0 decoder errors
[11:18:27] sync: got 224916 frames, 224702 expected
[11:18:27] sync: framerate min 23.968 fps, max 29.970 fps, avg 23.976 fps
x264 [info]: frame I:1415  Avg QP:14.05  size: 37773
x264 [info]: frame P:58919 Avg QP:18.26  size: 14905
x264 [info]: frame B:164582 Avg QP:21.16  size:  4259
x264 [info]: consecutive B-frames:  1.9%  0.9%  2.1% 95.2%
x264 [info]: mb I  I16..4: 22.9% 51.1% 25.9%
x264 [info]: mb P  I16..4:  1.0%  7.3%  2.4%  P16..4: 28.8% 19.0% 11.8%  0.0%  0.0%    skip:29.6%
x264 [info]: mb B  I16..4:  0.1%  0.9%  0.4%  B16..8: 33.0%  6.3%  1.7%  direct: 3.9%  skip:53.7%  L0:41.3% L1:43.6% BI:15.1%
x264 [info]: 8x8 transform intra:64.8% inter:61.1%
x264 [info]: coded y,uvDC,uvAC intra: 78.1% 71.0% 29.4% inter: 21.4% 18.9% 0.8%
x264 [info]: i16 v,h,dc,p: 40% 26%  9% 25%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 16% 16%  7%  9%  9% 10%  9% 10%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 19% 13%  7% 10% 10% 11%  8%  9%
x264 [info]: i8c dc,h,v,p: 54% 23% 18%  5%
x264 [info]: Weighted P-Frames: Y:6.2% UV:3.2%
x264 [info]: ref P L0: 51.8% 16.1% 23.5%  8.0%  0.6%
x264 [info]: ref B L0: 84.9% 11.3%  3.8%
x264 [info]: ref B L1: 95.3%  4.7%
x264 [info]: kb/s:1392.30
[11:18:27] mux: track 0, 224916 frames, 1632562012 bytes, 1392.25 kbps, fifo 4096
[11:18:27] mux: track 1, 293151 frames, 525326592 bytes, 448.00 kbps, fifo 8192
[11:18:27] mux: track 2, 1266 frames, 2858592 bytes, 2.44 kbps, fifo 32
[11:18:27] libhb: work result = 0

# Encode Completed ...
Deleted User 11865

Re: Wrong placement and size of burned subtitles

Post by Deleted User 11865 »

Bite_Me wrote:

Code: Select all

[09:58:45]    + filters
[09:58:45]      + Decomb (mode=7)
[09:58:45]      + Framerate Shaper (mode=0)
[09:58:45]        + frame rate: same as source (around 23.976 fps)
[09:58:45]      + Subtitle renderer ()
That does look like there's a bug somewhere indeed.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

Rodeo wrote:
Bite_Me wrote:

Code: Select all

[09:58:45]    + filters
[09:58:45]      + Decomb (mode=7)
[09:58:45]      + Framerate Shaper (mode=0)
[09:58:45]        + frame rate: same as source (around 23.976 fps)
[09:58:45]      + Subtitle renderer ()
That does look like there's a bug somewhere indeed.
@Rodeo, what looks like a bug?
@Bite_Me, I haven't been able to reproduce your problem.
Deleted User 11865

Re: Wrong placement and size of burned subtitles

Post by Deleted User 11865 »

Shouldn't the subtitle renderer settings contain video width, height and crop by that stage, in order to know how to properly adjust subtitle coordinates for it?

I understand these may be automatically set by libhb or the filter, but shouldn't this be already done by the time the job configuration gets printed?
Deleted User 23485

Re: Wrong placement and size of burned subtitles

Post by Deleted User 23485 »

"what looks like a bug?"

All I can say is click on the Microsoft One-Drive link I provided in my posting. It shows the difference in subtitle placement between the DVD playback versus the Handbrake encoded video.

"I haven't been able to reproduce your problem."

I first noticed the problem in Handbrake 10.5, so I downloaded the nightly build and reproduced the same problem in that version of Handbrake. When a video is ready to encode I switch the "Cropping" option in the Picture tab from Automatic to Custom and then place "zeros" in the top, bottom, left, and right boxes so I don't crop, thus the encoded video is the same 720x480 resolution as the original DVD resolution. I did this in the past to make the subtitle placements equal between the DVD playback and the encoded video playback. But it doesn't work anymore. I also set Anamorphic to "Strict", if that could make a difference.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

Rodeo wrote:Shouldn't the subtitle renderer settings contain video width, height and crop by that stage, in order to know how to properly adjust subtitle coordinates for it?

I understand these may be automatically set by libhb or the filter, but shouldn't this be already done by the time the job configuration gets printed?
The renderer knows width and height from the filter_init struct that is passed in. This struct gets updated by the init function of each filter to reflect the properties of the frames it will output. The one thing render could not get this way is cropping because crop & scale happens after render. This is what the post_init api was added for. It lets all filters know the final properties of the output of the filter chain.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

Bite_Me wrote:"what looks like a bug?"
That was directed @Rodeo, not you.
I first noticed the problem in Handbrake 10.5, so I downloaded the nightly build and reproduced the same problem in that version of Handbrake. When a video is ready to encode I switch the "Cropping" option in the Picture tab from Automatic to Custom and then place "zeros" in the top, bottom, left, and right boxes so I don't crop, thus the encoded video is the same 720x480 resolution as the original DVD resolution. I did this in the past to make the subtitle placements equal between the DVD playback and the encoded video playback. But it doesn't work anymore. I also set Anamorphic to "Strict", if that could make a difference.
I performed the same sequence of operations. I compared the settings in my log to the settings in your log. So my settings matched yours. Then I compared the output video and subtitle placement with the source. They looked identical.

Maybe we can figure out a way for you to create a sample of video that I can use to reproduce with. Try this.
  1. Figure out where an offending subtitle is in the video.
  2. Use the point-to-point encoding options to encode about 30 seconds around that subtitle (i.e. change "Chapters" dropdown to "Seconds" and set appropriate range.
  3. Encode that range with *soft* subtitles.
  4. Verify that the encoded video plays back and displays the soft subtitle in the correct position.
  5. Re-encode the sample you just created with the subtitle burned in.
  6. Check if the subtitle is in the wrong position. If it is, post the sample with the soft subtitle somewhere I can retrieve it for testing.
Deleted User 23485

Re: Wrong placement and size of burned subtitles

Post by Deleted User 23485 »

The link below is to a zip file that contains all the test files that I used to recreate the problem. The zip file is 394MB. Once unpacked the "REV" directory contains the movie shorten to 5 mins, by using a tool called VobBlanker. I dragged and dropped REV onto HandBrake to create the "Rev-2.mp4" video file. The log files for this encoding are in the "logs" directory. The "screen images" directory contains images of the HandBrake settings I used. And lastly the "DVD vs HB.jpg" image is a side-by-side comparison of the DVD "REV" directory played in MPC-HC versus playback of the HandBrake encoded "Rev-2.mpg" video file. Note, I used a different computer for this encoding than in my first posting and also used HandBrake 10.5.

The encoded "Rev-2.mp4" video has subtitles burned in and the same subtitles not burned in. Upon playback I can tell they are in the same position to each other. But not in the same position versus the DVD playback as shown in "DVD vs HB.jpg" image.

Hope this helps.

The link goes to a directory where you can click on the "hb test files.zip" file to download it.

https://1drv.ms/u/s!AFfE2po5LtK6m0M
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

I don't know where you are getting this content, but it's very screwed up. The raw stream itself (VTS_02_1.VOB) has 12 vobsub streams. Only 6 of which are referred to by the IFO file.

Here's a scan of the VOB

Code: Select all

[09:39:51] file is MPEG Program Stream
[09:39:51] Probing 1 unknown stream
[09:39:51]     Probe: Found stream mpeg2video. stream id 0xe0-0x0
[09:39:51] Found the following streams
[09:39:51]     Video Streams : 
[09:39:51]       0xe0-0x0 type MPEG2 (0x2)
[09:39:51]     Audio Streams : 
[09:39:51]       0xbd-0x80 type AC3 (0x81)
[09:39:51]       0xbd-0x81 type AC3 (0x81)
[09:39:51]       0xbd-0x82 type AC3 (0x81)
[09:39:51]       0xbd-0x83 type AC3 (0x81)
[09:39:51]     Subtitle Streams : 
[09:39:51]       0xbd-0x20 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x21 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x22 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x23 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x24 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x25 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x26 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x27 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x28 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x29 type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x2a type DVD Subtitle (0x0)
[09:39:51]       0xbd-0x2b type DVD Subtitle (0x0)
Here's a scan of the disc which shows the IFO

Code: Select all

[09:45:46] scan: scanning title 2
[09:45:46] scan: opening IFO for VTS 2
[09:45:46] scan: duration is 00:05:17 (317000 ms)
[09:45:46] pgc_id: 1, pgn: 1: pgc: 0x7f0614015380
[09:45:46] scan: vts=2, ttn=1, cells=0->25, blocks=0->129607, 129608 blocks
[09:45:46] scan: checking audio 1
[09:45:46] scan: id=0x80bd, lang=English (AC3), 3cc=eng ext=0
[09:45:46] scan: checking audio 2
[09:45:46] scan: id=0x81bd, lang=English (AC3), 3cc=eng ext=2
[09:45:46] scan: checking audio 3
[09:45:46] scan: id=0x82bd, lang=español (AC3), 3cc=spa ext=0
[09:45:46] scan: checking audio 4
[09:45:46] scan: id=0x83bd, lang=Francais (AC3), 3cc=fra ext=0
[09:45:46] scan: checking subtitle 1
[09:45:46] scan: id=0x21bd, lang=English (Forced Caption), 3cc=eng ext=9
[09:45:46] scan: checking subtitle 2
[09:45:46] scan: id=0x23bd, lang=English (Closed Caption), 3cc=eng ext=5
[09:45:46] scan: checking subtitle 3
[09:45:46] scan: id=0x25bd, lang=español, 3cc=spa ext=1
[09:45:46] scan: checking subtitle 4
[09:45:46] scan: id=0x27bd, lang=español (Forced Caption), 3cc=spa ext=9
[09:45:46] scan: checking subtitle 5
[09:45:46] scan: id=0x29bd, lang=Francais, 3cc=fra ext=1
[09:45:46] scan: checking subtitle 6
[09:45:46] scan: id=0x2bbd, lang=Francais (Forced Caption), 3cc=fra ext=9
[09:45:46] scan: title 2 has 25 chapters
[09:45:46] scan: chap 1 c=0->0, b=0->129482 (129483), 304500 ms
[09:45:46] scan: chap 2 c=1->1, b=129483->129487 (5), 500 ms
[09:45:46] scan: chap 3 c=2->2, b=129488->129492 (5), 500 ms
[09:45:46] scan: chap 4 c=3->3, b=129493->129497 (5), 500 ms
[09:45:46] scan: chap 5 c=4->4, b=129498->129502 (5), 500 ms
[09:45:46] scan: chap 6 c=5->5, b=129503->129507 (5), 500 ms
[09:45:46] scan: chap 7 c=6->6, b=129508->129512 (5), 500 ms
[09:45:46] scan: chap 8 c=7->7, b=129513->129517 (5), 500 ms
[09:45:46] scan: chap 9 c=8->8, b=129518->129522 (5), 500 ms
[09:45:46] scan: chap 10 c=9->9, b=129523->129527 (5), 500 ms
[09:45:46] scan: chap 11 c=10->10, b=129528->129532 (5), 500 ms
[09:45:46] scan: chap 12 c=11->11, b=129533->129537 (5), 500 ms
[09:45:46] scan: chap 13 c=12->12, b=129538->129542 (5), 500 ms
[09:45:46] scan: chap 14 c=13->13, b=129543->129547 (5), 500 ms
[09:45:46] scan: chap 15 c=14->15, b=129548->129557 (10), 1000 ms
[09:45:46] scan: chap 16 c=16->16, b=129558->129562 (5), 500 ms
[09:45:46] scan: chap 17 c=17->17, b=129563->129567 (5), 500 ms
[09:45:46] scan: chap 18 c=18->18, b=129568->129572 (5), 500 ms
[09:45:46] scan: chap 19 c=19->19, b=129573->129577 (5), 500 ms
[09:45:46] scan: chap 20 c=20->20, b=129578->129582 (5), 500 ms
[09:45:46] scan: chap 21 c=21->21, b=129583->129587 (5), 500 ms
[09:45:46] scan: chap 22 c=22->22, b=129588->129592 (5), 500 ms
[09:45:46] scan: chap 23 c=23->23, b=129593->129597 (5), 500 ms
[09:45:46] scan: chap 24 c=24->24, b=129598->129602 (5), 500 ms
[09:45:46] scan: chap 25 c=25->25, b=129603->129607 (5), 500 ms
[09:45:46] scan: aspect = 16:9
If you encode the raw vob multiple times, once for each subtitle stream, you will find one stream that has the subtitle positions where you want them. And you will find another subtitle stream where the subtitle are positioned as HandBrake is rendering them. Note the subtitle colors will be screwed up in this test (black in my testing) because vobsub palettes are part of the IFO and there is no good way to guess defaults that work with every vobsub stream.

So there is nothing wrong with HandBrake here. It's just that your IFO file only references the subtitle stream that you don't like.
Deleted User 23485

Re: Wrong placement and size of burned subtitles

Post by Deleted User 23485 »

The content comes from ripping "The Revenant" DVD to my hard drive. I don't know anything about IFO files and how screwed up they can be while still be able to playback, which the REV files can do. It seems to me DVD producers tend to leave junk laying around.

I encoded the video 6 times burning one subtitle stream at a time, with no cropping, as per your suggestion. Subtitle track #1 is what I have shown in my jpeg images, where the text is on the small side and up into the frame. Subtitle tracks 2-6 have much larger text placed closer to the bottom of the frame and the text is slanted. All subtitles show up white, so I have no idea why your encoding produced black text. I did my encoding using 10.5. I only want to burn subtitle track #1, the "English forced" subtitle track.

I have played the DVD ripped files, the VIDEO_TS.IFO file in 3 different video players, MPC-HC, VLC, and Kodi. All 3 seems to be playing back subtitle track #1 (English forced). All 3 place the text in the same position, closer to the bottom of the fame with taller characters versus the HandBrake encoded video. So John, I'm now completely confused. You say HandBrake is placing and sizing the subtitles correctly. If so, that means MPC-HC, VLC and Kodi are not correctly placing and sizing the subtitles??? To me it seems the video players are correct, of course that is just my opinion. Others may actually prefer the subtitles higher into the frame.
Woodstock
Veteran User
Posts: 4613
Joined: Tue Aug 27, 2013 6:39 am

Re: Wrong placement and size of burned subtitles

Post by Woodstock »

Something that I've seen on some Disney-distributed titles recently is subtitles that are placed to show the relationship to the speaker, rather than everything centered. You have a choice of "regular" and "character placement" (for lack of another name) subtitles. VLC definitely displayed them differently. "Only Yesterday" and "A Letter to Momo", and "When Marnie Was There" all are like that. Kind of annoying. :)
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

You didn't quite understand my earlier post, but no worries.

I used VLC and mpv to play the REV directory you provided. VLC gets very confused about the subtitle list, but it does have the subtitles you want as one of the options (It's first in the list). The subtitle track you don't want is second in the list. It gets confused about what language each is and which are CCs. mpv has a similar subtitle list. Both VLC and mpv see more than 6 subtitle tracks. It's not clear to me how they are creating their lists, but given the confusion in labeling the list, I suspect they are scanning the stream instead of relying only on what they see in the IFO file.

All that said, I took a closer look at how our code selects which subtitles to add to the list. DVDs have this convoluted selection criteria that filters subtitles depending on the aspect ratio of the video and whether Letterbox and Pan & Scan are permitted (these are all things the IFO tells you). What HandBrake is doing is showing you *only* the Letterbox subtitles when the IFO says Letterbox is allowed. But there are also subtitles designed for Wide Screen that I think we should also enable in this scenario. The subtitle you want is one that is flagged as Wide Screen.

I suspect this is a very unusual disc having separate subtitle tracks for Letterbox vs. Wide Screen that are so drastically different from each other. Would explain why we haven't seen this kind of thing before.

I did some testing with a couple of discs I have handy. With one, the Letterbox and Wide Screen subtitle indexes referenced the same subtitle track. I filter out duplicates, so this is ok. With the other, Letterbox and Wide Screen result in different subtitle tracks and the Wide Screen version of the subtitles is positioned slightly (not a lot like yours) higher on the screen than the Letterbox version. This is exactly opposite of your disc where the Letterbox version of the subtitle track was positioned higher. So there's no logic to how the positioning is determined it seems.

Anyway, I'm going to propose a patch to add the Wide Screen subtitle tracks to the list in this scenario. But since HandBrake is in a feature freeze right now, it may not get accepted until after the 1.0 release gets kicked out the door.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

FYI, pull request for this patch is here https://github.com/HandBrake/HandBrake/pull/355
Deleted User 23485

Re: Wrong placement and size of burned subtitles

Post by Deleted User 23485 »

Nice to see this got on the patch list of things to do, thanks.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

I inspected a few more DVDs to see what the differences generally are between "widescreen" and "letterbox" subtitles. In all of the DVDs I looked at that have separate subtitles for each, the letterbox subtitles were always *lower* on the image and at least partially into the black bar at the bottom of the screen. This makes sense because when you play back a dvd on a widescreen tv and zoom to fill the screen, the black bars would not be visible and you would be cutting off part of the letterbox subtitles. The "widescreen" subtitles are meant for this scenario, you need them higher in order to see them in widescreen mode.

Your DVD on the other hand has both the widescreen and letterbox subtitles above the black bar with the letterbox subtitles being even higher than the widescreen subtitles. So your DVD appears to be an aberration where someone got things badly backwards. Given that the subtitles are also smaller, my guess is that someone set a scale factor incorrectly when mastering the disc and it slipped past whatever QA they have.
Deleted User 23485

Re: Wrong placement and size of burned subtitles

Post by Deleted User 23485 »

Ever since I started using HandBrake I don't crop DVD encodings, because I prefer subtitles to show up in the black bar at the bottom of the frame.

"The Revenant" DVD can't be that usual. The link below shows an image of two frames from "Dawn of the Planet of the Apes". The left frame with the yellow forced subtitle track burned-in. The right frame with the white English subtitle track not been burned-in. This is playing back a Handbrake encoded video, not the DVD vobfiles, which I no longer have. Both subtitles are higher into the frame than what I would like to see, probably because HandBrake selected letterbox subtitles when I prefer it to have selected widescreen subtitles. Since I no longer have the DVD I can't test playback of the vobfiles using VLC or MPC-HC to see where the DVD places the subtitles. But I would think the subtitles would show up lower in the frame.

It seems odd to me HandBrake defaults to selecting letterbox subtitles. Given that 99.99% of HandBrake users have widescreen TVs it would make more sense to default to selecting widescreen subtitles. Anyways, letting the user select between widescreen or letterbox subtitles is the way to go.

https://1drv.ms/i/s!AFfE2po5LtK6m0c
poit57
Posts: 7
Joined: Thu Dec 08, 2011 3:10 pm

Re: Wrong placement and size of burned subtitles

Post by poit57 »

I think I'm having the same issue as the OP described, but with a Captain America: Civil War Bluray and using the current 1.0.1 version of Handbrake.

My source file is a rip using MakeMKV, and I want to burn in the subtitles for the foreign language dialogue. The Bluray displays the subtitles in the black bar at the bottom of the screen, but I noticed the output file had the subtitles on the picture. At first, I figured it was because the black bars were cropped, so I changed the output size to 1920x1080 and changed the top and bottom crop to "0" just like the OP.

If I render the video with soft subtitles, it places them in the same location in the black bar. If I burn them in, it still places them in the picture - the same as if the black bars were cropped. The burned in text is also slightly smaller than the text of the subtitles in the original placement - like the text was scaled down for the 1920x804 frame as opposed to the original 1920x1080 frame. See below.

Image

Here are logs for each test file (only about 30 seconds of this particular scene.

http://pastebin.com/embed_js/qxnK1EMR - burned in subtitles
http://pastebin.com/embed_js/AqkpA2bf - soft subtitles
User avatar
JohnAStebbins
HandBrake Team
Posts: 5709
Joined: Sat Feb 09, 2008 7:21 pm

Re: Wrong placement and size of burned subtitles

Post by JohnAStebbins »

Not the same issue. You are using Bluray PGS subtitiles. OP was using DVD VOBSUB subtitles.

I'll have to do some testing to see if I can reproduce the issue.
Deleted User 23485

Re: Wrong placement and size of burned subtitles

Post by Deleted User 23485 »

Its been a long time since I have checked into this bug report. A fix seems to be committed to version 1.1, yeah!

In my Nov. 1, 2016 posting I mentioned subtitles from "Dawn of the Planet of the Apes" seem to me to be placed too high into the frame. I just pick up that DVD from my local library and just ran a test. The link below shows a side-by-side comparison, in the left side VLC is playing the ripped DVD files, the right side VLC is playing the encoded MKV (MP4 encoding using the x264 encoder) file from Handbrake 1.0.7. As you can tell the encoded MKV file shows the subtitles higher into the frame. If Handbrake cannot gather enough information from the ripped IFO file to keep the same placement as in the original DVD, then the default placement should be near the bottom of the frame. Lower is better, at least I bet most folks would prefer lower. I did not crop the video when making the MKV.

https://1drv.ms/i/s!AlfE2po5LtK6m2EzB9yl5uEwyhQd
Woodstock
Veteran User
Posts: 4613
Joined: Tue Aug 27, 2013 6:39 am

Re: Wrong placement and size of burned subtitles

Post by Woodstock »

You also see that the subtitles are compressed a bit - Handbrake is rescaling the bit map to fit the non-letterboxed (cropped) image, while VLC is probably not scaling.

"Not scaling" is a problem if the author rendered the subtitles to fit into the letterbox; they could potentially be clipped off. I have a few series where I had to prevent cropping to keep the subtitles "in frame" when not burned in.
Post Reply