Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Subtitles

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th April 2009, 11:06   #221  |  Link
magic144
Registered User
 
Join Date: May 2005
Posts: 386
0xdeadbeef,

I've done a bit more digging
It seems perhaps VSFilter will let me vertically expand the subtitles on playback after all...

There's a setting under the General tab, under Picture Size, called "Vertical Padding" which has one value called "Extend to 16:9" which looks like it will show full-scale (1920x1080) subtitles exported from BDSup2Sub properly proportioned across the whole screen, NOT just within the confines of my cropped video encode (by default, this WAS set to "Original Height" which is what was giving me the vertically squashed presentation).

I'll do some further investigation on my end before you get too deep into implementing that Vertical Offset feature!

Last edited by magic144; 7th April 2009 at 11:20.
magic144 is offline   Reply With Quote
Old 7th April 2009, 17:23   #222  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
To be honest, most of the code is already there, the only thing missing is the command line support. Yet I could quickly undo the changes if they prove to be useless. So please tell me when you're sure about it.
Then again, I'm still struggling with the BD-SUP parser anyway. Although I rewrote large parts again, I'm still not completely happy with it and it may take a while until I find a solution that works for all the problematic SUPs in my private zoo.
0xdeadbeef is offline   Reply With Quote
Old 8th April 2009, 15:33   #223  |  Link
Jaja1
Registered User
 
Join Date: Aug 2007
Posts: 59
First of all, thanks for your tool. It helps me a lot.

I do have a question. I wonder why the 1080p sub/idx's are less smooth than the original sups which are 1080p as well. Any thoughts on that?
Jaja1 is offline   Reply With Quote
Old 8th April 2009, 16:03   #224  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
Quote:
Originally Posted by Jaja1 View Post
I do have a question. I wonder why the 1080p sub/idx's are less smooth than the original sups which are 1080p as well. Any thoughts on that?
Sure and you would know the answer, too, if you read the online help.
In a nutshell: SUPs have an individual 256 color palette per caption, VobSubs have a fixed 16 color palette for the whole stream and only 4 colors of these 16 colors can be used per caption. As there's one color used as transparent color, this leaves 3 (more or less) opaque colors for the caption which is about 252 colors less compared to a SUP.
Obviously this doesn't leave much space for antialiasing and thus the images look less smooth.
0xdeadbeef is offline   Reply With Quote
Old 8th April 2009, 17:38   #225  |  Link
Jaja1
Registered User
 
Join Date: Aug 2007
Posts: 59
Thanks for your answer.

And I did read the online help, from which I understood that the conversion to sub/idx results in a reduction of color information. However, my knowledge on this subject is way too little to see that this results in jagged edges.
Jaja1 is offline   Reply With Quote
Old 8th April 2009, 19:34   #226  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
08.04.2009 2.9 -> 3.0
  • Changed: reworked BD-SUP parser again to support multiple object per epoch and to split the epoch were it makes sense.
    Also equal captions can be merged now even if they're in separate epochs.
  • Changed: added cropping support (crop the first n lines)
  • Changed: colorspace conversion according to BT.709 instead of BT.601. Doesn't seem to make much of a difference though.
  • Fixed: the alpha fading detection for BD-SUPs could create wrong colors in certain cases.
0xdeadbeef is offline   Reply With Quote
Old 9th April 2009, 03:42   #227  |  Link
magic144
Registered User
 
Join Date: May 2005
Posts: 386
Thanks for the update 0xdeadbeef

I tried out the subtitle cropping feature with my test movie/subtitle. Took me a while to realize I had to press the "Upper Bound" button instead of manually entering the "Offset Y value"!!

The original movie is 1920x1280.
I am cropping the video 140 pixels each, top and bottom, leaving 1920x800 (AR 2.4:1)

I used v3.0 using the "Move all captions" dialog, set AR=2.4, set the "move inside bounds" radio button and set a Crop Offset Y value of 140 (via the "Upper bound" button).

Only thing I have to do manually after export is change the Frame size in the idx file from:-

size: 1920x1080
to
size: 1920x800

