![]() |
|
Deoldify Vapoursynth filter - Printable Version +- Selur's Little Message Board (https://forum.selur.net) +-- Forum: Talk, Talk, Talk (https://forum.selur.net/forum-5.html) +--- Forum: Small Talk (https://forum.selur.net/forum-7.html) +--- Thread: Deoldify Vapoursynth filter (/thread-3595.html) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
RE: Deoldify Vapoursynth filter - Dan64 - 01.02.2025 (01.02.2025, 13:32)Selur Wrote: not at home atm. will look at it later and report back, had a quick look at beginning of 'The Trial'. Sadly, as soon as there is motion, things turn b&w. In effect DeepRemaster provides less colored frames, but for some movies, this characteristic can been used to retain the visual impact of original black and white version of the movie. It is possible to mitigate this effect with the parameter "Vivid" and/or by enabling RefMerge. Try also the samples provided using DeepRemaster. Dan RE: Deoldify Vapoursynth filter - Selur - 01.02.2025 Back at home,... Reading that post, I'm really thinking about dropping support for HAVC in total. Quote:I think that is time to rename the filter DeOldify in HAVC as shown in the following pictureI'll rename it to 'DeOldify/HAVC'. Not starting to really rename the filter since then I would also have to rename all the existing (~60) parameters for consistency.
Quote:NEW USE of Method=5 "HAVC different_from_video"So you whish Hybrid to create: # ---------------- ADDING EXTERNAL COLORED VIDEO -------------------------
# Current color space: YUV420P8, bit depth: 8, resolution: 300x232, frame rate: 25fps, scanorder: progressive, yuv luminance scale: limited, matrix: 709, transfer: bt.709, primaries: bt.709, format: AVC
# the frame rate is converted to be the same of B&W clip (should not be relevant)
clipRef = core.lsmas.LWLibavSource(source="test_green_sample.mp4", format="YUV420P8", stream_index=0, cache=0, fpsnum=24000, fpsden=1001, prefer_hw=0)
# Resizing using bicubic spline to the same size of B&W clip
clipRef = core.fmtc.resample(clip=clipRef, kernel="spline16", w=920, h=672, interlaced=False, interlacedd=False)
clipRef = core.std.SetFrameProps(clipRef, _Matrix=vs.MATRIX_BT709)
if validate.transferIsInvalid(clip):
clipRef = core.std.SetFrameProps(clip=clipRef, _Transfer=vs.TRANSFER_BT709)
if validate.primariesIsInvalid(clip):
clipRef = core.std.SetFrameProps(clip=clipRef, _Primaries=vs.PRIMARIES_BT470_BG)
clipRef = core.std.SetFrameProps(clip=clipRef, _ColorRange=vs.RANGE_LIMITED)
clipRef = core.std.AssumeFPS(clip=clipRef, fpsnum=24000, fpsden=1001)
clipRef = core.std.SetFrameProps(clip=clipRef, _FieldBased=vs.FIELD_PROGRESSIVE)# progressive
clipRef = core.std.SetFrameProps(clip=clipRef, _ColorRange=vs.RANGE_FULL)
clipRef = core.resize.Bicubic(clip=clipRef, format=vs.RGB24, matrix_in_s="709", range_s="full")Wouldn't it make more sense to add something like: havc_refclip = core.bs.VideoSource(source="PATH_TO_FILE")
if clipRef.num_frames != clip.num_frames:
raise vs.Error('HAVC: Reference clip and source clip frame count differ!')
if havc_refclip.format.id != vs.RGB24:
refframe = havc_refclip.get_frame(0)
if frame.props.get('_ColorRange', None) != vs.RANGE_FULL :
clipRef = core.resize.Bicubic(clipRef, range_in_s="limited", range_s="full")
if frame.props.get('_Matrix', None) != vs.MATRIX_BT709 :
clipRef = core.resize.Bicubic(clipRef, matrix_in_s="470bg", matrix_s="709")
havc_refclip = core.resize.Bicubic(clip=havc_refclip, width=clip.width, height= clip.height, format=vs.RGB24, matrix_i_s="709", range_s="full")
clipRef = core.std.AssumeFPS(clip=clipRef, fpsnum=clip.fps_num, fpsden=clip.fps_den)Hybrid will not start to analyse random reference clips with mediainfo, mplayer, ffmpeg,... like it does for normal inputs. I can adjust Hybrid to add some generic code like above, but it seems like a bad idea to rely on tons of external code. So you might want to think about whether this really makes sense, especially since you should do the color, resolution, frame count checks inside HAVC anyway to make sure the input is as expected. I'll look into adding 'NEW ColorMNet encode_mode=2 -> "remote all-ref" ' and '5) NEW PRESET: BlackWhiteTune'. Cu Selur RE: Deoldify Vapoursynth filter - Selur - 01.02.2025 Changed checkbox label to 'DeOldify/HAVC', added 'ColorMNet encode_mode=2' and 'BlackWhiteTune'. => uploaded new Hybrid_deoldify Cu Selur RE: Deoldify Vapoursynth filter - Selur - 01.02.2025 I do not understand ref_freq. ref_freq: int = None,
...
:param ref_freq: If (ref_merge > 0 or method == 5). If > 0 will be generated at least a reference frame
every "ref_freq" frames. range [0-1500]. If is not set, is assigned automatically a
value depending on ref_merge value and method.1. it should only be used if ref_merge > 0 or method == 5. 2. If it is set to 'None' depending on ref_merge value and method some automatic value is assigned. 3. If set to a value > 0 at least a reference frame every "ref_freq" frames will be generated (1-1500). If set to 0 ??? Is there a difference between None and 0? If there is no difference, then 'None' should not be used at all. If there is a difference, please explain it. Cu Selur Ps.: updated Hybrid_deoldify to include 'Deep-Remaster' as ex_method. (did not add ref_freq since I don't get it) RE: Deoldify Vapoursynth filter - Dan64 - 01.02.2025 (01.02.2025, 14:53)Selur Wrote: Back at home,... Ok in not renaming vsDeoldify I was not aware that to change the name it would be necessary so many changes (for the same reasons I don't have changed the name of the project in GitHub). Regarding the possibility to add an external video, it is not clear your proposal. If necessary I can add some code (but I prefer to don't use bs.VideoSource is still too slow), but I cannot implement all the transformations that you usually add when a clip is loaded in Hybrid. In this case in the string sc_framedir need to be passed the path to the external movie. Could you clarify better ? Thanks, Dan (01.02.2025, 16:39)Selur Wrote: I do not understand ref_freq. In effect in the GUI there is already the field "SC min freq" and "SC thresh" which are currently used by HAVC_ddeoldify. Now these 2 parameters can to be passed also to HAVC_deepex. ref_thresh = "SC thresh" ref_freq = "SC min freq" When I introduced the "Ref merge" you added also the field "Threshold", but this field is not really necessary because you can use "SC thresh". It is possible to do that because when "Ref merge" is set "SC min freq" is set equal to 1 and all the remaining scene detection parameters will be ignored by HAVC_dddeoldify, so that you can use "SC min freq" and "SC thresh" for the "Ref merge", so that the parameter "Threshold" could be removed because is redundant. But I don't know your code so is up to you to decide what to implement. Dan RE: Deoldify Vapoursynth filter - Selur - 01.02.2025 Quote:Could you clarify better ?
# load clip
havc_refclip = core.bs.VideoSource(source="PATH_TO_FILE")
# validate frame count
if clipRef.num_frames != clip.num_frames:
raise vs.Error(f"HAVC: Reference clip ({clipRef.num_frames}) and source clip frame count ({clip.num_frames}) differ!")
# convert if not RGB24
if havc_refclip.format.id != vs.RGB24:
refframe = havc_refclip.get_frame(0)
# when the _ColorRange flag is not set or 'limited', assume that it is 'limited' and convert to 'full'
if frame.props.get('_ColorRange', None) != vs.RANGE_FULL :
clipRef = core.resize.Bicubic(clipRef, range_in_s="limited", range_s="full")
# when the _Matrix-flag isn't set or not '709' assume '470bg' and convert to '709'
if frame.props.get('_Matrix', None) != vs.MATRIX_BT709 :
clipRef = core.resize.Bicubic(clipRef, matrix_in_s="470bg", matrix_s="709")
# resize and convert to RGB24
clipRef = core.resize.Bicubic(clip=havc_refclip, width=clip.width, height= clip.height, format=vs.RGB24, matrix_i_s="709", range_s="full")
else:
# make sure resolution is correct (if the aspect ratio of the source and the reference differ, matching will not work properly)
clipRef = core.resize.Bicubic(clip=havc_refclip, width=clip.width, height= clip.height)
clipRef = core.std.AssumeFPS(clip=clipRef, fpsnum=clip.fps_num, fpsden=clip.fps_denSo the question is: Should Hybrid do this, or do you add (something like) this to HAVC? Cu Selur RE: Deoldify Vapoursynth filter - Selur - 01.02.2025 Quote:In effect in the GUI there is already the field "SC min freq" and "SC thresh" which are currently used by HAVC_ddeoldify. Now these 2 parameters can to be passed also to HAVC_deepex.That does not make any more sense. If ref_freq = "SC min freq"=> Adding a new parameter does not seem to make sense and from the sound of it either ref_thresh or sc_threshold should get removed too. Cu Selur RE: Deoldify Vapoursynth filter - Dan64 - 01.02.2025 The scene change detection is usually performed by HAVC_ddeoldify. But there are 2 exceptions: 1) When is used "Ref merge". How "Ref merge" works is quite complex but is explained at page 18 of HAVC User Guide. In summary in this case HAVC apply the following strategy:
2) When is used method=5. In this case the reference clip is not generated by HAVC_ddeoldy because is used an external clip already colored and HAVC_deepex must know how to generate the reference frames. So the scene detection parameters are necessary also to HAVC_deepex. I reduced the number to the minimum necessary to enable HAVC_deepex to perform such task. Dan RE: Deoldify Vapoursynth filter - Selur - 01.02.2025 Okay, then back to my questions: a. What happens if ref_freq is set to 0. b. Is there a difference between ref_freq None and 0? If there is no difference, then 'None' should not be used at all. If there is a difference, please explain it. Cu Selur RE: Deoldify Vapoursynth filter - Dan64 - 01.02.2025 Ok, I understand that is not easy to use None in the GUI, also ref_tresh is None, but you pass always a value. So you can pass ref_freq=0 if the user has not selected a different value. If ref_freq = 0 (or None) will be applied the following default values: If ref_merge is enabled, ref_freq is set to 0 If method=5 ref_freq is set to DEF_MIN_FREQ (=15) It is necessary also to change the rule to set core.num_threads=1. Currently num_threads=1 is set every time is checked "Reference frame only". Now is necessary to set num_threads=1 when: is checked "Reference frame only" AND (0 < SC SSIM thresh < 1 OR SC min int > 1) Thanks, Dan |