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 16th February 2019, 15:01   #1  |  Link
djloewen
Registered User
 
Join Date: Aug 2007
Posts: 112
Hardcoding UHD subtitles without conversion

Hi there, I've done all the research I can on this subject and still came up short. When I encode 1080p sources that have forced ".sup" subtitles, I like to use the avisynth SupTitle filter to hardcode the subtitles into the resulting video file. I prefer this to conversion because I like having the subtitles appear exactly as they do in the original source.

I'd like to do the same with a UHD source. the ".sup" files appear to be 1080p even on 4k sources? SupTitle appears incapable of displaying it properly, and the only resizing tools I've found online will make the subtitles smaller, not larger. I also see that there are challenges to doing this in a 10/16 bit environment (currently I'm using 16bit for processing and outputting to 10)?

I see that some people have possibly had luck using VaporSynth and either the "core.sub.imagefile" built-in filter, or VSfilterMod? I've never used VaporSynth before and I'm not sure whether it can be run side-by-side with Avisynth+ or whether I'd have to change my whole workflow. So I was hoping to find a few answers before I try messing with installs.

1) Is there any way to accomplish this in avisynth/avisynth+?

And if not,

2) Can VaporSynth be installed and only used for jobs that need subtitles, or would I need to change over completely?
3) Do most/all other things work in VaporSynth function the same as in avisynth? Can I use the same plugins, for example suptitle?
4) Is there a preference between core.sub.imagefile and VSFilterMod? Will they do what I'm trying to accomplish here?
5) Is there anything else I'm missing here?

Thank you!
djloewen is offline   Reply With Quote
Old 16th February 2019, 17:40   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
UltraHD Blu-Ray does indeed use 1080p subtitles for 2160p video.

2.) Who's stopping you from using VapourSynth?
3.) Most of the important plugins will have similar ones in VapourSynth. Usage will be different. There is a learning curve.

I think in VapourSynth you basically want to render the subs using e.g. core.sub.ImageFile() on an Alpha clip, then resize said clip to UHD, then blend it with the actual video. In the VapourSynth doc you can find a blending example for core.sub.TextFile().

1.) Did SupTitle() have an alpha mode? Don't really remember if/how. If so it should be similar. See this thread for ideas on blending subtitles on AviSynth.
sneaker_ger is offline   Reply With Quote
Old 17th February 2019, 00:48   #3  |  Link
djloewen
Registered User
 
Join Date: Aug 2007
Posts: 112
Thanks for the reply. The reason I had a preference for using avisynth is that I already know how to use it, have all my filters, etc. Can VapourSynth be used side-by-side with avisynth?

Also, thank you for the thread about blending subtitles. Am I correct in understanding that VSfilter doesn't support "sup" subtitles? I thought that maybe VSfiltermod did but I'm having a lot of trouble figuring out how to use it, I can't find any documentation about commands and I can't seem to find a way to render the subtitles using an avisynth script.
djloewen is offline   Reply With Quote
Old 17th February 2019, 12:08   #4  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by djloewen View Post
Thanks for the reply. The reason I had a preference for using avisynth is that I already know how to use it, have all my filters, etc. Can VapourSynth be used side-by-side with avisynth?
You can have AviSynth and VapourSynth on the same system without problems. VapourSynth scripts should have ".vpy" file extension, AviSynth scripts ".avs" extension.
It makes sense to try to solve the problem in AviSynth to avoid learning VapourSynth. Maybe someone else can you some tips for it.

Quote:
Originally Posted by djloewen View Post
Also, thank you for the thread about blending subtitles. Am I correct in understanding that VSfilter doesn't support "sup" subtitles? I thought that maybe VSfiltermod did but I'm having a lot of trouble figuring out how to use it, I can't find any documentation about commands and I can't seem to find a way to render the subtitles using an avisynth script.
I think neither vanilla vsfilter nor vsfiltermod support sup/PGS, at least not via AviSynth API. Not 100% sure, there are so many versions and forks out there ...
I can't find the documentation for "SupTitle()" anymore. Possibly it can render on Alpha.
sneaker_ger is offline   Reply With Quote
Old 17th February 2019, 14:55   #5  |  Link
djloewen
Registered User
 
Join Date: Aug 2007
Posts: 112
Thanks for your help. I can't find SupTitle documentation either but I did find a page that listed "Alpha channel transparency blending" as a feature. Is the idea to render it on a transparent video clip, resize that clip to 4k, and then blend the two videos? Would you be able to help me with this, or is there an example of someone doing this (with VobSub or whatever) that I can learn from and experiment?
djloewen is offline   Reply With Quote
Old 26th February 2019, 23:44   #6  |  Link
djloewen
Registered User
 
Join Date: Aug 2007
Posts: 112
So I've been stumbling around with this and I've ended up coming very very close to what I'm trying to accomplish. Any help to finish the job would be appreciated!

The two limitations I've found with SupTitle are that it doesn't scale the 2k SUP file to the 4K video, and it doesn't like 16bit. So I'm trying to put the subs on a blankclip, upscale and ConvertBits, and overlay it. Here's what I've got:

Code:
LoadPlugin("C:\Program Files (x86)\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\SupTitle.dll")

video = DGSource("D:\UHD movie\00244.mpls_2eng.dgi",fulldepth=true)

n = video.framecount
f = video.framerate

subs=blankclip(length=n, width=1920, height=1080, fps=f, pixel_type="YUV420P8").SupTitle("forced.sup").LanczosResize(3840,2160).ConvertBits(16)

Overlay(video,subs,mask=subs)
So, because I'm using the "subs" clip as the mask, the subtitles aren't fully opaque. What I'd like is the background to be fully transparent and the subtitles fully opaque. Can someone help me accomplish this without changing the color or appearance of the subtitles?

Also, is there a way to do this, like taking advantage of the alpha channel to recognize the transparency in the PGS stream so I can just set opacity=1 and not use "mask" at all? SupTitle does supposedly support alpha channel if that helps at all.

Thanks!
djloewen is offline   Reply With Quote
Old 27th February 2019, 17:17   #7  |  Link
djloewen
Registered User
 
Join Date: Aug 2007
Posts: 112
I think I've managed to accomplish it. In case it helps anyone, here's my code:

Quote:
video = *16 bit uhd hdr clip*
n = video.framecount
f = video.framerate
subs=blankclip(length=n, width=1920, height=1080, fps=f, pixel_type="YUV420P8").SupTitle("*supfile*").LanczosResize(3840,2160).ConvertBits(16)
submask=blankclip(length=n, width=1920, height=1080, fps=f, color=$FFFFFF, pixel_type="YUV420P8").SupTitle("*supfile*").Invert.LanczosResize(3840,2160).ConvertBits(16)
Overlay(video,subs,mask=ColorYUV(submask,gain_y=256,cont_y=1000000))
If anyone can think of a better or cleaner way to do it then I'm open to ideas, but this seems to work!
djloewen 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 09:37.


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