(because I've remapped the subtitles into the picture-only area of the source video, thanks to the cropping) - so it's not a totally automatic procedure just yet. Of course 1080-2*140=800.

I tried it in BOTH VSFilter in ZoomPlayer, AND in VLC (a quite behind-the-times v0.8.6i Windows build!) and both rendered the subtitles at the correct AR.

I think this will now mostly benefit people who use VLC as their only playback solution since it allows the subs to be used in cropped encodes like this and still be shown at the correct AR.

Thanks for the work and quick support!

m

PS - by the way, is using REC.709 appropriate for non-HD resolutions?? I had read that it was only applicable for YUV to RGB conversions of HD material.
http://www.glennchan.info/articles/t...olor-space.htm
http://forum.doom9.org/showthread.php?t=133982

Last edited by magic144; 9th April 2009 at 03:57.
magic144 is offline   Reply With Quote
Old 9th April 2009, 08:33   #228  |  Link
Rectal Prolapse
Registered User
 
Join Date: Mar 2005
Posts: 433
Quote:
PS - by the way, is using REC.709 appropriate for non-HD resolutions?? I had read that it was only applicable for YUV to RGB conversions of HD material.
Well, considering that Blu-ray uses REC.709 and BDSup2Sub is (primarily) for conversion of subtitles from Blu-ray discs, I cannot see why this is an issue? However, I guess for SD subtitles a switch could be added for REC.601 (or maybe it can autodetect...)

0xdeadbeef: Thanks for the REC.709 support! Does it use the exact formula I mentioned? That preserves the original levels of the subtitles. But if you wanted to do levels expansion, you could always add a switch I guess.
Rectal Prolapse is offline   Reply With Quote
Old 9th April 2009, 10:29   #229  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
Quote:
Originally Posted by Rectal Prolapse View Post
0xdeadbeef: Thanks for the REC.709 support! Does it use the exact formula I mentioned? That preserves the original levels of the subtitles. But if you wanted to do levels expansion, you could always add a switch I guess.
I'm using the following (partly self-constructed) formulas for BT.709 (based on Kb = 0.0722 and Kr = 0.2126):

Code:
/* BT.709 for RGB 0..255 (PC) -> YCbCr 16..235 */	
y  = 16  + (int)( r*0.2126*219/255        + g*0.7152*219/255        + b*0.0722*219/255 + 0.5);
cb = 128 + (int)(-r*0.2126/1.8556*219/255 - g*0.7152/1.8556*219/255 + b*0.5*219/255  + 0.5);
cr = 128 + (int)(r*0.5*219/255		   - g*0.7152/1.5748*219/255 - b*0.0722/1.5748*219/255  + 0.5);

/* BT.709 for -> YCbCr 16..235 -> RGB 0..255 (PC) */
y1 = 1.164383562*y;
r = (int)(-253.3400548 + y1 + 1.833671233*cr + 0.5);
g = (int)( 79.05863261 + y1 - 0.218117304*cb - 0.5450762084*cr + 0.5);
b = (int)(-295.1907945 + y1 + 2.160630137*cb + 0.5);
As you can see, they include conversion from the 16..235 video range to the 0..255 RGB range, which is necessary to display correctly on a PC monitor.
Anway, I find it hard to see any difference compared to my BT.601 code: at least with the naked eye, the colors look the same to me.

Last edited by 0xdeadbeef; 9th April 2009 at 13:11.
0xdeadbeef is offline   Reply With Quote
Old 9th April 2009, 13:11   #230  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
Quote:
Originally Posted by magic144 View Post
I tried out the subtitle cropping feature with my test movie/subtitle. Took me a while to realize I had to press the "Upper Bound" button instead of manually entering the "Offset Y value"!!
Well you don't have to. I just thought it would be more comfortable to set a sensible value with one click.

Quote:
Originally Posted by magic144 View Post
Only thing I have to do manually after export is change the Frame size in the idx file [...]
Hm, I was not quite sure about this indeed since I'm not really familiar with this use case. If this is an issue I could extend the cropping feature to assume symmetrical cropping and change the output screen size accordingly.

Quote:
Originally Posted by magic144 View Post
PS - by the way, is using REC.709 appropriate for non-HD resolutions??
AFAIK BT.709 is the color space used for HD video streams and BT.601 is used for standard definition sources. Still, currently, this is no problem, as only SUPs from HD sources are imported. The exported VobSubs are using a RGB (0..255) palette defined in the IDX file and the muxer or authoring tool has to convert this into an appropriate color space again. Besides, the difference between BT.601 and BT.709 are obviously not so big to be detect easily.

As a side note: the color model used in the IDX file is a little debatable, too. Indeed I didn't find any clear definition if it is always assumed to be RGB 0..255 or if some tools expect other color models (RGB 16..235 or YCbCr/YCrCb 16..235 or whatever).

Also the range of YCrCb/YCbCr values doesn't seem to be clearly defined. While the typical limits are 16..235 in video applications, there are some cases where this is extended to 16..240 - sometimes for all three components, sometimes only for the luminance (Y). Then again, it shouldn't really matter much in this context.
0xdeadbeef is offline   Reply With Quote
Old 9th April 2009, 15:47   #231  |  Link
magic144
Registered User
 
Join Date: May 2005
Posts: 386
Quote:
Well you don't have to. I just thought it would be more comfortable to set a sensible value with one click.
Oh OK - when I tried it, I don't think just manually entering a value worked, but maybe I was doing something wrong. It certainly didn't show the red line on the preview window until I pressed the button, as far as I remember. As for the size range and the symmetrical cropping, that sounds like the typical use-case, unless others think differently...

Quote:
Still, currently, this is no problem, as only SUPs from HD sources are imported.
D'oh - of course! Just me being a bit stupid there. So are SUPs using YCbCr encodings then? Hence you have to choose an interpretation when converting to RGB.

I would have thought that the 16..235 luminance values would have been inherent in the subtitle source, if they were to match the underlying video (typically). Obviously, as we have just witnessed, I am not an expert :-)
The ffdshow "RGB conversion" tab (Constrast section) describes the "Standard" conversion as being Y:16-235, Chroma:16-240

