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. |
![]() |
#1 | Link |
Registered User
Join Date: Jul 2011
Posts: 10
|
Bad quality when hardcode pgs with core.sub.ImageFile
Hi,
because of issues with displaying some pgs and ass subtitles on my tv (with jellyfin), I want to change my encoding workflow and burn them directly into my encodes. I'm working very much years with StaxRip there it seems, that burn in pgs subs only works with VapourSynth. I also tried SupTitle by myself, but the result was very similar. The crazy thing is, when I use the preview in StaxRip it look good, but after the encode, the text is not so smooth anymore, which is not nice on my screen, but definitely bad on my OLED TV. The first picture is saved from inside the preview of StaxRip: The second picture is saved from mpc-hc: This is the resulting vs script: Code:
1: import os, sys 2: import vapoursynth as vs 3: core = vs.core 4: 5: sys.path.append(r"E:\encoding\StaxRip-v2.44.2-x64\Apps\Plugins\VS\Scripts") 6: core.std.LoadPlugin(r"E:\encoding\StaxRip-v2.44.2-x64\Apps\Plugins\VS\SubText\SubText.dll", altsearchpath=True) 7: core.std.LoadPlugin(r"E:\encoding\StaxRip-v2.44.2-x64\Apps\Plugins\Dual\ffms2\ffms2.dll", altsearchpath=True) 8: 9: tcFile = r"E:\encoding\test-movie_HardSubtest_neu\source_[No DV].mkv_temp\source_[No DV]_timestamps.txt" # timestamps file path 10: clip = core.ffms2.Source(r"E:\encoding\test-movie_HardSubtest_neu\source_[No DV].mkv", cachefile=r"E:\encoding\test-movie_HardSubtest_neu\source_[No DV].mkv_temp\temp.ffindex", timecodes=tcFile) if os.path.exists(tcFile) else core.ffms2.Source(r"E:\encoding\test-movie_HardSubtest_neu\source_[No DV].mkv", cachefile=r"E:\encoding\test-movie_HardSubtest_neu\source_[No DV].mkv_temp\temp.ffindex") 11: clip = core.sub.ImageFile(clip, file = r"E:\encoding\test-movie_HardSubtest_neu\source_[No DV].mkv_temp\ID1_[de] {FORCED [DIY]}_default_forced.sup") 12: clip = core.std.Crop(clip, 0, 0, 276, 276) 13: clip = core.resize.Bicubic(clip, 1920, 804) 14: clip = clip[0:801] 15: 16: clip.set_output() Code:
--crf 18 --preset slow --output-depth 10 --ctu 32 --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" --hdr10 --colorprim bt2020 --colormatrix bt2020nc --transfer smpte2084 --range limited --max-cll "763,218" --chromaloc 2 --repeat-headers --aud --hrd --selective-sao 2 If it's in avisynth, I would be happy, too. Currently, I'm still working with avisynth. Edit: Some additional infos. If I play the original file and let the player show the pgs, then it looks pretty smooth regardless if on the pc with mpc-hc or on the tv with jellyfin. I tried very much things to solve it by myself, but my knowledge gerading avs and vs is limited. Nevertheless, I tried some filters and also tried to blend it by myself regarding "Example with manual blending" on https://github.com/vapoursynth/subte...cs/subtext.rst Maybe it's something with the color stuff, because of the 10bit HDR. But if there's a problem, then I'm lost. I'm very happy, that StaxRip does these configurations e.g. in x265 for me. br Br4twurscht Last edited by Br4twurscht; 24th January 2025 at 12:28. |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,564
|
Can't really help, since I never tried this, but you might want to upload the images somewhere else (i.e. imgbb.com, mediafire.com, google drive,..) and like to them, since attachments will require approval by a moderator, which can take ages,...)
My guess is the problem is that normally the subtitles are overlayed on the image after HDR is applied and not changed my the HDR data. In the file you create, you integrate the subtitles into the desaturated version of your source (without HDR information) and then on playback the HDR information is applied to the whole frames which will also alter the colors of the subtitles. My guess is one would need to add the subtitles to a blank clip, somehow (maybe some LUT) create a desaturated version of the subtitles and then combine them with the desaturated video, so that at playback the HDR info will adjust the color back to what they should look like. => best of luck Cu Selur |
![]() |
![]() |
![]() |
#4 | Link | ||
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,564
|
Quote:
(like I said, I never tried that so no clue whether there is a known method to change this) Quote:
Cu Selur |
||
![]() |
![]() |
![]() |
#5 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,834
|
Aliasing due to resizing after rendering ?
Code:
11: clip = core.sub.ImageFile(clip, file = r"E:\encoding\test-movie_HardSubtest_neu\source_[No DV].mkv_temp\ID1_[de] {FORCED [DIY]}_default_forced.sup") 12: clip = core.std.Crop(clip, 0, 0, 276, 276) 13: clip = core.resize.Bicubic(clip, 1920, 804)
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." |
![]() |
![]() |
![]() |
#6 | Link | ||
Registered User
Join Date: Jul 2011
Posts: 10
|
Thx, but I think, that will not really help, because see next.
Quote:
So, firstly I want to understand better your proposal. Quote:
Or did you mean adding the (desaturaded) subs to the hdr saturated video? Is that even possible? And if yes, how? That was a typo ![]() ![]() Br and thx Br4twurscht Last edited by Br4twurscht; 29th January 2025 at 09:58. |
||
![]() |
![]() |
![]() |
#7 | Link | |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,564
|
Quote:
My idea, no clue how to do it, would be to use some LUT on the subtitles clip which would do some destaturation which on playback would be nullified by the HDR metadata. Cu Selur |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|