dvdsub scaling 'fatness' work around?
dvdsubs are RLE (run length encoded) bitmaps. It appears that when dvdsubs from SD are encoded into full-HD, the run lengths are 720-to-1920 scaled and the lines (for NTSC DVDs) are 480-to-1080 scaled. That's great. However, the character bodies in the resulting dvdsubs are very fat and overrun each other. I presume the overruns are because the spaces between letters are not also scaled. The resulting subtitles are still somewhat readable but difficult. Does anyone know of a work around? Ideal would be scaling without 'fatness' by keeping letter stoke widths unchanged but scaling the heights and widths in addition to position -- yes, that will be tricky. Also ideal would be control over the palette. --Mark.
On Wed, Jul 23, 2025 at 8:00 PM Mark Filipak <markfilipak.imdb@gmail.com> wrote:
dvdsubs are RLE (run length encoded) bitmaps.
It appears that when dvdsubs from SD are encoded into full-HD, the run lengths are 720-to-1920 scaled and the lines (for NTSC DVDs) are 480-to-1080 scaled. That's great. However, the character bodies in the resulting dvdsubs are very fat and overrun each other. I presume the overruns are because the spaces between letters are not also scaled. The resulting subtitles are still somewhat readable but difficult.
Does anyone know of a work around?
Ideal would be scaling without 'fatness' by keeping letter stoke widths unchanged but scaling the heights and widths in addition to position -- yes, that will be tricky. Also ideal would be control over the palette.
If I had to hazard a guess, it would probably be the issue is the DVD subtitle images are expected to be rendered with a 4:3 aspect ratio. Scaling them from 720x480 to 1920x1080 causes the pixel aspect ratio to change, and thus they appear to be horizontally stretched. I'm not sure what your pipeline looks like, but I would assume you would need to change your scaling of the DVD subs to be scaled to preserve the appropriate aspect ratio. Devin -- Devin Heitmueller, Senior Software Engineer LTN Global Communications o: +1 (301) 363-1001 w: https://ltnglobal.com e: devin.heitmueller@ltnglobal.com
On 25/07/2025 09.24, Devin Heitmueller wrote:
On Wed, Jul 23, 2025 at 8:00 PM Mark Filipak <markfilipak.imdb@gmail.com> wrote:
dvdsubs are RLE (run length encoded) bitmaps.
It appears that when dvdsubs from SD are encoded into full-HD, the run lengths are 720-to-1920 scaled and the lines (for NTSC DVDs) are 480-to-1080 scaled. That's great. However, the character bodies in the resulting dvdsubs are very fat and overrun each other. I presume the overruns are because the spaces between letters are not also scaled. The resulting subtitles are still somewhat readable but difficult.
Does anyone know of a work around?
Ideal would be scaling without 'fatness' by keeping letter stoke widths unchanged but scaling the heights and widths in addition to position -- yes, that will be tricky. Also ideal would be control over the palette.
If I had to hazard a guess, it would probably be the issue is the DVD subtitle images are expected to be rendered with a 4:3 aspect ratio.
That's logical, Devin, but... No, SAR is 32/27, so DAR is 16/9. FFmpeg should scale just the same as a player does [note], and then pad to 1920x1080. FFmpeg appears to mis-scale the RLE subtitles (i.e. dvdsub), or, at least, to get the new run lengths wrong -- a guess because I have no way to actually see the run length numbers. (You know, now that I'm thinking about it more, I don't know whether the problem is with FFmpeg's scaling or with the players.) [note] 1920 x (1080/SAR) = 1920 x (1080/(32.27)) = 1920 x 911
Scaling them from 720x480 to 1920x1080 causes the pixel aspect ratio to change, and thus they appear to be horizontally stretched.
They're not horizontally stretched. They're just 'fat' -- the characters are 'fat'. :-)
I'm not sure what your pipeline looks like, but I would assume you would need to change your scaling of the DVD subs to be scaled to preserve the appropriate aspect ratio.
Devin
Besides what I wrote above, a 32/27 difference is just not a big enough difference to explain what I'm seeing. What I'm seeing isn't biggish, it's 'fat' -- 'e' looks like a blob for example. Right now I'm taking the existing DVD subs (dvdsub), making an 853x480 MKV via HandBrake, extracting IDX and SUB files from the MKV via mkvextract, OCRing via SubtitleEdit, and saving as SRT. Then putting the subrip subtitles (sub_text) into the MP4 via FFmpeg. Whew! It's really time consuming. For most movies I don't care about 'fixing' (SubtitleEdit) the awful subtitles and I'm seeking a way to simply get the original dvdsubs into the MP4 (-c:s dvd_subtitle), even if I have to forego scaling -- yeah, they would be small and towards the middle of the screen, but at least that would be progress. --Mark.
On Fri, Jul 25, 2025 at 1:22 PM Mark Filipak <markfilipak.imdb@gmail.com> wrote:
No, SAR is 32/27, so DAR is 16/9. FFmpeg should scale just the same as a player does [note], and then pad to 1920x1080. FFmpeg appears to mis-scale the RLE subtitles (i.e. dvdsub), or, at least, to get the new run lengths wrong -- a guess because I have no way to actually see the run length numbers. (You know, now that I'm thinking about it more, I don't know whether the problem is with FFmpeg's scaling or with the players.)
It would be helpful if you could provide an actual ffmpeg command line demonstrating what you're trying to do. If you're just passing the dvdsub data through to the MP4 unmodified, then it's entirely possible that it's just the player that doesn't know how to render them over 16:9 video. Devin -- Devin Heitmueller, Senior Software Engineer LTN Global Communications o: +1 (301) 363-1001 w: https://ltnglobal.com e: devin.heitmueller@ltnglobal.com
On 25/07/2025 15.45, Devin Heitmueller wrote:
On Fri, Jul 25, 2025 at 1:22 PM Mark Filipak <markfilipak.imdb@gmail.com> wrote:
No, SAR is 32/27, so DAR is 16/9. FFmpeg should scale just the same as a player does [note], and then pad to 1920x1080. FFmpeg appears to mis-scale the RLE subtitles (i.e. dvdsub), or, at least, to get the new run lengths wrong -- a guess because I have no way to actually see the run length numbers. (You know, now that I'm thinking about it more, I don't know whether the problem is with FFmpeg's scaling or with the players.)
It would be helpful if you could provide an actual ffmpeg command line demonstrating what you're trying to do. If you're just passing the dvdsub data through to the MP4 unmodified, then it's entirely possible that it's just the player that doesn't know how to render them over 16:9 video.
Devin
Oh, sure. But it reveals nothing much. _SOURCEva_ is 1920x1080, up from 720x480. _SOURCEs_ is 720x480, '-map 1:s -c:s dvd_subtitle' are the only options involving subtitles and there's no scaling... But the subtitles in _TARGET_ are 'fat'. :-) set _PATH_=c:\work\ set _NAME_=VANTAGE POINT [2008] if exist "%_PATH_%%_NAME_%_.mp4" pause rename "%_PATH_%%_NAME_%.mp4" "%_NAME_%_.mp4" set _SOURCEva_=%_PATH_%%_NAME_%_.mp4 set _SOURCEs_=%_PATH_%%_NAME_%.mkv set _TARGET_=%_PATH_%%_NAME_%.mp4 set _STANDARD_PREP_=-analyzeduration 500000000 -probesize 500000000 -start_at_zero -copyts -dn set _NO_CAPTIONS_=filter_units=remove_types=6 ffmpeg %_STANDARD_PREP_% -r:v 24000/1001 -i "%_SOURCEva_%" -i "%_SOURCEs_%"^ -bsf:v "%_NO_CAPTIONS_%"^ -map 0 -c copy^ -map 1:s -c:s dvd_subtitle^ "%_TARGET_%" I hope my script doesn't bother you. I call it a factory. It works for me. I used to save then as command scripts. Now I open them in a text editor and just swipe-n-paste into a terminal window.
On 25/07/2025 15.45, Devin Heitmueller wrote:
On Fri, Jul 25, 2025 at 1:22 PM Mark Filipak <markfilipak.imdb@gmail.com> wrote:
No, SAR is 32/27, so DAR is 16/9. FFmpeg should scale just the same as a player does [note], and then pad to 1920x1080. FFmpeg appears to mis-scale the RLE subtitles (i.e. dvdsub), or, at least, to get the new run lengths wrong -- a guess because I have no way to actually see the run length numbers. (You know, now that I'm thinking about it more, I don't know whether the problem is with FFmpeg's scaling or with the players.)
...it's entirely possible that it's just the player that doesn't know how to render them over 16:9 video.
I don't think that's the case -- at least, what you say doesn't seem plausible. I ask: How would the player (MPV, VLC, PowerDVD) know that a run length of 25 on line 460 does not apply to 1920x1080? I mean, why would the player scale the subtitles... how would it know to scale the subtitles, eh? The answer would be to make JPGs of the subtitles and see. I wish I knew how to do that. --Mark.
participants (2)
-
Devin Heitmueller -
Mark Filipak