Indeed the Wikipedia YCbCr page describes the RGB conversion as giving an output with Y(16-235) and CbCr(16-240).
http://en.wikipedia.org/wiki/YCbCr

ps - and again, THANKS for this great tool!

Last edited by magic144; 9th April 2009 at 15:55.
magic144 is offline   Reply With Quote
Old 9th April 2009, 16:32   #232  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
Quote:
Originally Posted by magic144 View Post
Oh OK - when I tried it, I don't think just manually entering a value worked, but maybe I was doing something wrong. It certainly didn't show the red line on the preview window until I pressed the button, as far as I remember.
As for all text input fields in BDSup2Sub the value is only actually used if enter is pressed. That is by intention though, since the value is checked and written back to the text field. Personally, I hate text fields that do that while typing.

Quote:
Originally Posted by magic144 View Post
D'oh - of course! Just me being a bit stupid there. So are SUPs using YCbCr encodings then?
The palette entries of BD-SUPs and HD-DVD-SUPs use a YCrCb color model. Indeed, the exact color model used seems to depend on the video stream at least for BD-SUPs. BT.601 is used for standard definition sources and BT.709 for HD sources.
So for the rare case of SUPs with PAL/BTSC resolution I guess I'd need to select BT.601 and BT.709 for the rest.
But as I said, the difference between BT.601 and BT.709 seem to be neglectable when it comes to subtitles which seldomly use subtle colors (if at all).

Quote:
Originally Posted by magic144 View Post
The ffdshow "RGB conversion" tab (Constrast section) describes the "Standard" conversion as being Y:16-235, Chroma:16-240
In the meantime I came to the same conclusion and I will change this in 3.1. Yet, the difference will be hardly perceivable anyway.

Quote:
Originally Posted by magic144 View Post
ps - and again, THANKS for this great tool!
You're welcome, still it's always nice to get positive feedback.
0xdeadbeef is offline   Reply With Quote
Old 10th April 2009, 14:39   #233  |  Link
pleinlesyeux
Registered User
 
Join Date: Feb 2009
Posts: 18
Thank you note

0xdeadbeef,

I just wanted to thank you for that great tool.

I allows me to offset the subtitles of a BD in the pictures, which is great when you have a 2.35 screen !!!

I used to manually trimmed exported .png then to reauthor my .xml and .png to recreate .sub. Took my hours. Now, 1 minute !!!
pleinlesyeux is offline   Reply With Quote
Old 10th April 2009, 15:20   #234  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
Ah, another happy camper
Still, there's always place for improvement.

