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. |
|
|
Thread Tools | Search this Thread | Display Modes |
10th February 2018, 17:25 | #1 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
[AviSynth+] Need help with rendering subtitles on YUV420P10
VSFilter does not work with 10 bit so I'm trying to overlay subtitles manually.
My code Code:
SubtitleColor=BlankClip(video,color=$FFFF00,pixel_type="RGB32") SubtitleMask=BlankClip(video,color=$000000,pixel_type="RGB32") Loadplugin("C:\Users\Dave\Documents\Delphi_Projects\RipBot264\_Compiled\Tools\AviSynth plugins\VSFilter\VSFilter.dll") SubtitleMask=VobSub(SubtitleMask,"C:\Temp\RipBot264temp\job1\5_subtitles_English_1080.sub") SubtitleColor=ConvertToYUV420(SubtitleColor,matrix="Rec2020").ConvertBits(10) SubtitleMask=ConvertToYUV420(SubtitleMask,matrix="Rec2020").ConvertBits(10) video=Overlay(video,SubtitleColor,mask=SubtitleMask,opacity=1) Original As you can see there is problem with mask because yellow color is not entirely removed. I reckon that it's a problem with 255 (8bit) vs 1023 scale (10bit) after conversion from RGB. Can some expert help me to correct this issue?
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper Last edited by Atak_Snajpera; 10th February 2018 at 17:33. |
10th February 2018, 17:59 | #2 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Yes, I've had this experience. Use mt_inpand.
|
10th February 2018, 19:12 | #3 | Link |
Registered User
Join Date: Oct 2011
Posts: 275
|
Can't try for now but what version of VSfilter is used, r4 ?
The R5 version might help maybe, if it's not already the one used https://github.com/sorayuki/VSFilterMod/releases binaries here : https://www.nmm-hd.org/newbbs/viewtopic.php?f=17&t=1989 Edit : Nevermind, YUV420P10 is supported only for vapoursynth it seems , sorry. Last edited by Yanak; 10th February 2018 at 19:15. |
10th February 2018, 19:32 | #4 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
I think I figured out how to overlay subtitles correctly on YUV420P10!
Code:
#Subtitles Loadplugin("C:\Users\Dave\Documents\Delphi_Projects\RipBot264\_Compiled\Tools\AviSynth plugins\VSFilter\VSFilter.dll") SubtitleColor=BlankClip(video,color=$FFFF00).Tweak(sat=0.5) SubtitleMask=BlankClip(video,color=$000000,pixel_type="YV12") SubtitleMask=VobSub(SubtitleMask,"C:\Temp\RipBot264temp\job1\5_subtitles_English_1080.sub") SubtitleMask=Grayscale(SubtitleMask).ConvertBits(10) SubtitleMask=Levels(SubtitleMask,0, 0.25, 768, 0,1023, coring=false) video=Overlay(video,SubtitleColor,mask=SubtitleMask,opacity=1)
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper Last edited by Atak_Snajpera; 11th February 2018 at 13:58. |
11th February 2018, 10:26 | #6 | Link |
47.952fps@71.928Hz
Join Date: Mar 2011
Posts: 940
|
I think that's Passengers? With Chris Pratt?
__________________
Win10 (x64) build 19041 NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4) NTSC | DVD: R1 | BD: A AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
|
11th February 2018, 14:08 | #8 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
Do you know guys a good and fast anti-aliasing filter? Something similar to FXAA? I would like to smooth a little bit mask without using simple blur.
zoom 200%
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper Last edited by Atak_Snajpera; 11th February 2018 at 14:28. |
11th February 2018, 15:12 | #9 | Link | |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
> a good and fast anti-aliasing filter? Something similar to FXAA?
Don't know if it's fast enough for you, but Quote:
|
|
11th February 2018, 15:21 | #10 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
When I see eedi3 I know that It will be too slow. For now I'm using Sharpen(-1). To bad that after all those years we still do not have FXAA/SMAA in avisynth.
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper |
11th February 2018, 17:19 | #11 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
Don't think FXAA can work on a bitmap, but SMAA is a post-process shader AA.
Maybe MysteryX's AviSynth Shader can help. (I'd be interested in that, myself) |
11th February 2018, 18:17 | #12 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
Both FXAA and SMAA work as post-process AA.
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper |
15th February 2018, 16:33 | #13 | Link |
Registered User
Join Date: Jan 2006
Location: Athens, Greece
Posts: 1,518
|
I used to smooth my subtitles using one of the 2 methods:
1. GaussianBlur() 2. Render the subs in 2x resolution and then doing a GaussResize() at half resolution. It worked fine, but I wouldn't say it was fast. |
16th February 2018, 08:32 | #14 | Link |
Registered User
Join Date: Sep 2005
Posts: 178
|
While I totally agree about the need for FXAA/SMAA and friends for AviSynth (perhaps I'll port them over at some point), for what you're doing they seem unnecessary. A better approach for subtitles is to OCR them and include them in a text-based format, e.g. SRT or ASS formats. The only reasons not to do so that I can think of is laziness (you can't be bothered to OCR), or playback speed/support on devices.
|
23rd February 2018, 12:04 | #16 | Link |
RipBot264 author
Join Date: May 2006
Location: Poland
Posts: 7,816
|
In case you are interested here is my final function
Code:
function TextSubHDR(clip video, string "SubPath", int "SubColor", int "SubOutlineColor", int "SubShadowColor" ) { SubtitleColor=BlankClip(video,color=SubColor,pixel_type="YUV420P10") OutlineColor=BlankClip(video,color=SubOutlineColor,pixel_type="YUV420P10") ShadowColor=BlankClip(video,color=SubShadowColor,pixel_type="YUV420P10") SubtitleOutlineColor=BlankClip(video,color=$FFFFFF,pixel_type="YV12") SubtitleOutlineMask=BlankClip(video,color=$000000,pixel_type="YV12") SubtitleMask=BlankClip(video,color=$000000,pixel_type="YV12") SubtitleMask=TextSub(SubtitleMask,SubPath,-1) SubtitleMask=Grayscale(SubtitleMask).ConvertToYV24 OutlineMask=AddBorders(SubtitleMask,1,0,0,0).Crop(0,0,-1,0) SubtitleOutlineMask=Overlay(SubtitleOutlineMask,SubtitleOutlineColor,mask=OutlineMask,opacity=1) OutlineMask=AddBorders(SubtitleMask,0,1,0,0).Crop(0,0,0,-1) SubtitleOutlineMask=Overlay(SubtitleOutlineMask,SubtitleOutlineColor,mask=OutlineMask,opacity=1) OutlineMask=Crop(SubtitleMask,1,0,0,0).AddBorders(0,0,1,0) SubtitleOutlineMask=Overlay(SubtitleOutlineMask,SubtitleOutlineColor,mask=OutlineMask,opacity=1) OutlineMask=Crop(SubtitleMask,0,1,0,0).AddBorders(0,0,0,1) SubtitleOutlineMask=Overlay(SubtitleOutlineMask,SubtitleOutlineColor,mask=OutlineMask,opacity=1) SubtitleOutlineMask=ConvertBits(SubtitleOutlineMask,10) SubtitleOutlineMask=Levels(SubtitleOutlineMask,128, 1, 896, 0,1023, coring=false) SubtitleMask=ConvertToYV12(SubtitleMask).ConvertBits(10) SubtitleMask=Levels(SubtitleMask,128, 1, 896, 0,1023, coring=false) ShadowMask=AddBorders(SubtitleMask,2,2,0,0).Crop(0,0,-2,-2) video=Overlay(video,ShadowColor,mask=ShadowMask,opacity=0.5) video=Overlay(video,OutlineColor,mask=SubtitleOutlineMask,opacity=1) video=Overlay(video,SubtitleColor,mask=SubtitleMask,opacity=1) return video } Code:
Loadplugin("VSFilter.dll") Import("TextSubHDR.avs") video=TextSubHDR(video,"Passengers.srt",$C0C0C0) (.ass)
__________________
Windows 7 Image Updater - SkyLake\KabyLake\CoffeLake\Ryzen Threadripper Last edited by Atak_Snajpera; 23rd February 2018 at 12:17. |
|
|