10.04.2009 3.0 -> 3.1.0
  • Changed: depending on the resolution of an imported SUP, either BT.601 (PAL/NTSC) or BT.709 (HD) is selected.
  • Changed: cropping is assumed to be symmetrical and now also affects screen size in exported IDX or SUP.
  • Changed: reworked default VobSub colors a little to provide better anti-aliasing. Also white is used in combination with dark gray now.
  • Changed: minimum distance between two equal captions is now fixed to 200ms and doesn't depend on minimum display time any more.
  • Changed: merged code and look of preview windows.
  • Changed: all (?) edit boxes select smallest/biggest valid value if given value is out of bounds instead of just ignoring invalid inputs.
  • Fixed: Merging captions failed in certain cases, which also resulted in wrong end times
  • Fixed: BT.709 color space assumes Cr/Cb values to be inside 0..240 instead of 0..235
  • Fixed: exporting forced captions didn't work any more (introduced in 2.9)
  • Fixed: value for min display time is also used if fix short frames checkbox is unchecked.
  • Fixed: move dialog remembers screen ratio.
0xdeadbeef is offline   Reply With Quote
Old 11th April 2009, 17:31   #235  |  Link
kikker
Registered User
 
Join Date: Feb 2007
Posts: 195
Fantastic App! Thanks very much. I do have a request of course

Could you possibly implement a job queue of some sort such that many front end GUI encoders have? Once the jobs are queued up, they could then be started one after the other. Perhaps even a drop box to queue up the SUPs? Also, as direct VOBSUB (VSfilter) can read one IDX and one RAR'ed SUB for multiple languages, it would be fantastic to have that as a possible output as well. Thanks again!
kikker is offline   Reply With Quote
Old 14th April 2009, 00:29   #236  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
14.04.2009 3.1.0 -> 3.2.0
  • Changed: BD-SUP palette is created by default when scaling, mode can be selected (keep palette, new palette, dither)
  • Changed: reduced text output to a minimum. To get full output, select "verbatim" mode.
  • Fixed: progress bar was never updated when importing HD-SUPs, also cancel didn't work in this case
  • Fixed: progress bar didn't work for very large files (during load)

Last edited by 0xdeadbeef; 14th April 2009 at 00:32.
0xdeadbeef is offline   Reply With Quote
Old 14th April 2009, 03:11   #237  |  Link
avivahl
Registered User
 
Join Date: Dec 2007
Posts: 215
Amazing work. It's wonderful to see such a professional free tool w/ an amazing development rate. Good job.
I hope you'll consider open-sourcing it one day (your code can probably help many open-source projects).
avivahl is offline   Reply With Quote
Old 14th April 2009, 05:18   #238  |  Link
alc0re
Registered User
 
Join Date: Jun 2008
Posts: 91
Changed: BD-SUP palette is created by default when scaling, mode can be selected (keep palette, new palette, dither)

What exactly does that mean?

Well, let me ask a more direct question...if I'm just downscaling a BD-Sup to 720p to be burned back to an avchd/bluray structure...should I change my default back to keep palette?
alc0re is offline   Reply With Quote
Old 14th April 2009, 12:46   #239  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
Before 3.2.0, BDSup2Sub used the existing palette for each caption. When scaling up/down, this led to suboptimal antialiasing in cases where the original palette didn't contain the according intermediate colors or versions of the same color with intermediate alpha values.

Although theses cases were rare, some people complained about it and so I decided to determine a new (optimized) palette when scaling. You can see the differences when changing the "palette mode" options in the GUI.

As the creation of a new palette proved to be about as fast as using the existing one, I decided to make this the default option. This shouldn't be a problem though.

So the answer is "no, you should get best results with the default setting".
0xdeadbeef is offline   Reply With Quote
Old 14th April 2009, 12:54   #240  |  Link
0xdeadbeef
Author of BDSup2Sub
 
Join Date: Jun 2003
Posts: 478
Quote:
Originally Posted by avivahl View Post
Amazing work. It's wonderful to see such a professional free tool w/ an amazing development rate. Good job.
I hope you'll consider open-sourcing it one day (your code can probably help many open-source projects).
While I still plan to release the source some day, currently, this is too much of a work in progress. Still, as written in the disclaimer, I'll give the source to everybody who asks nicely and agrees to some basic rules (mainly: don't release a branch with only your name in, give me credit if you use code, don't spread the code without asking me). Indeed, I already gave the source to one person already.

Besides, you can use the JAR as library for own Java projects. The Javadoc help is included and I can provide everyone interested with an example to use the Core classes (indeed the example is the main class of BDSup2Sub containing the CLI stuff).
0xdeadbeef is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:52.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.